xunge/DecIR huggingface dataset:
int digit_sum(int n) {
  int sum = 0;
  while (n / 10) {
    sum += n % 10;
    n /= 10;
  }
  sum += n;
  return sum;
}


x86 assembly (clang, -O0):
<digit_sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     1146 <digit_sum+0x46>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    -0x8(%rbp),%edx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
jmp    110e <digit_sum+0xe>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digit_sum>:
mov    %edi,%eax
lea    0x9(%rax),%edx
xor    %r8d,%r8d
cmp    $0x13,%edx
jb     113e <digit_sum+0x3e>
xor    %r8d,%r8d
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rsi
mov    %rsi,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rsi
lea    (%rsi,%rdi,1),%eax
lea    (%rax,%rax,1),%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%edx
add    %edx,%r8d
lea    (%rsi,%rdi,1),%ecx
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <digit_sum+0x10>
add    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @digit_sum(i32 %0) {
%2 = add i32 %0, 9
%3 = icmp ult i32 %2, 19
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %9, %4 ], [ 0, %1 ]
%6 = phi i32 [ %7, %4 ], [ %0, %1 ]
%7 = sdiv i32 %6, 10
%8 = srem i32 %6, 10
%9 = add nsw i32 %5, %8
%10 = add nsw i32 %7, 9
%11 = icmp ult i32 %10, 19
br i1 %11, label %12, label %4
12: ; preds = %4, %1
%13 = phi i32 [ %0, %1 ], [ %7, %4 ]
%14 = phi i32 [ 0, %1 ], [ %9, %4 ]
%15 = add nsw i32 %14, %13
ret i32 %15
}
int check_bme_init() { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @check_bme_init() {
ret i32 1
}
struct bst_test_list *test_vcs_install(struct bst_test_list *tests) {
  return tests;
}


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

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

LLVM IR (-O0):
%struct.bst_test_list = type opaque
define %struct.bst_test_list* @test_vcs_install(%struct.bst_test_list* %0) {
%2 = alloca %struct.bst_test_list*
store %struct.bst_test_list* %0, %struct.bst_test_list** %2
%3 = load %struct.bst_test_list*, %struct.bst_test_list** %2
ret %struct.bst_test_list* %3
}

LLVM IR (-O2):
%struct.bst_test_list = type opaque
define %struct.bst_test_list* @test_vcs_install(%struct.bst_test_list* readnone returned %0) {
ret %struct.bst_test_list* %0
}
void adis16300_remove_trigger(struct iio_dev *indio_dev) {}


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

x86 assembly (clang, -O2):
ret

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

LLVM IR (-O2):
%struct.iio_dev = type opaque
define void @adis16300_remove_trigger(%struct.iio_dev* nocapture %0) {
ret void
}
int f(void) { return 0xd00d; }


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

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

LLVM IR (-O0):
define i32 @f() {
ret i32 53261
}

LLVM IR (-O2):
define i32 @f() {
ret i32 53261
}
/* Variables and functions */
int random_between(int, int);
int poison_random_life() { return random_between(20, 100); }


x86 assembly (clang, -O0):
<poison_random_life>:
push   %rbp
mov    %rsp,%rbp
mov    $0x14,%edi
mov    $0x64,%esi
call   1030 <random_between@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<poison_random_life>:
mov    $0x14,%edi
mov    $0x64,%esi
jmp    1030 <random_between@plt>

LLVM IR (-O0):
define i32 @poison_random_life() {
%1 = call i32 @random_between(i32 20, i32 100)
ret i32 %1
}

LLVM IR (-O2):
define i32 @poison_random_life() {
%1 = tail call i32 @random_between(i32 20, i32 100)
ret i32 %1
}
void set_idt(const struct idt_ptr *ptr) {
  __asm__ volatile("lidt (%0)" : : "a"(ptr));
}


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

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

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

LLVM IR (-O2):
%struct.idt_ptr = type opaque
define void @set_idt(%struct.idt_ptr* %0) {
tail call void asm sideeffect "lidt ($0)", "{ax},~{dirflag},~{fpsr},~{flags}"(%struct.idt_ptr* %0)
ret void
}
/* Variables and functions */
double geom_norm3d(double *);
double geom_normalize3d(double v[3]) {
  double n = geom_norm3d(v);
  v[0] /= n;
  v[1] /= n;
  v[2] /= n;
  return n;
}


x86 assembly (clang, -O0):
<geom_normalize3d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <geom_norm3d@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x8(%rax)
movsd  -0x10(%rbp),%xmm1
mov    -0x8(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rax)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geom_normalize3d>:
push   %rbx
mov    %rdi,%rbx
call   1030 <geom_norm3d@plt>
movupd (%rbx),%xmm1
movapd %xmm0,%xmm2
unpcklpd %xmm0,%xmm2
divpd  %xmm2,%xmm1
movupd %xmm1,(%rbx)
movsd  0x10(%rbx),%xmm1
divsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define double @geom_normalize3d(double* %0) {
%2 = alloca double*
%3 = alloca double
store double* %0, double** %2
%4 = load double*, double** %2
%5 = call double @geom_norm3d(double* %4)
store double %5, double* %3
%6 = load double, double* %3
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 0
%9 = load double, double* %8
%10 = fdiv double %9, %6
store double %10, double* %8
%11 = load double, double* %3
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fdiv double %14, %11
store double %15, double* %13
%16 = load double, double* %3
%17 = load double*, double** %2
%18 = getelementptr inbounds double, double* %17, i64 2
%19 = load double, double* %18
%20 = fdiv double %19, %16
store double %20, double* %18
%21 = load double, double* %3
ret double %21
}

LLVM IR (-O2):
define double @geom_normalize3d(double* %0) {
%2 = tail call double @geom_norm3d(double* %0)
%3 = bitcast double* %0 to <2 x double>*
%4 = load <2 x double>, <2 x double>* %3
%5 = insertelement <2 x double> poison, double %2, i64 0
%6 = shufflevector <2 x double> %5, <2 x double> poison, <2 x i32> zeroinitializer
%7 = fdiv <2 x double> %4, %6
%8 = bitcast double* %0 to <2 x double>*
store <2 x double> %7, <2 x double>* %8
%9 = getelementptr inbounds double, double* %0, i64 2
%10 = load double, double* %9
%11 = fdiv double %10, %2
store double %11, double* %9
ret double %2
}
int main() {
  int arg1 = 0;
  int not = 0;
  __asm__("notl %%eax;" : "=a"(not ) : "a"(arg1));
  if (not != -1) {
    abort();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
not    %eax
mov    %eax,-0xc(%rbp)
cmpl   $0xffffffff,-0xc(%rbp)
je     1144 <main+0x34>
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xor    %eax,%eax
not    %eax
cmp    $0xffffffff,%eax
jne    111c <main+0xc>
xor    %eax,%eax
ret
push   %rax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 asm "notl %eax;", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %0
unreachable
9: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "notl %eax;", "={ax},{ax},~{dirflag},~{fpsr},~{flags}"(i32 0)
%2 = icmp eq i32 %1, -1
br i1 %2, label %4, label %3
3: ; preds = %0
tail call void @abort()
unreachable
4: ; preds = %0
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main(int argc, char *argv[]) {
  printf("%x %x %x\n", 0xffffffff << 31, 0xffffffff << 32, 0xffffffff << 33);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed3(%rip),%rdi
mov    $0x80000000,%esi
mov    %ecx,%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"%x %x %x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 -2147483648, i32 poison, i32 poison)
ret i32 0
}
void unsigned_char_add_signed_char_signed_int(unsigned char *LHS,
                                              signed int RHS) {
  (*LHS) += RHS;
}


x86 assembly (clang, -O0):
<unsigned_char_add_signed_char_signed_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
add    %edx,%ecx
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<unsigned_char_add_signed_char_signed_int>:
add    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @unsigned_char_add_signed_char_signed_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = zext i8 %7 to i32
%9 = add nsw i32 %8, %5
%10 = trunc i32 %9 to i8
store i8 %10, i8* %6
ret void
}

LLVM IR (-O2):
define void @unsigned_char_add_signed_char_signed_int(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = trunc i32 %1 to i8
%5 = add i8 %3, %4
store i8 %5, i8* %0
ret void
}
void disable_flap_detection_routines(void) {}


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

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

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

LLVM IR (-O2):
define void @disable_flap_detection_routines() {
ret void
}
int test_imm_B0uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0xB0 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B0uint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
shr    $0x10,%rdx
and    $0xb0,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B0uint64_midword_reg>:
test   $0xb00000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B0uint64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 16
%5 = and i64 %4, 176
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_B0uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 11534336
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char foo(char *);
main() {
  char x;
  if (foo(&x) != 'a')
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x5(%rbp),%rdi
call   1040 <foo@plt>
movsbl %al,%eax
cmp    $0x61,%eax
je     115b <main+0x2b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0x7(%rsp),%rdi
call   1040 <foo@plt>
cmp    $0x61,%al
jne    1146 <main+0x16>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
%3 = call signext i8 @foo(i8* %2)
%4 = sext i8 %3 to i32
%5 = icmp ne i32 %4, 97
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (...) @abort()
unreachable
8: ; preds = %0
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i8
%2 = call signext i8 @foo(i8* %1)
%3 = icmp eq i8 %2, 97
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = call i32 (...) @abort()
unreachable
6: ; preds = %0
%7 = call i32 @exit(i32 0)
unreachable
}
int flen(int nodeslen) { return (int)(nodeslen * 0.1); }


x86 assembly (clang, -O0):
<flen>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xeec(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<flen>:
cvtsi2sd %edi,%xmm0
mulsd  0xef4(%rip),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @flen(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sitofp i32 %3 to double
%5 = fmul double %4, 1.000000e-01
%6 = fptosi double %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @flen(i32 %0) {
%2 = sitofp i32 %0 to double
%3 = fmul double %2, 1.000000e-01
%4 = fptosi double %3 to i32
ret i32 %4
}
/* Type definitions */
struct foo {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *, struct foo *);
void print(struct foo *f) { printf("%p\n", f); }


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

x86 assembly (clang, -O2):
<print>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.foo = type { i32 }
@.str = [4 x i8] c"%p\0A\00"
define void @print(%struct.foo* %0) {
%2 = alloca %struct.foo*
store %struct.foo* %0, %struct.foo** %2
%3 = load %struct.foo*, %struct.foo** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %struct.foo* %3)
ret void
}

LLVM IR (-O2):
%struct.foo = type { i32 }
@.str = [4 x i8] c"%p\0A\00"
define void @print(%struct.foo* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), %struct.foo* %0)
ret void
}
double pathconN_nm2_sq(double x) { return x * x; }


x86 assembly (clang, -O0):
<pathconN_nm2_sq>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathconN_nm2_sq>:
mulsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @pathconN_nm2_sq(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  printf("Hola Mundo\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"Hola Mundo\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ CoProFPTest();
int /*<<< orphan*/ writeString(char *);
int main(void) {
  writeString("Hi!\n");
  CoProFPTest();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <writeString@plt>
mov    $0x0,%al
call   1030 <CoProFPTest@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <writeString@plt>
xor    %eax,%eax
call   1030 <CoProFPTest@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"Hi!\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @writeString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (...) @CoProFPTest()
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"Hi!\0A\00"
define i32 @main() {
%1 = tail call i32 @writeString(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @CoProFPTest()
ret i32 0
}
/* Type definitions */
struct ev_loop {
  int dummy;
};

/* Variables and functions */
unsigned int ev_iteration(struct ev_loop *);
unsigned int __attribute__((unused)) ev_loop_count(struct ev_loop *loop) {
  return ev_iteration(loop);
}


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

x86 assembly (clang, -O2):
<ev_loop_count>:
jmp    1030 <ev_iteration@plt>

LLVM IR (-O0):
%struct.ev_loop = type { i32 }
define i32 @ev_loop_count(%struct.ev_loop* %0) {
%2 = alloca %struct.ev_loop*
store %struct.ev_loop* %0, %struct.ev_loop** %2
%3 = load %struct.ev_loop*, %struct.ev_loop** %2
%4 = call i32 @ev_iteration(%struct.ev_loop* %3)
ret i32 %4
}

LLVM IR (-O2):
%struct.ev_loop = type { i32 }
define i32 @ev_loop_count(%struct.ev_loop* %0) {
%2 = tail call i32 @ev_iteration(%struct.ev_loop* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *get_dt_string(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int rpi_board_check() {
  char *dtm;
  int ret = 0;
  dtm = get_dt_string("model");
  if (dtm) {
    ret = !(strstr(dtm, "Raspberry Pi") == NULL);
    free(dtm);
  }
  return ret;
}


x86 assembly (clang, -O0):
<rpi_board_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0xc(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <get_dt_string@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1184 <rpi_board_check+0x54>
mov    -0x8(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1050 <strstr@plt>
cmp    $0x0,%rax
sete   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rpi_board_check>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rdi
call   1040 <get_dt_string@plt>
test   %rax,%rax
je     1169 <rpi_board_check+0x39>
mov    %rax,%rbx
lea    0xeb8(%rip),%rsi
mov    %rax,%rdi
call   1050 <strstr@plt>
xor    %ebp,%ebp
test   %rax,%rax
setne  %bpl
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    116b <rpi_board_check+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"model\00"
@.str.1 = [13 x i8] c"Raspberry Pi\00"
define i32 @rpi_board_check() {
%1 = alloca i8*
%2 = alloca i32
store i32 0, i32* %2
%3 = call i8* @get_dt_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = load i8*, i8** %1
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = load i8*, i8** %1
%8 = call i32* @strstr(i8* %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i32* %8, null
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
store i32 %11, i32* %2
%12 = load i8*, i8** %1
%13 = call i32 @free(i8* %12)
br label %14
14: ; preds = %6, %0
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
@.str = [6 x i8] c"model\00"
@.str.1 = [13 x i8] c"Raspberry Pi\00"
define i32 @rpi_board_check() {
%1 = tail call i8* @get_dt_string(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i32* @strstr(i8* %1, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp ne i32* %4, null
%6 = zext i1 %5 to i32
%7 = tail call i32 @free(i8* %1)
br label %8
8: ; preds = %3, %0
%9 = phi i32 [ %6, %3 ], [ 0, %0 ]
ret i32 %9
}
int ti_dema_start(double const *options) {
  const int period = (int)options[0];
  return (period - 1) * 2;
}


x86 assembly (clang, -O0):
<ti_dema_start>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cvttsd2si (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
shl    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ti_dema_start>:
cvttsd2si (%rdi),%eax
add    %eax,%eax
add    $0xfffffffe,%eax
ret

LLVM IR (-O0):
define i32 @ti_dema_start(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
%4 = load double*, double** %2
%5 = getelementptr inbounds double, double* %4, i64 0
%6 = load double, double* %5
%7 = fptosi double %6 to i32
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 1
%10 = mul nsw i32 %9, 2
ret i32 %10
}

LLVM IR (-O2):
define i32 @ti_dema_start(double* nocapture %0) {
%2 = load double, double* %0
%3 = fptosi double %2 to i32
%4 = shl i32 %3, 1
%5 = add i32 %4, -2
ret i32 %5
}
/* Variables and functions */
double atan(double const);
char f_atan(double *a, const double *b) {
  *a = atan(*b);
  return (0);
}


x86 assembly (clang, -O0):
<f_atan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <atan@plt>
mov    -0x8(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_atan>:
push   %rbx
mov    %rdi,%rbx
movsd  (%rsi),%xmm0
call   1030 <atan@plt>
movsd  %xmm0,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define signext i8 @f_atan(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = load double, double* %5
%7 = call double @atan(double %6)
%8 = load double*, double** %3
store double %7, double* %8
ret i8 0
}

LLVM IR (-O2):
define signext i8 @f_atan(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = tail call double @atan(double %3)
store double %4, double* %0
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void error_in_allocation(char *program) { printf("%s> Bye bye!\n", program); }


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

x86 assembly (clang, -O2):
<error_in_allocation>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%s> Bye bye!\0A\00"
define void @error_in_allocation(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"%s> Bye bye!\0A\00"
define void @error_in_allocation(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int main(int argc, char *argv[]) {
  int i;
  int s = 0;
#pragma omp parallel for reduction(+ : s)
  for (i = 0; i < 100; i++) {
    s += i;
  }
  assert(s == 4950);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jge    1155 <main+0x45>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1134 <main+0x24>
cmpl   $0x1356,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %15, %2
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 100
br i1 %10, label %11, label %18
11: ; preds = %8
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = add nsw i32 %13, %12
store i32 %14, i32* %7
br label %15
15: ; preds = %11
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %8
18: ; preds = %8
%19 = load i32, i32* %7
%20 = icmp eq i32 %19, 4950
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
/* Variables and functions */
int random();
int rand_key_int_pos(void) { return random(); }


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

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

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

LLVM IR (-O2):
define i32 @rand_key_int_pos() {
%1 = tail call i32 (...) @random()
ret i32 %1
}
int udp_destroy(struct netchannel *nc __attribute__((unused))) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.netchannel = type opaque
define i32 @udp_destroy(%struct.netchannel* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int __VERIFIER_nondet_int();
void HpCdrProcessLastSession(int Toc) {
  int index = __VERIFIER_nondet_int();
  {
    if (index) {
      index--;
    }
    return;
  }
}


x86 assembly (clang, -O0):
<HpCdrProcessLastSession>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1138 <HpCdrProcessLastSession+0x28>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @HpCdrProcessLastSession(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = add nsw i32 %8, -1
store i32 %9, i32* %3
br label %10
10: ; preds = %7, %1
ret void
}

LLVM IR (-O2):
define void @HpCdrProcessLastSession(i32 %0) {
%2 = tail call i32 (...) @__VERIFIER_nondet_int()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ echoinline(char *);
do_stuff() { echoinline("Stuff"); }


x86 assembly (clang, -O0):
<do_stuff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <echoinline@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [6 x i8] c"Stuff\00"
define i32 @do_stuff() {
%1 = alloca i32
%2 = call i32 @echoinline(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [6 x i8] c"Stuff\00"
define i32 @do_stuff() {
%1 = tail call i32 @echoinline(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret i32 undef
}
void write_barrier(void) { __asm__ __volatile__(" " : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @write_barrier() {
tail call void asm sideeffect " ", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
void testWson() {}


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

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

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

LLVM IR (-O2):
define void @testWson() {
ret void
}
/* Variables and functions */
char *strchr(char *, char);
char get_matching_open_paren(char p) { return *(strchr("()[]{}", p) - 1); }


x86 assembly (clang, -O0):
<get_matching_open_paren>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
lea    0xedb(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <strchr@plt>
movsbl -0x1(%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_matching_open_paren>:
push   %rax
mov    %edi,%esi
lea    0xee6(%rip),%rdi
call   1030 <strchr@plt>
mov    -0x1(%rax),%al
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"()[]{}\00"
define signext i8 @get_matching_open_paren(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i8* @strchr(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %3)
%5 = getelementptr inbounds i8, i8* %4, i64 -1
%6 = load i8, i8* %5
ret i8 %6
}

LLVM IR (-O2):
@.str = [7 x i8] c"()[]{}\00"
define signext i8 @get_matching_open_paren(i8 signext %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%3 = getelementptr inbounds i8, i8* %2, i64 -1
%4 = load i8, i8* %3
ret i8 %4
}
int tst_audit10_aux(void) { return 77; }


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

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

LLVM IR (-O0):
define i32 @tst_audit10_aux() {
ret i32 77
}

LLVM IR (-O2):
define i32 @tst_audit10_aux() {
ret i32 77
}
/* Variables and functions */
char *strncpy(char *restrict dest, const char *restrict src, size_t n) {
  return NULL;
}


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

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

LLVM IR (-O0):
define i8* @strncpy(i8* noalias %0, i8* noalias %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 i8* null
}

LLVM IR (-O2):
define noalias i8* @strncpy(i8* noalias nocapture readnone %0, i8* noalias nocapture readnone %1, i64 %2) {
ret i8* null
}
/* Variables and functions */
char shft_b(char *, char *);
signed char intr_wrap_557(signed char p1, signed char p2) {
  return shft_b(&p1, &p2);
}


x86 assembly (clang, -O0):
<intr_wrap_557>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
lea    -0x1(%rbp),%rdi
lea    -0x2(%rbp),%rsi
call   1030 <shft_b@plt>
movsbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intr_wrap_557>:
push   %rax
mov    %dil,0x7(%rsp)
mov    %sil,0x6(%rsp)
lea    0x7(%rsp),%rdi
lea    0x6(%rsp),%rsi
call   1030 <shft_b@plt>
pop    %rcx
ret

LLVM IR (-O0):
define signext i8 @intr_wrap_557(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = call signext i8 @shft_b(i8* %3, i8* %4)
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @intr_wrap_557(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = call signext i8 @shft_b(i8* %3, i8* %4)
ret i8 %5
}
int overflow(int u, int v) {
  if (u > 0 && v > 0 && u + v < 0)
    return 1;
  if (u < 0 && v < 0 && u + v > 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<overflow>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1139 <overflow+0x39>
cmpl   $0x0,-0xc(%rbp)
jle    1139 <overflow+0x39>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x0,%eax
jge    1139 <overflow+0x39>
movl   $0x1,-0x4(%rbp)
jmp    116f <overflow+0x6f>
cmpl   $0x0,-0x8(%rbp)
jge    1168 <overflow+0x68>
cmpl   $0x0,-0xc(%rbp)
jge    1168 <overflow+0x68>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    $0x0,%eax
jle    1168 <overflow+0x68>
movl   $0x1,-0x4(%rbp)
jmp    116f <overflow+0x6f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<overflow>:
lea    (%rsi,%rdi,1),%ecx
test   %edi,%edi
jle    1115 <overflow+0x15>
test   %esi,%esi
jle    1115 <overflow+0x15>
mov    $0x1,%eax
test   %ecx,%ecx
jns    1115 <overflow+0x15>
ret
test   %edi,%esi
sets   %al
test   %ecx,%ecx
setg   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @overflow(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = icmp sgt i32 %1, 0
%5 = and i1 %3, %4
%6 = add nsw i32 %1, %0
%7 = icmp slt i32 %6, 0
%8 = select i1 %5, i1 %7, i1 false
br i1 %8, label %15, label %9
9: ; preds = %2
%10 = and i32 %1, %0
%11 = icmp slt i32 %10, 0
%12 = icmp sgt i32 %6, 0
%13 = select i1 %11, i1 %12, i1 false
%14 = zext i1 %13 to i32
br label %15
15: ; preds = %9, %2
%16 = phi i32 [ 1, %2 ], [ %14, %9 ]
ret i32 %16
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *calloc(size_t nmemb, size_t size) {
  void *rv = malloc(nmemb * size);
  if (rv) {
    memset(rv, 0, nmemb * size);
  }
  return rv;
}


x86 assembly (clang, -O0):
<calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
imul   -0x10(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1161 <calloc+0x41>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
imul   -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
imul   %rsi,%rbx
mov    %rbx,%rdi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     1148 <calloc+0x28>
mov    %r14,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @malloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @memset(i8* %4, i32 0, i64 %3)
br label %8
8: ; preds = %6, %2
ret i8* %4
}
/* Variables and functions */
unsigned char foo3(int);
unsigned char bar3(int x) { return foo3(x + 6); }


x86 assembly (clang, -O0):
<bar3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x6,%edi
call   1030 <foo3@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar3>:
add    $0x6,%edi
jmp    1030 <foo3@plt>

LLVM IR (-O0):
define zeroext i8 @bar3(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 6
%5 = call zeroext i8 @foo3(i32 %4)
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @bar3(i32 %0) {
%2 = add nsw i32 %0, 6
%3 = tail call zeroext i8 @foo3(i32 %2)
ret i8 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ XTimeCoord;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XTimeCoord(void *_p) {
  if (_p == NULL)
    abort();
  free((XTimeCoord *)_p);
}


x86 assembly (clang, -O0):
<free_XTimeCoord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XTimeCoord+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XTimeCoord>:
test   %rdi,%rdi
je     112a <free_XTimeCoord+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

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

LLVM IR (-O2):
define void @free_XTimeCoord(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int bar(int i) {
  int *ptr = 0;
  float *ptr1;
  ptr = ptr1;
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @bar(i32 %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca float*
store i32 %0, i32* %2
store i32* null, i32** %3
%5 = load float*, float** %4
%6 = bitcast float* %5 to i32*
store i32* %6, i32** %3
ret i32 0
}

LLVM IR (-O2):
define i32 @bar(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int doper(int state, int oper, int modder) {
  switch (oper) {
  case 0:
    return (state | modder);
    break;
  case 1:
    return (state & modder);
    break;
  case 2:
    return (state ^ modder);
    break;
  }
  exit(1);
}


x86 assembly (clang, -O0):
<doper>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
test   %eax,%eax
je     1156 <doper+0x46>
jmp    1134 <doper+0x24>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     1164 <doper+0x54>
jmp    1145 <doper+0x35>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1172 <doper+0x62>
jmp    1180 <doper+0x70>
mov    -0x8(%rbp),%eax
or     -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118a <doper+0x7a>
mov    -0x8(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118a <doper+0x7a>
mov    -0x8(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    118a <doper+0x7a>
mov    $0x1,%edi
call   1030 <exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doper>:
cmp    $0x2,%esi
je     1123 <doper+0x13>
cmp    $0x1,%esi
je     1128 <doper+0x18>
test   %esi,%esi
jne    112d <doper+0x1d>
or     %edi,%edx
mov    %edx,%eax
ret
xor    %edi,%edx
mov    %edx,%eax
ret
and    %edi,%edx
mov    %edx,%eax
ret
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define i32 @doper(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* %6
switch i32 %8, label %21 [
i32 0, label %9
i32 1, label %13
i32 2, label %17
]
9: ; preds = %3
%10 = load i32, i32* %5
%11 = load i32, i32* %7
%12 = or i32 %10, %11
store i32 %12, i32* %4
br label %23
13: ; preds = %3
%14 = load i32, i32* %5
%15 = load i32, i32* %7
%16 = and i32 %14, %15
store i32 %16, i32* %4
br label %23
17: ; preds = %3
%18 = load i32, i32* %5
%19 = load i32, i32* %7
%20 = xor i32 %18, %19
store i32 %20, i32* %4
br label %23
21: ; preds = %3
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %17, %13, %9
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
define i32 @doper(i32 %0, i32 %1, i32 %2) {
switch i32 %1, label %10 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
]
4: ; preds = %3
%5 = or i32 %2, %0
br label %12
6: ; preds = %3
%7 = and i32 %2, %0
br label %12
8: ; preds = %3
%9 = xor i32 %2, %0
br label %12
10: ; preds = %3
%11 = tail call i32 @exit(i32 1)
unreachable
12: ; preds = %8, %6, %4
%13 = phi i32 [ %9, %8 ], [ %7, %6 ], [ %5, %4 ]
ret i32 %13
}
int main(void) {
  const int a = 1;
  int b = 2;
  int c = a + b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %2
store i32 2, i32* %3
%5 = load i32, i32* %3
%6 = add nsw i32 1, %5
store i32 %6, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
signed int spi_bulkwrite(void *handle, unsigned short addr,
                         unsigned char command, unsigned char *data,
                         unsigned int length) {
  return 0;
}


x86 assembly (clang, -O0):
<spi_bulkwrite>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %si,%dx
mov    %rdi,-0x8(%rbp)
mov    %dx,-0xa(%rbp)
mov    %al,-0xb(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @spi_bulkwrite(i8* %0, i16 zeroext %1, i8 zeroext %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i16
%8 = alloca i8
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i16 %1, i16* %7
store i8 %2, i8* %8
store i8* %3, i8** %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @spi_bulkwrite(i8* nocapture readnone %0, i16 zeroext %1, i8 zeroext %2, i8* nocapture readnone %3, i32 %4) {
ret i32 0
}
int vpu_hw_reset(int mgr_fd) {
  printf("[%s][%d] VPU H/W reset\n", __FUNCTION__, 1145);
  return ioctl(mgr_fd, 50, (void *)0);
}


x86 assembly (clang, -O0):
<vpu_hw_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    0xedf(%rip),%rsi
mov    $0x479,%edx
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    $0x32,%esi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x0,%al
call   1040 <ioctl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vpu_hw_reset>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
lea    0xee7(%rip),%rsi
mov    $0x479,%edx
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x32,%esi
xor    %edx,%edx
xor    %eax,%eax
pop    %rbx
jmp    1040 <ioctl@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"[%s][%d] VPU H/W reset\0A\00"
@__FUNCTION__.vpu_hw_reset = [13 x i8] c"vpu_hw_reset\00"
define i32 @vpu_hw_reset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.vpu_hw_reset, i64 0, i64 0), i32 1145)
%4 = load i32, i32* %2
%5 = call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i8*, ...)*)(i32 %4, i32 50, i8* null)
ret i32 %5
}

LLVM IR (-O2):
@.str = [24 x i8] c"[%s][%d] VPU H/W reset\0A\00"
@__FUNCTION__.vpu_hw_reset = [13 x i8] c"vpu_hw_reset\00"
define i32 @vpu_hw_reset(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @__FUNCTION__.vpu_hw_reset, i64 0, i64 0), i32 1145)
%3 = tail call i32 (i32, i32, i8*, ...) bitcast (i32 (...)* @ioctl to i32 (i32, i32, i8*, ...)*)(i32 %0, i32 50, i8* null)
ret i32 %3
}
/* Variables and functions */
int recv(int, void *, size_t, int);
int qemu_recv(int sock, void *buf, size_t len, int flags) {
  return recv(sock, buf, len, flags);
}


x86 assembly (clang, -O0):
<qemu_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <recv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qemu_recv>:
jmp    1030 <recv@plt>

LLVM IR (-O0):
define i32 @qemu_recv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = load i32, i32* %8
%13 = call i32 @recv(i32 %9, i8* %10, i64 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @qemu_recv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @recv(i32 %0, i8* %1, i64 %2, i32 %3)
ret i32 %5
}