Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type providers #304

Merged
merged 10 commits into from
Oct 24, 2022
Merged

Type providers #304

merged 10 commits into from
Oct 24, 2022

Conversation

frabert
Copy link
Collaborator

@frabert frabert commented Sep 21, 2022

Supersedes #302

Allows mechanisms to override the default LLVM type-to-Clang type conversion for functions and global variables

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3096927052

fizzbuzz.bc

--- /dev/fd/63	2022-09-22 07:11:24.370283402 +0000
+++ /dev/fd/62	2022-09-22 07:11:24.370283402 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[10] = "fizzbuzz\n\000";
 unsigned char _str_1[6] = "fizz\n\000";
 unsigned char _str_2[6] = "buzz\n\000";
 unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-22 07:11:24.998279232 +0000
+++ /dev/fd/62	2022-09-22 07:11:24.998279232 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[11] = "a=[%d %d]\n\000";
 unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-22 07:11:25.050278894 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.050278894 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-22 07:11:25.226277752 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.226277752 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-22 07:11:25.326277102 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.326277102 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
 unsigned char _str[2] = "3\000";
 unsigned char _str_1[2] = "2\000";
 unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-22 07:11:25.378276764 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.378276764 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-22 07:11:25.518275856 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.518275856 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-22 07:11:25.618275207 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.618275207 +0000
