xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ malloc(int);
void leak_memory(void) {
  char *ptr1, *ptr2;
  ptr1 = (char *)malloc(32);
  ptr2 = (char *)malloc(1024);
  return;
}


x86 assembly (clang, -O0):
<leak_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x400,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<leak_memory>:
push   %rax
mov    $0x20,%edi
call   1030 <malloc@plt>
mov    $0x400,%edi
pop    %rax
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define void @leak_memory() {
%1 = alloca i8*
%2 = alloca i8*
%3 = call i64 @malloc(i32 32)
%4 = inttoptr i64 %3 to i8*
store i8* %4, i8** %1
%5 = call i64 @malloc(i32 1024)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %2
ret void
}

LLVM IR (-O2):
define void @leak_memory() {
%1 = tail call i64 @malloc(i32 32)
%2 = tail call i64 @malloc(i32 1024)
ret void
}
/* Variables and functions */
int write(int, char *, int);
int _write_byte(int fd, char c) {
  if (-1 == fd)
    return 0;
  return write(fd, &c, 1);
}


x86 assembly (clang, -O0):
<_write_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    $0xffffffff,%eax
cmp    -0x8(%rbp),%eax
jne    113b <_write_byte+0x2b>
movl   $0x0,-0x4(%rbp)
jmp    114f <_write_byte+0x3f>
mov    -0x8(%rbp),%edi
lea    -0x9(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write_byte>:
push   %rax
mov    %sil,0x7(%rsp)
cmp    $0xffffffff,%edi
je     112c <_write_byte+0x1c>
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @_write_byte(i32 %0, i8 signext %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8
store i32 %0, i32* %4
store i8 %1, i8* %5
%6 = load i32, i32* %4
%7 = icmp eq i32 -1, %6
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 0, i32* %3
br label %12
9: ; preds = %2
%10 = load i32, i32* %4
%11 = call i32 @write(i32 %10, i8* %5, i32 1)
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %8
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @_write_byte(i32 %0, i8 signext %1) {
%3 = alloca i8
store i8 %1, i8* %3
%4 = icmp eq i32 %0, -1
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = call i32 @write(i32 %0, i8* %3, i32 1)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ %6, %5 ], [ 0, %2 ]
ret i32 %8
}
void g_slice_alloc0() {}


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

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

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

LLVM IR (-O2):
define void @g_slice_alloc0() {
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ Clock_gettime(int /*<<< orphan*/, struct timespec *);
struct timespec Timespec_current(void) {
  struct timespec retval;
  Clock_gettime(CLOCK_REALTIME, &retval);
  return retval;
}


x86 assembly (clang, -O0):
<Timespec_current>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <Clock_gettime@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Timespec_current>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <Clock_gettime@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @Timespec_current() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @Clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @Timespec_current() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_REALTIME
%3 = call i32 @Clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
scalar_t__ malloc(int);
float *tml_sr_Malloc(int length) {
  return (float *)malloc(length * sizeof(float));
}


x86 assembly (clang, -O0):
<tml_sr_Malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tml_sr_Malloc>:
shl    $0x2,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define float* @tml_sr_Malloc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = mul i64 %4, 4
%6 = trunc i64 %5 to i32
%7 = call i64 @malloc(i32 %6)
%8 = inttoptr i64 %7 to float*
ret float* %8
}

LLVM IR (-O2):
define float* @tml_sr_Malloc(i32 %0) {
%2 = shl i32 %0, 2
%3 = tail call i64 @malloc(i32 %2)
%4 = inttoptr i64 %3 to float*
ret float* %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void _CATMSG_Xran(void) {
  fputs("Out of range: invalid dynamic array position\n", stderr);
  abort();
}


x86 assembly (clang, -O0):
<_CATMSG_Xran>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<_CATMSG_Xran>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <fputs@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Out of range: invalid dynamic array position\0A\00"
@stderr = global i32 0
define void @_CATMSG_Xran() {
%1 = load i32, i32* @stderr
%2 = call i32 @fputs(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@.str = [46 x i8] c"Out of range: invalid dynamic array position\0A\00"
@stderr = global i32 0
define void @_CATMSG_Xran() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fputs(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %1)
%3 = tail call i32 (...) @abort()
unreachable
}
unsigned int one_num(unsigned int idx) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @one_num(i32 %0) {
ret i32 0
}
int AtEoIF() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @AtEoIF() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, size_t, void *);
void *real_malloc(size_t);
int /*<<< orphan*/ stderr;
void *malloc(size_t size) {
  void *ptr = real_malloc(size);
  fprintf(stderr, "malloc(%#lx) -> %p\n", size, ptr);
  return ptr;
}


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

x86 assembly (clang, -O2):
<malloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <real_malloc@plt>
mov    %rax,%rbx
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
lea    0xec1(%rip),%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
call   1030 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"malloc(%#lx) -> %p\0A\00"
define i8* @malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @real_malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i32, i32* @stderr
%7 = load i64, i64* %2
%8 = load i8*, i8** %3
%9 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %7, i8* %8)
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"malloc(%#lx) -> %p\0A\00"
define i8* @malloc(i64 %0) {
%2 = tail call i8* @real_malloc(i64 %0)
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0, i8* %2)
ret i8* %2
}
/* Variables and functions */
int pop();
int /*<<< orphan*/ push(int);
void apply_div(void) {
  int arg2 = pop();
  int arg1 = pop();
  push(arg1 / arg2);
}


