xunge/DecIR huggingface dataset:
/* Variables and functions */
float AngleNormalize360(float);
float AngleNormalize180(float angle) {
  angle = AngleNormalize360(angle);
  if (angle > 180.0) {
    angle -= 360.0;
  }
  return angle;
}


x86 assembly (clang, -O0):
<AngleNormalize180>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <AngleNormalize360@plt>
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1165 <AngleNormalize180+0x55>
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<AngleNormalize180>:
push   %rax
call   1030 <AngleNormalize360@plt>
movss  0xee2(%rip),%xmm2
addss  %xmm0,%xmm2
movss  0xeda(%rip),%xmm1
cmpltss %xmm0,%xmm1
andps  %xmm1,%xmm2
andnps %xmm0,%xmm1
orps   %xmm2,%xmm1
movaps %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @AngleNormalize180(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @AngleNormalize360(float %3)
store float %4, float* %2
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fcmp ogt double %6, 1.800000e+02
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load float, float* %2
%10 = fpext float %9 to double
%11 = fsub double %10, 3.600000e+02
%12 = fptrunc double %11 to float
store float %12, float* %2
br label %13
13: ; preds = %8, %1
%14 = load float, float* %2
ret float %14
}

LLVM IR (-O2):
define float @AngleNormalize180(float %0) {
%2 = tail call float @AngleNormalize360(float %0)
%3 = fcmp ogt float %2, 1.800000e+02
%4 = fadd float %2, -3.600000e+02
%5 = select i1 %3, float %4, float %2
ret float %5
}
int fun1(int n) { return n; }


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

