xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ print_error_msg(char *, char *, int, int);
void print_few_args(char *name, int given, int required) {
  print_error_msg("too few arguments for function '%s' (given %d, required "
                  "%d)!",
                  name, given, required);
}


x86 assembly (clang, -O0):
<print_few_args>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xecd(%rip),%rdi
call   1030 <print_error_msg@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_few_args>:
mov    %edx,%ecx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee2(%rip),%rdi
jmp    1030 <print_error_msg@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"too few arguments for function '%s' (given %d, required %d)!\00"
define void @print_few_args(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 @print_error_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"too few arguments for function '%s' (given %d, required %d)!\00"
define void @print_few_args(i8* %0, i32 %1, i32 %2) {
%4 = tail call i32 @print_error_msg(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2)
ret void
}
void loop_waypoint(void) {}


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

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

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

LLVM IR (-O2):
define void @loop_waypoint() {
ret void
}
int fun929() { return 929; }


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

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

LLVM IR (-O0):
define i32 @fun929() {
ret i32 929
}

LLVM IR (-O2):
define i32 @fun929() {
ret i32 929
}
void POLICYINFO_new(void) {}


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

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

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

LLVM IR (-O2):
define void @POLICYINFO_new() {
ret void
}
/* Variables and functions */
double sqrt(double);
double vlen(double x, double y, double z) {
  return sqrt(x * x + y * y + z * z);
}


x86 assembly (clang, -O0):
<vlen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vlen>:
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm2
jb     1136 <vlen+0x26>
xorps  %xmm0,%xmm0
sqrtsd %xmm2,%xmm0
ret
movapd %xmm2,%xmm0
jmp    1030 <sqrt@plt>

LLVM IR (-O0):
define double @vlen(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = call double @llvm.fmuladd.f64(double %7, double %8, double %11)
%13 = load double, double* %6
%14 = load double, double* %6
%15 = call double @llvm.fmuladd.f64(double %13, double %14, double %12)
%16 = call double @sqrt(double %15)
ret double %16
}

LLVM IR (-O2):
define double @vlen(double %0, double %1, double %2) {
%4 = fmul double %1, %1
%5 = tail call double @llvm.fmuladd.f64(double %0, double %0, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
%7 = tail call double @sqrt(double %6)
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float polegadas;
  scanf("%f", &polegadas);
  printf("%f", polegadas * 2.54);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeb5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fmul double %5, 2.540000e+00
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fpext float %4 to double
%6 = fmul double %5, 2.540000e+00
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}
/* Variables and functions */
double StringToNumberFromFile2(char *, char, char);
double StringToNumberFromFile(char *input) {
  return StringToNumberFromFile2(input, '.', ',');
}


x86 assembly (clang, -O0):
<StringToNumberFromFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2e,%esi
mov    $0x2c,%edx
call   1030 <StringToNumberFromFile2@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringToNumberFromFile>:
mov    $0x2e,%esi
mov    $0x2c,%edx
jmp    1030 <StringToNumberFromFile2@plt>

LLVM IR (-O0):
define double @StringToNumberFromFile(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call double @StringToNumberFromFile2(i8* %3, i8 signext 46, i8 signext 44)
ret double %4
}

LLVM IR (-O2):
define double @StringToNumberFromFile(i8* %0) {
%2 = tail call double @StringToNumberFromFile2(i8* %0, i8 signext 46, i8 signext 44)
ret double %2
}
int huff_class(int value) {
  value = value < 0 ? -value : value;
  int class = 0;
  while (value > 0) {
    value = value >> 1;
    class ++;
  }
  return class;
}


x86 assembly (clang, -O0):
<huff_class>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <huff_class+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <huff_class+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1152 <huff_class+0x52>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1131 <huff_class+0x31>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<huff_class>:
test   %edi,%edi
je     111d <huff_class+0x1d>
mov    %edi,%ecx
neg    %ecx
cmovs  %edi,%ecx
xor    %eax,%eax
mov    %ecx,%edx
nop
shr    %edx
add    $0x1,%eax
cmp    $0x1,%ecx
mov    %edx,%ecx
ja     1110 <huff_class+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @huff_class(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
br label %5
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ 0, %3 ]
%7 = phi i32 [ %8, %5 ], [ %4, %3 ]
%8 = lshr i32 %7, 1
%9 = add nuw nsw i32 %6, 1
%10 = icmp ult i32 %7, 2
br i1 %10, label %11, label %5
11: ; preds = %5, %1
%12 = phi i32 [ 0, %1 ], [ %9, %5 ]
ret i32 %12
}
void gpio_set_data_out(unsigned int port, unsigned int wide) {}


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

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

LLVM IR (-O0):
define void @gpio_set_data_out(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
define void @gpio_set_data_out(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int /*<<< orphan*/ sem_wait(int /*<<< orphan*/ *);
void FF_PendSemaphore(void *pSemaphore) {
  sem_t *pSem = (sem_t *)pSemaphore;
  sem_wait(pSem);
}


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

x86 assembly (clang, -O2):
<FF_PendSemaphore>:
jmp    1030 <sem_wait@plt>

LLVM IR (-O0):
define void @FF_PendSemaphore(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = call i32 @sem_wait(i32* %6)
ret void
}

LLVM IR (-O2):
define void @FF_PendSemaphore(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @sem_wait(i32* %2)
ret void
}
/* Variables and functions */
char *copy_string(char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *gen_random_field_name(int n) {
  char namebuf[100];
  sprintf(namebuf, "field%d", n);
  return copy_string(namebuf);
}


x86 assembly (clang, -O0):
<gen_random_field_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xec7(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <copy_string@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_random_field_name>:
push   %rbx
sub    $0x70,%rsp
mov    %edi,%edx
lea    0xed2(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <copy_string@plt>
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"field%d\00"
define i8* @gen_random_field_name(i32 %0) {
%2 = alloca i32
%3 = alloca [100 x i8]
store i32 %0, i32* %2
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%5 = load i32, i32* %2
%6 = call i32 @sprintf(i8* %4, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%8 = call i8* @copy_string(i8* %7)
ret i8* %8
}

LLVM IR (-O2):
@.str = [8 x i8] c"field%d\00"
define i8* @gen_random_field_name(i32 %0) {
%2 = alloca [100 x i8]
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%4 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = call i8* @copy_string(i8* %3)
ret i8* %5
}
/* Variables and functions */
char *getenv(char *);
char *getloginname() { return getenv("USER"); }


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

x86 assembly (clang, -O2):
<getloginname>:
lea    0xee9(%rip),%rdi
jmp    1030 <getenv@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"USER\00"
define i8* @getloginname() {
%1 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}

LLVM IR (-O2):
@.str = [5 x i8] c"USER\00"
define i8* @getloginname() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %1
}
/* Variables and functions */
int move(int, int);
int con_gotoXY(int x, int y) { return move(y, x); }


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

x86 assembly (clang, -O2):
<con_gotoXY>:
mov    %edi,%eax
mov    %esi,%edi
mov    %eax,%esi
jmp    1030 <move@plt>

LLVM IR (-O0):
define i32 @con_gotoXY(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 = load i32, i32* %3
%7 = call i32 @move(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @con_gotoXY(i32 %0, i32 %1) {
%3 = tail call i32 @move(i32 %1, i32 %0)
ret i32 %3
}
/* Variables and functions */
float powf(float, float);
float smn2fv(float note, float root) { return root * powf(2.0f, note); }


x86 assembly (clang, -O0):
<smn2fv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  0xec7(%rip),%xmm0
call   1030 <powf@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
mulss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smn2fv>:
push   %rax
movss  %xmm1,0x4(%rsp)
call   1030 <exp2f@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @smn2fv(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %4
%6 = load float, float* %3
%7 = call float @powf(float 2.000000e+00, float %6)
%8 = fmul float %5, %7
ret float %8
}

LLVM IR (-O2):
define float @smn2fv(float %0, float %1) {
%3 = tail call float @exp2f(float %0)
%4 = fmul float %3, %1
ret float %4
}
/* Variables and functions */
double log2(int);
double log_bino_d(int a, int b) {
  if (b == 0)
    return 0;
  return log_bino_d(a, b - 1) + log2(a - b + 1) - log2(b);
}


x86 assembly (clang, -O0):
<log_bino_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jne    1145 <log_bino_d+0x25>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1190 <log_bino_d+0x70>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1040 <log_bino_d@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0xc(%rbp),%edi
sub    -0x10(%rbp),%edi
add    $0x1,%edi
call   1030 <log2@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%edi
call   1030 <log2@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_bino_d>:
test   %esi,%esi
je     1169 <log_bino_d+0x49>
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    -0x1(%rbx),%esi
call   1040 <log_bino_d@plt>
movsd  %xmm0,(%rsp)
sub    %ebx,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1030 <log2@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <log2@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @log_bino_d(i32 %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store double 0.000000e+00, double* %3
br label %23
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = call double @log_bino_d(i32 %10, i32 %12)
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = sub nsw i32 %14, %15
%17 = add nsw i32 %16, 1
%18 = call double @log2(i32 %17)
%19 = fadd double %13, %18
%20 = load i32, i32* %5
%21 = call double @log2(i32 %20)
%22 = fsub double %19, %21
store double %22, double* %3
br label %23
23: ; preds = %9, %8
%24 = load double, double* %3
ret double %24
}

LLVM IR (-O2):
define double @log_bino_d(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2, %6
%5 = phi double [ %14, %6 ], [ 0.000000e+00, %2 ]
ret double %5
6: ; preds = %2
%7 = add nsw i32 %1, -1
%8 = tail call double @log_bino_d(i32 %0, i32 %7)
%9 = add i32 %0, 1
%10 = sub i32 %9, %1
%11 = tail call double @log2(i32 %10)
%12 = fadd double %8, %11
%13 = tail call double @log2(i32 %1)
%14 = fsub double %12, %13
br label %4
}
void gtk_event_box_set_visible_window() {}


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

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

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

LLVM IR (-O2):
define void @gtk_event_box_set_visible_window() {
ret void
}
int xmlUCSIsGeneralPunctuation(int code) {
  return (((code >= 0x2000) && (code <= 0x206F)));
}


x86 assembly (clang, -O0):
<xmlUCSIsGeneralPunctuation>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x2000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1126 <xmlUCSIsGeneralPunctuation+0x26>
cmpl   $0x206f,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmlUCSIsGeneralPunctuation>:
add    $0xffffe000,%edi
xor    %eax,%eax
cmp    $0x70,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @xmlUCSIsGeneralPunctuation(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 8192
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp sle i32 %6, 8303
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ false, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @xmlUCSIsGeneralPunctuation(i32 %0) {
%2 = add i32 %0, -8192
%3 = icmp ult i32 %2, 112
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int fptr_capi20_put_message(unsigned int, unsigned char *);
scalar_t__ loadlib();
unsigned capi20_put_message(unsigned ApplID, unsigned char *Msg) {
  if (loadlib() < 0)
    return 0x1009;
  return fptr_capi20_put_message(ApplID, Msg);
}


x86 assembly (clang, -O0):
<capi20_put_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <loadlib@plt>
cmp    $0x0,%rax
jge    114c <capi20_put_message+0x2c>
movl   $0x1009,-0x4(%rbp)
jmp    115b <capi20_put_message+0x3b>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <fptr_capi20_put_message@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<capi20_put_message>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <loadlib@plt>
test   %rax,%rax
js     1144 <capi20_put_message+0x24>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <fptr_capi20_put_message@plt>
mov    $0x1009,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @capi20_put_message(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = call i64 (...) @loadlib()
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 4105, i32* %3
br label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = load i8*, i8** %5
%12 = call i32 @fptr_capi20_put_message(i32 %10, i8* %11)
store i32 %12, i32* %3
br label %13
13: ; preds = %9, %8
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
define i32 @capi20_put_message(i32 %0, i8* %1) {
%3 = tail call i64 (...) @loadlib()
%4 = icmp slt i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @fptr_capi20_put_message(i32 %0, i8* %1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 4105, %2 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
void *dlopen(char const *, int /*<<< orphan*/);
void *dlopen_simple(const char *name) { return dlopen(name, RTLD_LAZY); }


x86 assembly (clang, -O0):
<dlopen_simple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
call   1030 <dlopen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlopen_simple>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%esi
jmp    1030 <dlopen@plt>

LLVM IR (-O0):
@RTLD_LAZY = global i32 0
define i8* @dlopen_simple(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @RTLD_LAZY
%5 = call i8* @dlopen(i8* %3, i32 %4)
ret i8* %5
}

LLVM IR (-O2):
@RTLD_LAZY = global i32 0
define i8* @dlopen_simple(i8* %0) {
%2 = load i32, i32* @RTLD_LAZY
%3 = tail call i8* @dlopen(i8* %0, i32 %2)
ret i8* %3
}
/* Type definitions */
typedef unsigned long __u32;

/* Variables and functions */
unsigned int tipc_node(__u32 addr) { return addr & (((1UL << 12) - 1) << 0); }


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

x86 assembly (clang, -O2):
<tipc_node>:
mov    %rdi,%rax
and    $0xfff,%eax
ret

LLVM IR (-O0):
define i32 @tipc_node(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 4095
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @tipc_node(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 4095
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *, int *, char *);
void readInts(int *a, int *b, int *c, char *letter) {
  printf("\nEnter 3 numbers and A or D for ascending or descending:\n > ");
  scanf("%d %d %d %c", a, b, c, letter);
}


x86 assembly (clang, -O0):
<readInts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xee2(%rip),%rdi
call   1040 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readInts>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"\0AEnter 3 numbers and A or D for ascending or descending:\0A > \00"
@.str.1 = [12 x i8] c"%d %d %d %c\00"
define void @readInts(i32* %0, i32* %1, i32* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i8*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i8* %3, i8** %8
%9 = call i32 @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %5
%11 = load i32*, i32** %6
%12 = load i32*, i32** %7
%13 = load i8*, i8** %8
%14 = call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %10, i32* %11, i32* %12, i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [61 x i8] c"\0AEnter 3 numbers and A or D for ascending or descending:\0A > \00"
@.str.1 = [12 x i8] c"%d %d %d %c\00"
define void @readInts(i32* %0, i32* %1, i32* %2, i8* %3) {
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @scanf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %0, i32* %1, i32* %2, i8* %3)
ret void
}
/* Variables and functions */
double pow(float, int);
int /*<<< orphan*/ printf(char *, float);
void volumenCilindro(float r, float h) {
  float v;
  v = 3.1416 * h * pow(r, 2);
  printf("El volumen es: %.4f \n", v);
}


x86 assembly (clang, -O0):
<volumenCilindro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xebd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
lea    0xe8c(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<volumenCilindro>:
push   %rax
cvtss2sd %xmm1,%xmm1
mulsd  0xed3(%rip),%xmm1
movsd  %xmm1,(%rsp)
mov    $0x2,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xebc(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"El volumen es: %.4f \0A\00"
define void @volumenCilindro(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %3
store float %1, float* %4
%6 = load float, float* %4
%7 = fpext float %6 to double
%8 = fmul double 3.141600e+00, %7
%9 = load float, float* %3
%10 = call double @pow(float %9, i32 2)
%11 = fmul double %8, %10
%12 = fptrunc double %11 to float
store float %12, float* %5
%13 = load float, float* %5
%14 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %13)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"El volumen es: %.4f \0A\00"
define void @volumenCilindro(float %0, float %1) {
%3 = fpext float %1 to double
%4 = fmul double %3, 3.141600e+00
%5 = tail call double @pow(float %0, i32 2)
%6 = fmul double %4, %5
%7 = fptrunc double %6 to float
%8 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), float %7)
ret void
}
void Copy(char to[], char from[]) {
  int i;
  i = 0;
  while ((to[i] = from[i]) != '\0') {
    ++i;
  }
}


x86 assembly (clang, -O0):
<Copy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0x8(%rbp),%rcx
movslq -0x14(%rbp),%rdx
mov    %al,(%rcx,%rdx,1)
movsbl %al,%eax
cmp    $0x0,%eax
je     1143 <Copy+0x43>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1113 <Copy+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Copy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rax,1),%ecx
mov    %cl,(%rdi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <Copy+0x10>
ret

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

LLVM IR (-O2):
define void @Copy(i8* nocapture writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %9, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* %1, i64 %4
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 %4
store i8 %6, i8* %7
%8 = icmp eq i8 %6, 0
%9 = add nuw i64 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ atoi(char *);
int dup2(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
void cmd_dup2(int argc, char *argv[]) {
  if (dup2(atoi(argv[1]), atoi(argv[2])) == -1)
    perror("dup2");
}


x86 assembly (clang, -O0):
<cmd_dup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atoi@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    117b <cmd_dup2+0x4b>
lea    0xe8a(%rip),%rdi
call   1040 <perror@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_dup2>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
je     115f <cmd_dup2+0x2f>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe9a(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <perror@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"dup2\00"
define void @cmd_dup2(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i8**, i8*** %4
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @atoi(i8* %7)
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 2
%11 = load i8*, i8** %10
%12 = call i32 @atoi(i8* %11)
%13 = call i32 @dup2(i32 %8, i32 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %2
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"dup2\00"
define void @cmd_dup2(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = getelementptr inbounds i8*, i8** %1, i64 2
%7 = load i8*, i8** %6
%8 = tail call i32 @atoi(i8* %7)
%9 = tail call i32 @dup2(i32 %5, i32 %8)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %2
ret void
}
char *strerror(int errno) {
  extern int sys_nerr;
  extern char *sys_errlist[];
  if ((0 <= errno) && (errno < sys_nerr))
    return sys_errlist[errno];
  else
    return ("unknown errno");
}


x86 assembly (clang, -O0):
<strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
xor    %eax,%eax
cmp    -0xc(%rbp),%eax
jg     113c <strerror+0x3c>
mov    -0xc(%rbp),%eax
mov    0x2ecc(%rip),%rcx
cmp    (%rcx),%eax
jge    113c <strerror+0x3c>
movslq -0xc(%rbp),%rcx
mov    0x2ec9(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x8(%rbp)
jmp    1147 <strerror+0x47>
lea    0xebd(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strerror>:
lea    0xef9(%rip),%rax
test   %edi,%edi
js     1123 <strerror+0x23>
mov    0x2ed6(%rip),%rcx
cmp    %edi,(%rcx)
jle    1123 <strerror+0x23>
mov    %edi,%eax
mov    0x2ed9(%rip),%rcx
mov    (%rcx,%rax,8),%rax
ret

LLVM IR (-O0):
@sys_nerr = external global i32
@sys_errlist = external global [0 x i8*]
@.str = [14 x i8] c"unknown errno\00"
define i8* @strerror(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 0, %4
br i1 %5, label %6, label %15
6: ; preds = %1
%7 = load i32, i32* %3
%8 = load i32, i32* @sys_nerr
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %12
%14 = load i8*, i8** %13
store i8* %14, i8** %2
br label %16
15: ; preds = %6, %1
store i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8** %2
br label %16
16: ; preds = %15, %10
%17 = load i8*, i8** %2
ret i8* %17
}

LLVM IR (-O2):
@sys_nerr = external global i32
@sys_errlist = external global [0 x i8*]
@.str = [14 x i8] c"unknown errno\00"
define i8* @strerror(i32 %0) {
%2 = icmp sgt i32 %0, -1
%3 = load i32, i32* @sys_nerr
%4 = icmp sgt i32 %3, %0
%5 = select i1 %2, i1 %4, i1 false
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = zext i32 %0 to i64
%8 = getelementptr inbounds [0 x i8*], [0 x i8*]* @sys_errlist, i64 0, i64 %7
%9 = load i8*, i8** %8
br label %10
10: ; preds = %1, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %11
}
char *GetMemory(void) {
  char *p = "hello world";
  return p;
}


x86 assembly (clang, -O0):
<GetMemory>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetMemory>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [12 x i8] c"hello world\00"
define i8* @GetMemory() {
%1 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [12 x i8] c"hello world\00"
define i8* @GetMemory() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
int compare_int(void const *a, void const *b) {
  return *((int *)a) - *((int *)b);
}


x86 assembly (clang, -O0):
<compare_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_int>:
mov    (%rdi),%eax
sub    (%rsi),%eax
ret

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

LLVM IR (-O2):
define i32 @compare_int(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = sub nsw i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int msim_existsSouthWall(unsigned int, unsigned int);
int msim_existsNorthWall(unsigned int x, unsigned int y) {
  return msim_existsSouthWall(x, y + 1);
}


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

x86 assembly (clang, -O2):
<msim_existsNorthWall>:
add    $0x1,%esi
jmp    1030 <msim_existsSouthWall@plt>

LLVM IR (-O0):
define i32 @msim_existsNorthWall(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 i32 %6, 1
%8 = call i32 @msim_existsSouthWall(i32 %5, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @msim_existsNorthWall(i32 %0, i32 %1) {
%3 = add i32 %1, 1
%4 = tail call i32 @msim_existsSouthWall(i32 %0, i32 %3)
ret i32 %4
}
/* Variables and functions */
int getCharacterName(unsigned char character, char *buffer, size_t size) {
  return 0;
}


x86 assembly (clang, -O0):
<getCharacterName>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @getCharacterName(i8 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i8
%5 = alloca i8*
%6 = alloca i64
store i8 %0, i8* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @getCharacterName(i8 zeroext %0, i8* nocapture readnone %1, i64 %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mill_choose_init(char *);
int mill_choose_wait();
__attribute__((no)) void unused(void) {
  {
    mill_choose_init("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                     "outputs/2022-01-22/02-19-57/repos/ebfe/libmill/refs/"
                     "heads/master/tests/choose.c"
                     ":"
                     "109");
    int mill_idx = -2;
    while (1) {
      if (mill_idx != -2) {
        if (0) {
          break;
        }
      }
      mill_idx = mill_choose_wait();
    }
  }
}


x86 assembly (clang, -O0):
<unused>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <mill_choose_init@plt>
movl   $0xfffffffe,-0x4(%rbp)
cmpl   $0xfffffffe,-0x4(%rbp)
je     114a <unused+0x2a>
jmp    114a <unused+0x2a>
mov    $0x0,%al
call   1030 <mill_choose_wait@plt>
mov    %eax,-0x4(%rbp)
jmp    113b <unused+0x1b>

x86 assembly (clang, -O2):
<unused>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <mill_choose_init@plt>
nopl   (%rax)
xor    %eax,%eax
call   1030 <mill_choose_wait@plt>
jmp    1130 <unused+0x10>

LLVM IR (-O0):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ebfe/libmill/refs/heads/master/tests/choose.c:109\00"
define void @unused() {
%1 = alloca i32
%2 = call i32 @mill_choose_init(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0))
store i32 -2, i32* %1
br label %3
3: ; preds = %0, %7
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, -2
br i1 %5, label %6, label %7
6: ; preds = %3
br label %7
7: ; preds = %6, %3
%8 = call i32 (...) @mill_choose_wait()
store i32 %8, i32* %1
br label %3
}

LLVM IR (-O2):
@.str = [140 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ebfe/libmill/refs/heads/master/tests/choose.c:109\00"
define void @unused() {
%1 = tail call i32 @mill_choose_init(i8* getelementptr inbounds ([140 x i8], [140 x i8]* @.str, i64 0, i64 0))
br label %2
2: ; preds = %2, %0
%3 = tail call i32 (...) @mill_choose_wait()
br label %2
}
void toggle_event_status(int allow_event_handling) {}


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

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

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

LLVM IR (-O2):
define void @toggle_event_status(i32 %0) {
ret void
}
void triggerPendSVC() {
  *(volatile unsigned char *)(0xE000ED22) = 0x000000FF;
  *(volatile unsigned long *)(0xE000ED04) = 0x10000000;
}


x86 assembly (clang, -O0):
<triggerPendSVC>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe000ed22,%eax
movb   $0xff,(%rax)
mov    $0xe000ed04,%eax
movq   $0x10000000,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<triggerPendSVC>:
mov    $0xe000ed04,%eax
movb   $0xff,0x1e(%rax)
movq   $0x10000000,(%rax)
ret

LLVM IR (-O0):
define void @triggerPendSVC() {
store volatile i8 -1, i8* inttoptr (i64 3758157090 to i8*)
store volatile i64 268435456, i64* inttoptr (i64 3758157060 to i64*)
ret void
}

LLVM IR (-O2):
define void @triggerPendSVC() {
store volatile i8 -1, i8* inttoptr (i64 3758157090 to i8*)
store volatile i64 268435456, i64* inttoptr (i64 3758157060 to i64*)
ret void
}
int check_prime(int num) {
  int i;
  for (i = 2; i < num; i++) {
    if (num % i == 0 || num == 1) {
      num = -1;
      goto end;
    }
  }
end:
  return num;
}


x86 assembly (clang, -O0):
<check_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1153 <check_prime+0x53>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
cmp    $0x0,%edx
je     1134 <check_prime+0x34>
cmpl   $0x1,-0x4(%rbp)
jne    1140 <check_prime+0x40>
movl   $0xffffffff,-0x4(%rbp)
jmp    1158 <check_prime+0x58>
jmp    1145 <check_prime+0x45>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <check_prime+0xe>
jmp    1158 <check_prime+0x58>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_prime>:
cmp    $0x3,%edi
jl     1120 <check_prime+0x20>
mov    $0x2,%ecx
nopw   0x0(%rax,%rax,1)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1123 <check_prime+0x23>
add    $0x1,%ecx
cmp    %ecx,%edi
jne    1110 <check_prime+0x10>
mov    %edi,%eax
ret
mov    $0xffffffff,%edi
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @check_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %3, %5, %1
%11 = phi i32 [ %0, %1 ], [ -1, %5 ], [ %0, %3 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int MEM_SIZE = 10 * 1024 * 1024;
  int DURATION = 60 * 1000 * 1000;
  int DELAY_OPS = 1;
  int count = 0;
  int *mem = (int *)malloc(sizeof(int) * MEM_SIZE);
  int elapsed = 0;
  int tmp = 0;
  while (1) {
    int read_addr = count % MEM_SIZE;
    tmp += mem[read_addr];
    elapsed += DELAY_OPS;
    count += 16;
  }
  printf("Sum is %d\n", tmp);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xa00000,-0x14(%rbp)
movl   $0x3938700,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x20(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x34(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
add    -0x30(%rbp),%eax
mov    %eax,-0x40(%rbp)
mov    %eax,-0x30(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x2c(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%eax
add    $0x10,%eax
mov    %eax,-0x38(%rbp)
mov    %eax,-0x20(%rbp)
jmp    1163 <main+0x53>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2800000,%edi
call   1030 <malloc@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 10485760, i32* %6
store i32 60000000, i32* %7
store i32 1, i32* %8
store i32 0, i32* %9
%14 = load i32, i32* %6
%15 = sext i32 %14 to i64
%16 = mul i64 4, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i32*
store i32* %19, i32** %10
store i32 0, i32* %11
store i32 0, i32* %12
br label %20
20: ; preds = %2, %20
%21 = load i32, i32* %9
%22 = load i32, i32* %6
%23 = srem i32 %21, %22
store i32 %23, i32* %13
%24 = load i32*, i32** %10
%25 = load i32, i32* %13
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32, i32* %24, i64 %26
%28 = load i32, i32* %27
%29 = load i32, i32* %12
%30 = add nsw i32 %29, %28
store i32 %30, i32* %12
%31 = load i32, i32* %8
%32 = load i32, i32* %11
%33 = add nsw i32 %32, %31
store i32 %33, i32* %11
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 16
store i32 %35, i32* %9
br label %20
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i64 @malloc(i32 41943040)
br label %4
4: ; preds = %4, %2
br label %4
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_str(int /*<<< orphan*/);
int /*<<< orphan*/ t16_memio_imm5_op(int);
void t16_str_imm5() { arm_memio_str(t16_memio_imm5_op(4)); }


x86 assembly (clang, -O0):
<t16_str_imm5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4,%edi
call   1030 <t16_memio_imm5_op@plt>
mov    %eax,%edi
call   1040 <arm_memio_str@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_str_imm5>:
push   %rax
mov    $0x4,%edi
call   1030 <t16_memio_imm5_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <arm_memio_str@plt>

LLVM IR (-O0):
define void @t16_str_imm5() {
%1 = call i32 @t16_memio_imm5_op(i32 4)
%2 = call i32 @arm_memio_str(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_str_imm5() {
%1 = tail call i32 @t16_memio_imm5_op(i32 4)
%2 = tail call i32 @arm_memio_str(i32 %1)
ret void
}
/* Variables and functions */
double floor(float);
float fixAngle(float angle) { return angle - floor(angle / 360.0) * 360.0; }


x86 assembly (clang, -O0):
<fixAngle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec4(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1030 <floor@plt>
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe93(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fixAngle>:
push   %rax
cvtss2sd %xmm0,%xmm1
movsd  %xmm1,(%rsp)
divss  0xede(%rip),%xmm0
call   1030 <floor@plt>
mulsd  0xed9(%rip),%xmm0
addsd  (%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fixAngle(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = load float, float* %2
%6 = fpext float %5 to double
%7 = fdiv double %6, 3.600000e+02
%8 = fptrunc double %7 to float
%9 = call double @floor(float %8)
%10 = fneg double %9
%11 = call double @llvm.fmuladd.f64(double %10, double 3.600000e+02, double %4)
%12 = fptrunc double %11 to float
ret float %12
}

LLVM IR (-O2):
define float @fixAngle(float %0) {
%2 = fpext float %0 to double
%3 = fdiv float %0, 3.600000e+02
%4 = tail call double @floor(float %3)
%5 = fneg double %4
%6 = tail call double @llvm.fmuladd.f64(double %5, double 3.600000e+02, double %2)
%7 = fptrunc double %6 to float
ret float %7
}
int fun2(int a, int b) { return a + b; }


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

x86 assembly (clang, -O2):
<fun2>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define i32 @fun2(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
ret i32 %7
}

LLVM IR (-O2):
define i32 @fun2(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}