x86 assembly (clang, -O0):
<apply_div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <pop@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cltd
idivl  -0x4(%rbp)
mov    %eax,%edi
call   1040 <push@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply_div>:
push   %rbx
xor    %eax,%eax
call   1030 <pop@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <pop@plt>
cltd
idiv   %ebx
mov    %eax,%edi
pop    %rbx
jmp    1040 <push@plt>

LLVM IR (-O0):
define void @apply_div() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @pop()
store i32 %3, i32* %1
%4 = call i32 (...) @pop()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = sdiv i32 %5, %6
%8 = call i32 @push(i32 %7)
ret void
}

LLVM IR (-O2):
define void @apply_div() {
%1 = tail call i32 (...) @pop()
%2 = tail call i32 (...) @pop()
%3 = sdiv i32 %2, %1
%4 = tail call i32 @push(i32 %3)
ret void
}
/* Variables and functions */
float Factorial(double);
int main(void) {
  float result;
  result = Factorial(2.1);
  return (0);
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call float @Factorial(double 2.100000e+00)
store float %3, float* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call float @Factorial(double 2.100000e+00)
ret i32 0
}
/* Variables and functions */
int accept_new_client();
int start_server();
int /*<<< orphan*/ stop_server();
int /*<<< orphan*/ vm_run(int);
int vm_main() {
  int ret;
  ret = start_server();
  if (ret < 0)
    return 0;
  for (;;) {
    int socket_fd = accept_new_client();
    if (socket_fd < 0)
      return -1;
    vm_run(socket_fd);
  }
  stop_server();
  return 0;
}


