xunge/DecIR huggingface dataset:
int compar(const void *a, const void *b) {
  int *aa = (int *)a;
  int *bb = (int *)b;
  if (*aa > *bb)
    return 1;
  if (*aa == *bb)
    return 0;
  if (*aa < *bb)
    return -1;
}


x86 assembly (clang, -O0):
<compar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jle    113a <compar+0x3a>
movl   $0x1,-0x4(%rbp)
jmp    1171 <compar+0x71>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jne    1158 <compar+0x58>
movl   $0x0,-0x4(%rbp)
jmp    1171 <compar+0x71>
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    -0x28(%rbp),%rcx
cmp    (%rcx),%eax
jge    1171 <compar+0x71>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compar>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setne  %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @compar(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sgt i32 %5, %6
%8 = icmp ne i32 %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int rand();
int rand_between(int first, int last) {
  return first + rand() % (last - first);
}


x86 assembly (clang, -O0):
<rand_between>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_between>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rand_between(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 = call i32 (...) @rand()
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = srem i32 %6, %9
%11 = add nsw i32 %5, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @rand_between(i32 %0, i32 %1) {
%3 = tail call i32 (...) @rand()
%4 = sub nsw i32 %1, %0
%5 = srem i32 %3, %4
%6 = add nsw i32 %5, %0
ret i32 %6
}
/* Variables and functions */
int func(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int numarg, char *arg[]) {
  printf("Numero de i-nodos\n");
  printf("Total size:%d\n", func(arg[1]));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
mov    0x8(%rbx),%rdi
call   1050 <func@plt>
lea    0xeb0(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Numero de i-nodos\0A\00"
@.str.1 = [15 x i8] c"Total size:%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i32 @func(i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [15 x i8] c"Total size:%d\0A\00"
@str = [18 x i8] c"Numero de i-nodos\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @func(i8* %5)
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xe1() {
  Assert_real((isalpha(225) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              1130, ("isalpha should be 0 for 0xe1"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xe1>:
push   %rbp
mov    %rsp,%rbp
mov    $0xe1,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x46a,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xe1>:
push   %rax
mov    $0xe1,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x46a,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe1\00"
define void @t_isalpha_0xe1() {
%1 = call i64 @isalpha(i32 225)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1130, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xe1\00"
define void @t_isalpha_0xe1() {
%1 = tail call i64 @isalpha(i32 225)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 1130, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
uint32_t reg_read(volatile uint32_t *address) { return *address; }


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

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

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

LLVM IR (-O2):
define i32 @reg_read(i32* %0) {
%2 = load volatile i32, i32* %0
ret i32 %2
}
int _test_program_change(void *buffer) {
  return (((unsigned char *)buffer)[0] & 0xf0) == (0xc << 4);
}


x86 assembly (clang, -O0):
<_test_program_change>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0xf0,%eax
cmp    $0xc0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_test_program_change>:
mov    (%rdi),%cl
and    $0xf0,%cl
xor    %eax,%eax
cmp    $0xc0,%cl
sete   %al
ret

LLVM IR (-O0):
define i32 @_test_program_change(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = and i32 %6, 240
%8 = icmp eq i32 %7, 192
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @_test_program_change(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -16
%4 = icmp eq i8 %3, -64
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ process_can(int /*<<< orphan*/);
void FDCAN1_IT1_IRQ_Handler(void) { process_can(0); }


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

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

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

LLVM IR (-O2):
define void @FDCAN1_IT1_IRQ_Handler() {
%1 = tail call i32 @process_can(i32 0)
ret void
}
int f(int n) { return n <= 10; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
xor    %eax,%eax
cmp    $0xb,%edi
setl   %al
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 %3, 10
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = icmp slt i32 %0, 11
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ e_1_13();
int main(void) {
  e_1_13();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <e_1_13@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @e_1_13()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @e_1_13()
ret i32 0
}
int do_something(int (*a)(char *)) {
  char test[10];
  return a(test);
}


x86 assembly (clang, -O0):
<do_something>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
lea    -0x12(%rbp),%rdi
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_something>:
sub    $0x18,%rsp
mov    %rdi,%rax
lea    0xe(%rsp),%rdi
call   *%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @do_something(i32 (i8*)* %0) {
%2 = alloca i32 (i8*)*
%3 = alloca [10 x i8]
store i32 (i8*)* %0, i32 (i8*)** %2
%4 = load i32 (i8*)*, i32 (i8*)** %2
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %3, i64 0, i64 0
%6 = call i32 %4(i8* %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @do_something(i32 (i8*)* nocapture %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 %0(i8* %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ command();
int /*<<< orphan*/ read();
int /*<<< orphan*/ welcome();
int main(int argc, const char *argv[]) {
  welcome();
  read();
  while (1) {
    command();
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1050 <welcome@plt>
mov    $0x0,%al
call   1040 <read@plt>
mov    $0x0,%al
call   1030 <command@plt>
jmp    1154 <main+0x24>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <welcome@plt>
xor    %eax,%eax
call   1040 <read@plt>
nop
xor    %eax,%eax
call   1030 <command@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @welcome()
%7 = call i32 (...) @read()
br label %8
8: ; preds = %2, %8
%9 = call i32 (...) @command()
br label %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @welcome()
%4 = tail call i32 (...) @read()
br label %5
5: ; preds = %2, %5
%6 = tail call i32 (...) @command()
br label %5
}
/* Type definitions */
struct timeval {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int wait_for_socket(int handle_socket, struct timeval *timeout) {
  fd_set handles_monitored;
  FD_ZERO(&handles_monitored);
  FD_SET(handle_socket, &handles_monitored);
  return select(handle_socket + 1, NULL, &handles_monitored, NULL, timeout);
}


x86 assembly (clang, -O0):
<wait_for_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x14(%rbp),%rdi
call   1030 <FD_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1050 <FD_SET@plt>
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    -0x10(%rbp),%r8
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x14(%rbp),%rdx
mov    %rcx,%rsi
call   1040 <select@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_for_socket>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <FD_ZERO@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <FD_SET@plt>
add    $0x1,%ebp
mov    %ebp,%edi
xor    %esi,%esi
mov    %rbx,%rdx
xor    %ecx,%ecx
mov    %r14,%r8
call   1040 <select@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.timeval = type { i32 }
define i32 @wait_for_socket(i32 %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = alloca %struct.timeval*
%5 = alloca i32
store i32 %0, i32* %3
store %struct.timeval* %1, %struct.timeval** %4
%6 = call i32 @FD_ZERO(i32* %5)
%7 = load i32, i32* %3
%8 = call i32 @FD_SET(i32 %7, i32* %5)
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = load %struct.timeval*, %struct.timeval** %4
%12 = call i32 @select(i32 %10, i32* null, i32* %5, i32* null, %struct.timeval* %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
define i32 @wait_for_socket(i32 %0, %struct.timeval* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @FD_ZERO(i32* %3)
%6 = call i32 @FD_SET(i32 %0, i32* %3)
%7 = add nsw i32 %0, 1
%8 = call i32 @select(i32 %7, i32* null, i32* %3, i32* null, %struct.timeval* %1)
ret i32 %8
}
/* Variables and functions */
int LINES;
int gui_max_y() { return LINES; }


x86 assembly (clang, -O0):
<gui_max_y>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_max_y>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@LINES = global i32 0
define i32 @gui_max_y() {
%1 = load i32, i32* @LINES
ret i32 %1
}

LLVM IR (-O2):
@LINES = global i32 0
define i32 @gui_max_y() {
%1 = load i32, i32* @LINES
ret i32 %1
}
/* Variables and functions */
scalar_t__ recv(int, char *, long, int);
long irecv(int sock, void *buf, long size, int mode) {
  return (long)recv(sock, (char *)buf, size, mode);
}


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

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

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

LLVM IR (-O2):
define i64 @irecv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i64 @recv(i32 %0, i8* %1, i64 %2, i32 %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalpha(int);
void t_isalpha_0xa5() {
  Assert_real((isalpha(165) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              830, ("isalpha should be 0 for 0xa5"));
}


x86 assembly (clang, -O0):
<t_isalpha_0xa5>:
push   %rbp
mov    %rsp,%rbp
mov    $0xa5,%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
lea    0xebf(%rip),%rsi
mov    $0x33e,%edx
lea    0xf5b(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isalpha_0xa5>:
push   %rax
mov    $0xa5,%edi
call   1030 <isalpha@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x33e,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xa5\00"
define void @t_isalpha_0xa5() {
%1 = call i64 @isalpha(i32 165)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 830, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [29 x i8] c"isalpha should be 0 for 0xa5\00"
define void @t_isalpha_0xa5() {
%1 = tail call i64 @isalpha(i32 165)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 830, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int simplified_simulated_while_with_and(int p) {
  int k = 0;
  int j = 0;
B:
  j++;
  if (k == 0 && j < 100) {
    goto B;
  }
  return k;
}


x86 assembly (clang, -O0):
<simplified_simulated_while_with_and>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1137 <simplified_simulated_while_with_and+0x37>
cmpl   $0x64,-0xc(%rbp)
jge    1137 <simplified_simulated_while_with_and+0x37>
jmp    1115 <simplified_simulated_while_with_and+0x15>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @simplified_simulated_while_with_and(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void die(char *msg) {
  fprintf(stderr, "%s", msg);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e8c(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_FAILURE = global i32 0
define void @die(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 ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @EXIT_FAILURE
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [3 x i8] c"%s\00"
@EXIT_FAILURE = global i32 0
define void @die(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Type definitions */
struct share_mem {
  int dummy;
};

/* Variables and functions */
struct share_mem *get_share_mem();
void *__to_trout_addr(void *addr) {
  struct share_mem *mem = get_share_mem();
  return (void *)4U + (addr - (void *)mem);
}


x86 assembly (clang, -O0):
<__to_trout_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <get_share_mem@plt>
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
sub    %rax,%rcx
mov    $0x4,%eax
add    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__to_trout_addr>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <get_share_mem@plt>
sub    %rax,%rbx
add    $0x4,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.share_mem = type { i32 }
define i8* @__to_trout_addr(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.share_mem*
store i8* %0, i8** %2
%4 = call %struct.share_mem* (...) @get_share_mem()
store %struct.share_mem* %4, %struct.share_mem** %3
%5 = load i8*, i8** %2
%6 = load %struct.share_mem*, %struct.share_mem** %3
%7 = bitcast %struct.share_mem* %6 to i8*
%8 = ptrtoint i8* %5 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
%11 = getelementptr i8, i8* inttoptr (i64 4 to i8*), i64 %10
ret i8* %11
}

LLVM IR (-O2):
%struct.share_mem = type { i32 }
define i8* @__to_trout_addr(i8* %0) {
%2 = tail call %struct.share_mem* (...) @get_share_mem()
%3 = ptrtoint i8* %0 to i64
%4 = ptrtoint %struct.share_mem* %2 to i64
%5 = sub i64 %3, %4
%6 = getelementptr i8, i8* inttoptr (i64 4 to i8*), i64 %5
ret i8* %6
}
unsigned int calcoloFrequenzaMassima(unsigned int etaAnni) {
  unsigned int massimaFrequenzaCardiaca;
  return massimaFrequenzaCardiaca = 220 - etaAnni;
}


x86 assembly (clang, -O0):
<calcoloFrequenzaMassima>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xdc,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcoloFrequenzaMassima>:
mov    $0xdc,%eax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @calcoloFrequenzaMassima(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sub i32 220, %4
store i32 %5, i32* %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @calcoloFrequenzaMassima(i32 %0) {
%2 = sub i32 220, %0
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_BLOCK;
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/ *);
sigset_t sig_block(sigset_t new) {
  sigset_t old;
  sigemptyset(&old);
  sigprocmask(SIG_BLOCK, &new, &old);
  return old;
}


x86 assembly (clang, -O0):
<sig_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <sigprocmask@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_block>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,0xc(%rsp)
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2ea3(%rip),%rax
mov    (%rax),%edi
lea    0xc(%rsp),%rsi
mov    %rbx,%rdx
call   1030 <sigprocmask@plt>
mov    0x8(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_BLOCK = global i32 0
define i32 @sig_block(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @sigemptyset(i32* %3)
%5 = load i32, i32* @SIG_BLOCK
%6 = call i32 @sigprocmask(i32 %5, i32* %2, i32* %3)
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
@SIG_BLOCK = global i32 0
define i32 @sig_block(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = bitcast i32* %3 to i8*
%5 = call i32 @sigemptyset(i32* %3)
%6 = load i32, i32* @SIG_BLOCK
%7 = call i32 @sigprocmask(i32 %6, i32* %2, i32* %3)
%8 = load i32, i32* %3
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
char *sqlite3_vmprintf(char *, int /*<<< orphan*/);
char *db_sqlite3_vmquery(char *fmt, va_list ap) {
  return sqlite3_vmprintf(fmt, ap);
}


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

x86 assembly (clang, -O2):
<db_sqlite3_vmquery>:
jmp    1030 <sqlite3_vmprintf@plt>

LLVM IR (-O0):
define i8* @db_sqlite3_vmquery(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 i8* @sqlite3_vmprintf(i8* %5, i32 %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @db_sqlite3_vmquery(i8* %0, i32 %1) {
%3 = tail call i8* @sqlite3_vmprintf(i8* %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ RTLD_LAZY;
void *dlopen(char *, int /*<<< orphan*/);
void *iwinfo_open(void) { return dlopen("/usr/lib/lua/iwinfo.so", RTLD_LAZY); }


x86 assembly (clang, -O0):
<iwinfo_open>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%esi
lea    0xedc(%rip),%rdi
call   1030 <dlopen@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"/usr/lib/lua/iwinfo.so\00"
@RTLD_LAZY = global i32 0
define i8* @iwinfo_open() {
%1 = load i32, i32* @RTLD_LAZY
%2 = call i8* @dlopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i8* %2
}

LLVM IR (-O2):
@.str = [23 x i8] c"/usr/lib/lua/iwinfo.so\00"
@RTLD_LAZY = global i32 0
define i8* @iwinfo_open() {
%1 = load i32, i32* @RTLD_LAZY
%2 = tail call i8* @dlopen(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i8* %2
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int initialize_dobldobl_monodromy(int n, int d, int k) {
  int fail;
  double *c;
  int dk[2];
  dk[0] = d;
  dk[1] = k;
  fail = _ada_use_c2phc4c(640, &n, dk, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<initialize_dobldobl_monodromy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
lea    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0x280,%edi
lea    -0x4(%rbp),%rsi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<initialize_dobldobl_monodromy>:
sub    $0x18,%rsp
mov    %edi,0xc(%rsp)
mov    %esi,0x10(%rsp)
mov    %edx,0x14(%rsp)
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    $0x280,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
define i32 @initialize_dobldobl_monodromy(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca [2 x i32]
store i32 %0, i32* %4
%6 = bitcast [2 x i32]* %5 to i8*
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
store i32 %1, i32* %7
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
store i32 %2, i32* %8
%9 = call i32 @_ada_use_c2phc4c(i32 640, i32* %4, i32* %7, double* undef, i32 0)
ret i32 %9
}
void grib_print_all_timers() { return; }


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

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

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

LLVM IR (-O2):
define void @grib_print_all_timers() {
ret void
}
void megaInit(void) {
  {}
}


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

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

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

LLVM IR (-O2):
define void @megaInit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(int);
void *thread1_func(void *arg) {
  usleep(2000 * 1000);
  printf("thread 1 exited\n");
  return (void *)0x8badf00d;
}


x86 assembly (clang, -O0):
<thread1_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1e8480,%edi
call   1040 <usleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
mov    $0x8badf00d,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thread1_func>:
push   %rax
mov    $0x1e8480,%edi
call   1040 <usleep@plt>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
mov    $0x8badf00d,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"thread 1 exited\0A\00"
define i8* @thread1_func(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @usleep(i32 2000000)
%4 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i8* inttoptr (i64 2343432205 to i8*)
}

LLVM IR (-O2):
@str = [16 x i8] c"thread 1 exited\00"
define i8* @thread1_func(i8* nocapture readnone %0) {
%2 = tail call i32 @usleep(i32 2000000)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret i8* inttoptr (i64 2343432205 to i8*)
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ lfs_frombe32(int /*<<< orphan*/);
uint32_t lfs_tobe32(uint32_t a) { return lfs_frombe32(a); }


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

x86 assembly (clang, -O2):
<lfs_tobe32>:
jmp    1030 <lfs_frombe32@plt>

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

LLVM IR (-O2):
define i32 @lfs_tobe32(i32 %0) {
%2 = tail call i32 @lfs_frombe32(i32 %0)
ret i32 %2
}
int sum(int n) {
  int i;
  int s = 0;
  for (i = 1; i <= n; ++i) {
    s += i;
  }
  return s;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1138 <sum+0x38>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1115 <sum+0x15>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
test   %edi,%edi
jle    1118 <sum+0x18>
lea    -0x1(%rdi),%eax
lea    -0x2(%rdi),%ecx
imul   %rax,%rcx
shr    %rcx
lea    (%rcx,%rdi,2),%eax
add    $0xffffffff,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @sum(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = shl nuw i32 %0, 1
%5 = add nsw i32 %0, -1
%6 = zext i32 %5 to i33
%7 = add nsw i32 %0, -2
%8 = zext i32 %7 to i33
%9 = mul i33 %6, %8
%10 = lshr i33 %9, 1
%11 = trunc i33 %10 to i32
%12 = add i32 %4, %11
%13 = add i32 %12, -1
br label %14
14: ; preds = %3, %1
%15 = phi i32 [ 0, %1 ], [ %13, %3 ]
ret i32 %15
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void usage(void) {
  die("Usage: build bootsect setup system [rootdev] [> image]");
}


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

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

LLVM IR (-O0):
@.str = [55 x i8] c"Usage: build bootsect setup system [rootdev] [> image]\00"
define void @usage() {
%1 = call i32 @die(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"Usage: build bootsect setup system [rootdev] [> image]\00"
define void @usage() {
%1 = tail call i32 @die(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int Usage();
int atoi(char const *);
int compare_zeroing_allocs(int);
int just_calloc(int);
int just_malloc(int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
int main(int argc, char const *argv[]) {
  if (argc < 2)
    return Usage();
  int count = atoi(argv[1]);
  return compare_zeroing_allocs(count);
  printf("Malloc (%d):%d  and Calloc(%d):%d\n", count, just_malloc(count),
         count, just_calloc(count));
  printf("Calloc (%d):%d  and Malloc(%d):%d\n", count, just_calloc(count),
         count, just_malloc(count));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    115f <main+0x2f>
mov    $0x0,%al
call   1030 <Usage@plt>
mov    %eax,-0x4(%rbp)
jmp    117a <main+0x4a>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <compare_zeroing_allocs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
cmp    $0x1,%edi
jg     113c <main+0xc>
xor    %eax,%eax
jmp    1030 <Usage@plt>
push   %rax
mov    0x8(%rsi),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <compare_zeroing_allocs@plt>

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 i32, i32* %4
%8 = icmp slt i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 (...) @Usage()
store i32 %10, i32* %3
br label %18
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @atoi(i8* %14)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @compare_zeroing_allocs(i32 %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %11, %9
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @Usage()
br label %11
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atoi(i8* %8)
%10 = tail call i32 @compare_zeroing_allocs(i32 %9)
br label %11
11: ; preds = %6, %4
%12 = phi i32 [ %5, %4 ], [ %10, %6 ]
ret i32 %12
}
/* Variables and functions */
int random();
int myran(int fromv, int tov) {
  int num, val;
  val = tov - fromv;
  num = random();
  num = (num % val);
  return num + fromv;
}


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

x86 assembly (clang, -O2):
<myran>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
sub    %edi,%ebx
xor    %eax,%eax
call   1030 <random@plt>
cltd
idiv   %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @myran(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
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
store i32 %9, i32* %6
%10 = call i32 (...) @random()
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = srem i32 %11, %12
store i32 %13, i32* %5
%14 = load i32, i32* %5
%15 = load i32, i32* %3
%16 = add nsw i32 %14, %15
ret i32 %16
}

LLVM IR (-O2):
define i32 @myran(i32 %0, i32 %1) {
%3 = sub nsw i32 %1, %0
%4 = tail call i32 (...) @random()
%5 = srem i32 %4, %3
%6 = add nsw i32 %5, %0
ret i32 %6
}
/* Type definitions */
typedef scalar_t__ time_t;
struct timespec {
  long tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ nanosleep(struct timespec *, struct timespec *);
void delay(unsigned int millis) {
  struct timespec sleeper, dummy;
  sleeper.tv_sec = (time_t)(millis / 1000);
  sleeper.tv_nsec = (long)(millis % 1000) * 1000000;
  nanosleep(&sleeper, &dummy);
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,%eax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
imul   $0xf4240,%rax,%rax
mov    %rax,-0x18(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <nanosleep@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delay>:
sub    $0x28,%rsp
mov    %edi,%eax
imul   $0x10624dd3,%rax,%rax
shr    $0x26,%rax
mov    %rax,0x10(%rsp)
imul   $0x3e8,%eax,%eax
sub    %eax,%edi
imul   $0xf4240,%edi,%eax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
lea    0x18(%rsp),%rsi
call   1030 <nanosleep@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define void @delay(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
%4 = alloca %struct.timespec
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = udiv i32 %5, 1000
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i64 %7, i64* %8
%9 = load i32, i32* %2
%10 = urem i32 %9, 1000
%11 = zext i32 %10 to i64
%12 = mul nsw i64 %11, 1000000
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i64 %12, i64* %13
%14 = call i32 @nanosleep(%struct.timespec* %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i64 }
define void @delay(i32 %0) {
%2 = alloca %struct.timespec
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %2 to i8*
%5 = bitcast %struct.timespec* %3 to i8*
%6 = udiv i32 %0, 1000
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i64 %7, i64* %8
%9 = urem i32 %0, 1000
%10 = mul nuw nsw i32 %9, 1000000
%11 = zext i32 %10 to i64
%12 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i64 %11, i64* %12
%13 = call i32 @nanosleep(%struct.timespec* %2, %struct.timespec* %3)
ret void
}
int ddns3_sockio_cleanup(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @ddns3_sockio_cleanup() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_silence_memory() {
  printf("NOT IMPLEMENTED:"
         "pa_silence_memory"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_silence_memory\0A\00"
define i32 @pa_silence_memory() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_silence_memory\00"
define i32 @pa_silence_memory() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *, size_t);
void *realloc(void *, size_t);
void *xrealloc(void *old, size_t size) {
  void *r = realloc(old, size);
  if (r == NULL && size != 0)
    fatal("Failed to realloc %zu bytes.\n", size);
  return r;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1167 <xrealloc+0x47>
cmpq   $0x0,-0x10(%rbp)
je     1167 <xrealloc+0x47>
mov    -0x10(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1040 <fatal@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
call   1030 <realloc@plt>
mov    %rax,%r14
test   %rbx,%rbx
je     1148 <xrealloc+0x28>
test   %r14,%r14
jne    1148 <xrealloc+0x28>
lea    0xec0(%rip),%rdi
mov    %rbx,%rsi
call   1040 <fatal@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Failed to realloc %zu bytes.\0A\00"
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i64, i64* %4
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i64, i64* %4
%16 = call i32 @fatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %15)
br label %17
17: ; preds = %14, %11, %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@.str = [30 x i8] c"Failed to realloc %zu bytes.\0A\00"
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
%5 = icmp ne i64 %1, 0
%6 = and i1 %5, %4
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = tail call i32 @fatal(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i64 %1)
br label %9
9: ; preds = %7, %2
ret i8* %3
}
char conv_to_hex(int value) {
  char c;
  if (value > 9) {
    c = (char)(value + ('A' - 10));
  } else {
    c = (char)(value + '0');
  }
  return (c);
}


x86 assembly (clang, -O0):
<conv_to_hex>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    111f <conv_to_hex+0x1f>
mov    -0x4(%rbp),%eax
add    $0x37,%eax
mov    %al,-0x5(%rbp)
jmp    1128 <conv_to_hex+0x28>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<conv_to_hex>:
cmp    $0xa,%edi
mov    $0x37,%ecx
mov    $0x30,%eax
cmovge %ecx,%eax
add    %dil,%al
ret

LLVM IR (-O0):
define signext i8 @conv_to_hex(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 9
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 55
%9 = trunc i32 %8 to i8
store i8 %9, i8* %3
br label %14
10: ; preds = %1
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 48
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
br label %14
14: ; preds = %10, %6
%15 = load i8, i8* %3
ret i8 %15
}

LLVM IR (-O2):
define signext i8 @conv_to_hex(i32 %0) {
%2 = icmp sgt i32 %0, 9
%3 = trunc i32 %0 to i8
%4 = select i1 %2, i8 55, i8 48
%5 = add i8 %4, %3
ret i8 %5
}
/* Variables and functions */
int check_with_mode(char const *, char const *, char const *, char const *, int,
                    int);
int check_backtranslation_with_mode(const char *tableList, const char *str,
                                    const char *typeform, const char *expected,
                                    int mode) {
  return check_with_mode(tableList, str, typeform, expected, mode, 1);
}


x86 assembly (clang, -O0):
<check_backtranslation_with_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    $0x1,%r9d
call   1030 <check_with_mode@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_backtranslation_with_mode>:
mov    $0x1,%r9d
jmp    1030 <check_with_mode@plt>

LLVM IR (-O0):
define i32 @check_backtranslation_with_mode(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i32 %4, i32* %10
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = load i8*, i8** %8
%14 = load i8*, i8** %9
%15 = load i32, i32* %10
%16 = call i32 @check_with_mode(i8* %11, i8* %12, i8* %13, i8* %14, i32 %15, i32 1)
ret i32 %16
}

LLVM IR (-O2):
define i32 @check_backtranslation_with_mode(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4) {
%6 = tail call i32 @check_with_mode(i8* %0, i8* %1, i8* %2, i8* %3, i32 %4, i32 1)
ret i32 %6
}