xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ MB_CUR_MAX;
int mbtowc(int /*<<< orphan*/ *, char const *, int /*<<< orphan*/);
int xmbtowc(wchar_t *wc, const char *s) {
  int n;
  n = mbtowc(wc, s, MB_CUR_MAX);
  if (n == -1) {
    n = mbtowc(NULL, NULL, MB_CUR_MAX);
    return 0;
  }
  return n;
}


x86 assembly (clang, -O0):
<xmbtowc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    0x2ec9(%rip),%rax
mov    (%rax),%edx
call   1030 <mbtowc@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1167 <xmbtowc+0x57>
mov    0x2eae(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1030 <mbtowc@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x4(%rbp)
jmp    116d <xmbtowc+0x5d>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmbtowc>:
push   %r14
push   %rbx
push   %rax
mov    0x2edd(%rip),%r14
mov    (%r14),%edx
call   1030 <mbtowc@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1138 <xmbtowc+0x28>
mov    (%r14),%edx
xor    %ebx,%ebx
xor    %edi,%edi
xor    %esi,%esi
call   1030 <mbtowc@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@MB_CUR_MAX = global i32 0
define i32 @xmbtowc(i32* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i32
store i32* %0, i32** %4
store i8* %1, i8** %5
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* @MB_CUR_MAX
%10 = call i32 @mbtowc(i32* %7, i8* %8, i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = load i32, i32* @MB_CUR_MAX
%15 = call i32 @mbtowc(i32* null, i8* null, i32 %14)
store i32 %15, i32* %6
store i32 0, i32* %3
br label %18
16: ; preds = %2
%17 = load i32, i32* %6
store i32 %17, i32* %3
br label %18
18: ; preds = %16, %13
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@MB_CUR_MAX = global i32 0
define i32 @xmbtowc(i32* %0, i8* %1) {
%3 = load i32, i32* @MB_CUR_MAX
%4 = tail call i32 @mbtowc(i32* %0, i8* %1, i32 %3)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = load i32, i32* @MB_CUR_MAX
%8 = tail call i32 @mbtowc(i32* null, i8* null, i32 %7)
br label %9
9: ; preds = %2, %6
%10 = phi i32 [ 0, %6 ], [ %4, %2 ]
ret i32 %10
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int solcon_standard_drop_coordinate_by_index(int k) {
  int fail, *b;
  double *c;
  fail = _ada_use_c2phc4c(38, &k, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_standard_drop_coordinate_by_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x26,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_standard_drop_coordinate_by_index>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x26,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solcon_standard_drop_coordinate_by_index(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
%5 = alloca double*
store i32 %0, i32* %2
%6 = load i32*, i32** %4
%7 = load double*, double** %5
%8 = call i32 @_ada_use_c2phc4c(i32 38, i32* %2, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @solcon_standard_drop_coordinate_by_index(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @_ada_use_c2phc4c(i32 38, i32* %2, i32* undef, double* undef, i32 0)
ret i32 %3
}
/* Variables and functions */
int INT_MAX;
int isinf(float);
scalar_t__ isnan(float);
int to_int(float x) {
  if (isnan(x)) {
    return 0;
  } else if (isinf(x) != 0) {
    return INT_MAX * isinf(x);
  } else {
    return (int)x;
  }
}


x86 assembly (clang, -O0):
<to_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <isnan@plt>
cmp    $0x0,%rax
je     114d <to_int+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    118e <to_int+0x6e>
movss  -0x8(%rbp),%xmm0
call   1040 <isinf@plt>
cmp    $0x0,%eax
je     1186 <to_int+0x66>
mov    0x2e81(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <isinf@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    118e <to_int+0x6e>
cvttss2si -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<to_int>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
call   1030 <isnan@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1168 <to_int+0x48>
movss  0xc(%rsp),%xmm0
call   1040 <isinf@plt>
test   %eax,%eax
je     1162 <to_int+0x42>
mov    0x2e98(%rip),%rax
mov    (%rax),%ebx
movss  0xc(%rsp),%xmm0
call   1040 <isinf@plt>
imul   %ebx,%eax
jmp    1168 <to_int+0x48>
cvttss2si 0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@INT_MAX = global i32 0
define i32 @to_int(float %0) {
%2 = alloca i32
%3 = alloca float
store float %0, float* %3
%4 = load float, float* %3
%5 = call i64 @isnan(float %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %20
8: ; preds = %1
%9 = load float, float* %3
%10 = call i32 @isinf(float %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %17
12: ; preds = %8
%13 = load i32, i32* @INT_MAX
%14 = load float, float* %3
%15 = call i32 @isinf(float %14)
%16 = mul nsw i32 %13, %15
store i32 %16, i32* %2
br label %20
17: ; preds = %8
%18 = load float, float* %3
%19 = fptosi float %18 to i32
store i32 %19, i32* %2
br label %20
20: ; preds = %17, %12, %7
%21 = load i32, i32* %2
ret i32 %21
}

LLVM IR (-O2):
@INT_MAX = global i32 0
define i32 @to_int(float %0) {
%2 = tail call i64 @isnan(float %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call i32 @isinf(float %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %4
%8 = load i32, i32* @INT_MAX
%9 = tail call i32 @isinf(float %0)
%10 = mul nsw i32 %9, %8
br label %13
11: ; preds = %4
%12 = fptosi float %0 to i32
br label %13
13: ; preds = %1, %11, %7
%14 = phi i32 [ %10, %7 ], [ %12, %11 ], [ 0, %1 ]
ret i32 %14
}
void LedsP$Led0$makeOutput(void) { ReverseGPIOP$0$Out$makeOutput(); }


x86 assembly (clang, -O0):
<LedsP$Led0$makeOutput>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <ReverseGPIOP$0$Out$makeOutput@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<LedsP$Led0$makeOutput>:
xor    %eax,%eax
jmp    1030 <ReverseGPIOP$0$Out$makeOutput@plt>

LLVM IR (-O0):
define void @"LedsP$Led0$makeOutput"() {
%1 = call i32 (...) @"ReverseGPIOP$0$Out$makeOutput"()
ret void
}

LLVM IR (-O2):
define void @"LedsP$Led0$makeOutput"() {
%1 = tail call i32 (...) @"ReverseGPIOP$0$Out$makeOutput"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fun(char *);
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char ch[81];
  gets(ch);
  fun(ch);
  printf("%s\n", ch);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x60(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x60(%rbp),%rdi
call   1030 <fun@plt>
lea    -0x60(%rbp),%rsi
lea    0xea4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
mov    %rbx,%rdi
call   1030 <fun@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [81 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%4 = call i32 @gets(i8* %3)
%5 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%6 = call i32 @fun(i8* %5)
%7 = getelementptr inbounds [81 x i8], [81 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [81 x i8]
%2 = getelementptr inbounds [81 x i8], [81 x i8]* %1, i64 0, i64 0
%3 = call i32 @gets(i8* %2)
%4 = call i32 @fun(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
scalar_t__ printf(char *);
int main(void) {
  int status = 0;
  if (printf("Hello world!\n") != 0) {
    status = -1;
  }
  return status;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
je     1143 <main+0x33>
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
neg    %rax
sbb    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%3 = call i64 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 -1, i32* %2
br label %6
6: ; preds = %5, %0
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [14 x i8] c"Hello world!\0A\00"
define i32 @main() {
%1 = tail call i64 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
%3 = sext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printd(int);
int main() {
  int n = 1234567890;
  printd(n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x499602d2,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <printd@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x499602d2,%edi
call   1030 <printd@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 1234567890, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printd(i32 %3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @printd(i32 1234567890)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __crow_f3();
int expect(int, int /*<<< orphan*/);
int test_f3() { return expect(2, __crow_f3()); }


x86 assembly (clang, -O0):
<test_f3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <__crow_f3@plt>
mov    %eax,%esi
mov    $0x2,%edi
call   1030 <expect@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_f3>:
push   %rax
xor    %eax,%eax
call   1040 <__crow_f3@plt>
mov    $0x2,%edi
mov    %eax,%esi
pop    %rax
jmp    1030 <expect@plt>

LLVM IR (-O0):
define i32 @test_f3() {
%1 = call i32 (...) @__crow_f3()
%2 = call i32 @expect(i32 2, i32 %1)
ret i32 %2
}

LLVM IR (-O2):
define i32 @test_f3() {
%1 = tail call i32 (...) @__crow_f3()
%2 = tail call i32 @expect(i32 2, i32 %1)
ret i32 %2
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t z80_cb_b0_res_6(uint8_t value) { return value & 0xbf; }


x86 assembly (clang, -O0):
<z80_cb_b0_res_6>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xbf,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<z80_cb_b0_res_6>:
mov    %edi,%eax
and    $0xbf,%eax
ret

LLVM IR (-O0):
define i32 @z80_cb_b0_res_6(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 191
ret i32 %4
}

LLVM IR (-O2):
define i32 @z80_cb_b0_res_6(i32 %0) {
%2 = and i32 %0, 191
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timeval {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ __syscall(int, struct timeval *, int /*<<< orphan*/);
time_t time(time_t *t) {
  struct timeval tv;
  __syscall(78, &tv, 0);
  if (t)
    *t = tv.tv_sec;
  return tv.tv_sec;
}


x86 assembly (clang, -O0):
<time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4e,%edi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1030 <__syscall@plt>
cmpq   $0x0,-0x8(%rbp)
je     1140 <time+0x30>
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<time>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x4e,%edi
xor    %edx,%edx
call   1030 <__syscall@plt>
mov    0x8(%rsp),%eax
test   %rbx,%rbx
je     1134 <time+0x24>
mov    %eax,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @time(i32* %0) {
%2 = alloca i32*
%3 = alloca %struct.timeval
store i32* %0, i32** %2
%4 = call i32 @__syscall(i32 78, %struct.timeval* %3, i32 0)
%5 = load i32*, i32** %2
%6 = icmp ne i32* %5, null
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %2
store i32 %9, i32* %10
br label %11
11: ; preds = %7, %1
%12 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%13 = load i32, i32* %12
ret i32 %13
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @time(i32* writeonly %0) {
%2 = alloca %struct.timeval
%3 = bitcast %struct.timeval* %2 to i8*
%4 = call i32 @__syscall(i32 78, %struct.timeval* %2, i32 0)
%5 = icmp eq i32* %0, null
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %2, i64 0, i32 0
%7 = load i32, i32* %6
br i1 %5, label %9, label %8
8: ; preds = %1
store i32 %7, i32* %0
br label %9
9: ; preds = %1, %8
ret i32 %7
}
void main(void) {
  static const int cpu[] = {0, 1, 2, 3};
  int i;
  for (i = 0; i < sizeof(cpu) / sizeof(cpu[0]); i++) {
    static const unsigned int register_values[] = {
        0x0000c144, 0x0000f8f8, 0x00000000, 0x0000c14C, 0x0000f8f8, 0x00000001,
        0x0000c154, 0x0000f8f8, 0x00000002, 0x0000c15C, 0x0000f8f8, 0x00000003,
        0x0000c164, 0x0000f8f8, 0x00000004, 0x0000c16C, 0x0000f8f8, 0x00000005,
        0x0000c174, 0x0000f8f8, 0x00000006, 0x0000c17C, 0x0000f8f8, 0x00000007,
    };
    int j;
    int max = sizeof(register_values) / sizeof(register_values[0]);
    for (j = 0; j < max; j += 3) {
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movslq -0x4(%rbp),%rax
cmp    $0x4,%rax
jae    1159 <main+0x59>
movl   $0x18,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1146 <main+0x46>
jmp    1138 <main+0x38>
mov    -0x8(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x8(%rbp)
jmp    1127 <main+0x27>
jmp    114b <main+0x4b>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110b <main+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
ret

LLVM IR (-O0):
@main.cpu = internal constant [4 x i32] [i32 0, i32 1, i32 2, i32 3]
@main.register_values = internal constant [24 x i32] [i32 49476, i32 63736, i32 0, i32 49484, i32 63736, i32 1, i32 49492, i32 63736, i32 2, i32 49500, i32 63736, i32 3, i32 49508, i32 63736, i32 4, i32 49516, i32 63736, i32 5, i32 49524, i32 63736, i32 6, i32 49532, i32 63736, i32 7]
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
br label %4
4: ; preds = %18, %0
%5 = load i32, i32* %1
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, 4
br i1 %7, label %8, label %21
8: ; preds = %4
store i32 24, i32* %3
store i32 0, i32* %2
br label %9
9: ; preds = %14, %8
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %17
13: ; preds = %9
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 3
store i32 %16, i32* %2
br label %9
17: ; preds = %9
br label %18
18: ; preds = %17
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %4
21: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sgen2(char *, char *, int, char *);
void cgincpg(char *s, int v) { sgen2("%s\t$%d,%s", "addl", v, s); }


x86 assembly (clang, -O0):
<cgincpg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xed3(%rip),%rdi
lea    0xed6(%rip),%rsi
call   1030 <sgen2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgincpg>:
mov    %esi,%edx
mov    %rdi,%rcx
lea    0xee4(%rip),%rdi
lea    0xee7(%rip),%rsi
jmp    1030 <sgen2@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%s\09$%d,%s\00"
@.str.1 = [5 x i8] c"addl\00"
define void @cgincpg(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @sgen2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%s\09$%d,%s\00"
@.str.1 = [5 x i8] c"addl\00"
define void @cgincpg(i8* %0, i32 %1) {
%3 = tail call i32 @sgen2(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %1, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void transmit(char *pData, unsigned size) {
  for (int i = 0; i < size; i++)
    putchar(pData[i]);
}


x86 assembly (clang, -O0):
<transmit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    1151 <transmit+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <transmit+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transmit>:
push   %r15
push   %r14
push   %rbx
test   %esi,%esi
je     1143 <transmit+0x33>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <transmit+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @transmit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp ult i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8*, i8** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @putchar(i8 signext %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @transmit(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @putchar(i8 signext %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
unsigned int JSHash(const char *str) {
  unsigned int hash = 1315423911;
  while (*str) {
    hash ^= ((hash << 5) + (*str++) + (hash >> 2));
  }
  return (hash & 0x7FFFFFFF);
}


x86 assembly (clang, -O0):
<JSHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x4e67c6a7,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1149 <JSHash+0x49>
mov    -0xc(%rbp),%eax
shl    $0x5,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    -0xc(%rbp),%ecx
shr    $0x2,%ecx
add    %ecx,%eax
xor    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <JSHash+0xf>
mov    -0xc(%rbp),%eax
and    $0x7fffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<JSHash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1134 <JSHash+0x34>
add    $0x1,%rdi
mov    $0x4e67c6a7,%eax
nop
mov    %eax,%edx
mov    %eax,%esi
shl    $0x5,%esi
movsbl %cl,%ecx
shr    $0x2,%eax
add    %esi,%eax
add    %ecx,%eax
xor    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <JSHash+0x10>
and    $0x7fffffff,%eax
ret
mov    $0x4e67c6a7,%eax
ret

LLVM IR (-O0):
define i32 @JSHash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1315423911, i32* %3
br label %4
4: ; preds = %8, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = icmp ne i8 %6, 0
br i1 %7, label %8, label %21
8: ; preds = %4
%9 = load i32, i32* %3
%10 = shl i32 %9, 5
%11 = load i8*, i8** %2
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %2
%13 = load i8, i8* %11
%14 = sext i8 %13 to i32
%15 = add i32 %10, %14
%16 = load i32, i32* %3
%17 = lshr i32 %16, 2
%18 = add i32 %15, %17
%19 = load i32, i32* %3
%20 = xor i32 %19, %18
store i32 %20, i32* %3
br label %4
21: ; preds = %4
%22 = load i32, i32* %3
%23 = and i32 %22, 2147483647
ret i32 %23
}

LLVM IR (-O2):
define i32 @JSHash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %19, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i32 [ %14, %4 ], [ 1315423911, %1 ]
%7 = phi i8* [ %9, %4 ], [ %0, %1 ]
%8 = shl i32 %6, 5
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = sext i8 %5 to i32
%11 = lshr i32 %6, 2
%12 = add i32 %11, %8
%13 = add i32 %12, %10
%14 = xor i32 %13, %6
%15 = load i8, i8* %9
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4
%18 = and i32 %14, 2147483647
br label %19
19: ; preds = %17, %1
%20 = phi i32 [ 1315423911, %1 ], [ %18, %17 ]
ret i32 %20
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ t_repalloc(int, int);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  t_repalloc(1024 * 1024, 1024);
  t_repalloc(1024 * 1024 * 1024, 8192);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x100000,%edi
mov    $0x400,%esi
call   1030 <t_repalloc@plt>
mov    $0x40000000,%edi
mov    $0x2000,%esi
call   1030 <t_repalloc@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x100000,%edi
mov    $0x400,%esi
call   1030 <t_repalloc@plt>
mov    $0x40000000,%edi
mov    $0x2000,%esi
call   1030 <t_repalloc@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 @t_repalloc(i32 1048576, i32 1024)
%5 = call i32 @t_repalloc(i32 1073741824, i32 8192)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 @t_repalloc(i32 1048576, i32 1024)
%4 = tail call i32 @t_repalloc(i32 1073741824, i32 8192)
ret i32 0
}
int main(void) {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    110b <main+0xb>

x86 assembly (clang, -O2):
<main>:
jmp    1100 <main>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
double __ocml_trunc_f64(double);
double trunc(double x) { return __ocml_trunc_f64(x); }


x86 assembly (clang, -O0):
<trunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <__ocml_trunc_f64@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trunc>:
jmp    1030 <__ocml_trunc_f64@plt>

LLVM IR (-O0):
define double @trunc(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @__ocml_trunc_f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @trunc(double %0) {
%2 = tail call double @__ocml_trunc_f64(double %0)
ret double %2
}
void gtk_tearoff_menu_item_get_type() {}


x86 assembly (clang, -O0):
<gtk_tearoff_menu_item_get_type>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gtk_tearoff_menu_item_get_type>:
ret

LLVM IR (-O0):
define void @gtk_tearoff_menu_item_get_type() {
ret void
}

LLVM IR (-O2):
define void @gtk_tearoff_menu_item_get_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ examine_stack(void *);
int /*<<< orphan*/ mark_stack(void *);
int /*<<< orphan*/ myThread_work(void *);
void *myThread(void *arg) {
  mark_stack(arg);
  myThread_work(arg);
  examine_stack(arg);
  return 0;
}


x86 assembly (clang, -O0):
<myThread>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <mark_stack@plt>
mov    -0x8(%rbp),%rdi
call   1040 <myThread_work@plt>
mov    -0x8(%rbp),%rdi
call   1030 <examine_stack@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myThread>:
push   %rbx
mov    %rdi,%rbx
call   1050 <mark_stack@plt>
mov    %rbx,%rdi
call   1040 <myThread_work@plt>
mov    %rbx,%rdi
call   1030 <examine_stack@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @myThread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @mark_stack(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @myThread_work(i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @examine_stack(i8* %7)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @myThread(i8* %0) {
%2 = tail call i32 @mark_stack(i8* %0)
%3 = tail call i32 @myThread_work(i8* %0)
%4 = tail call i32 @examine_stack(i8* %0)
ret i8* null
}
void addReplyHelp(void) {
  _serverPanic("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/"
               "heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c",
               26, "Function '%s' is disabled.", __func__);
}


x86 assembly (clang, -O0):
<addReplyHelp>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x1a,%esi
lea    0xf79(%rip),%rdx
lea    0xf8d(%rip),%rcx
mov    $0x0,%al
call   1030 <_serverPanic@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<addReplyHelp>:
lea    0xee9(%rip),%rdi
lea    0xf82(%rip),%rdx
lea    0xf96(%rip),%rcx
mov    $0x1a,%esi
xor    %eax,%eax
jmp    1030 <_serverPanic@plt>

LLVM IR (-O0):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.addReplyHelp = [13 x i8] c"addReplyHelp\00"
define void @addReplyHelp() {
%1 = call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.addReplyHelp, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CodisLabs/redis-port/refs/heads/redis-4.x-cgo/pkg/rdb/cgo_glue_meow.c\00"
@.str.1 = [27 x i8] c"Function '%s' is disabled.\00"
@__func__.addReplyHelp = [13 x i8] c"addReplyHelp\00"
define void @addReplyHelp() {
%1 = tail call i32 (i8*, i32, i8*, i8*, ...) bitcast (i32 (...)* @_serverPanic to i32 (i8*, i32, i8*, i8*, ...)*)(i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str, i64 0, i64 0), i32 26, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__func__.addReplyHelp, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SBC_(int);
int /*<<< orphan*/ c64_memAbsoluteAddrX();
void SBC_absx(void) {
  c64_memAbsoluteAddrX();
  SBC_(1);
}


x86 assembly (clang, -O0):
<SBC_absx>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <c64_memAbsoluteAddrX@plt>
mov    $0x1,%edi
call   1030 <SBC_@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SBC_absx>:
push   %rax
xor    %eax,%eax
call   1040 <c64_memAbsoluteAddrX@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <SBC_@plt>

LLVM IR (-O0):
define void @SBC_absx() {
%1 = call i32 (...) @c64_memAbsoluteAddrX()
%2 = call i32 @SBC_(i32 1)
ret void
}

LLVM IR (-O2):
define void @SBC_absx() {
%1 = tail call i32 (...) @c64_memAbsoluteAddrX()
%2 = tail call i32 @SBC_(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DataAnalysis(unsigned char *, unsigned char);
int /*<<< orphan*/ getchar();
int main() {
  unsigned char test_str[] = "aaaa0b02007d007d025b";
  unsigned char len = 20;
  DataAnalysis(test_str, len);
  getchar();
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xec0(%rip),%al
mov    %al,-0xc(%rbp)
movb   $0x14,-0x21(%rbp)
lea    -0x20(%rbp),%rdi
movzbl -0x21(%rbp),%esi
call   1030 <DataAnalysis@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
movabs $0x62353230643730,%rax
mov    %rax,0xd(%rsp)
mov    %rsp,%rdi
mov    $0x14,%esi
call   1030 <DataAnalysis@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.test_str = [21 x i8] c"aaaa0b02007d007d025b\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [21 x i8]
%3 = alloca i8
store i32 0, i32* %1
%4 = bitcast [21 x i8]* %2 to i8*
store i8 20, i8* %3
%5 = getelementptr inbounds [21 x i8], [21 x i8]* %2, i64 0, i64 0
%6 = load i8, i8* %3
%7 = call i32 @DataAnalysis(i8* %5, i8 zeroext %6)
%8 = call i32 (...) @getchar()
%9 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.test_str = [21 x i8] c"aaaa0b02007d007d025b\00"
define i32 @main() {
%1 = alloca [21 x i8]
%2 = getelementptr inbounds [21 x i8], [21 x i8]* %1, i64 0, i64 0
%3 = call i32 @DataAnalysis(i8* %2, i8 zeroext 20)
%4 = call i32 (...) @getchar()
%5 = call i32 (...) @getchar()
ret i32 0
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void ts_set_transportpriority(uint8_t *p_ts) { p_ts[1] |= 0x20; }


x86 assembly (clang, -O0):
<ts_set_transportpriority>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
or     $0x20,%ecx
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ts_set_transportpriority>:
orb    $0x20,0x4(%rdi)
ret

LLVM IR (-O0):
define void @ts_set_transportpriority(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 1
%5 = load i32, i32* %4
%6 = or i32 %5, 32
store i32 %6, i32* %4
ret void
}

LLVM IR (-O2):
define void @ts_set_transportpriority(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = or i32 %3, 32
store i32 %4, i32* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void Disconnect(int sockfd) { close(sockfd); }


x86 assembly (clang, -O0):
<Disconnect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Disconnect>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @Disconnect(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @close(i32 %3)
ret void
}

LLVM IR (-O2):
define void @Disconnect(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
int foo(int a) { usleep(100); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x64,%edi
call   1030 <usleep@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    $0x64,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @usleep(i32 100)
%5 = load i32, i32* %2
ret i32 %5
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 @usleep(i32 100)
ret i32 undef
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
char *fgets_or_exit(char *buffer, int size, FILE *stream) {
  if (!fgets(buffer, size, stream))
    exit(0);
  return "";
}


x86 assembly (clang, -O0):
<fgets_or_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <fgets@plt>
cmp    $0x0,%eax
jne    1153 <fgets_or_exit+0x33>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xea6(%rip),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fgets_or_exit>:
push   %rax
call   1030 <fgets@plt>
test   %eax,%eax
je     1133 <fgets_or_exit+0x13>
lea    0xecf(%rip),%rax
pop    %rcx
ret
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i8* @fgets_or_exit(i8* %0, i32 %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32* %2, i32** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32*, i32** %6
%10 = call i32 @fgets(i8* %7, i32 %8, i32* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %3
%13 = call i32 @exit(i32 0)
unreachable
14: ; preds = %3
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i8* @fgets_or_exit(i8* %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32 @fgets(i8* %0, i32 %1, i32* %2)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @exit(i32 0)
unreachable
8: ; preds = %3
ret i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
struct event_source {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cleanup(struct event_source *);
int /*<<< orphan*/ free(struct event_source *);
void destroy(struct event_source *this) {
  cleanup(this);
  free(this);
}


x86 assembly (clang, -O0):
<destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <cleanup@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<destroy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <cleanup@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.event_source = type { i32 }
define void @destroy(%struct.event_source* %0) {
%2 = alloca %struct.event_source*
store %struct.event_source* %0, %struct.event_source** %2
%3 = load %struct.event_source*, %struct.event_source** %2
%4 = call i32 @cleanup(%struct.event_source* %3)
%5 = load %struct.event_source*, %struct.event_source** %2
%6 = call i32 @free(%struct.event_source* %5)
ret void
}

LLVM IR (-O2):
%struct.event_source = type { i32 }
define void @destroy(%struct.event_source* %0) {
%2 = tail call i32 @cleanup(%struct.event_source* %0)
%3 = tail call i32 @free(%struct.event_source* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fileRead();
int /*<<< orphan*/ setenv(char *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main(int argc, char **argv) {
  system("/home/mazumdar/DRTSIM/drt-code/tregression.sh");
  setenv("DRT_DEBUG", "4", 0);
  system("./fib-tsu4 > output.txt");
  fileRead();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1040 <system@plt>
lea    0xed5(%rip),%rdi
lea    0xed8(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
lea    0xecc(%rip),%rdi
call   1040 <system@plt>
mov    $0x0,%al
call   1050 <fileRead@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <system@plt>
lea    0xeea(%rip),%rdi
lea    0xeed(%rip),%rsi
xor    %edx,%edx
call   1030 <setenv@plt>
lea    0xee1(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
call   1050 <fileRead@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"/home/mazumdar/DRTSIM/drt-code/tregression.sh\00"
@.str.1 = [10 x i8] c"DRT_DEBUG\00"
@.str.2 = [2 x i8] c"4\00"
@.str.3 = [24 x i8] c"./fib-tsu4 > output.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @setenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0)
%8 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (...) @fileRead()
ret i32 0
}

LLVM IR (-O2):
@.str = [46 x i8] c"/home/mazumdar/DRTSIM/drt-code/tregression.sh\00"
@.str.1 = [10 x i8] c"DRT_DEBUG\00"
@.str.2 = [2 x i8] c"4\00"
@.str.3 = [24 x i8] c"./fib-tsu4 > output.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @system(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @setenv(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i32 0)
%5 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%6 = tail call i32 (...) @fileRead()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
int xcommon_fatal_handler(Display *dis) { return 0; }


x86 assembly (clang, -O0):
<xcommon_fatal_handler>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcommon_fatal_handler>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @xcommon_fatal_handler(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
ret i32 0
}

LLVM IR (-O2):
define i32 @xcommon_fatal_handler(i32* nocapture readnone %0) {
ret i32 0
}
__attribute__((no)) void *Ident(void *argument) { return argument; }


x86 assembly (clang, -O0):
<Ident>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ident>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @Ident(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
ret i8* %3
}

LLVM IR (-O2):
define i8* @Ident(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int __signbit(double);
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("%d %d\n", __signbit(-1), __signbit(2.0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
call   1040 <__signbit@plt>
mov    %eax,-0x8(%rbp)
movsd  0xeb9(%rip),%xmm0
call   1040 <__signbit@plt>
mov    -0x8(%rbp),%esi
mov    %eax,%edx
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
movsd  0xed7(%rip),%xmm0
call   1040 <__signbit@plt>
mov    %eax,%ebx
movsd  0xed0(%rip),%xmm0
call   1040 <__signbit@plt>
lea    0xecc(%rip),%rdi
mov    %ebx,%esi
mov    %eax,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @__signbit(double -1.000000e+00)
%3 = call i32 @__signbit(double 2.000000e+00)
%4 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %3)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @__signbit(double -1.000000e+00)
%2 = tail call i32 @__signbit(double 2.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
/* Variables and functions */
int write_block(int, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/);
int bwd(void) { return write_block(107, 0, 0, 0); }


x86 assembly (clang, -O0):
<bwd>:
push   %rbp
mov    %rsp,%rbp
mov    $0x6b,%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <write_block@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bwd>:
mov    $0x6b,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <write_block@plt>

LLVM IR (-O0):
define i32 @bwd() {
%1 = call i32 @write_block(i32 107, i32 0, i32 0, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @bwd() {
%1 = tail call i32 @write_block(i32 107, i32 0, i32 0, i32 0)
ret i32 %1
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ id;
};
typedef TYPE_1__ HEADER;

/* Variables and functions */
unsigned short ntohs(int /*<<< orphan*/);
unsigned short dns_get_id(char *packet, size_t packetlen) {
  HEADER *header;
  header = (HEADER *)packet;
  if (packetlen < sizeof(HEADER))
    return 0;
  return ntohs(header->id);
}


x86 assembly (clang, -O0):
<dns_get_id>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x4,-0x18(%rbp)
jae    113e <dns_get_id+0x2e>
movw   $0x0,-0x2(%rbp)
jmp    114d <dns_get_id+0x3d>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
call   1030 <ntohs@plt>
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dns_get_id>:
cmp    $0x4,%rsi
jae    1119 <dns_get_id+0x9>
xor    %eax,%eax
ret
mov    (%rdi),%edi
jmp    1030 <ntohs@plt>

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32 }
define zeroext i16 @dns_get_id(i8* %0, i64 %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = alloca i64
%6 = alloca %struct.TYPE_2__*
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = load i8*, i8** %4
%8 = bitcast i8* %7 to %struct.TYPE_2__*
store %struct.TYPE_2__* %8, %struct.TYPE_2__** %6
%9 = load i64, i64* %5
%10 = icmp ult i64 %9, 4
br i1 %10, label %11, label %12
11: ; preds = %2
store i16 0, i16* %3
br label %17
12: ; preds = %2
%13 = load %struct.TYPE_2__*, %struct.TYPE_2__** %6
%14 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %13, i32 0, i32 0
%15 = load i32, i32* %14
%16 = call zeroext i16 @ntohs(i32 %15)
store i16 %16, i16* %3
br label %17
17: ; preds = %12, %11
%18 = load i16, i16* %3
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @dns_get_id(i8* nocapture %0, i64 %1) {
%3 = icmp ult i64 %1, 4
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = tail call zeroext i16 @ntohs(i32 %6)
br label %8
8: ; preds = %2, %4
%9 = phi i16 [ %7, %4 ], [ 0, %2 ]
ret i16 %9
}
/* Type definitions */
typedef char *uint64_t;

/* Variables and functions */
uint64_t ROL64_03(uint64_t x) {
  __asm__("rolq $3, %0" : "=r"(x) : "0"(x));
  return x;
}


x86 assembly (clang, -O0):
<ROL64_03>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
rol    $0x3,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ROL64_03>:
mov    %rdi,%rax
rol    $0x3,%rax
ret

LLVM IR (-O0):
define i8* @ROL64_03(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* asm "rolq $$3, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %3)
store i8* %4, i8** %2
%5 = load i8*, i8** %2
ret i8* %5
}

LLVM IR (-O2):
define i8* @ROL64_03(i8* readnone %0) {
%2 = tail call i8* asm "rolq $$3, $0", "=r,0,~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ dot(float *, float *);
float sqrtf(int /*<<< orphan*/);
void normalize(float x[3]) {
  float len = 1.0f / sqrtf(dot(x, x));
  x[0] *= len;
  x[1] *= len;
  x[2] *= len;
}


x86 assembly (clang, -O0):
<normalize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <dot@plt>
mov    %eax,%edi
call   1040 <sqrtf@plt>
movaps %xmm0,%xmm1
movss  0xeb5(%rip),%xmm0
divss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  (%rax),%xmm0
movss  %xmm0,(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x4(%rax),%xmm0
movss  %xmm0,0x4(%rax)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mulss  0x8(%rax),%xmm0
movss  %xmm0,0x8(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<normalize>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rsi
call   1030 <dot@plt>
mov    %eax,%edi
call   1040 <sqrtf@plt>
movss  0xec5(%rip),%xmm1
divss  %xmm0,%xmm1
movss  (%rbx),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,(%rbx)
movss  0x4(%rbx),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,0x4(%rbx)
mulss  0x8(%rbx),%xmm1
movss  %xmm1,0x8(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @normalize(float* %0) {
%2 = alloca float*
%3 = alloca float
store float* %0, float** %2
%4 = load float*, float** %2
%5 = load float*, float** %2
%6 = call i32 @dot(float* %4, float* %5)
%7 = call float @sqrtf(i32 %6)
%8 = fdiv float 1.000000e+00, %7
store float %8, float* %3
%9 = load float, float* %3
%10 = load float*, float** %2
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = fmul float %12, %9
store float %13, float* %11
%14 = load float, float* %3
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = fmul float %17, %14
store float %18, float* %16
%19 = load float, float* %3
%20 = load float*, float** %2
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = fmul float %22, %19
store float %23, float* %21
ret void
}

LLVM IR (-O2):
define void @normalize(float* %0) {
%2 = tail call i32 @dot(float* %0, float* %0)
%3 = tail call float @sqrtf(i32 %2)
%4 = fdiv float 1.000000e+00, %3
%5 = load float, float* %0
%6 = fmul float %5, %4
store float %6, float* %0
%7 = getelementptr inbounds float, float* %0, i64 1
%8 = load float, float* %7
%9 = fmul float %4, %8
store float %9, float* %7
%10 = getelementptr inbounds float, float* %0, i64 2
%11 = load float, float* %10
%12 = fmul float %4, %11
store float %12, float* %10
ret void
}