x86 assembly (clang, -O0):
<vm_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <start_server@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1158 <vm_main+0x28>
movl   $0x0,-0x4(%rbp)
jmp    118a <vm_main+0x5a>
jmp    115d <vm_main+0x2d>
mov    $0x0,%al
call   1040 <accept_new_client@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    117d <vm_main+0x4d>
movl   $0xffffffff,-0x4(%rbp)
jmp    118a <vm_main+0x5a>
mov    -0xc(%rbp),%edi
call   1030 <vm_run@plt>
jmp    115d <vm_main+0x2d>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vm_main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <start_server@plt>
test   %eax,%eax
js     1162 <vm_main+0x32>
xor    %eax,%eax
call   1040 <accept_new_client@plt>
mov    $0xffffffff,%ebx
test   %eax,%eax
js     1162 <vm_main+0x32>
xchg   %ax,%ax
mov    %eax,%edi
call   1030 <vm_run@plt>
xor    %eax,%eax
call   1040 <accept_new_client@plt>
test   %eax,%eax
jns    1150 <vm_main+0x20>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vm_main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (...) @start_server()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
store i32 0, i32* %1
br label %17
8: ; preds = %0
br label %9
9: ; preds = %14, %8
%10 = call i32 (...) @accept_new_client()
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 -1, i32* %1
br label %17
14: ; preds = %9
%15 = load i32, i32* %3
%16 = call i32 @vm_run(i32 %15)
br label %9
17: ; preds = %13, %7
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @vm_main() {
%1 = tail call i32 (...) @start_server()
%2 = icmp slt i32 %1, 0
br i1 %2, label %11, label %3
3: ; preds = %0
%4 = tail call i32 (...) @accept_new_client()
%5 = icmp slt i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ %4, %3 ]
%8 = tail call i32 @vm_run(i32 %7)
%9 = tail call i32 (...) @accept_new_client()
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %6
11: ; preds = %6, %3, %0
%12 = phi i32 [ 0, %0 ], [ -1, %3 ], [ -1, %6 ]
ret i32 %12
}
/* Variables and functions */
void *m(size_t);
void *n2(size_t n) { return m(n); }


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

x86 assembly (clang, -O2):
<n2>:
jmp    1030 <m@plt>