x86 assembly (clang, -O2):
<fun1>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @fun1(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int solib_main(int);
main() {
  int result;
  result = solib_main(100);
  result = solib_main(result);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @solib_main(i32 100)
%2 = tail call i32 @solib_main(i32 %1)
ret i32 0
}
int tmrm_hash_memory_sync(void *context) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @tmrm_hash_memory_sync(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
char *adjust_unit(double *);
int /*<<< orphan*/ printf(char *, double, char const *);
void pr_avg_speed(double speed) {
  const char *unit = adjust_unit(&speed);
  printf("Average writing speed: %.2f %s/s\n", speed, unit);
}


x86 assembly (clang, -O0):
<pr_avg_speed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <adjust_unit@plt>
mov    %rax,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_avg_speed>:
push   %rax
movsd  %xmm0,(%rsp)
mov    %rsp,%rdi
call   1040 <adjust_unit@plt>
movsd  (%rsp),%xmm0
lea    0xec6(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [34 x i8] c"Average writing speed: %.2f %s/s\0A\00"
define void @pr_avg_speed(double %0) {
%2 = alloca double
%3 = alloca i8*
store double %0, double* %2
%4 = call i8* @adjust_unit(double* %2)
store i8* %4, i8** %3
%5 = load double, double* %2
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [34 x i8] c"Average writing speed: %.2f %s/s\0A\00"
define void @pr_avg_speed(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = call i8* @adjust_unit(double* %2)
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %4, i8* %3)
ret void
}
int channel_test_1() { return 1; }


x86 assembly (clang, -O0):
<channel_test_1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<channel_test_1>:
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @channel_test_1() {
ret i32 1
}

LLVM IR (-O2):
define i32 @channel_test_1() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isspace(int);
void t_isspace_0x88() {
  Assert_real((isspace(136) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isspace.c",
              685, ("isspace should be 0 for 0x88"));
}


x86 assembly (clang, -O0):
<t_isspace_0x88>:
push   %rbp
mov    %rsp,%rbp
mov    $0x88,%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x2ad,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isspace_0x88>:
push   %rax
mov    $0x88,%edi
call   1030 <isspace@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x2ad,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x88\00"
define void @t_isspace_0x88() {
%1 = call i64 @isspace(i32 136)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 685, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isspace.c\00"
@.str.1 = [29 x i8] c"isspace should be 0 for 0x88\00"
define void @t_isspace_0x88() {
%1 = tail call i64 @isspace(i32 136)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 685, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int glutCreateWindow(const char *str) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @glutCreateWindow(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int failure_handler() {
  printf("You are now OFFLINE.\n");
  return 0;
}


x86 assembly (clang, -O0):
<failure_handler>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<failure_handler>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"You are now OFFLINE.\0A\00"
define i32 @failure_handler() {
%1 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [21 x i8] c"You are now OFFLINE.\00"
define i32 @failure_handler() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int convert_3d_indices_to_linear_index_inline(int, int, int, int, int, int);
int convert_3d_indices_to_linear_index(int index_x, int index_y, int index_z,
                                       int nx, int ny, int nz) {
  return convert_3d_indices_to_linear_index_inline(index_x, index_y, index_z,
                                                   nx, ny, nz);
}


x86 assembly (clang, -O0):
<convert_3d_indices_to_linear_index>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9d,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x18(%rbp),%r9d
call   1030 <convert_3d_indices_to_linear_index_inline@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_3d_indices_to_linear_index>:
jmp    1030 <convert_3d_indices_to_linear_index_inline@plt>

LLVM IR (-O0):
define i32 @convert_3d_indices_to_linear_index(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = load i32, i32* %12
%19 = call i32 @convert_3d_indices_to_linear_index_inline(i32 %13, i32 %14, i32 %15, i32 %16, i32 %17, i32 %18)
ret i32 %19
}

LLVM IR (-O2):
define i32 @convert_3d_indices_to_linear_index(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @convert_3d_indices_to_linear_index_inline(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5)
ret i32 %7
}
int clampi(int val, int min, int max) {
  return (val < min) ? min : (val > max) ? max : val;
}


x86 assembly (clang, -O0):
<clampi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1124 <clampi+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1147 <clampi+0x47>
mov    -0x4(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    113b <clampi+0x3b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <clampi+0x41>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<clampi>:
mov    %edx,%eax
cmp    %edx,%edi
cmovle %edi,%eax
cmp    %esi,%edi
cmovl  %esi,%eax
ret

LLVM IR (-O0):
define i32 @clampi(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32, i32* %5
br label %22
12: ; preds = %3
%13 = load i32, i32* %4
%14 = load i32, i32* %6
%15 = icmp sgt i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load i32, i32* %6
br label %20
18: ; preds = %12
%19 = load i32, i32* %4
br label %20
20: ; preds = %18, %16
%21 = phi i32 [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi i32 [ %11, %10 ], [ %21, %20 ]
ret i32 %23
}

LLVM IR (-O2):
define i32 @clampi(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, %1
%5 = icmp sgt i32 %0, %2
%6 = select i1 %5, i32 %2, i32 %0
%7 = select i1 %4, i32 %1, i32 %6
ret i32 %7
}
int do_255() { return 255; }


x86 assembly (clang, -O0):
<do_255>:
push   %rbp
mov    %rsp,%rbp
mov    $0xff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_255>:
mov    $0xff,%eax
ret

LLVM IR (-O0):
define i32 @do_255() {
ret i32 255
}

LLVM IR (-O2):
define i32 @do_255() {
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ rec();
int main(void) { rec(); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rec@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <rec@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @rec()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @rec()
ret i32 0
}
signed char _schar(signed char x) { return x; }


x86 assembly (clang, -O0):
<_schar>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_schar>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define signext i8 @_schar(i8 returned signext %0) {
ret i8 %0
}
/* Variables and functions */
scalar_t__ random();
void initAlloc(size_t end, char *memblock) {
  for (size_t i = 0; i < end; ++i)
    memblock[i] = (char)random();
}


x86 assembly (clang, -O0):
<initAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jae    115b <initAlloc+0x4b>
mov    $0x0,%al
call   1030 <random@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <initAlloc+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initAlloc>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1144 <initAlloc+0x34>
mov    %rsi,%r14
mov    %rdi,%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <random@plt>
mov    %al,(%r14,%rbx,1)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <initAlloc+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @initAlloc(i64 %0, i8* nocapture writeonly %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 0, %2 ]
%7 = tail call i64 (...) @random()
%8 = trunc i64 %7 to i8
%9 = getelementptr inbounds i8, i8* %1, i64 %6
store i8 %8, i8* %9
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %0
br i1 %11, label %4, label %5
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char const *argv[]) {
  double nc;
  for (nc = 0; getchar() != EOF; ++nc)
    ;
  printf("%.0f\n", nc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2e9c(%rip),%rcx
cmp    (%rcx),%rax
je     1171 <main+0x51>
jmp    115a <main+0x3a>
movsd  0xe9e(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    113e <main+0x1e>
movsd  -0x18(%rbp),%xmm0
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb5(%rip),%rbx
xorpd  %xmm0,%xmm0
cmp    (%rbx),%rax
je     1160 <main+0x40>
xorpd  %xmm0,%xmm0
addsd  0xeb8(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %eax,%eax
call   1040 <getchar@plt>
movsd  0x8(%rsp),%xmm0
cmp    (%rbx),%rax
jne    1140 <main+0x20>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i64 0
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %6
br label %7
7: ; preds = %12, %2
%8 = call i64 (...) @getchar()
%9 = load i64, i64* @EOF
%10 = icmp ne i64 %8, %9
br i1 %10, label %11, label %15
11: ; preds = %7
br label %12
12: ; preds = %11
%13 = load double, double* %6
%14 = fadd double %13, 1.000000e+00
store double %14, double* %6
br label %7
15: ; preds = %7
%16 = load double, double* %6
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %16)
ret i32 0
}

LLVM IR (-O2):
@EOF = global i64 0
@.str = [6 x i8] c"%.0f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 (...) @getchar()
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi double [ %8, %6 ], [ 0.000000e+00, %2 ]
%8 = fadd double %7, 1.000000e+00
%9 = tail call i64 (...) @getchar()
%10 = load i64, i64* @EOF
%11 = icmp eq i64 %9, %10
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = phi double [ 0.000000e+00, %2 ], [ %8, %6 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), double %13)
ret i32 0
}
/* Variables and functions */
char *strdup(char *);
char *testPrint(void *toBePrinted) {
  if (toBePrinted != NULL) {
    return strdup((char *)toBePrinted);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<testPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1139 <testPrint+0x29>
mov    -0x10(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
jmp    1141 <testPrint+0x31>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPrint>:
test   %rdi,%rdi
je     111a <testPrint+0xa>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @testPrint(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = call i8* @strdup(i8* %7)
store i8* %8, i8** %2
br label %10
9: ; preds = %1
store i8* null, i8** %2
br label %10
10: ; preds = %9, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
define noalias i8* @testPrint(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
/* Variables and functions */
char toupper(char);
int findIndex(char *autor) {
  char fristChar = toupper(autor[0]);
  return fristChar - 65;
}


x86 assembly (clang, -O0):
<findIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %al,-0x9(%rbp)
movsbl -0x9(%rbp),%eax
sub    $0x41,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findIndex>:
push   %rax
movsbl (%rdi),%edi
call   1030 <toupper@plt>
movsbl %al,%eax
add    $0xffffffbf,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @findIndex(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 0
%6 = load i8, i8* %5
%7 = call signext i8 @toupper(i8 signext %6)
store i8 %7, i8* %3
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = sub nsw i32 %9, 65
ret i32 %10
}

LLVM IR (-O2):
define i32 @findIndex(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call signext i8 @toupper(i8 signext %2)
%4 = sext i8 %3 to i32
%5 = add nsw i32 %4, -65
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ __chk_error(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int *, int /*<<< orphan*/);
void wait_for_child(pid_t pid) {
  int status;
  __chk_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/"
              "qemu/tests/tcg/multiarch/linux-test.c",
              397, (waitpid(pid, &status, 0)));
}


x86 assembly (clang, -O0):
<wait_for_child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
mov    %eax,%edx
lea    0xebe(%rip),%rdi
mov    $0x18d,%esi
call   1030 <__chk_error@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_child>:
push   %rax
lea    0x4(%rsp),%rsi
xor    %edx,%edx
call   1040 <waitpid@plt>
lea    0xecc(%rip),%rdi
mov    $0x18d,%esi
mov    %eax,%edx
call   1030 <__chk_error@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [166 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/multiarch/linux-test.c\00"
define void @wait_for_child(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @waitpid(i32 %4, i32* %3, i32 0)
%6 = call i32 @__chk_error(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str, i64 0, i64 0), i32 397, i32 %5)
ret void
}

LLVM IR (-O2):
@.str = [166 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Cisco-Talos/pyrebox/refs/heads/master/qemu/tests/tcg/multiarch/linux-test.c\00"
define void @wait_for_child(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @waitpid(i32 %0, i32* %2, i32 0)
%5 = call i32 @__chk_error(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str, i64 0, i64 0), i32 397, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ eprintf(char *);
size_t strlcpy(char *, char const *, size_t);
size_t estrlcpy(char *dst, const char *src, size_t siz) {
  size_t ret;
  if ((ret = strlcpy(dst, src, siz)) >= siz)
    eprintf("strlcpy: input string too long\n");
  return ret;
}


x86 assembly (clang, -O0):
<estrlcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strlcpy@plt>
mov    %rax,-0x20(%rbp)
cmp    -0x18(%rbp),%rax
jb     115f <estrlcpy+0x3f>
lea    0xea6(%rip),%rdi
call   1040 <eprintf@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<estrlcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
call   1030 <strlcpy@plt>
mov    %rax,%r14
cmp    %rbx,%rax
jb     1140 <estrlcpy+0x20>
lea    0xec5(%rip),%rdi
call   1040 <eprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [32 x i8] c"strlcpy: input string too long\0A\00"
define i64 @estrlcpy(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i64 @strlcpy(i8* %8, i8* %9, i64 %10)
store i64 %11, i64* %7
%12 = load i64, i64* %6
%13 = icmp uge i64 %11, %12
br i1 %13, label %14, label %16
14: ; preds = %3
%15 = call i32 @eprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %3
%17 = load i64, i64* %7
ret i64 %17
}

LLVM IR (-O2):
@.str = [32 x i8] c"strlcpy: input string too long\0A\00"
define i64 @estrlcpy(i8* %0, i8* %1, i64 %2) {
%4 = tail call i64 @strlcpy(i8* %0, i8* %1, i64 %2)
%5 = icmp ult i64 %4, %2
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @eprintf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %3
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void **);
void _gfortran_caf_deregister(void ***token, int *stat,
                              char *errmsg __attribute__((unused)),
                              int errmsg_len __attribute__((unused))) {
  free((*token)[0]);
  free(*token);
  if (stat)
    *stat = 0;
}


x86 assembly (clang, -O0):
<_gfortran_caf_deregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
cmpq   $0x0,-0x10(%rbp)
je     1157 <_gfortran_caf_deregister+0x47>
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_gfortran_caf_deregister>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    (%rdi),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
call   1030 <free@plt>
test   %r14,%r14
je     1139 <_gfortran_caf_deregister+0x29>
movl   $0x0,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @_gfortran_caf_deregister(i8*** %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i8***
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
store i8*** %0, i8**** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8***, i8**** %5
%10 = load i8**, i8*** %9
%11 = getelementptr inbounds i8*, i8** %10, i64 0
%12 = load i8*, i8** %11
%13 = bitcast i8* %12 to i8**
%14 = call i32 @free(i8** %13)
%15 = load i8***, i8**** %5
%16 = load i8**, i8*** %15
%17 = call i32 @free(i8** %16)
%18 = load i32*, i32** %6
%19 = icmp ne i32* %18, null
br i1 %19, label %20, label %22
20: ; preds = %4
%21 = load i32*, i32** %6
store i32 0, i32* %21
br label %22
22: ; preds = %20, %4
ret void
}

LLVM IR (-O2):
define void @_gfortran_caf_deregister(i8*** nocapture %0, i32* writeonly %1, i8* nocapture readnone %2, i32 %3) {
%5 = bitcast i8*** %0 to i8****
%6 = load i8***, i8**** %5
%7 = load i8**, i8*** %6
%8 = tail call i32 @free(i8** %7)
%9 = load i8**, i8*** %0
%10 = tail call i32 @free(i8** %9)
%11 = icmp eq i32* %1, null
br i1 %11, label %13, label %12
12: ; preds = %4
store i32 0, i32* %1
br label %13
13: ; preds = %12, %4
ret void
}
void mycpuid(int *p, unsigned int param, unsigned int ecx) {
  __asm__ __volatile__("cpuid\n\t"
                       : "=a"(p[0]), "=b"(p[1]), "=c"(p[2]), "=d"(p[3])
                       : "a"(param), "c"(ecx)
                       : "cc");
}


x86 assembly (clang, -O0):
<mycpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x10(%rbp),%r8
mov    -0x10(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<mycpuid>:
push   %rbx
mov    %edx,%ecx
mov    %esi,%eax
cpuid
mov    %eax,(%rdi)
mov    %ebx,0x4(%rdi)
mov    %ecx,0x8(%rdi)
mov    %edx,0xc(%rdi)
pop    %rbx
ret

LLVM IR (-O0):
define void @mycpuid(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 3
%15 = load i32, i32* %5
%16 = load i32, i32* %6
%17 = call { i32, i32, i32, i32 } asm sideeffect "cpuid\0A\09", "={ax},={bx},={cx},={dx},{ax},{cx},~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %15, i32 %16)
%18 = extractvalue { i32, i32, i32, i32 } %17, 0
%19 = extractvalue { i32, i32, i32, i32 } %17, 1
%20 = extractvalue { i32, i32, i32, i32 } %17, 2
%21 = extractvalue { i32, i32, i32, i32 } %17, 3
store i32 %18, i32* %8
store i32 %19, i32* %10
store i32 %20, i32* %12
store i32 %21, i32* %14
ret void
}

LLVM IR (-O2):
define void @mycpuid(i32* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = getelementptr inbounds i32, i32* %0, i64 3
%7 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid\0A\09", "={ax},={bx},={cx},={dx},{ax},{cx},~{cc},~{dirflag},~{fpsr},~{flags}"(i32 %1, i32 %2)
%8 = extractvalue { i32, i32, i32, i32 } %7, 0
%9 = extractvalue { i32, i32, i32, i32 } %7, 1
%10 = extractvalue { i32, i32, i32, i32 } %7, 2
%11 = extractvalue { i32, i32, i32, i32 } %7, 3
store i32 %8, i32* %0
store i32 %9, i32* %4
store i32 %10, i32* %5
store i32 %11, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, float, float);
void test7() {
  int px = (int)malloc(120);
  *(float *)px = 8.8f;
  *(float *)(px + 4) = 9.9f;
  printf("Testing read/write (float*): %g %g\n", *(float *)px,
         *(float *)(px + 4));
  free((void *)px);
}


x86 assembly (clang, -O0):
<test7>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x78,%edi
call   1050 <malloc@plt>
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movss  0xeb3(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
movss  0xe9b(%rip),%xmm0
movss  %xmm0,(%rax)
movslq -0x4(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x4(%rbp),%eax
add    $0x4,%eax
cltq
movss  (%rax),%xmm1
lea    0xe84(%rip),%rdi
call   1040 <printf@plt>
movslq -0x4(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test7>:
push   %rbx
mov    $0x78,%edi
call   1050 <malloc@plt>
movslq %eax,%rbx
movl   $0x410ccccd,(%rbx)
lea    0x4(%rbx),%eax
cltq
movl   $0x411e6666,(%rax)
movss  (%rbx),%xmm0
lea    0xeaa(%rip),%rdi
movss  0xe9e(%rip),%xmm1
call   1040 <printf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [36 x i8] c"Testing read/write (float*): %g %g\0A\00"
define void @test7() {
%1 = alloca i32
%2 = call i64 @malloc(i32 120)
%3 = trunc i64 %2 to i32
store i32 %3, i32* %1
%4 = load i32, i32* %1
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to float*
store float 0x40219999A0000000, float* %6
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 4
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to float*
store float 0x4023CCCCC0000000, float* %10
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to float*
%14 = load float, float* %13
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 4
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to float*
%19 = load float, float* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %14, float %19)
%21 = load i32, i32* %1
%22 = sext i32 %21 to i64
%23 = inttoptr i64 %22 to i8*
%24 = call i32 @free(i8* %23)
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"Testing read/write (float*): %g %g\0A\00"
define void @test7() {
%1 = tail call i64 @malloc(i32 120)
%2 = shl i64 %1, 32
%3 = ashr exact i64 %2, 32
%4 = inttoptr i64 %3 to float*
store float 0x40219999A0000000, float* %4
%5 = add i64 %2, 17179869184
%6 = ashr exact i64 %5, 32
%7 = inttoptr i64 %6 to float*
store float 0x4023CCCCC0000000, float* %7
%8 = load float, float* %4
%9 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), float %8, float 0x4023CCCCC0000000)
%10 = inttoptr i64 %3 to i8*
%11 = tail call i32 @free(i8* %10)
ret void
}
void rdu_dgrade_lock(struct rdu *p) {}


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

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

LLVM IR (-O0):
%struct.rdu = type opaque
define void @rdu_dgrade_lock(%struct.rdu* %0) {
%2 = alloca %struct.rdu*
store %struct.rdu* %0, %struct.rdu** %2
ret void
}

LLVM IR (-O2):
%struct.rdu = type opaque
define void @rdu_dgrade_lock(%struct.rdu* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
bool flash_get_bit(uint32_t flag, uint32_t bit) {
  return (flag & bit) ? false : true;
}


x86 assembly (clang, -O0):
<flash_get_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
and    -0x8(%rbp),%edx
mov    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flash_get_bit>:
xor    %eax,%eax
test   %edi,%esi
sete   %al
ret

LLVM IR (-O0):
define i32 @flash_get_bit(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = and i32 %5, %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i64
%10 = select i1 %8, i32 0, i32 1
ret i32 %10
}

LLVM IR (-O2):
define i32 @flash_get_bit(i32 %0, i32 %1) {
%3 = and i32 %1, %0
%4 = icmp eq i32 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit_with_int(int);
void __attribute__((noreturn))
exit_with_status_and_signal(int val, int signal) {
  if (signal == 0)
    val = val & 0xff;
  else {
    val = (128 + signal) & 0xff;
    signal = signal & 0xff;
  }
  exit_with_int((0xffff << 16) | (signal << 8) | val);
}


x86 assembly (clang, -O0):
<exit_with_status_and_signal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1138 <exit_with_status_and_signal+0x28>
mov    -0x4(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <exit_with_status_and_signal+0x43>
mov    -0x8(%rbp),%eax
add    $0x80,%eax
and    $0xff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
shl    $0x8,%edi
or     $0xffff0000,%edi
or     -0x4(%rbp),%edi
call   1030 <exit_with_int@plt>

x86 assembly (clang, -O2):
<exit_with_status_and_signal>:
push   %rax
lea    0x80(%rsi),%eax
mov    %esi,%ecx
shl    $0x8,%ecx
or     $0xffff0000,%ecx
test   %esi,%esi
cmove  %edi,%eax
mov    $0xffff0000,%edx
cmovne %ecx,%edx
movzbl %al,%edi
or     %edx,%edi
call   1030 <exit_with_int@plt>

LLVM IR (-O0):
define void @exit_with_status_and_signal(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %3
%9 = and i32 %8, 255
store i32 %9, i32* %3
br label %16
10: ; preds = %2
%11 = load i32, i32* %4
%12 = add nsw i32 128, %11
%13 = and i32 %12, 255
store i32 %13, i32* %3
%14 = load i32, i32* %4
%15 = and i32 %14, 255
store i32 %15, i32* %4
br label %16
16: ; preds = %10, %7
%17 = load i32, i32* %4
%18 = shl i32 %17, 8
%19 = or i32 -65536, %18
%20 = load i32, i32* %3
%21 = or i32 %19, %20
%22 = call i32 @exit_with_int(i32 %21)
unreachable
}

LLVM IR (-O2):
define void @exit_with_status_and_signal(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = add nsw i32 %1, 128
%5 = shl i32 %1, 8
%6 = or i32 %5, -65536
%7 = select i1 %3, i32 %0, i32 %4
%8 = select i1 %3, i32 -65536, i32 %6
%9 = and i32 %7, 255
%10 = or i32 %8, %9
%11 = tail call i32 @exit_with_int(i32 %10)
unreachable
}
double dp_neg(double a) { return -a; }


x86 assembly (clang, -O0):
<dp_neg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dp_neg>:
xorps  0xef9(%rip),%xmm0
ret

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

LLVM IR (-O2):
define double @dp_neg(double %0) {
%2 = fneg double %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ arg_uint3(unsigned int, unsigned int, unsigned int);
void arg_uint2(unsigned int a, unsigned int b) { arg_uint3(a, b, b + 1); }


x86 assembly (clang, -O0):
<arg_uint2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
call   1030 <arg_uint3@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<arg_uint2>:
lea    0x1(%rsi),%edx
jmp    1030 <arg_uint3@plt>

LLVM IR (-O0):
define void @arg_uint2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = load i32, i32* %4
%8 = add i32 %7, 1
%9 = call i32 @arg_uint3(i32 %5, i32 %6, i32 %8)
ret void
}

LLVM IR (-O2):
define void @arg_uint2(i32 %0, i32 %1) {
%3 = add i32 %1, 1
%4 = tail call i32 @arg_uint3(i32 %0, i32 %1, i32 %3)
ret void
}
char mksym_i8() { return 0; }


x86 assembly (clang, -O0):
<mksym_i8>:
push   %rbp
mov    %rsp,%rbp
xor    %eax,%eax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @mksym_i8() {
ret i8 0
}

LLVM IR (-O2):
define signext i8 @mksym_i8() {
ret i8 0
}
/* Variables and functions */
int sysfsparser_getvalue(char *);
int get_processor_number_kernel_max() {
  return sysfsparser_getvalue("/sys/devices/system"
                              "/cpu"
                              "/kernel_max") +
         1;
}


x86 assembly (clang, -O0):
<get_processor_number_kernel_max>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <sysfsparser_getvalue@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_processor_number_kernel_max>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <sysfsparser_getvalue@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"/sys/devices/system/cpu/kernel_max\00"
define i32 @get_processor_number_kernel_max() {
%1 = call i32 @sysfsparser_getvalue(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = add nsw i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
@.str = [35 x i8] c"/sys/devices/system/cpu/kernel_max\00"
define i32 @get_processor_number_kernel_max() {
%1 = tail call i32 @sysfsparser_getvalue(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = add nsw i32 %1, 1
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XTextItem16;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XTextItem16(void) {
  XTextItem16 *_p = (XTextItem16 *)malloc(sizeof(XTextItem16));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XTextItem16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XTextItem16+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XTextItem16>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XTextItem16+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @alloc_XTextItem16() {
%1 = alloca i32*
%2 = call i64 @malloc(i32 4)
%3 = inttoptr i64 %2 to i32*
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = icmp eq i32* %4, null
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = load i32*, i32** %1
%10 = bitcast i32* %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @alloc_XTextItem16() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
int icvAlign(int size, int align) { return (size + align - 1) & -align; }


x86 assembly (clang, -O0):
<icvAlign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
sub    $0x1,%eax
xor    %ecx,%ecx
sub    -0x8(%rbp),%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<icvAlign>:
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
neg    %esi
and    %esi,%eax
ret

LLVM IR (-O0):
define i32 @icvAlign(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
%8 = sub nsw i32 %7, 1
%9 = load i32, i32* %4
%10 = sub nsw i32 0, %9
%11 = and i32 %8, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @icvAlign(i32 %0, i32 %1) {
%3 = add i32 %0, -1
%4 = add i32 %3, %1
%5 = sub nsw i32 0, %1
%6 = and i32 %4, %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void show_usage() { fprintf(stderr, "usage: %s PROG [ARGS]\n", "ft_strace"); }


x86 assembly (clang, -O0):
<show_usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
lea    0xeec(%rip),%rdx
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
lea    0xef0(%rip),%rdx
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s PROG [ARGS]\0A\00"
@.str.1 = [10 x i8] c"ft_strace\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s PROG [ARGS]\0A\00"
@.str.1 = [10 x i8] c"ft_strace\00"
define void @show_usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
ret void
}
void sg_notification_msg_handler(void *msg, unsigned short msglen) {
  printf("got server group notification msg: %.*s\n\n", msglen, (char *)msg);
}


x86 assembly (clang, -O0):
<sg_notification_msg_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
movzwl -0xa(%rbp),%esi
mov    -0x8(%rbp),%rdx
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_notification_msg_handler>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [42 x i8] c"got server group notification msg: %.*s\0A\0A\00"
define void @sg_notification_msg_handler(i8* %0, i16 zeroext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = load i8*, i8** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %6, i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [42 x i8] c"got server group notification msg: %.*s\0A\0A\00"
define void @sg_notification_msg_handler(i8* %0, i16 zeroext %1) {
%3 = zext i16 %1 to i32
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ commit_creds(int /*<<< orphan*/);
int /*<<< orphan*/ prepare_kernel_cred(int /*<<< orphan*/);
int __attribute__((regparm(3))) getroot(void *head, void *table) {
  commit_creds(prepare_kernel_cred(0));
  return -1;
}


x86 assembly (clang, -O0):
<getroot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <prepare_kernel_cred@plt>
mov    %eax,%edi
call   1040 <commit_creds@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getroot>:
push   %rax
xor    %edi,%edi
call   1030 <prepare_kernel_cred@plt>
mov    %eax,%edi
call   1040 <commit_creds@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @getroot(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 @prepare_kernel_cred(i32 0)
%6 = call i32 @commit_creds(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
define i32 @getroot(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = tail call i32 @prepare_kernel_cred(i32 0)
%4 = tail call i32 @commit_creds(i32 %3)
ret i32 -1
}
/* Type definitions */
struct stream {
  int dummy;
};

/* Variables and functions */
int decode_long_address(unsigned char const *, struct stream *);
int decode_long_address_32bit_is0(const unsigned char *pkt,
                                  struct stream *stream) {
  return decode_long_address(pkt, stream);
}


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

x86 assembly (clang, -O2):
<decode_long_address_32bit_is0>:
jmp    1030 <decode_long_address@plt>

LLVM IR (-O0):
%struct.stream = type { i32 }
define i32 @decode_long_address_32bit_is0(i8* %0, %struct.stream* %1) {
%3 = alloca i8*
%4 = alloca %struct.stream*
store i8* %0, i8** %3
store %struct.stream* %1, %struct.stream** %4
%5 = load i8*, i8** %3
%6 = load %struct.stream*, %struct.stream** %4
%7 = call i32 @decode_long_address(i8* %5, %struct.stream* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.stream = type { i32 }
define i32 @decode_long_address_32bit_is0(i8* %0, %struct.stream* %1) {
%3 = tail call i32 @decode_long_address(i8* %0, %struct.stream* %1)
ret i32 %3
}