xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ brk(void *);
void *sbrk(int /*<<< orphan*/);
int main() {
  void *pbrk;
  pbrk = sbrk(0);
  brk(pbrk);
  brk((void *)-1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1040 <sbrk@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <brk@plt>
mov    $0xffffffffffffffff,%rdi
call   1030 <brk@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @sbrk(i32 0)
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @brk(i8* %4)
%6 = call i32 @brk(i8* inttoptr (i64 -1 to i8*))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i8* @sbrk(i32 0)
%2 = tail call i32 @brk(i8* %1)
%3 = tail call i32 @brk(i8* inttoptr (i64 -1 to i8*))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
void *malloc(size_t);
void *safeMalloc(size_t size) {
  void *p = malloc(size);
  assert(p);
  return p;
}


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

x86 assembly (clang, -O2):
<safeMalloc>:
push   %rbx
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @safeMalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @safeMalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = tail call i32 @assert(i8* %2)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ cmdargParse(char const **);
int /*<<< orphan*/ init_modemu();
int /*<<< orphan*/ pre_init_modemu();
int run_modemu();
int /*<<< orphan*/ usleep(int);
int main(int argc, const char *argv[]) {
  int ret;
  cmdargParse(argv);
  if (!pre_init_modemu())
    return 0;
  init_modemu();
  do {
    ret = run_modemu();
    usleep(10000);
  } while (ret == 2);
  return ret;
}


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)
mov    -0x10(%rbp),%rdi
call   1050 <cmdargParse@plt>
mov    $0x0,%al
call   1030 <pre_init_modemu@plt>
cmp    $0x0,%eax
jne    118b <main+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    11b6 <main+0x66>
mov    $0x0,%al
call   1060 <init_modemu@plt>
mov    $0x0,%al
call   1040 <run_modemu@plt>
mov    %eax,-0x14(%rbp)
mov    $0x2710,%edi
call   1070 <usleep@plt>
cmpl   $0x2,-0x14(%rbp)
je     1192 <main+0x42>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rdi
call   1050 <cmdargParse@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <pre_init_modemu@plt>
test   %eax,%eax
je     1188 <main+0x38>
xor    %eax,%eax
call   1060 <init_modemu@plt>
nopl   (%rax)
xor    %eax,%eax
call   1040 <run_modemu@plt>
mov    %eax,%ebx
mov    $0x2710,%edi
call   1070 <usleep@plt>
cmp    $0x2,%ebx
je     1170 <main+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = call i32 @cmdargParse(i8** %7)
%9 = call i32 (...) @pre_init_modemu()
%10 = icmp ne i32 %9, 0
br i1 %10, label %12, label %11
11: ; preds = %2
store i32 0, i32* %3
br label %22
12: ; preds = %2
%13 = call i32 (...) @init_modemu()
br label %14
14: ; preds = %17, %12
%15 = call i32 (...) @run_modemu()
store i32 %15, i32* %6
%16 = call i32 @usleep(i32 10000)
br label %17
17: ; preds = %14
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, 2
br i1 %19, label %14, label %20
20: ; preds = %17
%21 = load i32, i32* %6
store i32 %21, i32* %3
br label %22
22: ; preds = %20, %11
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @cmdargParse(i8** %1)
%4 = tail call i32 (...) @pre_init_modemu()
%5 = icmp eq i32 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %2
%7 = tail call i32 (...) @init_modemu()
br label %8
8: ; preds = %8, %6
%9 = tail call i32 (...) @run_modemu()
%10 = tail call i32 @usleep(i32 10000)
%11 = icmp eq i32 %9, 2
br i1 %11, label %8, label %12
12: ; preds = %8, %2
%13 = phi i32 [ 0, %2 ], [ %9, %8 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ eoi_pic1();
int /*<<< orphan*/ outb(int, int);
void eoi_pic2(void) {
  outb(0x20, 0x00a0);
  eoi_pic1();
}


x86 assembly (clang, -O0):
<eoi_pic2>:
push   %rbp
mov    %rsp,%rbp
mov    $0x20,%edi
mov    $0xa0,%esi
call   1040 <outb@plt>
mov    $0x0,%al
call   1030 <eoi_pic1@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<eoi_pic2>:
push   %rax
mov    $0x20,%edi
mov    $0xa0,%esi
call   1040 <outb@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <eoi_pic1@plt>

LLVM IR (-O0):
define void @eoi_pic2() {
%1 = call i32 @outb(i32 32, i32 160)
%2 = call i32 (...) @eoi_pic1()
ret void
}

LLVM IR (-O2):
define void @eoi_pic2() {
%1 = tail call i32 @outb(i32 32, i32 160)
%2 = tail call i32 (...) @eoi_pic1()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int n = 10;
  if (n < 30) {
    printf("The number is less than 30.\n");
  } else if (n < 50) {
    printf("The number is less than 50\.n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
cmpl   $0x1e,-0x8(%rbp)
jge    1141 <main+0x31>
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <main+0x4c>
cmpl   $0x32,-0x8(%rbp)
jge    1157 <main+0x47>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
jmp    115c <main+0x4c>
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 = [29 x i8] c"The number is less than 30.\0A\00"
@.str.1 = [29 x i8] c"The number is less than 50.n\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 30
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
br label %13
7: ; preds = %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 50
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %12
12: ; preds = %10, %7
br label %13
13: ; preds = %12, %5
ret i32 0
}

LLVM IR (-O2):
@str = [28 x i8] c"The number is less than 30.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f(void) { printf("f() called\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"f() called\00"
define void @f() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int __VERIFIER_nondet_int();
int calculateNext(int s2) {
  int cnex;
  do
    cnex = __VERIFIER_nondet_int();
  while (cnex == s2 || cnex == 0);
  return cnex;
}


x86 assembly (clang, -O0):
<calculateNext>:
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)
mov    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    -0x4(%rbp),%ecx
mov    %al,-0x9(%rbp)
je     1140 <calculateNext+0x30>
cmpl   $0x0,-0x8(%rbp)
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    111b <calculateNext+0xb>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculateNext>:
push   %rbx
mov    %edi,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <__VERIFIER_nondet_int@plt>
cmp    %ebx,%eax
je     1120 <calculateNext+0x10>
test   %eax,%eax
je     1120 <calculateNext+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define i32 @calculateNext(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
br label %4
4: ; preds = %13, %1
%5 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %5, i32* %3
br label %6
6: ; preds = %4
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = icmp eq i32 %7, %8
br i1 %9, label %13, label %10
10: ; preds = %6
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 0
br label %13
13: ; preds = %10, %6
%14 = phi i1 [ true, %6 ], [ %12, %10 ]
br i1 %14, label %4, label %15
15: ; preds = %13
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @calculateNext(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = tail call i32 (...) @__VERIFIER_nondet_int()
%4 = icmp eq i32 %3, %0
%5 = icmp eq i32 %3, 0
%6 = or i1 %4, %5
br i1 %6, label %2, label %7
7: ; preds = %2
ret i32 %3
}
/* Variables and functions */
int ENOTSUP;
int /*<<< orphan*/ assert(char const *);
int smaunch_set_database_smack_path(const char *smackdb) {
  assert(smackdb);
  (void)smackdb;
  return -ENOTSUP;
}


x86 assembly (clang, -O0):
<smaunch_set_database_smack_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <assert@plt>
xor    %eax,%eax
mov    0x2eba(%rip),%rcx
sub    (%rcx),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smaunch_set_database_smack_path>:
push   %rax
call   1030 <assert@plt>
mov    0x2ecb(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOTSUP = global i32 0
define i32 @smaunch_set_database_smack_path(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @assert(i8* %3)
%5 = load i8*, i8** %2
%6 = load i32, i32* @ENOTSUP
%7 = sub nsw i32 0, %6
ret i32 %7
}

LLVM IR (-O2):
@ENOTSUP = global i32 0
define i32 @smaunch_set_database_smack_path(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = load i32, i32* @ENOTSUP
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Type definitions */
struct simple_track {
  int dummy;
};
struct editable {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ do_editable_add(struct editable *, struct simple_track *,
                                   int);
void editable_add_before(struct editable *e, struct simple_track *track) {
  do_editable_add(e, track, -1);
}


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

x86 assembly (clang, -O2):
<editable_add_before>:
mov    $0xffffffff,%edx
jmp    1030 <do_editable_add@plt>

LLVM IR (-O0):
%struct.editable = type { i32 }
%struct.simple_track = type { i32 }
define void @editable_add_before(%struct.editable* %0, %struct.simple_track* %1) {
%3 = alloca %struct.editable*
%4 = alloca %struct.simple_track*
store %struct.editable* %0, %struct.editable** %3
store %struct.simple_track* %1, %struct.simple_track** %4
%5 = load %struct.editable*, %struct.editable** %3
%6 = load %struct.simple_track*, %struct.simple_track** %4
%7 = call i32 @do_editable_add(%struct.editable* %5, %struct.simple_track* %6, i32 -1)
ret void
}

LLVM IR (-O2):
%struct.editable = type { i32 }
%struct.simple_track = type { i32 }
define void @editable_add_before(%struct.editable* %0, %struct.simple_track* %1) {
%3 = tail call i32 @do_editable_add(%struct.editable* %0, %struct.simple_track* %1, i32 -1)
ret void
}
void cpu_state_init() {}


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

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

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

LLVM IR (-O2):
define void @cpu_state_init() {
ret void
}
void value2reg(int val, unsigned char *b1, unsigned char *b2) {
  *b1 = val >> 2;
  *b2 = val << 6;
}


x86 assembly (clang, -O0):
<value2reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
mov    -0x4(%rbp),%eax
shl    $0x6,%eax
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<value2reg>:
mov    %edi,%eax
shr    $0x2,%eax
mov    %al,(%rsi)
shl    $0x6,%dil
mov    %dil,(%rdx)
ret

LLVM IR (-O0):
define void @value2reg(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = ashr i32 %7, 2
%9 = trunc i32 %8 to i8
%10 = load i8*, i8** %5
store i8 %9, i8* %10
%11 = load i32, i32* %4
%12 = shl i32 %11, 6
%13 = trunc i32 %12 to i8
%14 = load i8*, i8** %6
store i8 %13, i8* %14
ret void
}

LLVM IR (-O2):
define void @value2reg(i32 %0, i8* nocapture writeonly %1, i8* nocapture writeonly %2) {
%4 = lshr i32 %0, 2
%5 = trunc i32 %4 to i8
store i8 %5, i8* %1
%6 = trunc i32 %0 to i8
%7 = shl i8 %6, 6
store i8 %7, i8* %2
ret void
}
set(int *p, int v) { *p = v; }


x86 assembly (clang, -O0):
<set>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<set>:
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define i32 @set(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* %5
%7 = load i32*, i32** %4
store i32 %6, i32* %7
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @set(i32* nocapture writeonly %0, i32 %1) {
store i32 %1, i32* %0
ret i32 undef
}
/* Variables and functions */
bool nrf52_errata_25(void) { return false; }


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

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

LLVM IR (-O0):
define i32 @nrf52_errata_25() {
ret i32 0
}

LLVM IR (-O2):
define i32 @nrf52_errata_25() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void ply_error_cb(const char *message) {
  fprintf(stderr, "RPly: %s\n", message);
}


x86 assembly (clang, -O0):
<ply_error_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ply_error_cb>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [10 x i8] c"RPly: %s\0A\00"
define void @ply_error_cb(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [10 x i8] c"RPly: %s\0A\00"
define void @ply_error_cb(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int16_t;

/* Variables and functions */
int /*<<< orphan*/ memset(int /*<<< orphan*/ *, int /*<<< orphan*/, int);
void ioctl_audio_callback(int16_t *output, int len) {
  memset(output, 0, len * 2);
}


x86 assembly (clang, -O0):
<ioctl_audio_callback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ioctl_audio_callback>:
lea    (%rsi,%rsi,1),%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @ioctl_audio_callback(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 2
%8 = call i32 @memset(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @ioctl_audio_callback(i32* %0, i32 %1) {
%3 = shl nsw i32 %1, 1
%4 = tail call i32 @memset(i32* %0, i32 0, i32 %3)
ret void
}
int check(int n) {
  int i;
  for (i = 2; i <= n / 2; ++i) {
    if (n % i == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jg     115b <check+0x5b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1148 <check+0x48>
movl   $0x1,-0x4(%rbp)
jmp    1162 <check+0x62>
jmp    114d <check+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <check+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
xor    %r8d,%r8d
cmp    $0x4,%edi
jl     1137 <check+0x37>
mov    %edi,%esi
shr    %esi
neg    %esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     113b <check+0x3b>
lea    (%rsi,%rcx,1),%eax
add    $0x1,%eax
add    $0x1,%ecx
cmp    $0x1,%eax
jne    1120 <check+0x20>
mov    %r8d,%eax
ret
mov    $0x1,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @check(i32 %0) {
%2 = icmp slt i32 %0, 4
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %8
5: ; preds = %8
%6 = add nuw nsw i32 %9, 1
%7 = icmp eq i32 %9, %4
br i1 %7, label %12, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %6, %5 ], [ 2, %3 ]
%10 = srem i32 %0, %9
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %8, %5, %1
%13 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 1, %8 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ bof(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  char str[517];
  FILE *badfile;
  badfile = fopen("badfile", "r");
  fread(str, sizeof(char), 517, badfile);
  bof(str);
  printf("Returned Properly\n");
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x230,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x228(%rbp)
lea    -0x220(%rbp),%rdi
mov    -0x228(%rbp),%rcx
mov    $0x1,%esi
mov    $0x205,%edx
call   1030 <fread@plt>
lea    -0x220(%rbp),%rdi
call   1050 <bof@plt>
lea    0xe67(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x230,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x210,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1060 <fopen@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x205,%edx
mov    %rax,%rcx
call   1040 <fread@plt>
mov    %rbx,%rdi
call   1050 <bof@plt>
lea    0xe88(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x210,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"badfile\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [19 x i8] c"Returned Properly\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [517 x i8]
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %8, i32** %7
%9 = getelementptr inbounds [517 x i8], [517 x i8]* %6, i64 0, i64 0
%10 = load i32*, i32** %7
%11 = call i32 @fread(i8* %9, i32 1, i32 517, i32* %10)
%12 = getelementptr inbounds [517 x i8], [517 x i8]* %6, i64 0, i64 0
%13 = call i32 @bof(i8* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@.str = [8 x i8] c"badfile\00"
@.str.1 = [2 x i8] c"r\00"
@str = [18 x i8] c"Returned Properly\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [517 x i8]
%4 = getelementptr inbounds [517 x i8], [517 x i8]* %3, i64 0, i64 0
%5 = tail call i32* @fopen(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @fread(i8* %4, i32 1, i32 517, i32* %5)
%7 = call i32 @bof(i8* %4)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printArr(int *arr, int len) {
  int i;
  for (i = 0; i < len; i++) {
    printf("%d ", arr[i]);
  }
}


x86 assembly (clang, -O0):
<printArr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1157 <printArr+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printArr+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArr>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printArr+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printArr+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
define void @printArr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printArr(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
unsigned int nextpow2(unsigned int n) {
  n |= n >> 1;
  n |= n >> 2;
  n |= n >> 4;
  n |= n >> 8;
  n |= n >> 16;
  return (n + 1);
}


x86 assembly (clang, -O0):
<nextpow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextpow2>:
mov    %edi,%eax
shr    %eax
or     %edi,%eax
mov    %eax,%ecx
shr    $0x2,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x4,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x8,%ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x10,%eax
or     %ecx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @nextpow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = lshr i32 %3, 1
%5 = load i32, i32* %2
%6 = or i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = lshr i32 %7, 2
%9 = load i32, i32* %2
%10 = or i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = lshr i32 %11, 4
%13 = load i32, i32* %2
%14 = or i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = lshr i32 %15, 8
%17 = load i32, i32* %2
%18 = or i32 %17, %16
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = lshr i32 %19, 16
%21 = load i32, i32* %2
%22 = or i32 %21, %20
store i32 %22, i32* %2
%23 = load i32, i32* %2
%24 = add i32 %23, 1
ret i32 %24
}

LLVM IR (-O2):
define i32 @nextpow2(i32 %0) {
%2 = lshr i32 %0, 1
%3 = or i32 %2, %0
%4 = lshr i32 %3, 2
%5 = or i32 %4, %3
%6 = lshr i32 %5, 4
%7 = or i32 %6, %5
%8 = lshr i32 %7, 8
%9 = or i32 %8, %7
%10 = lshr i32 %9, 16
%11 = or i32 %10, %9
%12 = add i32 %11, 1
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ my_putchar(char);
void my_putstr(char *str) {
  int i;
  i = 0;
  while (*(str + i) != '\0') {
    my_putchar(*(str + i));
    i++;
  }
}


x86 assembly (clang, -O0):
<my_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1157 <my_putstr+0x47>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <my_putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <my_putstr+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <my_putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <my_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <my_putstr+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @my_putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = tail call i32 @my_putchar(i8 signext %6)
%8 = add nuw i64 %5, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
size_t ceil_div(size_t n, size_t d) { return n ? ((n - 1) / d) + 1 : 0; }


x86 assembly (clang, -O0):
<ceil_div>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1134 <ceil_div+0x34>
mov    -0x8(%rbp),%rax
sub    $0x1,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    113f <ceil_div+0x3f>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    113f <ceil_div+0x3f>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ceil_div>:
test   %rdi,%rdi
je     1122 <ceil_div+0x22>
add    $0xffffffffffffffff,%rdi
mov    %rdi,%rax
or     %rsi,%rax
shr    $0x20,%rax
je     1125 <ceil_div+0x25>
mov    %rdi,%rax
xor    %edx,%edx
div    %rsi
add    $0x1,%rax
ret
xor    %eax,%eax
ret
mov    %edi,%eax
xor    %edx,%edx
div    %esi
add    $0x1,%rax
ret

LLVM IR (-O0):
define i64 @ceil_div(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i64, i64* %3
%9 = sub i64 %8, 1
%10 = load i64, i64* %4
%11 = udiv i64 %9, %10
%12 = add i64 %11, 1
br label %14
13: ; preds = %2
br label %14
14: ; preds = %13, %7
%15 = phi i64 [ %12, %7 ], [ 0, %13 ]
ret i64 %15
}

LLVM IR (-O2):
define i64 @ceil_div(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = add i64 %0, -1
%6 = udiv i64 %5, %1
%7 = add nuw i64 %6, 1
br label %8
8: ; preds = %2, %4
%9 = phi i64 [ %7, %4 ], [ 0, %2 ]
ret i64 %9
}
int get_tableswitch_padding(unsigned long pc) { return 3 - (pc % 4); }


x86 assembly (clang, -O0):
<get_tableswitch_padding>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
and    $0x3,%rcx
mov    $0x3,%eax
sub    %rcx,%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @get_tableswitch_padding(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = and i32 %2, 3
%4 = xor i32 %3, 3
ret i32 %4
}
/* Variables and functions */
bool isPair(char open, char close) {
  switch (open) {
  case '(':
    return close == ')';
  case '{':
    return close == '}';
  case '[':
    return close == ']';
  default:
    return false;
  }
}


x86 assembly (clang, -O0):
<isPair>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x5(%rbp)
mov    %al,-0x6(%rbp)
movsbl -0x5(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x28,%eax
je     1147 <isPair+0x47>
jmp    1125 <isPair+0x25>
mov    -0xc(%rbp),%eax
sub    $0x5b,%eax
je     1175 <isPair+0x75>
jmp    1136 <isPair+0x36>
mov    -0xc(%rbp),%eax
sub    $0x7b,%eax
je     115e <isPair+0x5e>
jmp    118c <isPair+0x8c>
movsbl -0x6(%rbp),%eax
cmp    $0x29,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <isPair+0x93>
movsbl -0x6(%rbp),%eax
cmp    $0x7d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <isPair+0x93>
movsbl -0x6(%rbp),%eax
cmp    $0x5d,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1193 <isPair+0x93>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isPair>:
cmp    $0x7b,%edi
je     1115 <isPair+0x15>
cmp    $0x5b,%edi
je     111b <isPair+0x1b>
cmp    $0x28,%edi
jne    1126 <isPair+0x26>
cmp    $0x29,%sil
jmp    111f <isPair+0x1f>
cmp    $0x7d,%sil
jmp    111f <isPair+0x1f>
cmp    $0x5d,%sil
sete   %al
movzbl %al,%eax
ret
xor    %eax,%eax
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isPair(i8 signext %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i8
%5 = alloca i8
store i8 %0, i8* %4
store i8 %1, i8* %5
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
switch i32 %7, label %23 [
i32 40, label %8
i32 123, label %13
i32 91, label %18
]
8: ; preds = %2
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 41
%12 = zext i1 %11 to i32
store i32 %12, i32* %3
br label %24
13: ; preds = %2
%14 = load i8, i8* %5
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 125
%17 = zext i1 %16 to i32
store i32 %17, i32* %3
br label %24
18: ; preds = %2
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 93
%22 = zext i1 %21 to i32
store i32 %22, i32* %3
br label %24
23: ; preds = %2
store i32 0, i32* %3
br label %24
24: ; preds = %23, %18, %13, %8
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @isPair(i8 signext %0, i8 signext %1) {
%3 = sext i8 %0 to i32
switch i32 %3, label %10 [
i32 40, label %4
i32 123, label %6
i32 91, label %8
]
4: ; preds = %2
%5 = icmp eq i8 %1, 41
br label %10
6: ; preds = %2
%7 = icmp eq i8 %1, 125
br label %10
8: ; preds = %2
%9 = icmp eq i8 %1, 93
br label %10
10: ; preds = %2, %8, %6, %4
%11 = phi i1 [ %9, %8 ], [ %7, %6 ], [ %5, %4 ], [ false, %2 ]
%12 = zext i1 %11 to i32
ret i32 %12
}
void av_strdup() {}


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

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

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

LLVM IR (-O2):
define void @av_strdup() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ socket_server_stop();
int com_stop_server(void) { socket_server_stop(); }


x86 assembly (clang, -O0):
<com_stop_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <socket_server_stop@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @com_stop_server() {
%1 = alloca i32
%2 = call i32 (...) @socket_server_stop()
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @com_stop_server() {
%1 = tail call i32 (...) @socket_server_stop()
ret i32 undef
}
int add(int a1, int a2) { return a1 + a2; }


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

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

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

LLVM IR (-O2):
define i32 @add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
const char *mg_version(void) { return "3.5"; }


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"3.5\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [4 x i8] c"3.5\00"
define i8* @mg_version() {
ret i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ internal_fiat_poly1305_to_bytes(uintptr_t, uintptr_t);
void fiat_poly1305_to_bytes(uint8_t out1[17], const uint64_t arg1[3]) {
  internal_fiat_poly1305_to_bytes((uintptr_t)out1, (uintptr_t)arg1);
}


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

x86 assembly (clang, -O2):
<fiat_poly1305_to_bytes>:
jmp    1030 <internal_fiat_poly1305_to_bytes@plt>

LLVM IR (-O0):
define void @fiat_poly1305_to_bytes(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
store i32* %0, i32** %3
store i32* %1, i32** %4
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i64
%7 = load i32*, i32** %4
%8 = ptrtoint i32* %7 to i64
%9 = call i32 @internal_fiat_poly1305_to_bytes(i64 %6, i64 %8)
ret void
}

LLVM IR (-O2):
define void @fiat_poly1305_to_bytes(i32* %0, i32* %1) {
%3 = ptrtoint i32* %0 to i64
%4 = ptrtoint i32* %1 to i64
%5 = tail call i32 @internal_fiat_poly1305_to_bytes(i64 %3, i64 %4)
ret void
}
long stub_syscall5(long syscall, long arg1, long arg2, long arg3, long arg4,
                   long arg5) {
  long ret;
  __asm__ volatile("int $0x80"
                   : "=a"(ret)
                   : "0"(syscall), "b"(arg1), "c"(arg2), "d"(arg3), "S"(arg4),
                     "D"(arg5));
  return ret;
}


x86 assembly (clang, -O0):
<stub_syscall5>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rbx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdi
int    $0x80
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<stub_syscall5>:
push   %rbx
mov    %rcx,%r10
mov    %rdx,%rcx
mov    %rsi,%rbx
mov    %rdi,%rax
mov    %r10,%rdx
mov    %r9,%rdi
mov    %r8,%rsi
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
define i64 @stub_syscall5(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i64 %0, i64* %7
store i64 %1, i64* %8
store i64 %2, i64* %9
store i64 %3, i64* %10
store i64 %4, i64* %11
store i64 %5, i64* %12
%14 = load i64, i64* %7
%15 = load i64, i64* %8
%16 = load i64, i64* %9
%17 = load i64, i64* %10
%18 = load i64, i64* %11
%19 = load i64, i64* %12
%20 = call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},{si},{di},~{dirflag},~{fpsr},~{flags}"(i64 %14, i64 %15, i64 %16, i64 %17, i64 %18, i64 %19)
store i64 %20, i64* %13
%21 = load i64, i64* %13
ret i64 %21
}

LLVM IR (-O2):
define i64 @stub_syscall5(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5) {
%7 = tail call i64 asm sideeffect "int $$0x80", "={ax},0,{bx},{cx},{dx},{si},{di},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3, i64 %4, i64 %5)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ pointer(int *);
int /*<<< orphan*/ pointer2(int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int n = 20;
  pointer(&n);
  pointer2(&n);
  printf("n:%d\n", n);
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x14,0xc(%rsp)
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <pointer@plt>
mov    %rbx,%rdi
call   1030 <pointer2@plt>
mov    0xc(%rsp),%esi
lea    0xea3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"n:%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 20, i32* %1
%3 = call i32 @pointer(i32* %1)
%4 = call i32 @pointer2(i32* %1)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}
double errorSum(double error1, double error2) { return error1 + error2; }


x86 assembly (clang, -O0):
<errorSum>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<errorSum>:
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @errorSum(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fadd double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @errorSum(double %0, double %1) {
%3 = fadd double %0, %1
ret double %3
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void growl_tcp_close(int sock) {
  if (sock != -1)
    close(sock);
}


x86 assembly (clang, -O0):
<growl_tcp_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
je     112d <growl_tcp_close+0x1d>
mov    -0x4(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<growl_tcp_close>:
cmp    $0xffffffff,%edi
je     111a <growl_tcp_close+0xa>
jmp    1030 <close@plt>
ret

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

LLVM IR (-O2):
define void @growl_tcp_close(i32 %0) {
%2 = icmp eq i32 %0, -1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @close(i32 %0)
br label %5
5: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse(char *, int /*<<< orphan*/, scalar_t__);
scalar_t__ strlen(char *);
int main() {
  char s[] = "Hello, World!!!";
  reverse(s, 0, strlen(s) - 1);
  printf("%s", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %rax,%rdx
sub    $0x1,%rdx
xor    %esi,%esi
call   1030 <reverse@plt>
lea    -0x10(%rbp),%rsi
lea    0xe94(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movaps 0xec4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    -0x1(%rax),%rdx
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <reverse@plt>
lea    0xeb0(%rip),%rdi
mov    %rbx,%rsi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.s = [16 x i8] c"Hello, World!!!\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = bitcast [16 x i8]* %1 to i8*
%3 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%5 = call i64 @strlen(i8* %4)
%6 = sub nsw i64 %5, 1
%7 = call i32 @reverse(i8* %3, i32 0, i64 %6)
%8 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%9 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %8)
ret i32 0
}

LLVM IR (-O2):
@__const.main.s = [16 x i8] c"Hello, World!!!\00"
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [16 x i8]
%2 = getelementptr inbounds [16 x i8], [16 x i8]* %1, i64 0, i64 0
%3 = call i64 @strlen(i8* %2)
%4 = add nsw i64 %3, -1
%5 = call i32 @reverse(i8* %2, i32 0, i64 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
scalar_t__ uvl_unload_all_modules();
int /*<<< orphan*/ vita_logf(char *, int, char *);
int uvl_cleanup_memory() {
  if (uvl_unload_all_modules() < 0) {
    vita_logf("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/"
              "cleanup.c",
              255, "Failed to unload all modules.");
    return -1;
  }
}


x86 assembly (clang, -O0):
<uvl_cleanup_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <uvl_unload_all_modules@plt>
cmp    $0x0,%rax
jge    1158 <uvl_cleanup_memory+0x38>
lea    0xec0(%rip),%rdi
mov    $0xff,%esi
lea    0xf3c(%rip),%rdx
call   1040 <vita_logf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uvl_cleanup_memory>:
push   %rax
xor    %eax,%eax
call   1030 <uvl_unload_all_modules@plt>
test   %rax,%rax
jns    1145 <uvl_cleanup_memory+0x25>
lea    0xecc(%rip),%rdi
lea    0xf4d(%rip),%rdx
mov    $0xff,%esi
call   1040 <vita_logf@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/cleanup.c\00"
@.str.1 = [30 x i8] c"Failed to unload all modules.\00"
define i32 @uvl_cleanup_memory() {
%1 = alloca i32
%2 = call i64 (...) @uvl_unload_all_modules()
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @vita_logf(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %6
6: ; preds = %4, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [136 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/MrNetrix/UVLoader/refs/heads/master/cleanup.c\00"
@.str.1 = [30 x i8] c"Failed to unload all modules.\00"
define i32 @uvl_cleanup_memory() {
%1 = tail call i64 (...) @uvl_unload_all_modules()
%2 = icmp slt i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @vita_logf(i8* getelementptr inbounds ([136 x i8], [136 x i8]* @.str, i64 0, i64 0), i32 255, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
ret i32 -1
}