LLVM IR (-O0):
define i8* @n2(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @m(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define i8* @n2(i64 %0) {
%2 = tail call i8* @m(i64 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ paillier_get_rand_file(void *, int, char *);
void paillier_get_rand_devrandom(void *buf, int len) {
  paillier_get_rand_file(buf, len, "/dev/random");
}


x86 assembly (clang, -O0):
<paillier_get_rand_devrandom>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdx
call   1030 <paillier_get_rand_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<paillier_get_rand_devrandom>:
lea    0xee9(%rip),%rdx
jmp    1030 <paillier_get_rand_file@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"/dev/random\00"
define void @paillier_get_rand_devrandom(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i8*, i8** %3
%6 = load i32, i32* %4
%7 = call i32 @paillier_get_rand_file(i8* %5, i32 %6, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"/dev/random\00"
define void @paillier_get_rand_devrandom(i8* %0, i32 %1) {
%3 = tail call i32 @paillier_get_rand_file(i8* %0, i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strnlen(const char *str, unsigned int sz) {
  int res = 0;
  while (*str++ && sz--)
    res++;
  return res;
}


x86 assembly (clang, -O0):
<strnlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1146 <strnlen+0x46>
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1156 <strnlen+0x56>
jmp    1164 <strnlen+0x64>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1112 <strnlen+0x12>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strnlen>:
xor    %eax,%eax
cmpb   $0x0,(%rdi)
je     1122 <strnlen+0x22>
test   %esi,%esi
je     1122 <strnlen+0x22>
add    $0xffffffff,%esi
xor    %ecx,%ecx
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
je     1122 <strnlen+0x22>
cmp    %ecx,%esi
mov    %rax,%rcx
jne    1110 <strnlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @strnlen(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
%5 = icmp eq i32 %1, 0
%6 = or i1 %4, %5
br i1 %6, label %18, label %7
7: ; preds = %2, %7
%8 = phi i32 [ %13, %7 ], [ 0, %2 ]
%9 = phi i32 [ %12, %7 ], [ %1, %2 ]
%10 = phi i8* [ %11, %7 ], [ %0, %2 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = add i32 %9, -1
%13 = add nuw nsw i32 %8, 1
%14 = load i8, i8* %11
%15 = icmp eq i8 %14, 0
%16 = icmp eq i32 %12, 0
%17 = select i1 %15, i1 true, i1 %16
br i1 %17, label %18, label %7
18: ; preds = %7, %2
%19 = phi i32 [ 0, %2 ], [ %13, %7 ]
ret i32 %19
}
void bn_zero(unsigned int *bn) {
  int i;
  for (i = 0; i < 2; i++) {
    bn[i] = 0;
  }
}


x86 assembly (clang, -O0):
<bn_zero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1136 <bn_zero+0x36>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <bn_zero+0xf>
pop    %rbp
ret

x86 assembly (clang, -O2):
<bn_zero>:
movq   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @bn_zero(i32* nocapture writeonly %0) {
%2 = bitcast i32* %0 to i64*
store i64 0, i64* %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ CloseSystemLog();
int /*<<< orphan*/ bb_perror_msg_and_die(char const *);
void error_exit(const char *str) {
  CloseSystemLog();
  bb_perror_msg_and_die(str);
}


x86 assembly (clang, -O0):
<error_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <CloseSystemLog@plt>
mov    -0x8(%rbp),%rdi
call   1040 <bb_perror_msg_and_die@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<error_exit>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <CloseSystemLog@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <bb_perror_msg_and_die@plt>

LLVM IR (-O0):
define void @error_exit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (...) @CloseSystemLog()
%4 = load i8*, i8** %2
%5 = call i32 @bb_perror_msg_and_die(i8* %4)
ret void
}

LLVM IR (-O2):
define void @error_exit(i8* %0) {
%2 = tail call i32 (...) @CloseSystemLog()
%3 = tail call i32 @bb_perror_msg_and_die(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sigwinch(int unused) { printf("Sigwinch!\n"); }


x86 assembly (clang, -O0):
<sigwinch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"Sigwinch!\0A\00"
define void @sigwinch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [10 x i8] c"Sigwinch!\00"
define void @sigwinch(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
unsigned int UARTSpaceAvail(unsigned int baseAdd) {
  unsigned int retVal = 0;
  if ((*((volatile unsigned int *)(baseAdd + (0x14)))) &
      ((0x00000040u) | (0x00000020u))) {
    retVal = 1;
  }
  return retVal;
}


x86 assembly (clang, -O0):
<UARTSpaceAvail>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x14,%eax
mov    %eax,%eax
mov    (%rax),%eax
and    $0x60,%eax
cmp    $0x0,%eax
je     112b <UARTSpaceAvail+0x2b>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<UARTSpaceAvail>:
add    $0x14,%edi
xor    %eax,%eax
testl  $0x60,(%rdi)
setne  %al
ret

LLVM IR (-O0):
define i32 @UARTSpaceAvail(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = add i32 %4, 20
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
%9 = and i32 %8, 96
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %3
br label %12
12: ; preds = %11, %1
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @UARTSpaceAvail(i32 %0) {
%2 = add i32 %0, 20
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
%6 = and i32 %5, 96
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
char *strchr(char const *, char const);
int getOccurCount(const char *src, const char seperator) {
  int count;
  char *p;
  count = 0;
  p = strchr(src, seperator);
  while (p != NULL) {
    count++;
    p = strchr(p + 1, seperator);
  }
  return count;
}


x86 assembly (clang, -O0):
<getOccurCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1168 <getOccurCount+0x58>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
add    $0x1,%rdi
movsbl -0x9(%rbp),%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
jmp    113a <getOccurCount+0x2a>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getOccurCount>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
call   1030 <strchr@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1146 <getOccurCount+0x36>
movsbl %bpl,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
add    $0x1,%rax
mov    %rax,%rdi
mov    %ebp,%esi
call   1030 <strchr@plt>
test   %rax,%rax
jne    1130 <getOccurCount+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @getOccurCount(i8* %0, i8 signext %1) {
%3 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %12, label %5
5: ; preds = %2, %5
%6 = phi i8* [ %10, %5 ], [ %3, %2 ]
%7 = phi i32 [ %8, %5 ], [ 0, %2 ]
%8 = add nuw nsw i32 %7, 1
%9 = getelementptr inbounds i8, i8* %6, i64 1
%10 = tail call i8* @strchr(i8* %9, i8 signext %1)
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %5
12: ; preds = %5, %2
%13 = phi i32 [ 0, %2 ], [ %8, %5 ]
ret i32 %13
}
/* Type definitions */
typedef scalar_t__ volatile uint32_t;

/* Variables and functions */
uint32_t ivory_hw_io_read_u32(uint32_t addr) {
  return *((volatile uint32_t *)addr);
}


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

x86 assembly (clang, -O2):
<ivory_hw_io_read_u32>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    (%rax),%rax
ret

LLVM IR (-O0):
define i64 @ivory_hw_io_read_u32(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
define i64 @ivory_hw_io_read_u32(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = inttoptr i64 %3 to i64*
%5 = load volatile i64, i64* %4
ret i64 %5
}
unsigned long rol(unsigned long val) {
  int hbit = val & 0x80000000;
  val <<= 1;
  if (hbit) {
    val |= 1;
  }
  return val;
}


x86 assembly (clang, -O0):
<rol>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movabs $0x80000000,%rax
and    -0x8(%rbp),%rax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x1,%rax
mov    %rax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     113b <rol+0x3b>
mov    -0x8(%rbp),%rax
or     $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rol>:
mov    %edi,%eax
shr    $0x1f,%eax
lea    (%rax,%rdi,2),%rax
ret

LLVM IR (-O0):
define i64 @rol(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = and i64 %4, 2147483648
%6 = trunc i64 %5 to i32
store i32 %6, i32* %3
%7 = load i64, i64* %2
%8 = shl i64 %7, 1
store i64 %8, i64* %2
%9 = load i32, i32* %3
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %1
%12 = load i64, i64* %2
%13 = or i64 %12, 1
store i64 %13, i64* %2
br label %14
14: ; preds = %11, %1
%15 = load i64, i64* %2
ret i64 %15
}

LLVM IR (-O2):
define i64 @rol(i64 %0) {
%2 = shl i64 %0, 1
%3 = lshr i64 %0, 31
%4 = and i64 %3, 1
%5 = or i64 %4, %2
ret i64 %5
}
void antic_read_byte_blank_mode_2(void) {}


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

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

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

LLVM IR (-O2):
define void @antic_read_byte_blank_mode_2() {
ret void
}
main() {
  f((char[]){1, 2, 3, 4, 5, 6, 7, 8, 9});
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x1,-0xd(%rbp)
movb   $0x2,-0xc(%rbp)
movb   $0x3,-0xb(%rbp)
movb   $0x4,-0xa(%rbp)
movb   $0x5,-0x9(%rbp)
movb   $0x6,-0x8(%rbp)
movb   $0x7,-0x7(%rbp)
movb   $0x8,-0x6(%rbp)
movb   $0x9,-0x5(%rbp)
lea    -0xd(%rbp),%rdi
mov    $0x0,%al
call   1030 <f@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x807060504030201,%rax
06 07 08
mov    %rax,0xf(%rsp)
movb   $0x9,0x17(%rsp)
lea    0xf(%rsp),%rdi
xor    %eax,%eax
call   1030 <f@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [9 x i8]
%2 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
store i8 1, i8* %2
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 1
store i8 2, i8* %3
%4 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 2
store i8 3, i8* %4
%5 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 3
store i8 4, i8* %5
%6 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 4
store i8 5, i8* %6
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 5
store i8 6, i8* %7
%8 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 6
store i8 7, i8* %8
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 7
store i8 8, i8* %9
%10 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 8
store i8 9, i8* %10
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @f to i32 (i8*, ...)*)(i8* %2)
ret i32 0
}
char *find(c, str)
char c, *str;
{
  while (*str && *str != c)
    str++;
  return (str);
}


x86 assembly (clang, -O0):
<find>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1136 <find+0x36>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
movsbl -0x1(%rbp),%ecx
cmp    %ecx,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1146 <find+0x46>
jmp    1157 <find+0x57>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    110e <find+0xe>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find>:
mov    %rsi,%rax
mov    (%rsi),%cl
test   %cl,%cl
je     1123 <find+0x23>
movsbl %dil,%edx
nopl   (%rax)
movsbl %cl,%ecx
cmp    %ecx,%edx
je     1123 <find+0x23>
movzbl 0x1(%rax),%ecx
add    $0x1,%rax
test   %cl,%cl
jne    1110 <find+0x10>
ret

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

LLVM IR (-O2):
define i8* @find(i32 %0, i8* %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2
%6 = shl i32 %0, 24
%7 = ashr exact i32 %6, 24
br label %8
8: ; preds = %5, %13
%9 = phi i8 [ %3, %5 ], [ %15, %13 ]
%10 = phi i8* [ %1, %5 ], [ %14, %13 ]
%11 = sext i8 %9 to i32
%12 = icmp eq i32 %7, %11
br i1 %12, label %17, label %13
13: ; preds = %8
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %8
17: ; preds = %8, %13, %2
%18 = phi i8* [ %1, %2 ], [ %14, %13 ], [ %10, %8 ]
ret i8* %18
}
/* Variables and functions */
char *malloc(int);
int rand();
char *realloc(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
char *fn80() {
  char *result;
  result = malloc(20 + rand() % 20);
  result = realloc(result, 30 + rand() % 20);
  strcpy((char *)result, "fn80");
  return result;
}


x86 assembly (clang, -O0):
<fn80>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <rand@plt>
mov    -0x10(%rbp),%rdi
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %edx,%esi
add    $0x1e,%esi
call   1050 <realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe67(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn80>:
push   %rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%edi
add    $0x14,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1060 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
neg    %ecx
lea    (%rax,%rcx,1),%esi
add    $0x1e,%esi
mov    %rbx,%rdi
call   1050 <realloc@plt>
mov    %rax,%rbx
lea    0xe4f(%rip),%rsi
mov    %rax,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"fn80\00"
define i8* @fn80() {
%1 = alloca i8*
%2 = call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = add nsw i32 20, %3
%5 = call i8* @malloc(i32 %4)
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 20
%9 = add nsw i32 30, %8
%10 = call i8* @realloc(i8* %6, i32 %9)
store i8* %10, i8** %1
%11 = load i8*, i8** %1
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %1
ret i8* %13
}

LLVM IR (-O2):
@.str = [5 x i8] c"fn80\00"
define i8* @fn80() {
%1 = tail call i32 (...) @rand()
%2 = srem i32 %1, 20
%3 = add nsw i32 %2, 20
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 20
%7 = add nsw i32 %6, 30
%8 = tail call i8* @realloc(i8* %4, i32 %7)
%9 = tail call i32 @strcpy(i8* %8, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ DEBUG_ASSERT(int /*<<< orphan*/);
int /*<<< orphan*/ IntDisable(unsigned long);
int /*<<< orphan*/ IntUnregister(unsigned long);
int /*<<< orphan*/ SSIBaseValid(unsigned long);
unsigned long SSIIntNumberGet(unsigned long);
void SSIIntUnregister(unsigned long ulBase) {
  unsigned long ulInt;
  DEBUG_ASSERT(SSIBaseValid(ulBase));
  ulInt = SSIIntNumberGet(ulBase);
  IntDisable(ulInt);
  IntUnregister(ulInt);
}


x86 assembly (clang, -O0):
<SSIIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <SSIBaseValid@plt>
mov    %eax,%edi
call   1050 <DEBUG_ASSERT@plt>
mov    -0x8(%rbp),%rdi
call   1040 <SSIIntNumberGet@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <IntDisable@plt>
mov    -0x10(%rbp),%rdi
call   1060 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SSIIntUnregister>:
push   %rbx
mov    %rdi,%rbx
call   1070 <SSIBaseValid@plt>
mov    %eax,%edi
call   1050 <DEBUG_ASSERT@plt>
mov    %rbx,%rdi
call   1040 <SSIIntNumberGet@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <IntDisable@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1060 <IntUnregister@plt>

LLVM IR (-O0):
define void @SSIIntUnregister(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i32 @SSIBaseValid(i64 %4)
%6 = call i32 @DEBUG_ASSERT(i32 %5)
%7 = load i64, i64* %2
%8 = call i64 @SSIIntNumberGet(i64 %7)
store i64 %8, i64* %3
%9 = load i64, i64* %3
%10 = call i32 @IntDisable(i64 %9)
%11 = load i64, i64* %3
%12 = call i32 @IntUnregister(i64 %11)
ret void
}

LLVM IR (-O2):
define void @SSIIntUnregister(i64 %0) {
%2 = tail call i32 @SSIBaseValid(i64 %0)
%3 = tail call i32 @DEBUG_ASSERT(i32 %2)
%4 = tail call i64 @SSIIntNumberGet(i64 %0)
%5 = tail call i32 @IntDisable(i64 %4)
%6 = tail call i32 @IntUnregister(i64 %4)
ret void
}
void INT_Excep_PERIA_INTA214(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIA_INTA214() {
ret void
}
void InitialiseTypes(void) {
  struct fieldnode *fields;
  int arraydims[16];
  arraydims[0] = 0;
}


x86 assembly (clang, -O0):
<InitialiseTypes>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x50(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.fieldnode = type opaque
define void @InitialiseTypes() {
%1 = alloca %struct.fieldnode*
%2 = alloca [16 x i32]
%3 = getelementptr inbounds [16 x i32], [16 x i32]* %2, i64 0, i64 0
store i32 0, i32* %3
ret void
}

LLVM IR (-O2):
%struct.fieldnode = type opaque
define void @InitialiseTypes() {
ret void
}
void fn0AE6() { return; }


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

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

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

LLVM IR (-O2):
define void @fn0AE6() {
ret void
}
int check_number(int number, int n) {
  int m;
  int i = 0;
  do {
    m = number % 10;
    if (m == 9)
      i++;
  } while (number /= 10);
  return i;
}


x86 assembly (clang, -O0):
<check_number>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jne    1132 <check_number+0x32>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <check_number+0x37>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
jne    1111 <check_number+0x11>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_number>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movslq %edi,%rcx
imul   $0x66666667,%rcx,%rdi
mov    %rdi,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rdi
add    %edx,%edi
lea    (%rdi,%rdi,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%esi
sub    %edx,%esi
xor    %edx,%edx
cmp    $0x9,%esi
sete   %dl
add    %edx,%eax
add    $0x9,%ecx
cmp    $0x12,%ecx
ja     1110 <check_number+0x10>
ret

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

LLVM IR (-O2):
define i32 @check_number(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ %0, %2 ], [ %10, %3 ]
%5 = phi i32 [ 0, %2 ], [ %9, %3 ]
%6 = srem i32 %4, 10
%7 = icmp eq i32 %6, 9
%8 = zext i1 %7 to i32
%9 = add nuw nsw i32 %5, %8
%10 = sdiv i32 %4, 10
%11 = add i32 %4, 9
%12 = icmp ult i32 %11, 19
br i1 %12, label %13, label %3
13: ; preds = %3
ret i32 %9
}
/* Variables and functions */
scalar_t__ LINES;
int /*<<< orphan*/ clear();
int /*<<< orphan*/ move(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ printChats();
int /*<<< orphan*/ printw(char *, char *);
int /*<<< orphan*/ refresh();
void updateTerm() {
  clear();
  printChats();
  move(LINES - 1, 0);
  printw("%s", "YOU:");
  refresh();
}


x86 assembly (clang, -O0):
<updateTerm>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <clear@plt>
mov    $0x0,%al
call   1050 <printChats@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe82(%rip),%rdi
lea    0xe7e(%rip),%rsi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateTerm>:
push   %rax
xor    %eax,%eax
call   1060 <clear@plt>
xor    %eax,%eax
call   1050 <printChats@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
call   1070 <move@plt>
lea    0xe85(%rip),%rdi
lea    0xe81(%rip),%rsi
call   1030 <printw@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <refresh@plt>

LLVM IR (-O0):
@LINES = global i64 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"YOU:\00"
define void @updateTerm() {
%1 = call i32 (...) @clear()
%2 = call i32 (...) @printChats()
%3 = load i64, i64* @LINES
%4 = sub nsw i64 %3, 1
%5 = call i32 @move(i64 %4, i32 0)
%6 = call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
@LINES = global i64 0
@.str = [3 x i8] c"%s\00"
@.str.1 = [5 x i8] c"YOU:\00"
define void @updateTerm() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 (...) @printChats()
%3 = load i64, i64* @LINES
%4 = add nsw i64 %3, -1
%5 = tail call i32 @move(i64 %4, i32 0)
%6 = tail call i32 @printw(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cgbrcond(char *, int);
void cgbreq(int n) { cgbrcond("je", n); }


x86 assembly (clang, -O0):
<cgbreq>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <cgbrcond@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgbreq>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <cgbrcond@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"je\00"
define void @cgbreq(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @cgbrcond(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"je\00"
define void @cgbreq(i32 %0) {
%2 = tail call i32 @cgbrcond(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
void *malloc(int);
int main(int argc, char **argv) {
  void *p = malloc(16);
  ((char *)p)[0] = 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i8*
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = call i8* @malloc(i32 16)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = getelementptr inbounds i8, i8* %7, i64 0
store i8 0, i8* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ pthread_cancel(int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void *killer(void *arg) {
  pthread_t *target = (pthread_t *)arg;
  sleep(1);
  pthread_cancel(*target);
  return (NULL);
}


x86 assembly (clang, -O0):
<killer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1030 <pthread_cancel@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<killer>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
call   1040 <sleep@plt>
mov    (%rbx),%edi
call   1030 <pthread_cancel@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @killer(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %3
%6 = call i32 @sleep(i32 1)
%7 = load i32*, i32** %3
%8 = load i32, i32* %7
%9 = call i32 @pthread_cancel(i32 %8)
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @killer(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 @sleep(i32 1)
%4 = load i32, i32* %2
%5 = tail call i32 @pthread_cancel(i32 %4)
ret i8* null
}
char *skipblank(char *str) {
  register char *ptr;
  for (ptr = str; *ptr == ' ' || *ptr == '\t'; ptr++)
    ;
  return ptr;
}


x86 assembly (clang, -O0):
<skipblank>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x11(%rbp)
je     1135 <skipblank+0x35>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1145 <skipblank+0x45>
jmp    115b <skipblank+0x5b>
jmp    114a <skipblank+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <skipblank+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skipblank>:
mov    %rdi,%rax
jmp    1114 <skipblank+0x14>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1110 <skipblank+0x10>
cmp    $0x9,%cl
je     1110 <skipblank+0x10>
ret

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

LLVM IR (-O2):
define i8* @skipblank(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %7 [
i8 32, label %5
i8 9, label %5
]
5: ; preds = %2, %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int _vga_get_cursor_position_offset();
int vga_get_cursor_position_row(void) {
  return (_vga_get_cursor_position_offset() / 2) / 80;
}


x86 assembly (clang, -O0):
<vga_get_cursor_position_row>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <_vga_get_cursor_position_offset@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0x50,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_get_cursor_position_row>:
push   %rax
xor    %eax,%eax
call   1030 <_vga_get_cursor_position_offset@plt>
cltq
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @vga_get_cursor_position_row() {
%1 = call i32 (...) @_vga_get_cursor_position_offset()
%2 = sdiv i32 %1, 2
%3 = sdiv i32 %2, 80
ret i32 %3
}

LLVM IR (-O2):
define i32 @vga_get_cursor_position_row() {
%1 = tail call i32 (...) @_vga_get_cursor_position_offset()
%2 = sdiv i32 %1, 160
ret i32 %2
}