xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ assert1();
int /*<<< orphan*/ assert2();
int main(void) {
  assert1();
  assert2();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <assert1@plt>
mov    $0x0,%al
call   1040 <assert2@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @assert1()
%2 = call i32 (...) @assert2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @assert1()
%2 = tail call i32 (...) @assert2()
ret i32 0
}
void BIO_number_written(void) {}


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

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

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

LLVM IR (-O2):
define void @BIO_number_written() {
ret void
}
/* Variables and functions */
int baz(int, int);
__attribute__((no)) int foo(int a, int b) { return baz(a * 2, b - a); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x1,%edi
mov    -0x8(%rbp),%esi
sub    -0x4(%rbp),%esi
call   1030 <baz@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    %edi,%esi
add    %edi,%edi
jmp    1030 <baz@plt>

LLVM IR (-O0):
define i32 @foo(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 = mul nsw i32 %5, 2
%7 = load i32, i32* %4
%8 = load i32, i32* %3
%9 = sub nsw i32 %7, %8
%10 = call i32 @baz(i32 %6, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @foo(i32 %0, i32 %1) {
%3 = shl nsw i32 %0, 1
%4 = sub nsw i32 %1, %0
%5 = tail call i32 @baz(i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void bannner(void) {
  printf("Spoon Interpreter - v1.00\nWritten by S.Goodwin 1998\n");
  printf("Code and Language based on BrainF***, by Urban Mueller\n\n");
  printf("Usage: spoon [/b /c /d /h /q /0 /1] <source filename>\n\n");
}


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

x86 assembly (clang, -O2):
<bannner>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf10(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3c(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [53 x i8] c"Spoon Interpreter - v1.00\0AWritten by S.Goodwin 1998\0A\00"
@.str.1 = [57 x i8] c"Code and Language based on BrainF***, by Urban Mueller\0A\0A\00"
@.str.2 = [56 x i8] c"Usage: spoon [/b /c /d /h /q /0 /1] <source filename>\0A\0A\00"
define void @bannner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [52 x i8] c"Spoon Interpreter - v1.00\0AWritten by S.Goodwin 1998\00"
@str.3 = [56 x i8] c"Code and Language based on BrainF***, by Urban Mueller\0A\00"
@str.4 = [55 x i8] c"Usage: spoon [/b /c /d /h /q /0 /1] <source filename>\0A\00"
define void @bannner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([56 x i8], [56 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str.4, i64 0, i64 0))
ret void
}
void gtk_target_list_find() {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ event_del(struct event *);
int /*<<< orphan*/ free(struct event *);
void event_free(struct event *ev) {
  event_del(ev);
  free(ev);
}


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

x86 assembly (clang, -O2):
<event_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <event_del@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.event = type { i32 }
define void @event_free(%struct.event* %0) {
%2 = alloca %struct.event*
store %struct.event* %0, %struct.event** %2
%3 = load %struct.event*, %struct.event** %2
%4 = call i32 @event_del(%struct.event* %3)
%5 = load %struct.event*, %struct.event** %2
%6 = call i32 @free(%struct.event* %5)
ret void
}

LLVM IR (-O2):
%struct.event = type { i32 }
define void @event_free(%struct.event* %0) {
%2 = tail call i32 @event_del(%struct.event* %0)
%3 = tail call i32 @free(%struct.event* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ volatile *__bb_addr(void volatile *, int /*<<< orphan*/, int,
                                       int);
volatile uint32_t *bb_sramp(volatile void *address, uint32_t bit) {
  return __bb_addr(address, bit, 0x22000000, 0x20000000);
}


x86 assembly (clang, -O0):
<bb_sramp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    $0x22000000,%edx
mov    $0x20000000,%ecx
call   1030 <__bb_addr@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_sramp>:
mov    $0x22000000,%edx
mov    $0x20000000,%ecx
jmp    1030 <__bb_addr@plt>

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

LLVM IR (-O2):
define i32* @bb_sramp(i8* %0, i32 %1) {
%3 = tail call i32* @__bb_addr(i8* %0, i32 %1, i32 570425344, i32 536870912)
ret i32* %3
}
/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, int);
void sig_hup(int signo) { printf("SIGHUP received, pid = %d\n", getpid()); }


x86 assembly (clang, -O0):
<sig_hup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
lea    0xec5(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_hup>:
push   %rax
xor    %eax,%eax
call   1030 <getpid@plt>
lea    0xed1(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"SIGHUP received, pid = %d\0A\00"
define void @sig_hup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @getpid()
%4 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"SIGHUP received, pid = %d\0A\00"
define void @sig_hup(i32 %0) {
%2 = tail call i32 (...) @getpid()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2)
ret void
}
/* Variables and functions */
int write(int, char *, int);
int __gnat_write_signalling_fd(int wsig) {
  char c = 0;
  return write(wsig, &c, 1);
}


x86 assembly (clang, -O0):
<__gnat_write_signalling_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movb   $0x0,-0x5(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x5(%rbp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__gnat_write_signalling_fd>:
push   %rax
movb   $0x0,0x7(%rsp)
lea    0x7(%rsp),%rsi
mov    $0x1,%edx
call   1030 <write@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @__gnat_write_signalling_fd(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
store i8 0, i8* %3
%4 = load i32, i32* %2
%5 = call i32 @write(i32 %4, i8* %3, i32 1)
ret i32 %5
}

LLVM IR (-O2):
define i32 @__gnat_write_signalling_fd(i32 %0) {
%2 = alloca i8
store i8 0, i8* %2
%3 = call i32 @write(i32 %0, i8* %2, i32 1)
ret i32 %3
}
void trm_wait() {}


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

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

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

LLVM IR (-O2):
define void @trm_wait() {
ret void
}
int exact_square(int num) {
  int div = 1;
  while (num > div) {
    if (num % div == 0) {
      if (div * div == num)
        return 1;
    }
    div++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<exact_square>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1159 <exact_square+0x59>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    114b <exact_square+0x4b>
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1146 <exact_square+0x46>
movl   $0x1,-0x4(%rbp)
jmp    1160 <exact_square+0x60>
jmp    114b <exact_square+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <exact_square+0xe>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<exact_square>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jl     112e <exact_square+0x2e>
mov    $0x1,%esi
jmp    1117 <exact_square+0x17>
xchg   %ax,%ax
add    $0x1,%esi
cmp    %esi,%edi
je     112e <exact_square+0x2e>
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
jne    1110 <exact_square+0x10>
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jne    1110 <exact_square+0x10>
mov    $0x1,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @exact_square(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %5, label %13
3: ; preds = %5
%4 = icmp eq i32 %12, %0
br i1 %4, label %13, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %12, %3 ], [ 1, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = mul nsw i32 %6, %6
%10 = icmp eq i32 %9, %0
%11 = select i1 %8, i1 %10, i1 false
%12 = add nuw nsw i32 %6, 1
br i1 %11, label %13, label %3
13: ; preds = %5, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ 1, %5 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ decode_non_word_load(long);
int /*<<< orphan*/ decode_special_triadic(long);
void decode_non_word_load_or_triadic(long int op_code) {
  switch ((op_code >> 28) & 0x3) {
  case 0x00L:
    decode_special_triadic(op_code);
    break;
  case 0x01L:
    return;
  case 0x02L:
    return;
  case 0x03L:
    decode_non_word_load(op_code);
    break;
  }
  return;
}


x86 assembly (clang, -O0):
<decode_non_word_load_or_triadic>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x1c,%eax
and    $0x3,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1179 <decode_non_word_load_or_triadic+0x59>
mov    -0x10(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rdi
call   1040 <decode_special_triadic@plt>
jmp    1179 <decode_non_word_load_or_triadic+0x59>
jmp    117e <decode_non_word_load_or_triadic+0x5e>
jmp    117e <decode_non_word_load_or_triadic+0x5e>
mov    -0x8(%rbp),%rdi
call   1030 <decode_non_word_load@plt>
jmp    117e <decode_non_word_load_or_triadic+0x5e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_non_word_load_or_triadic>:
mov    %edi,%eax
shr    $0x1c,%eax
and    $0x3,%eax
lea    -0x1(%rax),%rcx
cmp    $0x2,%rcx
jae    1133 <decode_non_word_load_or_triadic+0x13>
ret
cmp    $0x3,%eax
jne    113d <decode_non_word_load_or_triadic+0x1d>
jmp    1030 <decode_non_word_load@plt>
jmp    1040 <decode_special_triadic@plt>

LLVM IR (-O0):
define void @decode_non_word_load_or_triadic(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 28
%5 = and i64 %4, 3
switch i64 %5, label %14 [
i64 0, label %6
i64 1, label %9
i64 2, label %10
i64 3, label %11
]
6: ; preds = %1
%7 = load i64, i64* %2
%8 = call i32 @decode_special_triadic(i64 %7)
br label %14
9: ; preds = %1
br label %15
10: ; preds = %1
br label %15
11: ; preds = %1
%12 = load i64, i64* %2
%13 = call i32 @decode_non_word_load(i64 %12)
br label %14
14: ; preds = %1, %11, %6
br label %15
15: ; preds = %14, %10, %9
ret void
}

LLVM IR (-O2):
define void @decode_non_word_load_or_triadic(i64 %0) {
%2 = lshr i64 %0, 28
%3 = and i64 %2, 3
switch i64 %3, label %8 [
i64 0, label %4
i64 1, label %9
i64 2, label %9
i64 3, label %6
]
4: ; preds = %1
%5 = tail call i32 @decode_special_triadic(i64 %0)
br label %9
6: ; preds = %1
%7 = tail call i32 @decode_non_word_load(i64 %0)
br label %9
8: ; preds = %1
unreachable
9: ; preds = %4, %6, %1, %1
ret void
}
void tef_xml_read(void) {}


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

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

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

LLVM IR (-O2):
define void @tef_xml_read() {
ret void
}
int is_prime(unsigned int number) {
  if (number <= 1)
    return 0;
  unsigned int i;
  for (i = 2; i * i <= number; i++) {
    if (number % i == 0)
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
ja     111d <is_prime+0x1d>
movl   $0x0,-0x4(%rbp)
jmp    116b <is_prime+0x6b>
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
ja     1164 <is_prime+0x64>
mov    -0x8(%rbp),%eax
xor    %edx,%edx
divl   -0xc(%rbp)
cmp    $0x0,%edx
jne    1151 <is_prime+0x51>
movl   $0x0,-0x4(%rbp)
jmp    116b <is_prime+0x6b>
jmp    1156 <is_prime+0x56>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1124 <is_prime+0x24>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_prime>:
xor    %ecx,%ecx
cmp    $0x2,%edi
jae    110a <is_prime+0xa>
mov    %ecx,%eax
ret
cmp    $0x4,%edi
jae    1115 <is_prime+0x15>
mov    $0x1,%eax
ret
mov    $0x2,%esi
xor    %ecx,%ecx
nopl   0x0(%rax)
mov    %edi,%eax
xor    %edx,%edx
div    %esi
test   %edx,%edx
je     1107 <is_prime+0x7>
add    $0x1,%esi
mov    %esi,%eax
imul   %esi,%eax
cmp    %edi,%eax
jbe    1120 <is_prime+0x20>
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @is_prime(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = icmp ult i32 %0, 4
br i1 %4, label %13, label %8
5: ; preds = %8
%6 = mul i32 %12, %12
%7 = icmp ugt i32 %6, %0
br i1 %7, label %13, label %8
8: ; preds = %3, %5
%9 = phi i32 [ %12, %5 ], [ 2, %3 ]
%10 = urem i32 %0, %9
%11 = icmp eq i32 %10, 0
%12 = add i32 %9, 1
br i1 %11, label %13, label %5
13: ; preds = %5, %8, %3, %1
%14 = phi i32 [ 0, %1 ], [ 1, %3 ], [ 1, %5 ], [ 0, %8 ]
ret i32 %14
}
/* Variables and functions */
void *cmalloc_malloc(size_t);
void *cmalloc_calloc(size_t nmemb, size_t size) {
  void *ptr;
  ptr = cmalloc_malloc(nmemb * size);
  if (!ptr) {
    return NULL;
  }
  int i;
  for (i = 0; i < size; ++i)
    *(char *)(ptr + i) = 0;
  return ptr;
}


x86 assembly (clang, -O0):
<cmalloc_calloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
imul   -0x18(%rbp),%rdi
call   1030 <cmalloc_malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    114a <cmalloc_calloc+0x3a>
movq   $0x0,-0x8(%rbp)
jmp    1181 <cmalloc_calloc+0x71>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1179 <cmalloc_calloc+0x69>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1151 <cmalloc_calloc+0x41>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i8* @cmalloc_calloc(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
store i64 %0, i64* %4
store i64 %1, i64* %5
%8 = load i64, i64* %4
%9 = load i64, i64* %5
%10 = mul i64 %8, %9
%11 = call i8* @cmalloc_malloc(i64 %10)
store i8* %11, i8** %6
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %15, label %14
14: ; preds = %2
store i8* null, i8** %3
br label %31
15: ; preds = %2
store i32 0, i32* %7
br label %16
16: ; preds = %26, %15
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = load i64, i64* %5
%20 = icmp ult i64 %18, %19
br i1 %20, label %21, label %29
21: ; preds = %16
%22 = load i8*, i8** %6
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr i8, i8* %22, i64 %24
store i8 0, i8* %25
br label %26
26: ; preds = %21
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
br label %16
29: ; preds = %16
%30 = load i8*, i8** %6
store i8* %30, i8** %3
br label %31
31: ; preds = %29, %14
%32 = load i8*, i8** %3
ret i8* %32
}

LLVM IR (-O2):
define i8* @cmalloc_calloc(i64 %0, i64 %1) {
%3 = mul i64 %1, %0
%4 = tail call i8* @cmalloc_malloc(i64 %3)
%5 = icmp ne i8* %4, null
%6 = icmp ne i64 %1, 0
%7 = and i1 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %2
br label %9
9: ; preds = %8, %2
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ f();
int /*<<< orphan*/ g();
int main(void) {
  f();
  g();
  (void)f();
  (void)1;
  int x;
  (void)(x = 5);
  (void)(int)5;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @f()
%2 = tail call i32 (...) @g()
%3 = tail call i32 (...) @f()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ u_char;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ PACKETSZ;
int /*<<< orphan*/ const *p_cdnname(int /*<<< orphan*/ const *,
                                    int /*<<< orphan*/ const *,
                                    int /*<<< orphan*/, int /*<<< orphan*/ *);
const u_char *p_cdname(const u_char *cp, const u_char *msg, FILE *file) {
  return (p_cdnname(cp, msg, PACKETSZ, file));
}


x86 assembly (clang, -O0):
<p_cdname>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    0x2eb5(%rip),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rcx
call   1030 <p_cdnname@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<p_cdname>:
mov    %rdx,%rcx
mov    0x2ece(%rip),%rax
mov    (%rax),%edx
jmp    1030 <p_cdnname@plt>

LLVM IR (-O0):
@PACKETSZ = global i32 0
define i32* @p_cdname(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = load i32*, i32** %5
%9 = load i32, i32* @PACKETSZ
%10 = load i32*, i32** %6
%11 = call i32* @p_cdnname(i32* %7, i32* %8, i32 %9, i32* %10)
ret i32* %11
}

LLVM IR (-O2):
@PACKETSZ = global i32 0
define i32* @p_cdname(i32* %0, i32* %1, i32* %2) {
%4 = load i32, i32* @PACKETSZ
%5 = tail call i32* @p_cdnname(i32* %0, i32* %1, i32 %4, i32* %2)
ret i32* %5
}
void CMUTIL_StringBaseInit() {}


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

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

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

LLVM IR (-O2):
define void @CMUTIL_StringBaseInit() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
size_t fmt_u32_dec(char *, int /*<<< orphan*/);
int /*<<< orphan*/ print(char *, size_t);
void print_u32_dec(uint32_t val) {
  char buf[10];
  size_t len = fmt_u32_dec(buf, val);
  print(buf, len);
}


x86 assembly (clang, -O0):
<print_u32_dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <fmt_u32_dec@plt>
mov    %rax,-0x18(%rbp)
lea    -0xe(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_u32_dec>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%esi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <fmt_u32_dec@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <print@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_u32_dec(i32 %0) {
%2 = alloca [10 x i8]
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i64 @fmt_u32_dec(i8* %3, i32 %0)
%5 = call i32 @print(i8* %3, i64 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ agile_bitree_destroy(void *);
int /*<<< orphan*/ free(void *);
void destroy_tree(void *tree) {
  agile_bitree_destroy(tree);
  free(tree);
}


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

x86 assembly (clang, -O2):
<destroy_tree>:
push   %rbx
mov    %rdi,%rbx
call   1040 <agile_bitree_destroy@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @destroy_tree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @agile_bitree_destroy(i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
define void @destroy_tree(i8* %0) {
%2 = tail call i32 @agile_bitree_destroy(i8* %0)
%3 = tail call i32 @free(i8* %0)
ret void
}
int main(int argc, const char *argv[]) {
  int ****a;
  int ****b;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
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 i32
%5 = alloca i8**
%6 = alloca i32****
%7 = alloca i32****
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Variables and functions */
double add_double(double, double);
double wack_double(register double u, register double v) {
  register double l = u, r = v;
  l = add_double(l, r);
  return l + r;
}


x86 assembly (clang, -O0):
<wack_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
call   1030 <add_double@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wack_double>:
push   %rax
movsd  %xmm1,(%rsp)
call   1030 <add_double@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @wack_double(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %3
store double %1, double* %4
%7 = load double, double* %3
store double %7, double* %5
%8 = load double, double* %4
store double %8, double* %6
%9 = load double, double* %5
%10 = load double, double* %6
%11 = call double @add_double(double %9, double %10)
store double %11, double* %5
%12 = load double, double* %5
%13 = load double, double* %6
%14 = fadd double %12, %13
ret double %14
}

LLVM IR (-O2):
define double @wack_double(double %0, double %1) {
%3 = tail call double @add_double(double %0, double %1)
%4 = fadd double %3, %1
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int /*<<< orphan*/ FatalErrnoError(int, int, char *);
int setuid(int /*<<< orphan*/);
void Esetuid(uid_t uid) { FatalErrnoError(setuid(uid) == -1, 1, "setuid()"); }


x86 assembly (clang, -O0):
<Esetuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <setuid@plt>
cmp    $0xffffffff,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
mov    $0x1,%esi
lea    0xeb6(%rip),%rdx
call   1030 <FatalErrnoError@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Esetuid>:
push   %rax
call   1040 <setuid@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
sete   %dil
lea    0xeca(%rip),%rdx
mov    $0x1,%esi
pop    %rax
jmp    1030 <FatalErrnoError@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"setuid()\00"
define void @Esetuid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @setuid(i32 %3)
%5 = icmp eq i32 %4, -1
%6 = zext i1 %5 to i32
%7 = call i32 @FatalErrnoError(i32 %6, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"setuid()\00"
define void @Esetuid(i32 %0) {
%2 = tail call i32 @setuid(i32 %0)
%3 = icmp eq i32 %2, -1
%4 = zext i1 %3 to i32
%5 = tail call i32 @FatalErrnoError(i32 %4, i32 1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t extract32(uint32_t value, int start, int length) {
  return (value >> start) & (~0U >> (32 - length));
}


x86 assembly (clang, -O0):
<extract32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sar    %cl,%eax
mov    $0x20,%ecx
sub    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shr    %cl,%edx
mov    %edx,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract32>:
mov    %esi,%ecx
mov    %edi,%eax
sar    %cl,%eax
neg    %dl
mov    %edx,%ecx
shl    %cl,%eax
shr    %cl,%eax
ret

LLVM IR (-O0):
define i32 @extract32(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = ashr i32 %7, %8
%10 = load i32, i32* %6
%11 = sub nsw i32 32, %10
%12 = lshr i32 -1, %11
%13 = and i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @extract32(i32 %0, i32 %1, i32 %2) {
%4 = ashr i32 %0, %1
%5 = sub nsw i32 32, %2
%6 = lshr i32 -1, %5
%7 = and i32 %6, %4
ret i32 %7
}
int test_imm_97int32_reg(int val) { return ((val) & (0x97 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_97int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x97,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_97int32_reg>:
test   $0x97,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_97int32_reg(i32 %0) {
%2 = and i32 %0, 151
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void cnf1Initialise(void) {}


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

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

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

LLVM IR (-O2):
define void @cnf1Initialise() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Test2();
void Test1() { Test2(); }


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

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

LLVM IR (-O0):
define void @Test1() {
%1 = call i32 (...) @Test2()
ret void
}

LLVM IR (-O2):
define void @Test1() {
%1 = tail call i32 (...) @Test2()
ret void
}
int func() { return 10; }


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

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

LLVM IR (-O0):
define i32 @func() {
ret i32 10
}

LLVM IR (-O2):
define i32 @func() {
ret i32 10
}
int reset_others(void) {
  unsigned long leds, i;
  leds = (*(unsigned long *)0xbf7fc008) & 0x80200000;
  *(unsigned long *)(0xbf7fc008) = 0x005FFE49 | leds;
  if (*(unsigned long *)(0xbf7fc008) != (0x005FFE49 | leds))
    return (0);
  for (i = 0; i < 1000;)
    i++;
  *(unsigned long *)(0xbf7fc008) = 0x705FFE49 | leds;
  if (*(unsigned long *)(0xbf7fc008) != (0x705FFE49 | leds))
    return (0);
  return (1);
}


x86 assembly (clang, -O0):
<reset_others>:
push   %rbp
mov    %rsp,%rbp
mov    $0xbf7fc008,%ecx
movabs $0x80200000,%rax
and    (%rcx),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
or     $0x5ffe49,%rcx
mov    $0xbf7fc008,%eax
mov    %rcx,(%rax)
mov    $0xbf7fc008,%eax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
or     $0x5ffe49,%rcx
cmp    %rcx,%rax
je     1155 <reset_others+0x55>
movl   $0x0,-0x4(%rbp)
jmp    11be <reset_others+0xbe>
movq   $0x0,-0x18(%rbp)
cmpq   $0x3e8,-0x18(%rbp)
jae    117c <reset_others+0x7c>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    115d <reset_others+0x5d>
mov    -0x10(%rbp),%rcx
or     $0x705ffe49,%rcx
mov    $0xbf7fc008,%eax
mov    %rcx,(%rax)
mov    $0xbf7fc008,%eax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
or     $0x705ffe49,%rcx
cmp    %rcx,%rax
je     11b7 <reset_others+0xb7>
movl   $0x0,-0x4(%rbp)
jmp    11be <reset_others+0xbe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reset_others>:
mov    $0xbf7fc008,%eax
mov    (%rax),%rcx
and    $0x80200000,%ecx
or     $0x705ffe49,%rcx
mov    %rcx,(%rax)
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @reset_others() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = load i64, i64* inttoptr (i64 3212820488 to i64*)
%5 = and i64 %4, 2149580800
store i64 %5, i64* %2
%6 = load i64, i64* %2
%7 = or i64 6291017, %6
store i64 %7, i64* inttoptr (i64 3212820488 to i64*)
%8 = load i64, i64* inttoptr (i64 3212820488 to i64*)
%9 = load i64, i64* %2
%10 = or i64 6291017, %9
%11 = icmp ne i64 %8, %10
br i1 %11, label %12, label %13
12: ; preds = %0
store i32 0, i32* %1
br label %29
13: ; preds = %0
store i64 0, i64* %3
br label %14
14: ; preds = %17, %13
%15 = load i64, i64* %3
%16 = icmp ult i64 %15, 1000
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i64, i64* %3
%19 = add i64 %18, 1
store i64 %19, i64* %3
br label %14
20: ; preds = %14
%21 = load i64, i64* %2
%22 = or i64 1885339209, %21
store i64 %22, i64* inttoptr (i64 3212820488 to i64*)
%23 = load i64, i64* inttoptr (i64 3212820488 to i64*)
%24 = load i64, i64* %2
%25 = or i64 1885339209, %24
%26 = icmp ne i64 %23, %25
br i1 %26, label %27, label %28
27: ; preds = %20
store i32 0, i32* %1
br label %29
28: ; preds = %20
store i32 1, i32* %1
br label %29
29: ; preds = %28, %27, %12
%30 = load i32, i32* %1
ret i32 %30
}

LLVM IR (-O2):
define i32 @reset_others() {
%1 = load i64, i64* inttoptr (i64 3212820488 to i64*)
%2 = and i64 %1, 2149580800
%3 = or i64 %2, 1885339209
store i64 %3, i64* inttoptr (i64 3212820488 to i64*)
ret i32 1
}
/* Type definitions */
struct timespec {
  long tv_nsec;
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
void timespec_add_ns(struct timespec *ts, long ns) {
  ts->tv_nsec += ns;
  if (ts->tv_nsec >= 1000000000) {
    ts->tv_sec++;
    ts->tv_nsec -= 1000000000;
  }
}


x86 assembly (clang, -O0):
<timespec_add_ns>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpq   $0x3b9aca00,(%rax)
jl     1149 <timespec_add_ns+0x49>
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
add    $0x1,%ecx
mov    %ecx,0x8(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
sub    $0x3b9aca00,%rcx
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec_add_ns>:
add    (%rdi),%rsi
mov    %rsi,(%rdi)
cmp    $0x3b9aca00,%rsi
jl     111d <timespec_add_ns+0x1d>
addl   $0x1,0x8(%rdi)
add    $0xffffffffc4653600,%rsi
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i32 }
define void @timespec_add_ns(%struct.timespec* %0, i64 %1) {
%3 = alloca %struct.timespec*
%4 = alloca i64
store %struct.timespec* %0, %struct.timespec** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = load %struct.timespec*, %struct.timespec** %3
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = add nsw i64 %8, %5
store i64 %9, i64* %7
%10 = load %struct.timespec*, %struct.timespec** %3
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %10, i32 0, i32 0
%12 = load i64, i64* %11
%13 = icmp sge i64 %12, 1000000000
br i1 %13, label %14, label %23
14: ; preds = %2
%15 = load %struct.timespec*, %struct.timespec** %3
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = add nsw i32 %17, 1
store i32 %18, i32* %16
%19 = load %struct.timespec*, %struct.timespec** %3
%20 = getelementptr inbounds %struct.timespec, %struct.timespec* %19, i32 0, i32 0
%21 = load i64, i64* %20
%22 = sub nsw i64 %21, 1000000000
store i64 %22, i64* %20
br label %23
23: ; preds = %14, %2
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i64, i32 }
define void @timespec_add_ns(%struct.timespec* nocapture %0, i64 %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%4 = load i64, i64* %3
%5 = add nsw i64 %4, %1
store i64 %5, i64* %3
%6 = icmp sgt i64 %5, 999999999
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%9 = load i32, i32* %8
%10 = add nsw i32 %9, 1
store i32 %10, i32* %8
%11 = add nsw i64 %5, -1000000000
store i64 %11, i64* %3
br label %12
12: ; preds = %7, %2
ret void
}
/* Variables and functions */
int remove(char const *);
int /*<<< orphan*/ syssuerr(char *, char *);
int eremove(const char *file) {
  int status;
  if ((status = remove(file)))
    syssuerr("%s: eremove: remove failed",
             "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
             "2022-01-22/02-19-57/repos/TobbeTripitaka/src/refs/heads/master/"
             "trip/iwave/sucore/src/subcalls.c");
  return status;
}


x86 assembly (clang, -O0):
<eremove>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <remove@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
je     1154 <eremove+0x34>
lea    0xeb8(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <syssuerr@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eremove>:
push   %rbx
call   1030 <remove@plt>
mov    %eax,%ebx
test   %eax,%eax
je     113f <eremove+0x1f>
lea    0xecd(%rip),%rdi
lea    0xee1(%rip),%rsi
call   1040 <syssuerr@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"%s: eremove: remove failed\00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/TobbeTripitaka/src/refs/heads/master/trip/iwave/sucore/src/subcalls.c\00"
define i32 @eremove(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @remove(i8* %4)
store i32 %5, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @syssuerr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s: eremove: remove failed\00"
@.str.1 = [160 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/TobbeTripitaka/src/refs/heads/master/trip/iwave/sucore/src/subcalls.c\00"
define i32 @eremove(i8* nocapture %0) {
%2 = tail call i32 @remove(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @syssuerr(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([160 x i8], [160 x i8]* @.str.1, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void usage(const char *mess) {
  fprintf(stderr, "Error: %s\n", mess);
  fprintf(stderr, "Usage: mkbrncmdline -i input_file -o output_file [-a "
                  "loadaddress] arg1 [argx ...]\n");
  fprintf(stderr, "\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
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
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e7b(%rip),%rax
mov    (%rax),%edi
lea    0xeee(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rbx
mov    (%rbx),%edi
lea    0xecc(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xec7(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xf08(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [83 x i8] c"Usage: mkbrncmdline -i input_file -o output_file [-a loadaddress] arg1 [argx ...]\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
@.str.1 = [83 x i8] c"Usage: mkbrncmdline -i input_file -o output_file [-a loadaddress] arg1 [argx ...]\0A\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([83 x i8], [83 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @stderr
%7 = tail call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
}
int dmov2(double xo, double yo, double xm, double ym, double *x, double *y) {
  *x = xo + xm;
  *y = yo + ym;
  return 0;
}


x86 assembly (clang, -O0):
<dmov2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
mov    %rdi,-0x28(%rbp)
mov    %rsi,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x10(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmov2>:
addsd  %xmm2,%xmm0
movsd  %xmm0,(%rdi)
addsd  %xmm3,%xmm1
movsd  %xmm1,(%rsi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @dmov2(double %0, double %1, double %2, double %3, double* %4, double* %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double*
%12 = alloca double*
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double* %4, double** %11
store double* %5, double** %12
%13 = load double, double* %7
%14 = load double, double* %9
%15 = fadd double %13, %14
%16 = load double*, double** %11
store double %15, double* %16
%17 = load double, double* %8
%18 = load double, double* %10
%19 = fadd double %17, %18
%20 = load double*, double** %12
store double %19, double* %20
ret i32 0
}

LLVM IR (-O2):
define i32 @dmov2(double %0, double %1, double %2, double %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = fadd double %0, %2
store double %7, double* %4
%8 = fadd double %1, %3
store double %8, double* %5
ret i32 0
}
int isdigit(int c) { return c >= 0; }


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

x86 assembly (clang, -O2):
<isdigit>:
mov    %edi,%eax
not    %eax
shr    $0x1f,%eax
ret

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

LLVM IR (-O2):
define i32 @isdigit(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
ret i32 %3
}
/* Variables and functions */
double frandUniform();
double frandRange(double a, double b) { return ((b - a) * frandUniform()) + a; }


x86 assembly (clang, -O0):
<frandRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    $0x0,%al
call   1030 <frandUniform@plt>
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<frandRange>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1030 <frandUniform@plt>
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @frandRange(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double %5, %6
%8 = call double (...) @frandUniform()
%9 = load double, double* %3
%10 = call double @llvm.fmuladd.f64(double %7, double %8, double %9)
ret double %10
}

LLVM IR (-O2):
define double @frandRange(double %0, double %1) {
%3 = fsub double %1, %0
%4 = tail call double (...) @frandUniform()
%5 = tail call double @llvm.fmuladd.f64(double %3, double %4, double %0)
ret double %5
}
int main(void) {
  int a[5] = {1, 2, 3, 4, 5};
  *(&a[5]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    0xeee(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeeb(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xee9(%rip),%eax
mov    %eax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
store i32 0, i32* %1
%3 = bitcast [5 x i32]* %2 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 5
%5 = load i32, i32* %4
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
int abs(int x) {
  if (x < 0) {
    return -x;
  } else {
    return x;
  }
}


x86 assembly (clang, -O0):
<abs>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <abs+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <abs+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
int ad7160_remove_raw(struct device *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @ad7160_remove_raw(%struct.device* nocapture readnone %0) {
ret i32 0
}