xunge/DecIR huggingface dataset:
double pow10(double x) {
  double i;
  double num;
  i = 0;
  num = 1;
  while (i < x) {
    num *= 10;
    i++;
  }
  return (num);
}


x86 assembly (clang, -O0):
<pow10>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee7(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    115b <pow10+0x5b>
movsd  0xece(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeb4(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    111e <pow10+0x1e>
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pow10>:
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jbe    1133 <pow10+0x33>
movsd  0xeee(%rip),%xmm3
movsd  0xeee(%rip),%xmm4
movapd %xmm3,%xmm1
xchg   %ax,%ax
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm2
ucomisd %xmm2,%xmm0
ja     1120 <pow10+0x20>
movapd %xmm1,%xmm0
ret
movsd  0xec5(%rip),%xmm0
ret

LLVM IR (-O0):
define double @pow10(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
store double %0, double* %2
store double 0.000000e+00, double* %3
store double 1.000000e+00, double* %4
br label %5
5: ; preds = %9, %1
%6 = load double, double* %3
%7 = load double, double* %2
%8 = fcmp olt double %6, %7
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load double, double* %4
%11 = fmul double %10, 1.000000e+01
store double %11, double* %4
%12 = load double, double* %3
%13 = fadd double %12, 1.000000e+00
store double %13, double* %3
br label %5
14: ; preds = %5
%15 = load double, double* %4
ret double %15
}

LLVM IR (-O2):
define double @pow10(double %0) {
%2 = fcmp ogt double %0, 0.000000e+00
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi double [ %6, %3 ], [ 1.000000e+00, %1 ]
%5 = phi double [ %7, %3 ], [ 0.000000e+00, %1 ]
%6 = fmul double %4, 1.000000e+01
%7 = fadd double %5, 1.000000e+00
%8 = fcmp olt double %7, %0
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi double [ 1.000000e+00, %1 ], [ %6, %3 ]
ret double %10
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_greetings(void) { printf("Hello from UNPATCHED shared library\n"); }


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

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

LLVM IR (-O0):
@.str = [37 x i8] c"Hello from UNPATCHED shared library\0A\00"
define void @print_greetings() {
%1 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [36 x i8] c"Hello from UNPATCHED shared library\00"
define void @print_greetings() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main() {
  double a;
  a = 1.2435;
  printf("%f\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.243500e+00)
ret i32 0
}
void g_scanner_error() {}


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

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

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

LLVM IR (-O2):
define void @g_scanner_error() {
ret void
}
int main(void) {
  int x;
  int y;
  int z;
  printf("\n  &x:0x%x\n", &x);
  printf("\n  &y:0x%x\n", &y);
  printf("\n  &z:0x%x\n", &z);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xee5(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xede(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [12 x i8] c"\0A &x:0x%x\0A\00"
@.str.1 = [12 x i8] c"\0A &y:0x%x\0A\00"
@.str.2 = [12 x i8] c"\0A &z:0x%x\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32* %3)
ret i32 0
}
/* Variables and functions */
int syscall(int, int);
int epoll_create1(int flags) { return syscall(329, flags); }


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

x86 assembly (clang, -O2):
<epoll_create1>:
mov    %edi,%esi
mov    $0x149,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @epoll_create1(i32 %0) {
%2 = tail call i32 @syscall(i32 329, i32 %0)
ret i32 %2
}
int __sys_flen(int handle) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__sys_flen(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_js_fragment_create() { exit(1); }


x86 assembly (clang, -O0):
<caml_js_fragment_create>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<caml_js_fragment_create>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @caml_js_fragment_create() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_js_fragment_create() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ drawHex(unsigned int, int, int);
int /*<<< orphan*/ drawString(char *, int, int);
int strlen(char *);
void drawStringHex(char *str, unsigned val, int x, int y) {
  drawString(str, x, y);
  drawHex(val, x + strlen(str) * (8), y);
}


x86 assembly (clang, -O0):
<drawStringHex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1050 <drawString@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edi
shl    $0x3,%eax
add    %eax,%esi
mov    -0x14(%rbp),%edx
call   1030 <drawHex@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawStringHex>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %edx,%ebx
mov    %esi,%r14d
mov    %rdi,%rbp
mov    %edx,%esi
mov    %ecx,%edx
call   1050 <drawString@plt>
mov    %rbp,%rdi
call   1040 <strlen@plt>
lea    (%rbx,%rax,8),%esi
mov    %r14d,%edi
mov    %r15d,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <drawHex@plt>

LLVM IR (-O0):
define void @drawStringHex(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i32, i32* %7
%11 = load i32, i32* %8
%12 = call i32 @drawString(i8* %9, i32 %10, i32 %11)
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i8*, i8** %5
%16 = call i32 @strlen(i8* %15)
%17 = mul nsw i32 %16, 8
%18 = add nsw i32 %14, %17
%19 = load i32, i32* %8
%20 = call i32 @drawHex(i32 %13, i32 %18, i32 %19)
ret void
}

LLVM IR (-O2):
define void @drawStringHex(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @drawString(i8* %0, i32 %2, i32 %3)
%6 = tail call i32 @strlen(i8* %0)
%7 = shl nsw i32 %6, 3
%8 = add nsw i32 %7, %2
%9 = tail call i32 @drawHex(i32 %1, i32 %8, i32 %3)
ret void
}
unsigned int X(unsigned long n1, unsigned long n2, unsigned long n3) {
  return n1 ^ n2 ^ n3;
}


x86 assembly (clang, -O0):
<X>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
xor    -0x10(%rbp),%rax
xor    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<X>:
mov    %rdx,%rax
xor    %edi,%esi
xor    %esi,%eax
ret

LLVM IR (-O0):
define i32 @X(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = xor i64 %7, %8
%10 = load i64, i64* %6
%11 = xor i64 %9, %10
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @X(i64 %0, i64 %1, i64 %2) {
%4 = xor i64 %1, %0
%5 = xor i64 %4, %2
%6 = trunc i64 %5 to i32
ret i32 %6
}
int g(void) {
  int array[10] = {1, 2, 3, 4, 5};
  return array[sizeof(int)];
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movl   $0x1,-0x30(%rbp)
movl   $0x2,-0x2c(%rbp)
movl   $0x3,-0x28(%rbp)
movl   $0x4,-0x24(%rbp)
movl   $0x5,-0x20(%rbp)
mov    -0x20(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @g() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = bitcast i8* %2 to [10 x i32]*
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 0
store i32 1, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 1
store i32 2, i32* %5
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 2
store i32 3, i32* %6
%7 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 3
store i32 4, i32* %7
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i32 0, i32 4
store i32 5, i32* %8
%9 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @g() {
ret i32 5
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int sweep_get_quaddobl_start(int n, double *c) {
  int fail, ptos[2];
  ptos[0] = 2;
  ptos[1] = 0;
  fail = _ada_use_c2phc4c(619, ptos, &n, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<sweep_get_quaddobl_start>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x2,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
lea    -0x1c(%rbp),%rsi
mov    -0x10(%rbp),%rcx
mov    $0x26b,%edi
lea    -0x4(%rbp),%rdx
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sweep_get_quaddobl_start>:
sub    $0x18,%rsp
mov    %rsi,%rcx
mov    %edi,0xc(%rsp)
movq   $0x2,0x10(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    $0x26b,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @sweep_get_quaddobl_start(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca [2 x i32]
store i32 %0, i32* %3
store double* %1, double** %4
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
store i32 2, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
store i32 0, i32* %8
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%10 = load double*, double** %4
%11 = call i32 @_ada_use_c2phc4c(i32 619, i32* %9, i32* %3, double* %10, i32 0)
store i32 %11, i32* %5
%12 = load i32, i32* %5
ret i32 %12
}

LLVM IR (-O2):
define i32 @sweep_get_quaddobl_start(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca [2 x i32]
store i32 %0, i32* %3
%5 = bitcast [2 x i32]* %4 to i8*
%6 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
store i32 2, i32* %6
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
store i32 0, i32* %7
%8 = call i32 @_ada_use_c2phc4c(i32 619, i32* %6, i32* %3, double* %1, i32 0)
ret i32 %8
}
void XChangeSaveSet() {}


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

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

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

LLVM IR (-O2):
define void @XChangeSaveSet() {
ret void
}
double val(void) { return 1.42; }


x86 assembly (clang, -O0):
<val>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<val>:
movsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @val() {
ret double 1.420000e+00
}

LLVM IR (-O2):
define double @val() {
ret double 1.420000e+00
}
void sane_BACKEND_NAME_exit(void) { sane_BACKEND_NAME_exit(); }


x86 assembly (clang, -O0):
<sane_BACKEND_NAME_exit>:
push   %rbp
mov    %rsp,%rbp
call   1030 <sane_BACKEND_NAME_exit@plt>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @sane_BACKEND_NAME_exit() {
br label %1
1: ; preds = %1, %0
br label %1
}
int layer_table_base_3(int layer) {
  switch (layer) {
  case 1:
    return 0x100;
  case 2:
    return 0x120;
  case 3:
    return 0x140;
  }
  return 0;
}


x86 assembly (clang, -O0):
<layer_table_base_3>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x1,%eax
je     113d <layer_table_base_3+0x3d>
jmp    111b <layer_table_base_3+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
je     1149 <layer_table_base_3+0x49>
jmp    112c <layer_table_base_3+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x3,%eax
je     1155 <layer_table_base_3+0x55>
jmp    1161 <layer_table_base_3+0x61>
movl   $0x100,-0x4(%rbp)
jmp    1168 <layer_table_base_3+0x68>
movl   $0x120,-0x4(%rbp)
jmp    1168 <layer_table_base_3+0x68>
movl   $0x140,-0x4(%rbp)
jmp    1168 <layer_table_base_3+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<layer_table_base_3>:
add    $0xffffffff,%edi
mov    %edi,%ecx
shl    $0x5,%ecx
add    $0x100,%ecx
xor    %eax,%eax
cmp    $0x3,%edi
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @layer_table_base_3(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
]
5: ; preds = %1
store i32 256, i32* %2
br label %9
6: ; preds = %1
store i32 288, i32* %2
br label %9
7: ; preds = %1
store i32 320, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @layer_table_base_3(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 3
%4 = shl i32 %2, 5
%5 = add i32 %4, 256
%6 = select i1 %3, i32 %5, i32 0
ret i32 %6
}
/* Variables and functions */
int atoi(char *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int r() {
  char buf[64];
  return fgets(buf, 63, stdin) ? atoi(buf) : -1;
}


x86 assembly (clang, -O0):
<r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
mov    $0x3f,%esi
call   1030 <fgets@plt>
cmp    $0x0,%rax
je     115a <r+0x3a>
lea    -0x40(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x44(%rbp)
jmp    1167 <r+0x47>
mov    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
jmp    1167 <r+0x47>
mov    -0x44(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r>:
sub    $0x48,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x3f,%esi
call   1030 <fgets@plt>
test   %rax,%rax
je     114c <r+0x2c>
mov    %rsp,%rdi
call   1040 <atoi@plt>
add    $0x48,%rsp
ret
mov    $0xffffffff,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @r() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 63, i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%8 = call i32 @atoi(i8* %7)
br label %10
9: ; preds = %0
br label %10
10: ; preds = %9, %6
%11 = phi i32 [ %8, %6 ], [ -1, %9 ]
ret i32 %11
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @r() {
%1 = alloca [64 x i8]
%2 = getelementptr inbounds [64 x i8], [64 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 63, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @atoi(i8* %2)
br label %8
8: ; preds = %0, %6
%9 = phi i32 [ %7, %6 ], [ -1, %0 ]
ret i32 %9
}
char *strcpy(char *dst, const char *src) {
  char *result = dst;
  while (*src != '\0') {
    *dst = *src;
    dst++;
    src++;
  }
  return result;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     114d <strcpy+0x4d>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1120 <strcpy+0x20>
xor    %edx,%edx
nopl   0x0(%rax,%rax,1)
mov    %cl,(%rax,%rdx,1)
movzbl 0x1(%rsi,%rdx,1),%ecx
add    $0x1,%rdx
test   %cl,%cl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %0, %2 ]
%8 = phi i8* [ %10, %5 ], [ %1, %2 ]
store i8 %6, i8* %7
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ __set_BASEPRI(int /*<<< orphan*/);
void port_unlock(void) { __set_BASEPRI(0); }


x86 assembly (clang, -O0):
<port_unlock>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <__set_BASEPRI@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<port_unlock>:
xor    %edi,%edi
jmp    1030 <__set_BASEPRI@plt>

LLVM IR (-O0):
define void @port_unlock() {
%1 = call i32 @__set_BASEPRI(i32 0)
ret void
}

LLVM IR (-O2):
define void @port_unlock() {
%1 = tail call i32 @__set_BASEPRI(i32 0)
ret void
}
int iclamp(int v, int min, int max) {
  if (v < min)
    return min;
  if (v > max)
    return max;
  return v;
}


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

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

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

LLVM IR (-O2):
define i32 @iclamp(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
}
/* Variables and functions */
int /*<<< orphan*/ InitApp();
int /*<<< orphan*/ TASK_Update_LEDs();
void main(void) {
  InitApp();
  while (1) {
    TASK_Update_LEDs();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <InitApp@plt>
mov    $0x0,%al
call   1040 <TASK_Update_LEDs@plt>
jmp    112b <main+0xb>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <InitApp@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <TASK_Update_LEDs@plt>
jmp    1130 <main+0x10>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @InitApp()
br label %2
2: ; preds = %0, %2
%3 = call i32 (...) @TASK_Update_LEDs()
br label %2
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @InitApp()
br label %2
2: ; preds = %0, %2
%3 = tail call i32 (...) @TASK_Update_LEDs()
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: kill [-s signal_name] pid ...\n"
                  "       kill -l [exit_status]\n"
                  "       kill -signal_name pid ...\n"
                  "       kill -signal_number pid ...\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [135 x i8] c"usage: kill [-s signal_name] pid ...\0A kill -l [exit_status]\0A kill -signal_name pid ...\0A kill -signal_number pid ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [135 x i8] c"usage: kill [-s signal_name] pid ...\0A kill -l [exit_status]\0A kill -signal_name pid ...\0A kill -signal_number pid ...\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void signal_handler(int signal) {
  printf("Simulation has been ended.\n");
  exit(0);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Simulation has been ended.\0A\00"
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [27 x i8] c"Simulation has been ended.\00"
define void @signal_handler(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ mostrar_entero(int);
int /*<<< orphan*/ mostrar_vector(char *, int *);
int /*<<< orphan*/ pedir_vector(char *, int *);
int main() {
  int a[4];
  pedir_vector("a", a);
  mostrar_entero(a[0]);
  mostrar_vector("a", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xeb6(%rip),%rdi
call   1040 <pedir_vector@plt>
mov    -0x20(%rbp),%edi
call   1030 <mostrar_entero@plt>
lea    -0x20(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1050 <mostrar_vector@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rbx
mov    %rsp,%r14
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <pedir_vector@plt>
mov    (%rsp),%edi
call   1030 <mostrar_entero@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <mostrar_vector@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%4 = call i32 @pedir_vector(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %5
%7 = call i32 @mostrar_entero(i32 %6)
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%9 = call i32 @mostrar_vector(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @pedir_vector(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %3)
%5 = load i32, i32* %3
%6 = call i32 @mostrar_entero(i32 %5)
%7 = call i32 @mostrar_vector(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i32* %3)
ret i32 0
}
/* Type definitions */
struct cnfnode {
  int dummy;
};
struct cnfmodule {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ _unparse_python(int /*<<< orphan*/ *, struct cnfnode *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int unparse_python(struct cnfmodule *cm, FILE *fptr, struct cnfnode *cn_root) {
  fprintf(fptr, "cn_tree = {\n");
  _unparse_python(fptr, cn_root, 1);
  fprintf(fptr, "}\n");
  return 0;
}


x86 assembly (clang, -O0):
<unparse_python>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <_unparse_python@plt>
mov    -0x10(%rbp),%rdi
lea    0xeac(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unparse_python>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%rbx
lea    0xecf(%rip),%rdi
mov    $0xc,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x1,%edx
call   1030 <_unparse_python@plt>
lea    0xeb3(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cnfmodule = type { i32 }
%struct.cnfnode = type { i32 }
@.str = [13 x i8] c"cn_tree = {\0A\00"
@.str.1 = [3 x i8] c"}\0A\00"
define i32 @unparse_python(%struct.cnfmodule* %0, i32* %1, %struct.cnfnode* %2) {
%4 = alloca %struct.cnfmodule*
%5 = alloca i32*
%6 = alloca %struct.cnfnode*
store %struct.cnfmodule* %0, %struct.cnfmodule** %4
store i32* %1, i32** %5
store %struct.cnfnode* %2, %struct.cnfnode** %6
%7 = load i32*, i32** %5
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %5
%10 = load %struct.cnfnode*, %struct.cnfnode** %6
%11 = call i32 @_unparse_python(i32* %9, %struct.cnfnode* %10, i32 1)
%12 = load i32*, i32** %5
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.cnfmodule = type { i32 }
%struct.cnfnode = type { i32 }
@.str = [13 x i8] c"cn_tree = {\0A\00"
@.str.1 = [3 x i8] c"}\0A\00"
define i32 @unparse_python(%struct.cnfmodule* nocapture readnone %0, i32* %1, %struct.cnfnode* %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i64 12, i64 1, i32* %1)
%5 = tail call i32 @_unparse_python(i32* %1, %struct.cnfnode* %2, i32 1)
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64 2, i64 1, i32* %1)
ret i32 0
}
int f(int n) {
  int i, j = 0;
  for (i = 0; i < 31; i++)
    j = __builtin_ffs(i);
  return j;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1f,-0x8(%rbp)
jge    1141 <f+0x41>
mov    -0x8(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <f+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %14, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 31
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = call i32 @llvm.cttz.i32(i32 %9, i1 true)
%11 = add i32 %10, 1
%12 = icmp eq i32 %9, 0
%13 = select i1 %12, i32 0, i32 %11
store i32 %13, i32* %4
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
%18 = load i32, i32* %4
ret i32 %18
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
ret i32 2
}
/* Variables and functions */
scalar_t__ bar();
scalar_t__ bazIsInited();
int /*<<< orphan*/ printf(char *);
int foo() {
  if (bar() != 0) {
    return 1;
  }
  if (bazIsInited() == 0) {
    printf("[FAIL]  dlopen-in-init3, didn't init baz\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <bar@plt>
cmp    $0x0,%rax
je     1155 <foo+0x25>
movl   $0x1,-0x4(%rbp)
jmp    1185 <foo+0x55>
mov    $0x0,%al
call   1050 <bazIsInited@plt>
cmp    $0x0,%rax
jne    117e <foo+0x4e>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1185 <foo+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <bar@plt>
test   %rax,%rax
je     1146 <foo+0x16>
mov    $0x1,%ebx
jmp    1152 <foo+0x22>
xor    %eax,%eax
call   1050 <bazIsInited@plt>
test   %rax,%rax
je     1156 <foo+0x26>
mov    %ebx,%eax
pop    %rbx
ret
lea    0xea3(%rip),%rdi
call   1030 <puts@plt>
jmp    113f <foo+0xf>

LLVM IR (-O0):
@.str = [42 x i8] c"[FAIL] dlopen-in-init3, didn't init baz\0A\00"
define i32 @foo() {
%1 = alloca i32
%2 = call i64 (...) @bar()
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 1, i32* %1
br label %11
5: ; preds = %0
%6 = call i64 (...) @bazIsInited()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %11
10: ; preds = %5
store i32 0, i32* %1
br label %11
11: ; preds = %10, %8, %4
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@str = [41 x i8] c"[FAIL] dlopen-in-init3, didn't init baz\00"
define i32 @foo() {
%1 = tail call i64 (...) @bar()
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = tail call i64 (...) @bazIsInited()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
br label %8
8: ; preds = %3, %0, %6
%9 = phi i32 [ 1, %6 ], [ 1, %0 ], [ 0, %3 ]
ret i32 %9
}
void rcu_tasks_bootup_oddness(void) {}


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

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

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

LLVM IR (-O2):
define void @rcu_tasks_bootup_oddness() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ enable_interrupt(int);
void syscalls_init() { enable_interrupt(0x30); }


x86 assembly (clang, -O0):
<syscalls_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x30,%edi
call   1030 <enable_interrupt@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<syscalls_init>:
mov    $0x30,%edi
jmp    1030 <enable_interrupt@plt>

LLVM IR (-O0):
define void @syscalls_init() {
%1 = call i32 @enable_interrupt(i32 48)
ret void
}

LLVM IR (-O2):
define void @syscalls_init() {
%1 = tail call i32 @enable_interrupt(i32 48)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void show_help(void) {
  printf(
      "Usage: %s [OPTION]...\n\n     -h, --help\t\tdisplay this help\n     -V, "
      "--version\tdisplay version information\n     -m, --mode=MODE\tset file "
      "mode (as in chmod), not a=rwx - umask\n     -v, --verbose\tdisplay "
      "directories created\n\n     Report bugs to <bulliver@gmail.com>\n",
      "mkdir");
}


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

x86 assembly (clang, -O2):
<show_help>:
lea    0xee9(%rip),%rdi
lea    0xfe9(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [263 x i8] c"Usage: %s [OPTION]...\0A\0A -h, --help\09\09display this help\0A -V, --version\09display version information\0A -m, --mode=MODE\09set file mode (as in chmod), not a=rwx - umask\0A -v, --verbose\09display directories created\0A\0A Report bugs to <bulliver@gmail.com>\0A\00"
@.str.1 = [6 x i8] c"mkdir\00"
define void @show_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [263 x i8] c"Usage: %s [OPTION]...\0A\0A -h, --help\09\09display this help\0A -V, --version\09display version information\0A -m, --mode=MODE\09set file mode (as in chmod), not a=rwx - umask\0A -v, --verbose\09display directories created\0A\0A Report bugs to <bulliver@gmail.com>\0A\00"
@.str.1 = [6 x i8] c"mkdir\00"
define void @show_help() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([263 x i8], [263 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned long);
int /*<<< orphan*/ put8(int);
void add_eax_imm32(unsigned long imm32) {
  put8(0x05);
  put32(imm32);
}


x86 assembly (clang, -O0):
<add_eax_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x5,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%rdi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_eax_imm32>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5,%edi
call   1030 <put8@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @add_eax_imm32(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @put8(i32 5)
%4 = load i64, i64* %2
%5 = call i32 @put32(i64 %4)
ret void
}

LLVM IR (-O2):
define void @add_eax_imm32(i64 %0) {
%2 = tail call i32 @put8(i32 5)
%3 = tail call i32 @put32(i64 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_lu();
int /*<<< orphan*/ test_newton();
int /*<<< orphan*/ test_ptfix();
int /*<<< orphan*/ test_rk4();
int /*<<< orphan*/ test_sec();
int /*<<< orphan*/ test_spline();
int /*<<< orphan*/ test_sysnewton();
int main(void) {
  test_lu();
  test_spline();
  test_rk4();
  test_sysnewton();
  test_sec();
  test_newton();
  test_ptfix();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_lu@plt>
mov    $0x0,%al
call   1090 <test_spline@plt>
mov    $0x0,%al
call   1060 <test_rk4@plt>
mov    $0x0,%al
call   1050 <test_sysnewton@plt>
mov    $0x0,%al
call   1070 <test_sec@plt>
mov    $0x0,%al
call   1080 <test_newton@plt>
mov    $0x0,%al
call   1040 <test_ptfix@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_lu@plt>
xor    %eax,%eax
call   1090 <test_spline@plt>
xor    %eax,%eax
call   1060 <test_rk4@plt>
xor    %eax,%eax
call   1050 <test_sysnewton@plt>
xor    %eax,%eax
call   1070 <test_sec@plt>
xor    %eax,%eax
call   1080 <test_newton@plt>
xor    %eax,%eax
call   1040 <test_ptfix@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_lu()
%3 = call i32 (...) @test_spline()
%4 = call i32 (...) @test_rk4()
%5 = call i32 (...) @test_sysnewton()
%6 = call i32 (...) @test_sec()
%7 = call i32 (...) @test_newton()
%8 = call i32 (...) @test_ptfix()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_lu()
%2 = tail call i32 (...) @test_spline()
%3 = tail call i32 (...) @test_rk4()
%4 = tail call i32 (...) @test_sysnewton()
%5 = tail call i32 (...) @test_sec()
%6 = tail call i32 (...) @test_newton()
%7 = tail call i32 (...) @test_ptfix()
ret i32 0
}
void hc_a_equals_b_vector(a, b, n) double *a;
double *b;
int n;
{ memcpy(a, b, sizeof(double) * n); }


x86 assembly (clang, -O0):
<hc_a_equals_b_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x14(%rbp),%rdx
shl    $0x3,%rdx
call   1030 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hc_a_equals_b_vector>:
movslq %edx,%rdx
shl    $0x3,%rdx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @hc_a_equals_b_vector(double* %0, double* %1, i32 %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca i32
store double* %0, double** %4
store double* %1, double** %5
store i32 %2, i32* %6
%7 = load double*, double** %4
%8 = bitcast double* %7 to i8*
%9 = load double*, double** %5
%10 = bitcast double* %9 to i8*
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = mul i64 8, %12
ret void
}

LLVM IR (-O2):
define void @hc_a_equals_b_vector(double* nocapture writeonly %0, double* nocapture %1, i32 %2) {
%4 = bitcast double* %0 to i8*
%5 = bitcast double* %1 to i8*
%6 = sext i32 %2 to i64
%7 = shl nsw i64 %6, 3
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 8 %4, i8* align 8 %5, i64 %7, i1 false)
ret void
}
/* Variables and functions */
void *malloc(size_t);
void *wave_malloc(size_t size, const char *tag) { return malloc(size); }


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

x86 assembly (clang, -O2):
<wave_malloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @wave_malloc(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i64, i64* %3
%6 = call i8* @malloc(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @wave_malloc(i64 %0, i8* nocapture readnone %1) {
%3 = tail call i8* @malloc(i64 %0)
ret i8* %3
}
/* Type definitions */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t x87_ucompare(double a, double b) {
  uint32_t out = 0;
  if (a == b)
    out |= (1 << 14);
  else if (a < b)
    out |= (1 << 8);
  return out;
}


x86 assembly (clang, -O0):
<x87_ucompare>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    113b <x87_ucompare+0x3b>
jp     113b <x87_ucompare+0x3b>
mov    -0x14(%rbp),%eax
or     $0x4000,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <x87_ucompare+0x5f>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    115a <x87_ucompare+0x5a>
mov    -0x14(%rbp),%eax
or     $0x100,%eax
mov    %eax,-0x14(%rbp)
jmp    115f <x87_ucompare+0x5f>
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<x87_ucompare>:
mov    $0x4000,%eax
ucomisd %xmm1,%xmm0
jne    110e <x87_ucompare+0xe>
jp     110e <x87_ucompare+0xe>
ret
xor    %eax,%eax
ucomisd %xmm0,%xmm1
jbe    110d <x87_ucompare+0xd>
mov    $0x100,%eax
ret

LLVM IR (-O0):
define i32 @x87_ucompare(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca i32
store double %0, double* %3
store double %1, double* %4
store i32 0, i32* %5
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fcmp oeq double %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i32, i32* %5
%11 = or i32 %10, 16384
store i32 %11, i32* %5
br label %20
12: ; preds = %2
%13 = load double, double* %3
%14 = load double, double* %4
%15 = fcmp olt double %13, %14
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %5
%18 = or i32 %17, 256
store i32 %18, i32* %5
br label %19
19: ; preds = %16, %12
br label %20
20: ; preds = %19, %9
%21 = load i32, i32* %5
ret i32 %21
}

LLVM IR (-O2):
define i32 @x87_ucompare(double %0, double %1) {
%3 = fcmp oeq double %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = fcmp olt double %0, %1
br i1 %5, label %6, label %7
6: ; preds = %4
br label %7
7: ; preds = %2, %4, %6
%8 = phi i32 [ 256, %6 ], [ 0, %4 ], [ 16384, %2 ]
ret i32 %8
}
/* Type definitions */
struct option {
  int dummy;
};
struct _getopt_data {
  int dummy;
};

/* Variables and functions */
int _getopt_internal_r(int, char **, char const *, struct option const *, int *,
                       int /*<<< orphan*/, int /*<<< orphan*/,
                       struct _getopt_data *);
int _getopt_long_r(int argc, char **argv, const char *options,
                   const struct option *long_options, int *opt_index,
                   struct _getopt_data *d) {
  return _getopt_internal_r(argc, argv, options, long_options, opt_index, 0, 0,
                            d);
}


x86 assembly (clang, -O0):
<_getopt_long_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%rax
xor    %r9d,%r9d
movl   $0x0,(%rsp)
mov    %rax,0x8(%rsp)
call   1030 <_getopt_internal_r@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_getopt_long_r>:
push   %rax
mov    %r9,%rax
xor    %r9d,%r9d
push   %rax
push   $0x0
call   1030 <_getopt_internal_r@plt>
add    $0x10,%rsp
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.option = type { i32 }
%struct._getopt_data = type { i32 }
define i32 @_getopt_long_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, %struct._getopt_data* %5) {
%7 = tail call i32 @_getopt_internal_r(i32 %0, i8** %1, i8* %2, %struct.option* %3, i32* %4, i32 0, i32 0, %struct._getopt_data* %5)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ ENOENT;
int /*<<< orphan*/ errno;
__attribute__((__weak__)) int _unlink(char *name __attribute__((unused))) {
  errno = ENOENT;
  return -1;
}


x86 assembly (clang, -O0):
<_unlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unlink>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@errno = global i32 0
define weak i32 @_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ENOENT
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
define weak i32 @_unlink(i8* %0) {
%2 = load i32, i32* @ENOENT
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int round1_d();
int round1_c() { return round1_d(); }


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

x86 assembly (clang, -O2):
<round1_c>:
xor    %eax,%eax
jmp    1030 <round1_d@plt>

LLVM IR (-O0):
define i32 @round1_c() {
%1 = call i32 (...) @round1_d()
ret i32 %1
}

LLVM IR (-O2):
define i32 @round1_c() {
%1 = tail call i32 (...) @round1_d()
ret i32 %1
}