@@ -11,7 +11,7 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[4] = "%d\n\000";
 struct literal_struct_0 {
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-22 07:11:25.678274817 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.678274817 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-22 07:11:25.726274506 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.726274506 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-22 07:11:25.782274142 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.782274142 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-22 07:11:25.830273830 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.830273830 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-22 07:11:25.882273493 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.882273493 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-22 07:11:25.930273180 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.930273180 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-22 07:11:25.990272791 +0000
+++ /dev/fd/62	2022-09-22 07:11:25.990272791 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-22 07:11:26.198271469 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.198271469 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-22 07:11:26.250271139 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.250271139 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-22 07:11:26.394270225 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.394270225 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-22 07:11:26.446269895 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.446269895 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-22 07:11:26.550269235 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.550269235 +0000
@@ -1,4 +1,4 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[4] = "Bob\000";
 struct struct__pair {
@@ -16,7 +16,7 @@
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
 unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-22 07:11:26.598268930 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.598268930 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-22 07:11:26.650268600 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.650268600 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-22 07:11:26.746267991 +0000
+++ /dev/fd/62	2022-09-22 07:11:26.746267991 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-22 07:11:27.002266366 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.002266366 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-22 07:11:27.098265769 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.098265769 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
 unsigned char _str[2] = "5\000";
 unsigned char _str_1[13] = "loop1 x: %d\n\000";
 unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;
@@ -18,14 +18,14 @@
                 printf("loop1 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 || (int)var1 <= 10) {
+    if ((int)var1 <= 10 || (int)var1 >= 20) {
         while ((int)var1 < 20)
             {
                 var1 = var1 + 1U;
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
+    if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
         return var0;
     }
 }

zeroinit.bc

--- /dev/fd/63	2022-09-22 07:11:27.422263759 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.422263759 +0000
@@ -1,4 +1,4 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-22 07:11:27.566262864 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.566262864 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-22 07:11:27.670262220 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.670262220 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-22 07:11:27.726261872 +0000
+++ /dev/fd/62	2022-09-22 07:11:27.726261872 +0000
@@ -1,4 +1,4 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
@@ -7,7 +7,7 @@
 unsigned char _str_2[5] = "odd \000";
 unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
 unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-22 07:11:28.002260159 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.002260159 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-22 07:11:28.054259843 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.054259843 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-22 07:11:28.198258970 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.202258946 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
 unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-22 07:11:28.250258656 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.250258656 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-22 07:11:28.302258340 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.302258340 +0000
@@ -1,6 +1,6 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
 unsigned char _str[5] = "fizz\000";
 unsigned char _str_1[5] = "buzz\000";
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-22 07:11:28.606256496 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.606256496 +0000
@@ -1,4 +1,4 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
@@ -7,7 +7,7 @@
 unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
 unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
 unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char var1[20];
     unsigned char var2[20];

bool.bc

--- /dev/fd/63	2022-09-22 07:11:28.766255525 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.766255525 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-22 07:11:28.862254943 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.862254943 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-22 07:11:28.914254628 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.914254628 +0000
@@ -5,7 +5,7 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
 unsigned char _str[2] = "1\000";
@@ -18,7 +18,7 @@
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-22 07:11:28.970254288 +0000
+++ /dev/fd/62	2022-09-22 07:11:28.970254288 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-22 07:11:29.074253667 +0000
+++ /dev/fd/62	2022-09-22 07:11:29.074253667 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-22 07:11:29.174253075 +0000
+++ /dev/fd/62	2022-09-22 07:11:29.174253075 +0000
@@ -1,4 +1,4 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
 unsigned char _str[6] = "a % 3\000";
@@ -6,7 +6,7 @@
 unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
 unsigned char _str_2[6] = "a % 7\000";
 unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-22 07:11:29.350252032 +0000
+++ /dev/fd/62	2022-09-22 07:11:29.350252032 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned char _str[19] = "Variable at %d is \000";
 unsigned char _str_1[7] = "even.\n\000";
 unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-22 07:11:29.550250846 +0000
+++ /dev/fd/62	2022-09-22 07:11:29.550250846 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-22 07:11:29.666250159 +0000
+++ /dev/fd/62	2022-09-22 07:11:29.666250159 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
 unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3103581834

fizzbuzz.bc

--- /dev/fd/63	2022-09-22 07:31:52.173673717 +0000
+++ /dev/fd/62	2022-09-22 07:31:52.173673717 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[10] = "fizzbuzz\n\000";
-unsigned char _str_1[6] = "fizz\n\000";
-unsigned char _str_2[6] = "buzz\n\000";
-unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+char _str[10] = "fizzbuzz\n\000";
+char _str_1[6] = "fizz\n\000";
+char _str_2[6] = "buzz\n\000";
+char _str_3[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-22 07:31:52.813675310 +0000
+++ /dev/fd/62	2022-09-22 07:31:52.813675310 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[11] = "a=[%d %d]\n\000";
-unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
+char _str[11] = "a=[%d %d]\n\000";
+char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-22 07:31:52.865675440 +0000
+++ /dev/fd/62	2022-09-22 07:31:52.865675440 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-22 07:31:53.065675931 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.065675931 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-22 07:31:53.169676177 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.169676177 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "3\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+char _str[2] = "3\000";
+char _str_1[2] = "2\000";
+char _str_2[19] = "%d %d %d %d %d %d\n\000";
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-22 07:31:53.221676300 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.221676300 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-22 07:31:53.365676642 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.365676642 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-22 07:31:53.469676889 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.469676889 +0000
@@ -11,9 +11,9 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
+char _str[4] = "%d\n\000";
 struct literal_struct_0 {
     unsigned long field0;
     unsigned long field1;
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-22 07:31:53.525677022 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.525677022 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-22 07:31:53.573677137 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.573677137 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-22 07:31:53.633677278 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.633677278 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-22 07:31:53.685677402 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.685677402 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-22 07:31:53.733677516 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.733677516 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-22 07:31:53.785677639 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.785677639 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-22 07:31:53.841677772 +0000
+++ /dev/fd/62	2022-09-22 07:31:53.841677772 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-22 07:31:54.061678288 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.061678288 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-22 07:31:54.109678396 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.109678396 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-22 07:31:54.265678749 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.265678749 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-22 07:31:54.317678867 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.317678867 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-22 07:31:54.417679093 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.417679093 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "Bob\000";
+char _str[4] = "Bob\000";
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -15,8 +15,8 @@
     struct struct__person field2;
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
-unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+char _str_1[9] = "Name: %s\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-22 07:31:54.469679210 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.469679210 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-22 07:31:54.517679319 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.517679319 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-22 07:31:54.617679545 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.617679545 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-22 07:31:54.865680106 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.865680106 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-22 07:31:54.969680341 +0000
+++ /dev/fd/62	2022-09-22 07:31:54.969680341 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "5\000";
-unsigned char _str_1[13] = "loop1 x: %d\n\000";
-unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+char _str[2] = "5\000";
+char _str_1[13] = "loop1 x: %d\n\000";
+char _str_2[13] = "loop2 x: %d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;

zeroinit.bc

--- /dev/fd/63	2022-09-22 07:31:55.285681025 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.285681025 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-22 07:31:55.437681352 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.437681352 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-22 07:31:55.541681575 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.541681575 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-22 07:31:55.593681687 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.593681687 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
-unsigned char _str[39] = "Global variable 'a' of value %u is at \000";
-unsigned char _str_1[6] = "even \000";
-unsigned char _str_2[5] = "odd \000";
-unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
-unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+char _str[39] = "Global variable 'a' of value %u is at \000";
+char _str_1[6] = "even \000";
+char _str_2[5] = "odd \000";
+char _str_3[39] = "Global variable 'c' of value %u is at \000";
+char _str_4[10] = "address.\n\000";
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-22 07:31:55.877682298 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.877682298 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+char _str[17] = "a=[%d %d %d %d]\n\000";
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-22 07:31:55.929682410 +0000
+++ /dev/fd/62	2022-09-22 07:31:55.929682410 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-22 07:31:56.073682711 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.073682711 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-22 07:31:56.125682818 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.125682818 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-22 07:31:56.173682915 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.177682924 +0000
@@ -1,11 +1,11 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
-unsigned char _str[5] = "fizz\000";
-unsigned char _str_1[5] = "buzz\000";
-unsigned char _str_2[3] = "%d\000";
-unsigned char _str_3[2] = "\n\000";
+char _str[5] = "fizz\000";
+char _str_1[5] = "buzz\000";
+char _str_2[3] = "%d\000";
+char _str_3[2] = "\n\000";
 void fizzbuzz() {
     unsigned int var0;
     var0 = i;
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-22 07:31:56.481683544 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.481683544 +0000
@@ -1,16 +1,16 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[6] = "hello\000";
-unsigned char _str_1[12] = "helLO WORLD\000";
-unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
-unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
-unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+char _str[6] = "hello\000";
+char _str_1[12] = "helLO WORLD\000";
+char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
+char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
+char _str_4[41] = "Both the strings str1 and str2 are equal\000";
+int main() {
     unsigned int var0;
-    unsigned char var1[20];
-    unsigned char var2[20];
+    char var1[20];
+    char var2[20];
     unsigned int call3;
     unsigned int call4;
     var0 = 0U;

bool.bc

--- /dev/fd/63	2022-09-22 07:31:56.649683887 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.649683887 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-22 07:31:56.749684091 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.749684091 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
-unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main();
+char a = (unsigned char)1U;
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-22 07:31:56.797684189 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.797684189 +0000
@@ -5,20 +5,20 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "1\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[2] = "3\000";
-unsigned char _str_3[2] = "4\000";
-unsigned char _str_4[11] = "%lld %lld\n\000";
+char _str[2] = "1\000";
+char _str_1[2] = "2\000";
+char _str_2[2] = "3\000";
+char _str_3[2] = "4\000";
+char _str_4[11] = "%lld %lld\n\000";
 unsigned long get_3x(struct struct_foo arg0) {
     void *arg0_ptr = &arg0;
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-22 07:31:56.853684304 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.853684304 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-22 07:31:56.965684531 +0000
+++ /dev/fd/62	2022-09-22 07:31:56.965684531 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-22 07:31:57.065684730 +0000
+++ /dev/fd/62	2022-09-22 07:31:57.065684730 +0000
@@ -1,12 +1,12 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
-unsigned char _str[6] = "a % 3\000";
-unsigned char _str_1[9] = "assert.c\000";
-unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
-unsigned char _str_2[6] = "a % 7\000";
-unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+char _str[6] = "a % 3\000";
+char _str_1[9] = "assert.c\000";
+char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
+char _str_2[6] = "a % 7\000";
+char _str_3[7] = "a % 15\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-22 07:31:57.245685078 +0000
+++ /dev/fd/62	2022-09-22 07:31:57.249685085 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[19] = "Variable at %d is \000";
-unsigned char _str_1[7] = "even.\n\000";
-unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+char _str[19] = "Variable at %d is \000";
+char _str_1[7] = "even.\n\000";
+char _str_2[6] = "odd.\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-22 07:31:57.453685480 +0000
+++ /dev/fd/62	2022-09-22 07:31:57.453685480 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-22 07:31:57.573685712 +0000
+++ /dev/fd/62	2022-09-22 07:31:57.573685712 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@Ninja3047 Ninja3047 mentioned this pull request Sep 22, 2022
@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3113093853

fizzbuzz.bc

--- /dev/fd/63	2022-09-23 13:33:47.772119019 +0000
+++ /dev/fd/62	2022-09-23 13:33:47.772119019 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[10] = "fizzbuzz\n\000";
-unsigned char _str_1[6] = "fizz\n\000";
-unsigned char _str_2[6] = "buzz\n\000";
-unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+char _str[10] = "fizzbuzz\n\000";
+char _str_1[6] = "fizz\n\000";
+char _str_2[6] = "buzz\n\000";
+char _str_3[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-23 13:33:48.432116799 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.432116799 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[11] = "a=[%d %d]\n\000";
-unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
+char _str[11] = "a=[%d %d]\n\000";
+char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-23 13:33:48.484116624 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.484116624 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-23 13:33:48.668116009 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.668116009 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-23 13:33:48.776115647 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.776115647 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "3\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+char _str[2] = "3\000";
+char _str_1[2] = "2\000";
+char _str_2[19] = "%d %d %d %d %d %d\n\000";
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-23 13:33:48.828115473 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.828115473 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-23 13:33:48.976114977 +0000
+++ /dev/fd/62	2022-09-23 13:33:48.976114977 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-23 13:33:49.084114617 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.084114617 +0000
@@ -11,9 +11,9 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
+char _str[4] = "%d\n\000";
 struct literal_struct_0 {
     unsigned long field0;
     unsigned long field1;
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-23 13:33:49.140114432 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.140114432 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-23 13:33:49.192114260 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.192114260 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-23 13:33:49.252114060 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.252114060 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-23 13:33:49.304113888 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.304113888 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-23 13:33:49.356113716 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.356113716 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-23 13:33:49.408113543 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.408113543 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-23 13:33:49.464113358 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.464113358 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-23 13:33:49.696112589 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.696112589 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-23 13:33:49.748112417 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.748112417 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-23 13:33:49.904111900 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.904111900 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-23 13:33:49.956111727 +0000
+++ /dev/fd/62	2022-09-23 13:33:49.956111727 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-23 13:33:50.060111385 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.060111385 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "Bob\000";
+char _str[4] = "Bob\000";
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -15,8 +15,8 @@
     struct struct__person field2;
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
-unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+char _str_1[9] = "Name: %s\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-23 13:33:50.112111214 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.112111214 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-23 13:33:50.164111044 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.164111044 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-23 13:33:50.268110702 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.268110702 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-23 13:33:50.536109823 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.536109823 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-23 13:33:50.640109482 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.640109482 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "5\000";
-unsigned char _str_1[13] = "loop1 x: %d\n\000";
-unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+char _str[2] = "5\000";
+char _str_1[13] = "loop1 x: %d\n\000";
+char _str_2[13] = "loop2 x: %d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;

zeroinit.bc

--- /dev/fd/63	2022-09-23 13:33:50.988108342 +0000
+++ /dev/fd/62	2022-09-23 13:33:50.988108342 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-23 13:33:51.136107861 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.136107861 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-23 13:33:51.244107511 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.244107511 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-23 13:33:51.300107329 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.300107329 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
-unsigned char _str[39] = "Global variable 'a' of value %u is at \000";
-unsigned char _str_1[6] = "even \000";
-unsigned char _str_2[5] = "odd \000";
-unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
-unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+char _str[39] = "Global variable 'a' of value %u is at \000";
+char _str_1[6] = "even \000";
+char _str_2[5] = "odd \000";
+char _str_3[39] = "Global variable 'c' of value %u is at \000";
+char _str_4[10] = "address.\n\000";
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-23 13:33:51.600106355 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.600106355 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+char _str[17] = "a=[%d %d %d %d]\n\000";
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-23 13:33:51.656106173 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.656106173 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-23 13:33:51.804105693 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.804105693 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-23 13:33:51.856105524 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.856105524 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-23 13:33:51.908105354 +0000
+++ /dev/fd/62	2022-09-23 13:33:51.908105354 +0000
@@ -1,11 +1,11 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
-unsigned char _str[5] = "fizz\000";
-unsigned char _str_1[5] = "buzz\000";
-unsigned char _str_2[3] = "%d\000";
-unsigned char _str_3[2] = "\n\000";
+char _str[5] = "fizz\000";
+char _str_1[5] = "buzz\000";
+char _str_2[3] = "%d\000";
+char _str_3[2] = "\n\000";
 void fizzbuzz() {
     unsigned int var0;
     var0 = i;
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-23 13:33:52.228104324 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.228104324 +0000
@@ -1,16 +1,16 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[6] = "hello\000";
-unsigned char _str_1[12] = "helLO WORLD\000";
-unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
-unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
-unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+char _str[6] = "hello\000";
+char _str_1[12] = "helLO WORLD\000";
+char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
+char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
+char _str_4[41] = "Both the strings str1 and str2 are equal\000";
+int main() {
     unsigned int var0;
-    unsigned char var1[20];
-    unsigned char var2[20];
+    char var1[20];
+    char var2[20];
     unsigned int call3;
     unsigned int call4;
     var0 = 0U;

bool.bc

--- /dev/fd/63	2022-09-23 13:33:52.408103745 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.408103745 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-23 13:33:52.508103424 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.508103424 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
-unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main();
+char a = (unsigned char)1U;
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-23 13:33:52.560103258 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.560103258 +0000
@@ -5,20 +5,20 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "1\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[2] = "3\000";
-unsigned char _str_3[2] = "4\000";
-unsigned char _str_4[11] = "%lld %lld\n\000";
+char _str[2] = "1\000";
+char _str_1[2] = "2\000";
+char _str_2[2] = "3\000";
+char _str_3[2] = "4\000";
+char _str_4[11] = "%lld %lld\n\000";
 unsigned long get_3x(struct struct_foo arg0) {
     void *arg0_ptr = &arg0;
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-23 13:33:52.620103064 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.620103064 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-23 13:33:52.732102704 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.732102704 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-23 13:33:52.832102385 +0000
+++ /dev/fd/62	2022-09-23 13:33:52.832102385 +0000
@@ -1,12 +1,12 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
-unsigned char _str[6] = "a % 3\000";
-unsigned char _str_1[9] = "assert.c\000";
-unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
-unsigned char _str_2[6] = "a % 7\000";
-unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+char _str[6] = "a % 3\000";
+char _str_1[9] = "assert.c\000";
+char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
+char _str_2[6] = "a % 7\000";
+char _str_3[7] = "a % 15\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-23 13:33:53.028101756 +0000
+++ /dev/fd/62	2022-09-23 13:33:53.028101756 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[19] = "Variable at %d is \000";
-unsigned char _str_1[7] = "even.\n\000";
-unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+char _str[19] = "Variable at %d is \000";
+char _str_1[7] = "even.\n\000";
+char _str_2[6] = "odd.\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-23 13:33:53.244101068 +0000
+++ /dev/fd/62	2022-09-23 13:33:53.244101068 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-23 13:33:53.364100688 +0000
+++ /dev/fd/62	2022-09-23 13:33:53.364100688 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@frabert frabert force-pushed the frabert/type-providers branch from d7f8b8a to 6658fe8 Compare September 26, 2022 10:19
@frabert frabert marked this pull request as ready for review September 26, 2022 10:20
@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3126933173

fizzbuzz.bc

--- /dev/fd/63	2022-09-26 10:24:25.312776847 +0000
+++ /dev/fd/62	2022-09-26 10:24:25.312776847 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[10] = "fizzbuzz\n\000";
-unsigned char _str_1[6] = "fizz\n\000";
-unsigned char _str_2[6] = "buzz\n\000";
-unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+char _str[10] = "fizzbuzz\n\000";
+char _str_1[6] = "fizz\n\000";
+char _str_2[6] = "buzz\n\000";
+char _str_3[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if (!((int)var1 % 5 == 0U || (int)var1 % 3 != 0U) || (int)var1 % 3 != 0U) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-26 10:24:25.936759490 +0000
+++ /dev/fd/62	2022-09-26 10:24:25.936759490 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[11] = "a=[%d %d]\n\000";
-unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
+char _str[11] = "a=[%d %d]\n\000";
+char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-26 10:24:25.988758043 +0000
+++ /dev/fd/62	2022-09-26 10:24:25.988758043 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-26 10:24:26.164753199 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.164753199 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-26 10:24:26.268750339 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.268750339 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "3\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+char _str[2] = "3\000";
+char _str_1[2] = "2\000";
+char _str_2[19] = "%d %d %d %d %d %d\n\000";
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-26 10:24:26.320748908 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.320748908 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-26 10:24:26.460745059 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.460745059 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-26 10:24:26.560742308 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.560742308 +0000
@@ -11,9 +11,9 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
+char _str[4] = "%d\n\000";
 struct literal_struct_0 {
     unsigned long field0;
     unsigned long field1;
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-26 10:24:26.620740658 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.620740658 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-26 10:24:26.668739338 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.668739338 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-26 10:24:26.724737798 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.724737798 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-26 10:24:26.776736367 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.776736367 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-26 10:24:26.828734938 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.828734938 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-26 10:24:26.904732848 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.904732848 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-26 10:24:26.960731307 +0000
+++ /dev/fd/62	2022-09-26 10:24:26.960731307 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-26 10:24:27.172725529 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.172725529 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-26 10:24:27.224724115 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.224724115 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-26 10:24:27.372720090 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.372720090 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-26 10:24:27.424718677 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.424718677 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-26 10:24:27.524715958 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.524715958 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "Bob\000";
+char _str[4] = "Bob\000";
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -15,8 +15,8 @@
     struct struct__person field2;
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
-unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+char _str_1[9] = "Name: %s\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-26 10:24:27.576714543 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.576714543 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-26 10:24:27.628713129 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.628713129 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-26 10:24:27.728710410 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.728710410 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-26 10:24:27.976703667 +0000
+++ /dev/fd/62	2022-09-26 10:24:27.976703667 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-26 10:24:28.080700863 +0000
+++ /dev/fd/62	2022-09-26 10:24:28.080700863 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "5\000";
-unsigned char _str_1[13] = "loop1 x: %d\n\000";
-unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+char _str[2] = "5\000";
+char _str_1[13] = "loop1 x: %d\n\000";
+char _str_2[13] = "loop2 x: %d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;
@@ -18,14 +18,14 @@
                 printf("loop1 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 || (int)var1 <= 10) {
+    if ((int)var1 <= 10 || (int)var1 >= 20) {
         while ((int)var1 < 20)
             {
                 var1 = var1 + 1U;
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
+    if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
         return var0;
     }
 }

zeroinit.bc

--- /dev/fd/63	2022-09-26 10:24:28.412691936 +0000
+++ /dev/fd/62	2022-09-26 10:24:28.416691829 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-26 10:24:28.556688064 +0000
+++ /dev/fd/62	2022-09-26 10:24:28.556688064 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-26 10:24:28.664685160 +0000
+++ /dev/fd/62	2022-09-26 10:24:28.664685160 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-26 10:24:28.716683763 +0000
+++ /dev/fd/62	2022-09-26 10:24:28.716683763 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
-unsigned char _str[39] = "Global variable 'a' of value %u is at \000";
-unsigned char _str_1[6] = "even \000";
-unsigned char _str_2[5] = "odd \000";
-unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
-unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+char _str[39] = "Global variable 'a' of value %u is at \000";
+char _str_1[6] = "even \000";
+char _str_2[5] = "odd \000";
+char _str_3[39] = "Global variable 'c' of value %u is at \000";
+char _str_4[10] = "address.\n\000";
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-26 10:24:29.008675913 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.008675913 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+char _str[17] = "a=[%d %d %d %d]\n\000";
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-26 10:24:29.060674531 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.060674531 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-26 10:24:29.200670808 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.200670808 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-26 10:24:29.252669426 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.252669426 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-26 10:24:29.304668043 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.304668043 +0000
@@ -1,11 +1,11 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
-unsigned char _str[5] = "fizz\000";
-unsigned char _str_1[5] = "buzz\000";
-unsigned char _str_2[3] = "%d\000";
-unsigned char _str_3[2] = "\n\000";
+char _str[5] = "fizz\000";
+char _str_1[5] = "buzz\000";
+char _str_2[3] = "%d\000";
+char _str_3[2] = "\n\000";
 void fizzbuzz() {
     unsigned int var0;
     var0 = i;
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-26 10:24:29.604660067 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.604660067 +0000
@@ -1,16 +1,16 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[6] = "hello\000";
-unsigned char _str_1[12] = "helLO WORLD\000";
-unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
-unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
-unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+char _str[6] = "hello\000";
+char _str_1[12] = "helLO WORLD\000";
+char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
+char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
+char _str_4[41] = "Both the strings str1 and str2 are equal\000";
+int main() {
     unsigned int var0;
-    unsigned char var1[20];
-    unsigned char var2[20];
+    char var1[20];
+    char var2[20];
     unsigned int call3;
     unsigned int call4;
     var0 = 0U;

bool.bc

--- /dev/fd/63	2022-09-26 10:24:29.760655919 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.760655919 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-26 10:24:29.860653260 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.860653260 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
-unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main();
+char a = (unsigned char)1U;
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-26 10:24:29.912651878 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.912651878 +0000
@@ -5,20 +5,20 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "1\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[2] = "3\000";
-unsigned char _str_3[2] = "4\000";
-unsigned char _str_4[11] = "%lld %lld\n\000";
+char _str[2] = "1\000";
+char _str_1[2] = "2\000";
+char _str_2[2] = "3\000";
+char _str_3[2] = "4\000";
+char _str_4[11] = "%lld %lld\n\000";
 unsigned long get_3x(struct struct_foo arg0) {
     void *arg0_ptr = &arg0;
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-26 10:24:29.968650389 +0000
+++ /dev/fd/62	2022-09-26 10:24:29.968650389 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-26 10:24:30.072647645 +0000
+++ /dev/fd/62	2022-09-26 10:24:30.076647540 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-26 10:24:30.176644910 +0000
+++ /dev/fd/62	2022-09-26 10:24:30.176644910 +0000
@@ -1,12 +1,12 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
-unsigned char _str[6] = "a % 3\000";
-unsigned char _str_1[9] = "assert.c\000";
-unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
-unsigned char _str_2[6] = "a % 7\000";
-unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+char _str[6] = "a % 3\000";
+char _str_1[9] = "assert.c\000";
+char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
+char _str_2[6] = "a % 7\000";
+char _str_3[7] = "a % 15\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-26 10:24:30.360640073 +0000
+++ /dev/fd/62	2022-09-26 10:24:30.360640073 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[19] = "Variable at %d is \000";
-unsigned char _str_1[7] = "even.\n\000";
-unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+char _str[19] = "Variable at %d is \000";
+char _str_1[7] = "even.\n\000";
+char _str_2[6] = "odd.\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-26 10:24:30.564634708 +0000
+++ /dev/fd/62	2022-09-26 10:24:30.564634708 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-26 10:24:30.680631659 +0000
+++ /dev/fd/62	2022-09-26 10:24:30.680631659 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3139123158

fizzbuzz.bc

--- /dev/fd/63	2022-09-27 21:38:22.140828618 +0000
+++ /dev/fd/62	2022-09-27 21:38:22.140828618 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[10] = "fizzbuzz\n\000";
-unsigned char _str_1[6] = "fizz\n\000";
-unsigned char _str_2[6] = "buzz\n\000";
-unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+char _str[10] = "fizzbuzz\n\000";
+char _str_1[6] = "fizz\n\000";
+char _str_2[6] = "buzz\n\000";
+char _str_3[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
+            if (!((int)var1 % 3 != 0U || (int)var1 % 5 == 0U) || (int)var1 % 3 != 0U) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-27 21:38:22.748819652 +0000
+++ /dev/fd/62	2022-09-27 21:38:22.748819652 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[11] = "a=[%d %d]\n\000";
-unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
+char _str[11] = "a=[%d %d]\n\000";
+char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-27 21:38:22.800818885 +0000
+++ /dev/fd/62	2022-09-27 21:38:22.800818885 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-27 21:38:22.976816289 +0000
+++ /dev/fd/62	2022-09-27 21:38:22.976816289 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-27 21:38:23.076814827 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.076814827 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "3\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+char _str[2] = "3\000";
+char _str_1[2] = "2\000";
+char _str_2[19] = "%d %d %d %d %d %d\n\000";
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-27 21:38:23.128814069 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.128814069 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-27 21:38:23.264812087 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.264812087 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-27 21:38:23.360810687 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.360810687 +0000
@@ -11,9 +11,9 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
+char _str[4] = "%d\n\000";
 struct literal_struct_0 {
     unsigned long field0;
     unsigned long field1;
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-27 21:38:23.420809812 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.420809812 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-27 21:38:23.468809112 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.468809112 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-27 21:38:23.524808296 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.524808296 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-27 21:38:23.572807596 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.572807596 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-27 21:38:23.624806838 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.624806838 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-27 21:38:23.672806138 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.672806138 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-27 21:38:23.728805321 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.728805321 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-27 21:38:23.940802230 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.940802230 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-27 21:38:23.988801531 +0000
+++ /dev/fd/62	2022-09-27 21:38:23.988801531 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-27 21:38:24.132799453 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.132799453 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-27 21:38:24.180798762 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.180798762 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-27 21:38:24.280797320 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.280797320 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "Bob\000";
+char _str[4] = "Bob\000";
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -15,8 +15,8 @@
     struct struct__person field2;
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
-unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+char _str_1[9] = "Name: %s\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-27 21:38:24.332796571 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.332796571 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-27 21:38:24.380795878 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.380795878 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-27 21:38:24.480794437 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.480794437 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-27 21:38:24.720790978 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.720790978 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-27 21:38:24.816789594 +0000
+++ /dev/fd/62	2022-09-27 21:38:24.816789594 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "5\000";
-unsigned char _str_1[13] = "loop1 x: %d\n\000";
-unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+char _str[2] = "5\000";
+char _str_1[13] = "loop1 x: %d\n\000";
+char _str_2[13] = "loop2 x: %d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;
@@ -18,14 +18,14 @@
                 printf("loop1 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 || (int)var1 <= 10) {
+    if ((int)var1 <= 10 || (int)var1 >= 20) {
         while ((int)var1 < 20)
             {
                 var1 = var1 + 1U;
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
+    if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
         return var0;
     }
 }

zeroinit.bc

--- /dev/fd/63	2022-09-27 21:38:25.132785061 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.132785061 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-27 21:38:25.272783065 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.272783065 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-27 21:38:25.376781583 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.376781583 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-27 21:38:25.428780842 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.428780842 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
-unsigned char _str[39] = "Global variable 'a' of value %u is at \000";
-unsigned char _str_1[6] = "even \000";
-unsigned char _str_2[5] = "odd \000";
-unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
-unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+char _str[39] = "Global variable 'a' of value %u is at \000";
+char _str_1[6] = "even \000";
+char _str_2[5] = "odd \000";
+char _str_3[39] = "Global variable 'c' of value %u is at \000";
+char _str_4[10] = "address.\n\000";
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-27 21:38:25.704776909 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.704776909 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+char _str[17] = "a=[%d %d %d %d]\n\000";
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-27 21:38:25.756776168 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.756776168 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-27 21:38:25.896774172 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.900774115 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-27 21:38:25.948773431 +0000
+++ /dev/fd/62	2022-09-27 21:38:25.948773431 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-27 21:38:26.000772690 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.000772690 +0000
@@ -1,11 +1,11 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
-unsigned char _str[5] = "fizz\000";
-unsigned char _str_1[5] = "buzz\000";
-unsigned char _str_2[3] = "%d\000";
-unsigned char _str_3[2] = "\n\000";
+char _str[5] = "fizz\000";
+char _str_1[5] = "buzz\000";
+char _str_2[3] = "%d\000";
+char _str_3[2] = "\n\000";
 void fizzbuzz() {
     unsigned int var0;
     var0 = i;
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-27 21:38:26.296768519 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.296768519 +0000
@@ -1,16 +1,16 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[6] = "hello\000";
-unsigned char _str_1[12] = "helLO WORLD\000";
-unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
-unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
-unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+char _str[6] = "hello\000";
+char _str_1[12] = "helLO WORLD\000";
+char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
+char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
+char _str_4[41] = "Both the strings str1 and str2 are equal\000";
+int main() {
     unsigned int var0;
-    unsigned char var1[20];
-    unsigned char var2[20];
+    char var1[20];
+    char var2[20];
     unsigned int call3;
     unsigned int call4;
     var0 = 0U;

bool.bc

--- /dev/fd/63	2022-09-27 21:38:26.456766265 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.456766265 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-27 21:38:26.552764912 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.552764912 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
-unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main();
+char a = (unsigned char)1U;
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-27 21:38:26.604764179 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.604764179 +0000
@@ -5,20 +5,20 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "1\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[2] = "3\000";
-unsigned char _str_3[2] = "4\000";
-unsigned char _str_4[11] = "%lld %lld\n\000";
+char _str[2] = "1\000";
+char _str_1[2] = "2\000";
+char _str_2[2] = "3\000";
+char _str_3[2] = "4\000";
+char _str_4[11] = "%lld %lld\n\000";
 unsigned long get_3x(struct struct_foo arg0) {
     void *arg0_ptr = &arg0;
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-27 21:38:26.660763389 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.660763389 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-27 21:38:26.760761980 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.760761980 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-27 21:38:26.860760571 +0000
+++ /dev/fd/62	2022-09-27 21:38:26.860760571 +0000
@@ -1,12 +1,12 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
-unsigned char _str[6] = "a % 3\000";
-unsigned char _str_1[9] = "assert.c\000";
-unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
-unsigned char _str_2[6] = "a % 7\000";
-unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+char _str[6] = "a % 3\000";
+char _str_1[9] = "assert.c\000";
+char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
+char _str_2[6] = "a % 7\000";
+char _str_3[7] = "a % 15\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-27 21:38:27.036758097 +0000
+++ /dev/fd/62	2022-09-27 21:38:27.036758097 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[19] = "Variable at %d is \000";
-unsigned char _str_1[7] = "even.\n\000";
-unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+char _str[19] = "Variable at %d is \000";
+char _str_1[7] = "even.\n\000";
+char _str_2[6] = "odd.\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-27 21:38:27.244755198 +0000
+++ /dev/fd/62	2022-09-27 21:38:27.244755198 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-27 21:38:27.356753639 +0000
+++ /dev/fd/62	2022-09-27 21:38:27.356753639 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@github-actions
Copy link

See the diff generated by this PR for the tests here: https://github.com/lifting-bits/rellic/actions/runs/3139131698

fizzbuzz.bc

--- /dev/fd/63	2022-09-27 21:39:41.019888305 +0000
+++ /dev/fd/62	2022-09-27 21:39:41.019888305 +0000
@@ -1,17 +1,17 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[10] = "fizzbuzz\n\000";
-unsigned char _str_1[6] = "fizz\n\000";
-unsigned char _str_2[6] = "buzz\n\000";
-unsigned char _str_3[4] = "%d\n\000";
-unsigned int main() {
+char _str[10] = "fizzbuzz\n\000";
+char _str_1[6] = "fizz\n\000";
+char _str_2[6] = "buzz\n\000";
+char _str_3[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;
     var1 = 0U;
     while ((int)var1 < 30)
         {
-            if ((int)var1 % 3 != 0U || !((int)var1 % 5 == 0U || (int)var1 % 3 != 0U)) {
+            if ((int)var1 % 3 != 0U || !((int)var1 % 3 != 0U || (int)var1 % 5 == 0U)) {
                 if ((int)var1 % 3 != 0U) {
                     if ((int)var1 % 5 != 0U) {
                         printf("%d\n", var1);

typedefs_of_typedefs.bc

--- /dev/fd/63	2022-09-27 21:39:41.763810651 +0000
+++ /dev/fd/62	2022-09-27 21:39:41.763810651 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[11] = "a=[%d %d]\n\000";
-unsigned char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
+char _str[11] = "a=[%d %d]\n\000";
+char _str_1[29] = "array=[%lld %lld %lld %lld]\n\000";
 unsigned long array[4] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var1;
     __attribute__((__vector_size__(2 * sizeof(unsigned long)))) unsigned long var2;

switch_loop.bc

--- /dev/fd/63	2022-09-27 21:39:41.819804806 +0000
+++ /dev/fd/62	2022-09-27 21:39:41.819804806 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

func_cond_zero_arg.bc

--- /dev/fd/63	2022-09-27 21:39:42.019783964 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.019783964 +0000
@@ -1,11 +1,11 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

fcmp.bc

--- /dev/fd/63	2022-09-27 21:39:42.127772960 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.127772960 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 float atof(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "3\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[19] = "%d %d %d %d %d %d\n\000";
-unsigned int main() {
+char _str[2] = "3\000";
+char _str_1[2] = "2\000";
+char _str_2[19] = "%d %d %d %d %d %d\n\000";
+int main() {
     float var0;
     float var1;
     float var2;

conflicting_names.bc

--- /dev/fd/63	2022-09-27 21:39:42.179767662 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.179767662 +0000
@@ -1,6 +1,6 @@
 unsigned int foo();
 unsigned int bar();
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int foo() {
     unsigned int var0;
@@ -12,7 +12,7 @@
     var0 = 1U;
     return var0;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     void *var2;

struct.bc

--- /dev/fd/63	2022-09-27 21:39:42.335751768 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.335751768 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a.field0 == 0U) {

issue_183_literal_structs.bc

--- /dev/fd/63	2022-09-27 21:39:42.443740763 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.443740763 +0000
@@ -11,9 +11,9 @@
     struct union_anon field2;
     struct union_anon_0 field3;
 };
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
+char _str[4] = "%d\n\000";
 struct literal_struct_0 {
     unsigned long field0;
     unsigned long field1;
@@ -26,7 +26,7 @@
     ((struct literal_struct_0 *)val1)->field1 = arg1;
     return *(unsigned int *)(&var0.field3);
 }
-unsigned int main() {
+int main() {
     struct struct_foo_t var0;
     void *val1;
     unsigned int call2;

issue_127_uint128_t_lit.bc

--- /dev/fd/63	2022-09-27 21:39:42.507734242 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.507734242 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned __int128 x = (unsigned __int128)3735928559ULL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned char val1;
     var0 = 0U;

global_using_function_decl.bc

--- /dev/fd/63	2022-09-27 21:39:42.559728945 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.559728945 +0000
@@ -1,12 +1,12 @@
 void some_func(unsigned int arg0);
-unsigned int main();
+int main();
 void *afunc_pointer = &some_func;
 void some_func(unsigned int arg0) {
     unsigned int var0;
     var0 = arg0;
     return;
 }
-unsigned int main() {
+int main() {
     ((void (*)(unsigned int))afunc_pointer)(0U);
     return 0U;
 }

short.bc

--- /dev/fd/63	2022-09-27 21:39:42.623722423 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.623722423 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned short a = (unsigned short)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned short var1;
     var0 = 0U;

init_list.bc

--- /dev/fd/63	2022-09-27 21:39:42.675717126 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.675717126 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[5] = {0U, 1U, 2U, 3U, 4U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return a[1UL];

reg_test_structure_fields.bc

--- /dev/fd/63	2022-09-27 21:39:42.727711827 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.727711827 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct_a {
     unsigned int field0;
 };
 struct struct_b {
     struct struct_a field0;
 };
-unsigned int main() {
+int main() {
     struct struct_b var0;
     return 0U;
 }

ret0.bc

--- /dev/fd/63	2022-09-27 21:39:42.779706528 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.779706528 +0000
@@ -1,9 +1,9 @@
 unsigned int f();
-unsigned int main();
+int main();
 unsigned int f() {
     return 1U;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

goto_loop.bc

--- /dev/fd/63	2022-09-27 21:39:42.839700415 +0000
+++ /dev/fd/62	2022-09-27 21:39:42.839700415 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

trunc.bc

--- /dev/fd/63	2022-09-27 21:39:43.075676539 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.075676539 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 18446744073709551615UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

bitops.bc

--- /dev/fd/63	2022-09-27 21:39:43.127671368 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.127671368 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int a = 255U;
 unsigned int b = 7U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

cast.bc

--- /dev/fd/63	2022-09-27 21:39:43.287655457 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.287655457 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)(&a);

nullptr.bc

--- /dev/fd/63	2022-09-27 21:39:43.339650285 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.339650285 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 void *ptr = (void *)0U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (ptr != (void *)0U) {

nested_struct.bc

--- /dev/fd/63	2022-09-27 21:39:43.447639546 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.447639546 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[4] = "Bob\000";
+char _str[4] = "Bob\000";
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -15,8 +15,8 @@
     struct struct__person field2;
 };
 struct struct__record r1 = {14U, {33U, 42U}, {"Bob", (unsigned char)66U}};
-unsigned char _str_1[9] = "Name: %s\000";
-unsigned int main() {
+char _str_1[9] = "Name: %s\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     printf("Name: %s", r1.field2.field0);

array_swap.bc

--- /dev/fd/63	2022-09-27 21:39:43.499634375 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.503633977 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a[2] = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

bitmask.bc

--- /dev/fd/63	2022-09-27 21:39:43.555628806 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.555628806 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 43981UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((a & 4080UL) >> 4UL != 188UL) {

binops.bc

--- /dev/fd/63	2022-09-27 21:39:43.659618464 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.659618464 +0000
@@ -1,5 +1,5 @@
 unsigned int target(unsigned int arg0);
-unsigned int main();
+int main();
 unsigned int target(unsigned int arg0) {
     unsigned int var0;
     unsigned int var1;
@@ -22,7 +22,7 @@
     }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

float.bc

--- /dev/fd/63	2022-09-27 21:39:43.931591415 +0000
+++ /dev/fd/62	2022-09-27 21:39:43.931591415 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 float f = 3.1400001F;
-unsigned int main() {
+int main() {
     unsigned int var0;
     double var1;
     double var2;

nested_while.bc

--- /dev/fd/63	2022-09-27 21:39:44.039580755 +0000
+++ /dev/fd/62	2022-09-27 21:39:44.039580755 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "5\000";
-unsigned char _str_1[13] = "loop1 x: %d\n\000";
-unsigned char _str_2[13] = "loop2 x: %d\n\000";
-unsigned int main() {
+char _str[2] = "5\000";
+char _str_1[13] = "loop1 x: %d\n\000";
+char _str_2[13] = "loop2 x: %d\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     unsigned int call2;
@@ -18,14 +18,14 @@
                 printf("loop1 x: %d\n", var1);
             }
     }
-    if ((int)var1 <= 10 || (int)var1 >= 20) {
+    if ((int)var1 >= 20 || (int)var1 <= 10) {
         while ((int)var1 < 20)
             {
                 var1 = var1 + 1U;
                 printf("loop2 x: %d\n", var1);
             }
     }
-    if ((int)var1 >= 20 && ((int)var1 <= 10 || (int)var1 >= 20)) {
+    if ((int)var1 >= 20 && ((int)var1 >= 20 || (int)var1 <= 10)) {
         return var0;
     }
 }

zeroinit.bc

--- /dev/fd/63	2022-09-27 21:39:44.407545046 +0000
+++ /dev/fd/62	2022-09-27 21:39:44.407545046 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__person {
     void *field0;
-    unsigned char field1;
+    char field1;
 };
 struct struct__record {
     unsigned int field0;
@@ -14,7 +14,7 @@
 };
 struct struct__record r1 = {};
 unsigned long a1[256] = {};
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (r1.field1.field0 == 0U) {

funcptr.bc

--- /dev/fd/63	2022-09-27 21:39:44.563529908 +0000
+++ /dev/fd/62	2022-09-27 21:39:44.563529908 +0000
@@ -1,6 +1,6 @@
 unsigned int add(unsigned int arg0, unsigned int arg1);
 unsigned int sub(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int add(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
@@ -16,7 +16,7 @@
     var1 = arg1;
     return var0 - var1;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     unsigned int call2;

struct_swap.bc

--- /dev/fd/63	2022-09-27 21:39:44.671519429 +0000
+++ /dev/fd/62	2022-09-27 21:39:44.671519429 +0000
@@ -1,10 +1,10 @@
-unsigned int main();
+int main();
 struct struct__pair {
     unsigned int field0;
     unsigned int field1;
 };
 struct struct__pair a = {0U, 42U};
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

branch.bc

--- /dev/fd/63	2022-09-27 21:39:44.723514383 +0000
+++ /dev/fd/62	2022-09-27 21:39:44.723514383 +0000
@@ -1,13 +1,13 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 0U;
 unsigned int c = 1U;
-unsigned char _str[39] = "Global variable 'a' of value %u is at \000";
-unsigned char _str_1[6] = "even \000";
-unsigned char _str_2[5] = "odd \000";
-unsigned char _str_3[39] = "Global variable 'c' of value %u is at \000";
-unsigned char _str_4[10] = "address.\n\000";
-unsigned int main() {
+char _str[39] = "Global variable 'a' of value %u is at \000";
+char _str_1[6] = "even \000";
+char _str_2[5] = "odd \000";
+char _str_3[39] = "Global variable 'c' of value %u is at \000";
+char _str_4[10] = "address.\n\000";
+int main() {
     unsigned int var0;
     unsigned long var1;
     unsigned long var2;

vectors.bc

--- /dev/fd/63	2022-09-27 21:39:45.031484556 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.031484556 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[17] = "a=[%d %d %d %d]\n\000";
-unsigned int main() {
+char _str[17] = "a=[%d %d %d %d]\n\000";
+int main() {
     unsigned int var0;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var1;
     __attribute__((__vector_size__(4 * sizeof(unsigned int)))) unsigned int var2;

issue_4.bc

--- /dev/fd/63	2022-09-27 21:39:45.087479255 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.087479255 +0000
@@ -1,5 +1,5 @@
 unsigned int foo(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int foo(unsigned int arg0, unsigned int arg1) {
     unsigned int var0;
     unsigned int var1;
@@ -17,7 +17,7 @@
         }
     return var2;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

conflicting_global.bc

--- /dev/fd/63	2022-09-27 21:39:45.243464487 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.243464487 +0000
@@ -1,8 +1,8 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int a = 3U;
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int var0;
     var0 = 4U;
     printf("%d\n", var0);

issue_123_uint128_t.bc

--- /dev/fd/63	2022-09-27 21:39:45.299459186 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.299459186 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long x = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned __int128 var1;
     var0 = 0U;

fizzbuzz_stateful.bc

--- /dev/fd/63	2022-09-27 21:39:45.351454262 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.351454262 +0000
@@ -1,11 +1,11 @@
 void fizzbuzz();
 unsigned int printf(void *arg0, ...);
-unsigned int main();
+int main();
 unsigned int i = 0U;
-unsigned char _str[5] = "fizz\000";
-unsigned char _str_1[5] = "buzz\000";
-unsigned char _str_2[3] = "%d\000";
-unsigned char _str_3[2] = "\n\000";
+char _str[5] = "fizz\000";
+char _str_1[5] = "buzz\000";
+char _str_2[3] = "%d\000";
+char _str_3[2] = "\n\000";
 void fizzbuzz() {
     unsigned int var0;
     var0 = i;
@@ -24,7 +24,7 @@
     i = var0;
     return;
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     i = 1U;

issue_94_strncmp.bc

--- /dev/fd/63	2022-09-27 21:39:45.703420941 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.703420941 +0000
@@ -1,16 +1,16 @@
-unsigned int main();
+int main();
 void *strcpy(void *arg0, void *arg1);
 unsigned int strncmp(void *arg0, void *arg1, unsigned long arg2);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[6] = "hello\000";
-unsigned char _str_1[12] = "helLO WORLD\000";
-unsigned char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
-unsigned char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
-unsigned char _str_4[41] = "Both the strings str1 and str2 are equal\000";
-unsigned int main() {
+char _str[6] = "hello\000";
+char _str_1[12] = "helLO WORLD\000";
+char _str_2[70] = "ASCII value of first unmatched character of str1 is greater than str2\000";
+char _str_3[67] = "ASCII value of first unmatched character of str1 is less than str2\000";
+char _str_4[41] = "Both the strings str1 and str2 are equal\000";
+int main() {
     unsigned int var0;
-    unsigned char var1[20];
-    unsigned char var2[20];
+    char var1[20];
+    char var2[20];
     unsigned int call3;
     unsigned int call4;
     var0 = 0U;

bool.bc

--- /dev/fd/63	2022-09-27 21:39:45.883403901 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.883403901 +0000
@@ -1,7 +1,7 @@
-unsigned int main();
+int main();
 unsigned long a = 0UL;
 unsigned long b = 1UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     var0 = 0U;
     if ((unsigned int)(a == b) != 0U) {

zext.bc

--- /dev/fd/63	2022-09-27 21:39:45.991393676 +0000
+++ /dev/fd/62	2022-09-27 21:39:45.991393676 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
-unsigned char a = (unsigned char)1U;
-unsigned int main() {
+int main();
+char a = (unsigned char)1U;
+int main() {
     unsigned int var0;
     var0 = 0U;
     return (unsigned int)a;

byval_struct.bc

--- /dev/fd/63	2022-09-27 21:39:46.043388841 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.043388841 +0000
@@ -5,20 +5,20 @@
     unsigned long field3;
 };
 unsigned long get_3x(struct struct_foo arg0);
-unsigned int main();
+int main();
 unsigned int atoi(void *arg0);
 unsigned int printf(void *arg0, ...);
-unsigned char _str[2] = "1\000";
-unsigned char _str_1[2] = "2\000";
-unsigned char _str_2[2] = "3\000";
-unsigned char _str_3[2] = "4\000";
-unsigned char _str_4[11] = "%lld %lld\n\000";
+char _str[2] = "1\000";
+char _str_1[2] = "2\000";
+char _str_2[2] = "3\000";
+char _str_3[2] = "4\000";
+char _str_4[11] = "%lld %lld\n\000";
 unsigned long get_3x(struct struct_foo arg0) {
     void *arg0_ptr = &arg0;
     ((struct struct_foo *)arg0_ptr)->field0 = ((struct struct_foo *)arg0_ptr)->field0 * 3UL;
     return ((struct struct_foo *)arg0_ptr)->field0;
 }
-unsigned int main() {
+int main() {
     struct struct_foo var0;
     unsigned long var1;
     unsigned int call2;

func_cond_two_arg.bc

--- /dev/fd/63	2022-09-27 21:39:46.103383301 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.103383301 +0000
@@ -1,5 +1,5 @@
 unsigned int f(unsigned int arg0, unsigned int arg1);
-unsigned int main();
+int main();
 unsigned int x = 0U;
 unsigned int y = 1U;
 unsigned int f(unsigned int arg0, unsigned int arg1) {
@@ -9,7 +9,7 @@
     var1 = arg1;
     return (unsigned int)((int)var0 < (int)var1);
 }
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int call1;
     var0 = 0U;

inttoptr.bc

--- /dev/fd/63	2022-09-27 21:39:46.219372590 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.219372590 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned long a = 3735928559UL;
-unsigned int main() {
+int main() {
     unsigned int var0;
     void *var1;
     var0 = 0U;

assert.bc

--- /dev/fd/63	2022-09-27 21:39:46.327362618 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.327362618 +0000
@@ -1,12 +1,12 @@
-unsigned int main();
+int main();
 void __assert_fail(void *arg0, void *arg1, unsigned int arg2, void *arg3);
 unsigned long a = 1UL;
-unsigned char _str[6] = "a % 3\000";
-unsigned char _str_1[9] = "assert.c\000";
-unsigned char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
-unsigned char _str_2[6] = "a % 7\000";
-unsigned char _str_3[7] = "a % 15\000";
-unsigned int main() {
+char _str[6] = "a % 3\000";
+char _str_1[9] = "assert.c\000";
+char __PRETTY_FUNCTION___main[15] = "int main(void)\000";
+char _str_2[6] = "a % 7\000";
+char _str_3[7] = "a % 15\000";
+int main() {
     unsigned int var0;
     var0 = 0U;
     if (a % 3UL == 0UL) {

loop.bc

--- /dev/fd/63	2022-09-27 21:39:46.543342674 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.543342674 +0000
@@ -1,9 +1,9 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
-unsigned char _str[19] = "Variable at %d is \000";
-unsigned char _str_1[7] = "even.\n\000";
-unsigned char _str_2[6] = "odd.\n\000";
-unsigned int main() {
+char _str[19] = "Variable at %d is \000";
+char _str_1[7] = "even.\n\000";
+char _str_2[6] = "odd.\n\000";
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

switch.bc

--- /dev/fd/63	2022-09-27 21:39:46.783320514 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.783320514 +0000
@@ -1,6 +1,6 @@
-unsigned int main();
+int main();
 unsigned int a = 12U;
-unsigned int main() {
+int main() {
     unsigned int var0;
     unsigned int var1;
     var0 = 0U;

template_parameter_pack.bc

--- /dev/fd/63	2022-09-27 21:39:46.903309434 +0000
+++ /dev/fd/62	2022-09-27 21:39:46.903309434 +0000
@@ -1,11 +1,11 @@
-unsigned int main();
+int main();
 unsigned int printf(void *arg0, ...);
 unsigned int _Z3sumIiJiiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3, unsigned int arg4);
 unsigned int _Z3sumIiJiiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2, unsigned int arg3);
 unsigned int _Z3sumIiJiiEET_S0_DpT0_(unsigned int arg0, unsigned int arg1, unsigned int arg2);
 unsigned int _Z3sumIiET_S0_S0_(unsigned int arg0, unsigned int arg1);
-unsigned char _str[4] = "%d\n\000";
-unsigned int main() {
+char _str[4] = "%d\n\000";
+int main() {
     unsigned int call0;
     call0 = _Z3sumIiJiiiiEET_S0_DpT0_(1U, 2U, 3U, 4U, 5U);
     printf("%d\n", call0);

byval_tail_gep.ll

byval_tail_nogep.ll

@frabert frabert requested a review from surovic September 28, 2022 08:01
@frabert frabert merged commit fdfe905 into master Oct 24, 2022
@frabert frabert deleted the frabert/type-providers branch October 24, 2022 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants