xunge/DecIR huggingface dataset:
struct ThreadStorage *get_thread_storage() {
  static __thread struct ThreadStorage *counters = 0;
  if (counters == 0) {
    counters = ts_add_thread();
  }
  return counters;
}


x86 assembly (clang, -O0):
<get_thread_storage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0x2ea1(%rip),%rdi
call   1030 <__tls_get_addr@plt>
mov    0x0(%rax),%rax
cmp    $0x0,%rax
jne    1169 <get_thread_storage+0x49>
xor    %eax,%eax
call   1040 <ts_add_thread@plt>
cltq
mov    %rax,-0x8(%rbp)
lea    0x2e77(%rip),%rdi
call   1030 <__tls_get_addr@plt>
mov    -0x8(%rbp),%rcx
mov    %rcx,0x0(%rax)
lea    0x2e60(%rip),%rdi
call   1030 <__tls_get_addr@plt>
mov    0x0(%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_thread_storage>:
push   %rbx
lea    0x2ea8(%rip),%rdi
call   1030 <__tls_get_addr@plt>
mov    0x0(%rax),%rcx
test   %rcx,%rcx
jne    1150 <get_thread_storage+0x30>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <ts_add_thread@plt>
movslq %eax,%rcx
mov    %rbx,%rax
mov    %rcx,0x0(%rbx)
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.ThreadStorage = type opaque
@get_thread_storage.counters = internal thread_local global %struct.ThreadStorage* null
define %struct.ThreadStorage* @get_thread_storage() {
%1 = load %struct.ThreadStorage*, %struct.ThreadStorage** @get_thread_storage.counters
%2 = icmp eq %struct.ThreadStorage* %1, null
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = call i32 (...) @ts_add_thread()
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to %struct.ThreadStorage*
store %struct.ThreadStorage* %6, %struct.ThreadStorage** @get_thread_storage.counters
br label %7
7: ; preds = %3, %0
%8 = load %struct.ThreadStorage*, %struct.ThreadStorage** @get_thread_storage.counters
ret %struct.ThreadStorage* %8
}

LLVM IR (-O2):
%struct.ThreadStorage = type opaque
@get_thread_storage.counters = internal thread_local unnamed_addr global %struct.ThreadStorage* null
define %struct.ThreadStorage* @get_thread_storage() {
%1 = load %struct.ThreadStorage*, %struct.ThreadStorage** @get_thread_storage.counters
%2 = icmp eq %struct.ThreadStorage* %1, null
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call i32 (...) @ts_add_thread()
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to %struct.ThreadStorage*
store %struct.ThreadStorage* %6, %struct.ThreadStorage** @get_thread_storage.counters
br label %7
7: ; preds = %3, %0
%8 = phi %struct.ThreadStorage* [ %6, %3 ], [ %1, %0 ]
ret %struct.ThreadStorage* %8
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int _kill(pid_t pid, int sig) {
  _exit(-1);
  return -1;
}


x86 assembly (clang, -O0):
<_kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<_kill>:
push   %rax
mov    $0xffffffff,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
define i32 @_kill(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @_exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define i32 @_kill(i32 %0, i32 %1) {
%3 = tail call i32 @_exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ __svgalib_driver8_getbox(int, int, int, int, void *, int);
void __svgalib_driver32_getbox(int x, int y, int w, int h, void *b, int bw) {
  __svgalib_driver8_getbox(x * 4, y, w * 4, h, b, bw * 4);
}


x86 assembly (clang, -O0):
<__svgalib_driver32_getbox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
shl    $0x2,%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
shl    $0x2,%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
shl    $0x2,%r9d
call   1030 <__svgalib_driver8_getbox@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__svgalib_driver32_getbox>:
shl    $0x2,%edi
shl    $0x2,%edx
shl    $0x2,%r9d
jmp    1030 <__svgalib_driver8_getbox@plt>

LLVM IR (-O0):
define void @__svgalib_driver32_getbox(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i8*
%12 = alloca i32
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
store i32 %5, i32* %12
%13 = load i32, i32* %7
%14 = mul nsw i32 %13, 4
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = mul nsw i32 %16, 4
%18 = load i32, i32* %10
%19 = load i8*, i8** %11
%20 = load i32, i32* %12
%21 = mul nsw i32 %20, 4
%22 = call i32 @__svgalib_driver8_getbox(i32 %14, i32 %15, i32 %17, i32 %18, i8* %19, i32 %21)
ret void
}

LLVM IR (-O2):
define void @__svgalib_driver32_getbox(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4, i32 %5) {
%7 = shl nsw i32 %0, 2
%8 = shl nsw i32 %2, 2
%9 = shl nsw i32 %5, 2
%10 = tail call i32 @__svgalib_driver8_getbox(i32 %7, i32 %1, i32 %8, i32 %3, i8* %4, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isalnum(int);
void t_isalnum_0xd9() {
  Assert_real((isalnum(217) == 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_isalnum.c",
              1090, ("isalnum should be 0 for 0xd9"));
}


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

x86 assembly (clang, -O2):
<t_isalnum_0xd9>:
push   %rax
mov    $0xd9,%edi
call   1030 <isalnum@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf66(%rip),%rcx
mov    $0x442,%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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xd9\00"
define void @t_isalnum_0xd9() {
%1 = call i64 @isalnum(i32 217)
%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 1090, 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_isalnum.c\00"
@.str.1 = [29 x i8] c"isalnum should be 0 for 0xd9\00"
define void @t_isalnum_0xd9() {
%1 = tail call i64 @isalnum(i32 217)
%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 1090, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char, char, char, char);
int main(void) {
  printf("VTAB_O: %c, BELL_O: %c, VTAB_H: %c, BELL_H: %c", '\013', '\007',
         '\xb', '\x7');
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [47 x i8] c"VTAB_O: %c, BELL_O: %c, VTAB_H: %c, BELL_H: %c\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext 11, i8 signext 7, i8 signext 11, i8 signext 7)
ret i32 0
}

LLVM IR (-O2):
@.str = [47 x i8] c"VTAB_O: %c, BELL_O: %c, VTAB_H: %c, BELL_H: %c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8 signext 11, i8 signext 7, i8 signext 11, i8 signext 7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clearGraph(int **);
int /*<<< orphan*/ inputGraph(int **);
int /*<<< orphan*/ printGraphMatrix(int **);
int /*<<< orphan*/ traverseBFT(int **);
int /*<<< orphan*/ traverseDFT(int **);
int main() {
  int adjacencyMatrix[5][5];
  clearGraph(adjacencyMatrix);
  inputGraph(adjacencyMatrix);
  printGraphMatrix(adjacencyMatrix);
  traverseBFT(adjacencyMatrix);
  traverseDFT(adjacencyMatrix);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
call   1070 <clearGraph@plt>
lea    -0x70(%rbp),%rdi
call   1050 <inputGraph@plt>
lea    -0x70(%rbp),%rdi
call   1040 <printGraphMatrix@plt>
lea    -0x70(%rbp),%rdi
call   1030 <traverseBFT@plt>
lea    -0x70(%rbp),%rdi
call   1060 <traverseDFT@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1070 <clearGraph@plt>
mov    %rbx,%rdi
call   1050 <inputGraph@plt>
mov    %rbx,%rdi
call   1040 <printGraphMatrix@plt>
mov    %rbx,%rdi
call   1030 <traverseBFT@plt>
mov    %rbx,%rdi
call   1060 <traverseDFT@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
store i32 0, i32* %1
%3 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%4 = bitcast [5 x i32]* %3 to i32**
%5 = call i32 @clearGraph(i32** %4)
%6 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%7 = bitcast [5 x i32]* %6 to i32**
%8 = call i32 @inputGraph(i32** %7)
%9 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%10 = bitcast [5 x i32]* %9 to i32**
%11 = call i32 @printGraphMatrix(i32** %10)
%12 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%13 = bitcast [5 x i32]* %12 to i32**
%14 = call i32 @traverseBFT(i32** %13)
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%16 = bitcast [5 x i32]* %15 to i32**
%17 = call i32 @traverseDFT(i32** %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = bitcast [5 x [5 x i32]]* %1 to i8*
%3 = bitcast [5 x [5 x i32]]* %1 to i32**
%4 = call i32 @clearGraph(i32** %3)
%5 = call i32 @inputGraph(i32** %3)
%6 = call i32 @printGraphMatrix(i32** %3)
%7 = call i32 @traverseBFT(i32** %3)
%8 = call i32 @traverseDFT(i32** %3)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ jmp_buf;

/* Variables and functions */
int proc_4(int /*<<< orphan*/, int);
int proc_3(jmp_buf env, int i, int j) {
  return proc_4(env, i) + proc_4(env, j);
}


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

x86 assembly (clang, -O2):
<proc_3>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %edi,%ebp
call   1030 <proc_4@plt>
mov    %eax,%ebx
mov    %ebp,%edi
mov    %r14d,%esi
call   1030 <proc_4@plt>
add    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @proc_3(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 = call i32 @proc_4(i32 %7, i32 %8)
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = call i32 @proc_4(i32 %10, i32 %11)
%13 = add nsw i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @proc_3(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @proc_4(i32 %0, i32 %1)
%5 = tail call i32 @proc_4(i32 %0, i32 %2)
%6 = add nsw i32 %5, %4
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ check_val_fini();
__attribute__((__destructor__)) void destruct(void) { check_val_fini(); }


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

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

LLVM IR (-O0):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @destruct, i8* null }]
define void @destruct() {
%1 = call i32 (...) @check_val_fini()
ret void
}

LLVM IR (-O2):
@llvm.global_dtors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @destruct, i8* null }]
define void @destruct() {
%1 = tail call i32 (...) @check_val_fini()
ret void
}
int log2_ceil(int x) {
  int r = 1;
  while (1 << r < x)
    r++;
  return r;
}


x86 assembly (clang, -O0):
<log2_ceil>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    -0x4(%rbp),%eax
jge    112f <log2_ceil+0x2f>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <log2_ceil+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<log2_ceil>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    %edi,%eax
jl     1110 <log2_ceil+0x10>
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @log2_ceil(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %6, %2 ]
%4 = shl nuw i32 1, %3
%5 = icmp slt i32 %4, %0
%6 = add nuw nsw i32 %3, 1
br i1 %5, label %2, label %7
7: ; preds = %2
ret i32 %3
}
void RandomFunc(unsigned long input[1], unsigned long output[1]) {
  unsigned long state[1];
  {
    state[0UL] = (input[0UL] | 51238316UL) >> 3UL;
    if (!((state[0UL] >> 3UL) & 1UL)) {
      state[0UL] <<= ((state[0UL] >> 1UL) & 7UL) | 1UL;
    }
    output[0UL] = state[0UL] | 454761159UL;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
or     $0x30dd5ac,%rax
shr    $0x3,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shr    $0x3,%rax
and    $0x1,%rax
cmp    $0x0,%rax
jne    1152 <RandomFunc+0x52>
mov    -0x18(%rbp),%rcx
shr    $0x1,%rcx
and    $0x7,%rcx
or     $0x1,%rcx
mov    -0x18(%rbp),%rax
shl    %cl,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
or     $0x1b1b1ac7,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
mov    (%rdi),%rax
mov    %rax,%rdx
shr    $0x3,%rdx
or     $0x61bab5,%rdx
mov    %edx,%ecx
shr    %cl
and    $0x6,%cl
or     $0x1,%cl
xor    %edi,%edi
test   $0x40,%al
movzbl %cl,%ecx
cmovne %edi,%ecx
shl    %cl,%rdx
or     $0x1b1b1ac7,%rdx
mov    %rdx,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i64* %0, i64* %1) {
%3 = alloca i64*
%4 = alloca i64*
%5 = alloca [1 x i64]
store i64* %0, i64** %3
store i64* %1, i64** %4
%6 = load i64*, i64** %3
%7 = getelementptr inbounds i64, i64* %6, i64 0
%8 = load i64, i64* %7
%9 = or i64 %8, 51238316
%10 = lshr i64 %9, 3
%11 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
store i64 %10, i64* %11
%12 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%13 = load i64, i64* %12
%14 = lshr i64 %13, 3
%15 = and i64 %14, 1
%16 = icmp ne i64 %15, 0
br i1 %16, label %26, label %17
17: ; preds = %2
%18 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%19 = load i64, i64* %18
%20 = lshr i64 %19, 1
%21 = and i64 %20, 7
%22 = or i64 %21, 1
%23 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%24 = load i64, i64* %23
%25 = shl i64 %24, %22
store i64 %25, i64* %23
br label %26
26: ; preds = %17, %2
%27 = getelementptr inbounds [1 x i64], [1 x i64]* %5, i64 0, i64 0
%28 = load i64, i64* %27
%29 = or i64 %28, 454761159
%30 = load i64*, i64** %4
%31 = getelementptr inbounds i64, i64* %30, i64 0
store i64 %29, i64* %31
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i64* nocapture %0, i64* nocapture writeonly %1) {
%3 = load i64, i64* %0
%4 = lshr i64 %3, 3
%5 = or i64 %4, 6404789
%6 = and i64 %3, 64
%7 = icmp eq i64 %6, 0
%8 = lshr i64 %5, 1
%9 = and i64 %8, 6
%10 = or i64 %9, 1
%11 = select i1 %7, i64 %10, i64 0
%12 = shl i64 %5, %11
%13 = or i64 %12, 454761159
store i64 %13, i64* %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ siginfo_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ P_PID;
int /*<<< orphan*/ WSTOPPED;
int proc_step(int /*<<< orphan*/);
int /*<<< orphan*/ waitid(int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/ *, int /*<<< orphan*/);
int proc_step_and_wait(pid_t pid) {
  int ret;
  siginfo_t info;
  ret = proc_step(pid);
  if (ret)
    return -1;
  waitid(P_PID, pid, &info, WSTOPPED);
  return 0;
}


x86 assembly (clang, -O0):
<proc_step_and_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <proc_step@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     114c <proc_step_and_wait+0x2c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1171 <proc_step_and_wait+0x51>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%esi
mov    0x2e91(%rip),%rax
mov    (%rax),%ecx
lea    -0x10(%rbp),%rdx
call   1040 <waitid@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proc_step_and_wait>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
call   1030 <proc_step@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
test   %ecx,%ecx
jne    1157 <proc_step_and_wait+0x37>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2ea9(%rip),%rax
mov    (%rax),%ecx
lea    0xc(%rsp),%rdx
mov    %ebx,%esi
call   1040 <waitid@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@P_PID = global i32 0
@WSTOPPED = global i32 0
define i32 @proc_step_and_wait(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @proc_step(i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 -1, i32* %2
br label %16
11: ; preds = %1
%12 = load i32, i32* @P_PID
%13 = load i32, i32* %3
%14 = load i32, i32* @WSTOPPED
%15 = call i32 @waitid(i32 %12, i32 %13, i32* %5, i32 %14)
store i32 0, i32* %2
br label %16
16: ; preds = %11, %10
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
@P_PID = global i32 0
@WSTOPPED = global i32 0
define i32 @proc_step_and_wait(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i32 @proc_step(i32 %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* @P_PID
%8 = load i32, i32* @WSTOPPED
%9 = call i32 @waitid(i32 %7, i32 %0, i32* %2, i32 %8)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ 0, %6 ], [ -1, %1 ]
ret i32 %11
}
/* Variables and functions */
int read(int /*<<< orphan*/, char *, int);
void tty_FlushIn() {
  char key;
  while (read(0, &key, 1) != -1)
    ;
}


x86 assembly (clang, -O0):
<tty_FlushIn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
lea    -0x1(%rbp),%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0xffffffff,%eax
je     1136 <tty_FlushIn+0x26>
jmp    1118 <tty_FlushIn+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tty_FlushIn>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
nopw   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %rbx,%rsi
mov    $0x1,%edx
call   1030 <read@plt>
cmp    $0xffffffff,%eax
jne    1120 <tty_FlushIn+0x10>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @tty_FlushIn() {
%1 = alloca i8
br label %2
2: ; preds = %5, %0
%3 = call i32 @read(i32 0, i8* %1, i32 1)
%4 = icmp ne i32 %3, -1
br i1 %4, label %5, label %6
5: ; preds = %2
br label %2
6: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @tty_FlushIn() {
%1 = alloca i8
br label %2
2: ; preds = %2, %0
%3 = call i32 @read(i32 0, i8* %1, i32 1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %2
5: ; preds = %2
ret void
}
char s(int r) {
  if (r == 1) {
    return 88;
  }
  if (r == 0) {
    return 79;
  }
  if (r == 2) {
    return 32;
  }
  return 32;
}


x86 assembly (clang, -O0):

:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    111a <s+0x1a>
movb   $0x58,-0x1(%rbp)
jmp    1144 <s+0x44>
cmpl   $0x0,-0x8(%rbp)
jne    112d <s+0x2d>
movb   $0x4f,-0x1(%rbp)
jmp    1144 <s+0x44>
cmpl   $0x2,-0x8(%rbp)
jne    1140 <s+0x40>
movb   $0x20,-0x1(%rbp)
jmp    1144 <s+0x44>
movb   $0x20,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):

:
lea    0x0(,%rdi,8),%ecx
mov    $0x20584f,%edx
shr    %cl,%edx
cmp    $0x3,%edi
mov    $0x20,%eax
cmovb  %edx,%eax
ret

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

LLVM IR (-O2):
define signext i8 @s(i32 %0) {
%2 = icmp ult i32 %0, 3
%3 = trunc i32 %0 to i24
%4 = shl i24 %3, 3
%5 = lshr i24 2119759, %4
%6 = trunc i24 %5 to i8
%7 = select i1 %2, i8 %6, i8 32
ret i8 %7
}
void finish_ip_statistics(void) {}


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

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

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

LLVM IR (-O2):
define void @finish_ip_statistics() {
ret void
}
float bound_float(float val, float min, float max) {
  return val < min ? min : (val > max ? max : val);
}


x86 assembly (clang, -O0):
<bound_float>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1135 <bound_float+0x35>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
jmp    1167 <bound_float+0x67>
movss  -0x4(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    1153 <bound_float+0x53>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    115d <bound_float+0x5d>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bound_float>:
minss  %xmm0,%xmm2
cmpltss %xmm1,%xmm0
movaps %xmm0,%xmm3
andnps %xmm2,%xmm3
andps  %xmm1,%xmm0
orps   %xmm3,%xmm0
ret

LLVM IR (-O0):
define float @bound_float(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = fcmp olt float %7, %8
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load float, float* %5
br label %22
12: ; preds = %3
%13 = load float, float* %4
%14 = load float, float* %6
%15 = fcmp ogt float %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = load float, float* %6
br label %20
18: ; preds = %12
%19 = load float, float* %4
br label %20
20: ; preds = %18, %16
%21 = phi float [ %17, %16 ], [ %19, %18 ]
br label %22
22: ; preds = %20, %10
%23 = phi float [ %11, %10 ], [ %21, %20 ]
ret float %23
}

LLVM IR (-O2):
define float @bound_float(float %0, float %1, float %2) {
%4 = fcmp olt float %0, %1
%5 = fcmp ogt float %0, %2
%6 = select i1 %5, float %2, float %0
%7 = select i1 %4, float %1, float %6
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ vga_cls();
void main() {
  vga_cls();
  while (1)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <vga_cls@plt>
jmp    111b <main+0xb>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <vga_cls@plt>
nopl   0x0(%rax,%rax,1)
jmp    1120 <main+0x10>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @vga_cls()
br label %2
2: ; preds = %0, %2
br label %2
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @vga_cls()
br label %2
2: ; preds = %0, %2
br label %2
}
/* Variables and functions */
scalar_t__ param_getptr(char const *, int *, int *, int);
int param_getlength(const char *line, int paramnum) {
  int bg, en;
  if (param_getptr(line, &bg, &en, paramnum))
    return 0;
  return en - bg + 1;
}


x86 assembly (clang, -O0):
<param_getlength>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1030 <param_getptr@plt>
cmp    $0x0,%rax
je     1149 <param_getlength+0x39>
movl   $0x0,-0x4(%rbp)
jmp    1155 <param_getlength+0x45>
mov    -0x1c(%rbp),%eax
sub    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<param_getlength>:
push   %rax
mov    %esi,%ecx
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1030 <param_getptr@plt>
mov    (%rsp),%edx
sub    0x4(%rsp),%edx
add    $0x1,%edx
xor    %ecx,%ecx
test   %rax,%rax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @param_getlength(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i64 @param_getptr(i8* %0, i32* %3, i32* %4, i32 %1)
%8 = icmp eq i64 %7, 0
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = add i32 %9, 1
%12 = sub i32 %11, %10
%13 = select i1 %8, i32 %12, i32 0
ret i32 %13
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};
struct tb_event {
  int dummy;
};

/* Variables and functions */
int wait_fill_event(struct tb_event *, struct timeval *);
int tb_peek_event(struct tb_event *event, int timeout) {
  struct timeval tv;
  tv.tv_sec = timeout / 1000;
  tv.tv_usec = (timeout - (tv.tv_sec * 1000)) * 1000;
  return wait_fill_event(event, &tv);
}


x86 assembly (clang, -O0):
<tb_peek_event>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   $0x3e8,-0x18(%rbp),%ecx
sub    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <wait_fill_event@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tb_peek_event>:
push   %rax
movslq %esi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0xfffffc18,%ecx,%ecx
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rsi
call   1030 <wait_fill_event@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tb_event = type { i32 }
%struct.timeval = type { i32, i32 }
define i32 @tb_peek_event(%struct.tb_event* %0, i32 %1) {
%3 = alloca %struct.tb_event*
%4 = alloca i32
%5 = alloca %struct.timeval
store %struct.tb_event* %0, %struct.tb_event** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sdiv i32 %6, 1000
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
store i32 %7, i32* %8
%9 = load i32, i32* %4
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 0
%11 = load i32, i32* %10
%12 = mul nsw i32 %11, 1000
%13 = sub nsw i32 %9, %12
%14 = mul nsw i32 %13, 1000
%15 = getelementptr inbounds %struct.timeval, %struct.timeval* %5, i32 0, i32 1
store i32 %14, i32* %15
%16 = load %struct.tb_event*, %struct.tb_event** %3
%17 = call i32 @wait_fill_event(%struct.tb_event* %16, %struct.timeval* %5)
ret i32 %17
}

LLVM IR (-O2):
%struct.tb_event = type { i32 }
%struct.timeval = type { i32, i32 }
define i32 @tb_peek_event(%struct.tb_event* %0, i32 %1) {
%3 = alloca %struct.timeval
%4 = bitcast %struct.timeval* %3 to i8*
%5 = sdiv i32 %1, 1000
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 0
store i32 %5, i32* %6
%7 = mul nsw i32 %5, -1000
%8 = add i32 %7, %1
%9 = mul nsw i32 %8, 1000
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i64 0, i32 1
store i32 %9, i32* %10
%11 = call i32 @wait_fill_event(%struct.tb_event* %0, %struct.timeval* %3)
ret i32 %11
}
/* Variables and functions */
double sin(double const);
char f_sin(double *a, const double *b) {
  *a = sin(*b);
  return (0);
}


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

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

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

LLVM IR (-O2):
define signext i8 @f_sin(double* nocapture writeonly %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = tail call double @sin(double %3)
store double %4, double* %0
ret i8 0
}
/* Variables and functions */
int /*<<< orphan*/ os_enterKernel();
void Squawk_enterKernel(void) { os_enterKernel(); }


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

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

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

LLVM IR (-O2):
define void @Squawk_enterKernel() {
%1 = tail call i32 (...) @os_enterKernel()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mfread();
midifile() { mfread(); }


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

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

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

LLVM IR (-O2):
define i32 @midifile() {
%1 = tail call i32 (...) @mfread()
ret i32 undef
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int HadTu_decoding(void const *);
uint32_t SubEvt_trigType_trb3(const void *my) {
  return ((HadTu_decoding(my) & 0xF0) >> 4);
}


x86 assembly (clang, -O0):
<SubEvt_trigType_trb3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <HadTu_decoding@plt>
and    $0xf0,%eax
sar    $0x4,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SubEvt_trigType_trb3>:
push   %rax
call   1030 <HadTu_decoding@plt>
shr    $0x4,%eax
and    $0xf,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @SubEvt_trigType_trb3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @HadTu_decoding(i8* %3)
%5 = and i32 %4, 240
%6 = ashr i32 %5, 4
ret i32 %6
}

LLVM IR (-O2):
define i32 @SubEvt_trigType_trb3(i8* %0) {
%2 = tail call i32 @HadTu_decoding(i8* %0)
%3 = lshr i32 %2, 4
%4 = and i32 %3, 15
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ munmap(void *, size_t);
void xmm_free(void *m, size_t size) {
  if (m && size > 0) {
    if (size < 4096)
      free(m);
    else
      munmap(m, (((size / 4096) + ((size % 4096) != 0)) * 4096));
  }
  return;
}


x86 assembly (clang, -O0):
<xmm_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1197 <xmm_free+0x77>
cmpq   $0x0,-0x10(%rbp)
jbe    1197 <xmm_free+0x77>
cmpq   $0x1000,-0x10(%rbp)
jae    1162 <xmm_free+0x42>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    1192 <xmm_free+0x72>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
shr    $0xc,%rsi
mov    -0x10(%rbp),%rax
and    $0xfff,%rax
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%eax
cltq
add    %rax,%rsi
shl    $0xc,%rsi
call   1040 <munmap@plt>
jmp    1197 <xmm_free+0x77>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmm_free>:
test   %rdi,%rdi
je     1138 <xmm_free+0x18>
test   %rsi,%rsi
je     1138 <xmm_free+0x18>
cmp    $0xfff,%rsi
ja     1139 <xmm_free+0x19>
jmp    1030 <free@plt>
ret
xor    %eax,%eax
test   $0xfff,%esi
setne  %al
shl    $0xc,%rax
add    %rsi,%rax
and    $0xfffffffffffff000,%rax
mov    %rax,%rsi
jmp    1040 <munmap@plt>

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

LLVM IR (-O2):
define void @xmm_free(i8* %0, i64 %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
br i1 %5, label %6, label %17
6: ; preds = %2
%7 = icmp ult i64 %1, 4096
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @free(i8* %0)
br label %17
10: ; preds = %6
%11 = and i64 %1, 4095
%12 = icmp eq i64 %11, 0
%13 = select i1 %12, i64 0, i64 4096
%14 = add i64 %13, %1
%15 = and i64 %14, -4096
%16 = tail call i32 @munmap(i8* %0, i64 %15)
br label %17
17: ; preds = %8, %10, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ KIONIX_ACCEL_disable_int();
void KIONIX_ACCEL_disable_interrupt(void) {
  ;
  KIONIX_ACCEL_disable_int();
  ;
}


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

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

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

LLVM IR (-O2):
define void @KIONIX_ACCEL_disable_interrupt() {
%1 = tail call i32 (...) @KIONIX_ACCEL_disable_int()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_complex();
int /*<<< orphan*/ test_key_with_complex();
int /*<<< orphan*/ test_scan_with_basic_list();
int /*<<< orphan*/ test_simple_scan();
int main(void) {
  test_simple_scan();
  test_key_with_complex();
  test_scan_with_basic_list();
  test_complex();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_simple_scan@plt>
xor    %eax,%eax
call   1040 <test_key_with_complex@plt>
xor    %eax,%eax
call   1050 <test_scan_with_basic_list@plt>
xor    %eax,%eax
call   1060 <test_complex@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_simple_scan()
%2 = tail call i32 (...) @test_key_with_complex()
%3 = tail call i32 (...) @test_scan_with_basic_list()
%4 = tail call i32 (...) @test_complex()
ret i32 0
}
int test_imm_0Eint8_reg(signed char val) {
  return ((val) & (-0x0E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_0Eint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xfffffff2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_0Eint8_reg(i8 signext %0) {
%2 = and i8 %0, -14
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ range;

/* Variables and functions */
int minTimes(int *, int, int, int);
int /*<<< orphan*/ printf(char *, int);
void main() {
  int range[] = {3, 2, 1, 1, 3, 1, 2, 2, 1, 1, 2, 2, 2, 2, 3};
  int len = sizeof(range) / sizeof(range[0]);
  int start = 6;
  int end = 13;
  int res = minTimes(range, len, start, end);
  printf("%d", res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
lea    -0x40(%rbp),%rdi
lea    0xebd(%rip),%rsi
mov    $0x3c,%edx
call   1050 <memcpy@plt>
movl   $0xf,-0x44(%rbp)
movl   $0x6,-0x48(%rbp)
movl   $0xd,-0x4c(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x48(%rbp),%edx
mov    -0x4c(%rbp),%ecx
call   1040 <minTimes@plt>
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movups 0xf01(%rip),%xmm0
movups %xmm0,0x2c(%rsp)
movaps 0xee9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xecd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb1(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0xf,%esi
mov    $0x6,%edx
mov    $0xd,%ecx
call   1040 <minTimes@plt>
lea    0xecb(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.range = [15 x i32] [i32 3, i32 2, i32 1, i32 1, i32 3, i32 1, i32 2, i32 2, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [15 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast [15 x i32]* %1 to i8*
store i32 15, i32* %2
store i32 6, i32* %3
store i32 13, i32* %4
%7 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = load i32, i32* %4
%11 = call i32 @minTimes(i32* %7, i32 %8, i32 %9, i32 %10)
store i32 %11, i32* %5
%12 = load i32, i32* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}

LLVM IR (-O2):
@__const.main.range = [15 x i32] [i32 3, i32 2, i32 1, i32 1, i32 3, i32 1, i32 2, i32 2, i32 1, i32 1, i32 2, i32 2, i32 2, i32 2, i32 3]
@.str = [3 x i8] c"%d\00"
define void @main() {
%1 = alloca [15 x i32]
%2 = bitcast [15 x i32]* %1 to i8*
%3 = getelementptr inbounds [15 x i32], [15 x i32]* %1, i64 0, i64 0
%4 = call i32 @minTimes(i32* %3, i32 15, i32 6, i32 13)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %4)
ret void
}
/* Variables and functions */
unsigned int foo(int);
int main() {
  volatile unsigned int tem = foo(-0x7fffffff - 1);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x80000000,%edi
call   1030 <foo@plt>
mov    %eax,0x4(%rsp)
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 @foo(i32 -2147483648)
store volatile i32 %3, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @foo(i32 -2147483648)
store volatile i32 %3, i32* %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *mkstr(char *);
void g() {
  int i;
  char *a[100];
  for (i = 0; i < 100; i++)
    a[i] = mkstr("in f");
  free(a[2]);
  free(a[0]);
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x330,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jge    1165 <g+0x45>
lea    0xebd(%rip),%rdi
call   1040 <mkstr@plt>
mov    %rax,%rcx
movslq -0x4(%rbp),%rax
mov    %rcx,-0x330(%rbp,%rax,8)
ff
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <g+0x12>
mov    -0x320(%rbp),%rdi
call   1030 <free@plt>
mov    -0x330(%rbp),%rdi
call   1030 <free@plt>
add    $0x330,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g>:
push   %r14
push   %rbx
sub    $0x328,%rsp
xor    %ebx,%ebx
lea    0xecd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
call   1040 <mkstr@plt>
mov    %rax,(%rsp,%rbx,8)
add    $0x1,%rbx
cmp    $0x64,%rbx
jne    1140 <g+0x20>
mov    0x10(%rsp),%rdi
call   1030 <free@plt>
mov    (%rsp),%rdi
add    $0x328,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"in f\00"
define void @g() {
%1 = alloca [100 x i8*]
%2 = bitcast [100 x i8*]* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = phi i64 [ 0, %0 ], [ %7, %3 ]
%5 = tail call i8* @mkstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 %4
store i8* %5, i8** %6
%7 = add nuw nsw i64 %4, 1
%8 = icmp eq i64 %7, 100
br i1 %8, label %9, label %3
9: ; preds = %3
%10 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @free(i8* %11)
%13 = getelementptr inbounds [100 x i8*], [100 x i8*]* %1, i64 0, i64 0
%14 = load i8*, i8** %13
%15 = tail call i32 @free(i8* %14)
ret void
}
signed long long decode_zig_zag64(unsigned long long n) {
  return (n >> 1) ^ -(n & 1);
}


x86 assembly (clang, -O0):
<decode_zig_zag64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1,%rax
mov    -0x8(%rbp),%rdx
and    $0x1,%rdx
xor    %ecx,%ecx
sub    %rdx,%rcx
xor    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<decode_zig_zag64>:
mov    %rdi,%rax
shr    %rax
and    $0x1,%edi
neg    %rdi
xor    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @decode_zig_zag64(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 1
%5 = load i64, i64* %2
%6 = and i64 %5, 1
%7 = sub i64 0, %6
%8 = xor i64 %4, %7
ret i64 %8
}

LLVM IR (-O2):
define i64 @decode_zig_zag64(i64 %0) {
%2 = lshr i64 %0, 1
%3 = and i64 %0, 1
%4 = sub nsw i64 0, %3
%5 = xor i64 %2, %4
ret i64 %5
}
double fact(double n) {
  double r = 1;
  while (n > 1)
    r *= n--;
  return r;
}


x86 assembly (clang, -O0):
<fact>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xeef(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xedd(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1155 <fact+0x55>
movsd  -0x8(%rbp),%xmm0
movsd  0xece(%rip),%xmm2
movaps %xmm0,%xmm1
addsd  %xmm2,%xmm1
movsd  %xmm1,-0x8(%rbp)
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1116 <fact+0x16>
movsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fact>:
movsd  0xef8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    113e <fact+0x3e>
movsd  0xeea(%rip),%xmm2
movsd  0xeea(%rip),%xmm3
movapd %xmm2,%xmm1
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm0
ucomisd %xmm2,%xmm0
ja     1130 <fact+0x30>
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fact(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
store double 1.000000e+00, double* %3
br label %4
4: ; preds = %7, %1
%5 = load double, double* %2
%6 = fcmp ogt double %5, 1.000000e+00
br i1 %6, label %7, label %12
7: ; preds = %4
%8 = load double, double* %2
%9 = fadd double %8, -1.000000e+00
store double %9, double* %2
%10 = load double, double* %3
%11 = fmul double %10, %8
store double %11, double* %3
br label %4
12: ; preds = %4
%13 = load double, double* %3
ret double %13
}

LLVM IR (-O2):
define double @fact(double %0) {
%2 = fcmp ogt double %0, 1.000000e+00
br i1 %2, label %3, label %9
3: ; preds = %1, %3
%4 = phi double [ %7, %3 ], [ 1.000000e+00, %1 ]
%5 = phi double [ %6, %3 ], [ %0, %1 ]
%6 = fadd double %5, -1.000000e+00
%7 = fmul double %5, %4
%8 = fcmp ogt double %6, 1.000000e+00
br i1 %8, label %3, label %9
9: ; preds = %3, %1
%10 = phi double [ 1.000000e+00, %1 ], [ %7, %3 ]
ret double %10
}
void PyDTrace_AUDIT(const char *arg0, void *arg1) {}


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

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

LLVM IR (-O0):
define void @PyDTrace_AUDIT(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @PyDTrace_AUDIT(i8* nocapture %0, i8* nocapture %1) {
ret void
}