xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void checkIfOddOrEven(int numberToCheck) {
  if (numberToCheck % 2 == 0) {
    printf("%d is even\n", numberToCheck);
  } else {
    printf("%d is odd\n", numberToCheck);
  }
}


x86 assembly (clang, -O0):
<checkIfOddOrEven>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1143 <checkIfOddOrEven+0x33>
mov    -0x4(%rbp),%esi
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
jmp    1152 <checkIfOddOrEven+0x42>
mov    -0x4(%rbp),%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfOddOrEven>:
mov    %edi,%esi
test   $0x1,%sil
lea    0xee3(%rip),%rax
lea    0xee8(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%d is even\0A\00"
@.str.1 = [11 x i8] c"%d is odd\0A\00"
define void @checkIfOddOrEven(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %7)
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10)
br label %12
12: ; preds = %9, %6
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"%d is even\0A\00"
@.str.1 = [11 x i8] c"%d is odd\0A\00"
define void @checkIfOddOrEven(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @printf(i8* %4, i32 %0)
ret void
}
/* Variables and functions */
int bodyless();
unsigned call_bodyless(void) { return bodyless() + 1; }


x86 assembly (clang, -O0):
<call_bodyless>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <bodyless@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<call_bodyless>:
push   %rax
xor    %eax,%eax
call   1030 <bodyless@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @call_bodyless() {
%1 = call i32 (...) @bodyless()
%2 = add nsw i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @call_bodyless() {
%1 = tail call i32 (...) @bodyless()
%2 = add nsw i32 %1, 1
ret i32 %2
}
__attribute__((no)) long trampoline_move_code(unsigned long n1,
                                              unsigned long n2,
                                              unsigned long n3,
                                              unsigned long n4) {
  long ret;
  __asm__ __volatile__("leaq 1f(%%rip), %%r11\n\t"
                       "movq %%r11, %%fs:0x20\n\t"
                       "jmpq *%%gs:0x10000+"
                       "0x100"
                       "\n\t"
                       "1:\n\t"
                       : "=a"(ret)
                       : "D"(n1), "S"(n2), "d"(n3), "c"(n4)
                       : "memory");
  return ret;
}


x86 assembly (clang, -O0):
<trampoline_move_code>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x10100
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<trampoline_move_code>:
lea    0x11(%rip),%r11
mov    %r11,%fs:0x20
jmp    *%gs:0x10100
ret

LLVM IR (-O0):
define i64 @trampoline_move_code(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
store i64 %0, i64* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i64, i64* %5
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = load i64, i64* %8
%14 = call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0x100\0A\091:\0A\09", "={ax},{di},{si},{dx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %10, i64 %11, i64 %12, i64 %13)
store i64 %14, i64* %9
%15 = load i64, i64* %9
ret i64 %15
}

LLVM IR (-O2):
define i64 @trampoline_move_code(i64 %0, i64 %1, i64 %2, i64 %3) {
%5 = tail call i64 asm sideeffect "leaq 1f(%rip), %r11\0A\09movq %r11, %fs:0x20\0A\09jmpq *%gs:0x10000+0x100\0A\091:\0A\09", "={ax},{di},{si},{dx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %2, i64 %3)
ret i64 %5
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sleep(int sec) {
  int i;
  for (i = 0; i < sec; i++)
    usleep(1 * 1000 * 1000);
}


x86 assembly (clang, -O0):
<sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <sleep+0x36>
mov    $0xf4240,%edi
call   1030 <usleep@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <sleep+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sleep>:
push   %rbx
test   %edi,%edi
jle    112f <sleep+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0xf4240,%edi
call   1030 <usleep@plt>
add    $0xffffffff,%ebx
jne    1120 <sleep+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @sleep(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @usleep(i32 1000000)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
void pollen_interfaces_Gpio_makeInput__E() {}


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

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

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

LLVM IR (-O2):
define void @pollen_interfaces_Gpio_makeInput__E() {
ret void
}
lower(int c) {
  if (c >= 'A' && c <= 'Z')
    return c + 'a' - 'A';
  else
    return c;
}


x86 assembly (clang, -O0):
<lower>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     112c <lower+0x2c>
cmpl   $0x5a,-0x8(%rbp)
jg     112c <lower+0x2c>
mov    -0x8(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1132 <lower+0x32>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<lower>:
lea    -0x41(%rdi),%ecx
lea    0x20(%rdi),%eax
cmp    $0x1a,%ecx
cmovae %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @lower(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %4, i32 %0
ret i32 %5
}
/* Variables and functions */
int get_response(char *);
int /*<<< orphan*/ set_rc_noecho_mode();
int /*<<< orphan*/ tty_mode(int);
int main() {
  int response;
  tty_mode(0);
  set_rc_noecho_mode();
  response = get_response("Do you want another transaction");
  tty_mode(1);
  return response;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <tty_mode@plt>
mov    $0x0,%al
call   1040 <set_rc_noecho_mode@plt>
lea    0xeac(%rip),%rdi
call   1030 <get_response@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%edi
call   1050 <tty_mode@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <tty_mode@plt>
xor    %eax,%eax
call   1040 <set_rc_noecho_mode@plt>
lea    0xeba(%rip),%rdi
call   1030 <get_response@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1050 <tty_mode@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Do you want another transaction\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 @tty_mode(i32 0)
%4 = call i32 (...) @set_rc_noecho_mode()
%5 = call i32 @get_response(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
store i32 %5, i32* %2
%6 = call i32 @tty_mode(i32 1)
%7 = load i32, i32* %2
ret i32 %7
}

LLVM IR (-O2):
@.str = [32 x i8] c"Do you want another transaction\00"
define i32 @main() {
%1 = tail call i32 @tty_mode(i32 0)
%2 = tail call i32 (...) @set_rc_noecho_mode()
%3 = tail call i32 @get_response(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @tty_mode(i32 1)
ret i32 %3
}
/* Variables and functions */
int *malloc(int);
int *create_tab(int tab[], unsigned tab_size) {
  tab = malloc(sizeof(int) * tab_size);
  if (tab != NULL) {
    for (unsigned i = 0; i < tab_size; i++) {
      tab[i] = 0;
    }
  }
  return tab;
}


x86 assembly (clang, -O0):
<create_tab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1170 <create_tab+0x60>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jae    116b <create_tab+0x5b>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
movl   $0x0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1143 <create_tab+0x33>
jmp    1170 <create_tab+0x60>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_tab>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <malloc@plt>
mov    %rax,%r14
test   %rax,%rax
je     114e <create_tab+0x2e>
test   %ebx,%ebx
je     114e <create_tab+0x2e>
mov    %ebx,%edx
shl    $0x2,%rdx
mov    %r14,%rdi
xor    %esi,%esi
call   1030 <memset@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define noalias i32* @create_tab(i32* nocapture readnone %0, i32 %1) {
%3 = shl i32 %1, 2
%4 = tail call i32* @malloc(i32 %3)
%5 = icmp ne i32* %4, null
%6 = icmp ne i32 %1, 0
%7 = and i1 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = bitcast i32* %4 to i8*
%10 = zext i32 %1 to i64
%11 = shl nuw nsw i64 %10, 2
br label %12
12: ; preds = %8, %2
ret i32* %4
}
void RandomFunc(unsigned char input[1], unsigned char output[1]) {
  unsigned char state[1];
  unsigned char local1;
  {
    state[0UL] = (input[0UL] & 914778474UL) << (unsigned char)7;
    local1 = 0UL;
    while (local1 < (unsigned char)0) {
      state[0UL] &= state[local1];
      local1++;
    }
    output[0UL] = (state[0UL] << (unsigned char)1) >> (unsigned char)1;
  }
}


x86 assembly (clang, -O0):
<RandomFunc>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
and    $0x3686696a,%rax
shl    $0x7,%rax
mov    %al,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x12(%rbp),%eax
cmp    $0x0,%eax
jge    1150 <RandomFunc+0x50>
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp,%rax,1),%ecx
movzbl -0x11(%rbp),%eax
and    %ecx,%eax
mov    %al,-0x11(%rbp)
mov    -0x12(%rbp),%al
add    $0x1,%al
mov    %al,-0x12(%rbp)
jmp    1124 <RandomFunc+0x24>
movzbl -0x11(%rbp),%eax
shl    $0x1,%eax
sar    $0x1,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<RandomFunc>:
movb   $0x0,(%rsi)
ret

LLVM IR (-O0):
define void @RandomFunc(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [1 x i8]
%6 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = zext i8 %9 to i64
%11 = and i64 %10, 914778474
%12 = shl i64 %11, 7
%13 = trunc i64 %12 to i8
%14 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
store i8 %13, i8* %14
store i8 0, i8* %6
br label %15
15: ; preds = %19, %2
%16 = load i8, i8* %6
%17 = zext i8 %16 to i32
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %32
19: ; preds = %15
%20 = load i8, i8* %6
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 %21
%23 = load i8, i8* %22
%24 = zext i8 %23 to i32
%25 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%26 = load i8, i8* %25
%27 = zext i8 %26 to i32
%28 = and i32 %27, %24
%29 = trunc i32 %28 to i8
store i8 %29, i8* %25
%30 = load i8, i8* %6
%31 = add i8 %30, 1
store i8 %31, i8* %6
br label %15
32: ; preds = %15
%33 = getelementptr inbounds [1 x i8], [1 x i8]* %5, i64 0, i64 0
%34 = load i8, i8* %33
%35 = zext i8 %34 to i32
%36 = shl i32 %35, 1
%37 = ashr i32 %36, 1
%38 = trunc i32 %37 to i8
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 0
store i8 %38, i8* %40
ret void
}

LLVM IR (-O2):
define void @RandomFunc(i8* nocapture readnone %0, i8* nocapture writeonly %1) {
store i8 0, i8* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ orgfx_line3d(int, int, int /*<<< orphan*/, int, int,
                                int /*<<< orphan*/);
void orgfx_line(int x0, int y0, int x1, int y1) {
  orgfx_line3d(x0, y0, 0, x1, y1, 0);
}


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

x86 assembly (clang, -O2):
<orgfx_line>:
mov    %ecx,%r8d
mov    %edx,%ecx
xor    %edx,%edx
xor    %r9d,%r9d
jmp    1030 <orgfx_line3d@plt>

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

LLVM IR (-O2):
define void @orgfx_line(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 @orgfx_line3d(i32 %0, i32 %1, i32 0, i32 %2, i32 %3, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int main() { f(2); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 2)
ret i32 0
}
int barfoobar() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @barfoobar() {
ret i32 0
}
/* Variables and functions */
int print(int, char *);
int italics(int tty) { return print(tty, "\033[3m"); }


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

x86 assembly (clang, -O2):
<italics>:
lea    0xee9(%rip),%rsi
jmp    1030 <print@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[3m\00"
define i32 @italics(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @print(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %4
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[3m\00"
define i32 @italics(i32 %0) {
%2 = tail call i32 @print(i32 %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ XGraphicsExposeEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ free(int /*<<< orphan*/ *);
void free_XGraphicsExposeEvent(void *_p) {
  if (_p == NULL)
    abort();
  free((XGraphicsExposeEvent *)_p);
}


x86 assembly (clang, -O0):
<free_XGraphicsExposeEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    113e <free_XGraphicsExposeEvent+0x1e>
mov    $0x0,%al
call   1040 <abort@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_XGraphicsExposeEvent>:
test   %rdi,%rdi
je     112a <free_XGraphicsExposeEvent+0xa>
jmp    1030 <free@plt>
push   %rax
xor    %eax,%eax
call   1040 <abort@plt>

LLVM IR (-O0):
define void @free_XGraphicsExposeEvent(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = bitcast i8* %8 to i32*
%10 = call i32 @free(i32* %9)
ret void
}

LLVM IR (-O2):
define void @free_XGraphicsExposeEvent(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %1
%6 = bitcast i8* %0 to i32*
%7 = tail call i32 @free(i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cpu_do_idle();
void arch_idle(void) { cpu_do_idle(); }


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

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

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

LLVM IR (-O2):
define void @arch_idle() {
%1 = tail call i32 (...) @cpu_do_idle()
ret void
}
int main() {
  int m = 0;
  m = 1;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void func_a() { printf("I'm func_a\n"); }


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

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

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

LLVM IR (-O2):
@str = [11 x i8] c"I'm func_a\00"
define void @func_a() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ log_write_console_char(char);
void unity_putchar(int c) {
  log_write_console_char((unsigned char)c);
  if (c == '\n') {
    log_write_console_char('\r');
  }
}


x86 assembly (clang, -O0):
<unity_putchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movsbl %al,%edi
call   1030 <log_write_console_char@plt>
cmpl   $0xa,-0x4(%rbp)
jne    113a <unity_putchar+0x2a>
mov    $0xd,%edi
call   1030 <log_write_console_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unity_putchar>:
push   %rbx
mov    %edi,%ebx
movsbl %bl,%edi
call   1030 <log_write_console_char@plt>
cmp    $0xa,%ebx
jne    112b <unity_putchar+0x1b>
mov    $0xd,%edi
pop    %rbx
jmp    1030 <log_write_console_char@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @unity_putchar(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = tail call i32 @log_write_console_char(i8 signext %2)
%4 = icmp eq i32 %0, 10
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @log_write_console_char(i8 signext 13)
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PPCMMU(int, void *, int /*<<< orphan*/, int /*<<< orphan*/);
void MmuDbgEnter(int signal) { PPCMMU(0x201, (void *)signal, 0, 0); }


x86 assembly (clang, -O0):
<MmuDbgEnter>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rsi
mov    $0x201,%edi
xor    %ecx,%ecx
mov    %ecx,%edx
call   1030 <PPCMMU@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MmuDbgEnter>:
movslq %edi,%rsi
mov    $0x201,%edi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <PPCMMU@plt>

LLVM IR (-O0):
define void @MmuDbgEnter(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to i8*
%6 = call i32 @PPCMMU(i32 513, i8* %5, i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @MmuDbgEnter(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @PPCMMU(i32 513, i8* %3, i32 0, i32 0)
ret void
}
void XtVaAppInitialize() {}


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

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

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

LLVM IR (-O2):
define void @XtVaAppInitialize() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *);
void PrintVersion(void) {
  printf("%s version %s by %s\n", "setsuffix", "0.2", "Sveinbjorn Thordarson");
}


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

x86 assembly (clang, -O2):
<PrintVersion>:
lea    0xee9(%rip),%rdi
lea    0xef7(%rip),%rsi
lea    0xefa(%rip),%rdx
lea    0xef7(%rip),%rcx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"%s version %s by %s\0A\00"
@.str.1 = [10 x i8] c"setsuffix\00"
@.str.2 = [4 x i8] c"0.2\00"
@.str.3 = [22 x i8] c"Sveinbjorn Thordarson\00"
define void @PrintVersion() {
%1 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"%s version %s by %s\0A\00"
@.str.1 = [10 x i8] c"setsuffix\00"
@.str.2 = [4 x i8] c"0.2\00"
@.str.3 = [22 x i8] c"Sveinbjorn Thordarson\00"
define void @PrintVersion() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
char *itoa(int a, char *buf, int base) {
  sprintf(buf, "%d", a);
  return buf;
}


x86 assembly (clang, -O0):
<itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xed0(%rip),%rsi
call   1030 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itoa>:
push   %rbx
mov    %rsi,%rbx
mov    %edi,%edx
lea    0xee3(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define i8* @itoa(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %5
%8 = load i32, i32* %4
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = load i8*, i8** %5
ret i8* %10
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i8* @itoa(i32 %0, i8* returned writeonly %1, i32 %2) {
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *,
                           char const *, char const *);
void echo_server_version(FILE *out) {
  static const char prog_str[] = "echo server";
  static const char ver_str[] = "1.0";
  static const char author_str[] = "Paolo Rovelli";
  fprintf(out, "%s %s written by %s\n", prog_str, ver_str, author_str);
  fflush(out);
  return;
}


x86 assembly (clang, -O0):
<echo_server_version>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xee7(%rip),%rsi
lea    0xec2(%rip),%rdx
lea    0xec7(%rip),%rcx
lea    0xec4(%rip),%r8
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <fflush@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<echo_server_version>:
push   %rbx
mov    %rdi,%rbx
lea    0xef3(%rip),%rsi
lea    0xece(%rip),%rdx
lea    0xed3(%rip),%rcx
lea    0xed0(%rip),%r8
call   1030 <fprintf@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@echo_server_version.prog_str = internal constant [12 x i8] c"echo server\00"
@echo_server_version.ver_str = internal constant [4 x i8] c"1.0\00"
@echo_server_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @echo_server_version(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @echo_server_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @echo_server_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @echo_server_version.author_str, i64 0, i64 0))
%5 = load i32*, i32** %2
%6 = call i32 @fflush(i32* %5)
ret void
}

LLVM IR (-O2):
@echo_server_version.prog_str = internal constant [12 x i8] c"echo server\00"
@echo_server_version.ver_str = internal constant [4 x i8] c"1.0\00"
@echo_server_version.author_str = internal constant [14 x i8] c"Paolo Rovelli\00"
@.str = [21 x i8] c"%s %s written by %s\0A\00"
define void @echo_server_version(i32* nocapture %0) {
%2 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @echo_server_version.prog_str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @echo_server_version.ver_str, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @echo_server_version.author_str, i64 0, i64 0))
%3 = tail call i32 @fflush(i32* %0)
ret void
}
void deallocateMatrix(int **A, int n) {
  for (int i = 0; i < n; i++) {
    free(A[i]);
  }
  free(A);
}


x86 assembly (clang, -O0):
<deallocateMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <deallocateMatrix+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <deallocateMatrix+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<deallocateMatrix>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <deallocateMatrix+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <deallocateMatrix+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @deallocateMatrix(i32** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = bitcast i32** %0 to i8*
tail call void @free(i8* %7)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32*, i32** %0, i64 %9
%11 = bitcast i32** %10 to i8**
%12 = load i8*, i8** %11
tail call void @free(i8* %12)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Type definitions */
typedef int /*<<< orphan*/ set;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ gettid();
int sched_getcpu();
int /*<<< orphan*/ sched_setaffinity(int /*<<< orphan*/, int,
                                     int /*<<< orphan*/ *);
int pincpu_do_pin(int cpu) {
  cpu_set_t set;
  CPU_ZERO(&set);
  CPU_SET(cpu, &set);
  sched_setaffinity(gettid(), sizeof(set), &set);
  if (cpu != sched_getcpu())
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<pincpu_do_pin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
lea    -0xc(%rbp),%rdi
call   1050 <CPU_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1070 <CPU_SET@plt>
mov    $0x0,%al
call   1030 <gettid@plt>
mov    %eax,%edi
mov    $0x4,%esi
lea    -0xc(%rbp),%rdx
call   1040 <sched_setaffinity@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1060 <sched_getcpu@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
je     11ad <pincpu_do_pin+0x5d>
movl   $0xffffffff,-0x4(%rbp)
jmp    11b4 <pincpu_do_pin+0x64>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pincpu_do_pin>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1050 <CPU_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1070 <CPU_SET@plt>
xor    %eax,%eax
call   1030 <gettid@plt>
mov    %eax,%edi
mov    $0x4,%esi
mov    %r14,%rdx
call   1040 <sched_setaffinity@plt>
xor    %eax,%eax
call   1060 <sched_getcpu@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
neg    %ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @pincpu_do_pin(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = call i32 @CPU_ZERO(i32* %4)
%6 = load i32, i32* %3
%7 = call i32 @CPU_SET(i32 %6, i32* %4)
%8 = call i32 (...) @gettid()
%9 = call i32 @sched_setaffinity(i32 %8, i32 4, i32* %4)
%10 = load i32, i32* %3
%11 = call i32 (...) @sched_getcpu()
%12 = icmp ne i32 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %1
store i32 -1, i32* %2
br label %15
14: ; preds = %1
store i32 0, i32* %2
br label %15
15: ; preds = %14, %13
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
define i32 @pincpu_do_pin(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @CPU_ZERO(i32* %2)
%5 = call i32 @CPU_SET(i32 %0, i32* %2)
%6 = call i32 (...) @gettid()
%7 = call i32 @sched_setaffinity(i32 %6, i32 4, i32* %2)
%8 = call i32 (...) @sched_getcpu()
%9 = icmp ne i32 %8, %0
%10 = sext i1 %9 to i32
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
void smpte_fec_set_index(uint8_t *p_fec, uint8_t index) {
  index &= 0x7;
  p_fec[12] = (p_fec[12] & 0xf8) | index;
}


x86 assembly (clang, -O0):
<smpte_fec_set_index>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x7,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x30(%rax),%ecx
and    $0xf8,%ecx
or     -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x30(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smpte_fec_set_index>:
and    $0x7,%esi
mov    $0xf8,%eax
and    0x30(%rdi),%eax
or     %esi,%eax
mov    %eax,0x30(%rdi)
ret

LLVM IR (-O0):
define void @smpte_fec_set_index(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, 7
store i32 %6, i32* %4
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 12
%9 = load i32, i32* %8
%10 = and i32 %9, 248
%11 = load i32, i32* %4
%12 = or i32 %10, %11
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 12
store i32 %12, i32* %14
ret void
}

LLVM IR (-O2):
define void @smpte_fec_set_index(i32* nocapture %0, i32 %1) {
%3 = and i32 %1, 7
%4 = getelementptr inbounds i32, i32* %0, i64 12
%5 = load i32, i32* %4
%6 = and i32 %5, 248
%7 = or i32 %6, %3
store i32 %7, i32* %4
ret void
}
long libj_lrand(sn)
long sn;
{
  long L, H;
  L = 16807 * (sn & 0xffff);
  H = 16807 * (sn >> 16);
  sn = ((H & 0x7fff) << 16) + L;
  sn -= 0x7fffffff;
  sn += H >> 15;
  if (sn <= 0) {
    sn += 0x7fffffff;
  }
  return (sn);
}


x86 assembly (clang, -O0):
<libj_lrand>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
and    $0xffff,%rax
imul   $0x41a7,%rax,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
sar    $0x10,%rax
imul   $0x41a7,%rax,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
and    $0x7fff,%rax
shl    $0x10,%rax
add    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
sub    $0x7fffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
sar    $0xf,%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jg     117d <libj_lrand+0x7d>
mov    -0x8(%rbp),%rax
add    $0x7fffffff,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<libj_lrand>:
movzwl %di,%eax
imul   $0x41a7,%rax,%rax
sar    $0x10,%rdi
imul   $0x41a7,%rdi,%rcx
imul   $0x41a70000,%edi,%edx
and    $0x7fff0000,%edx
add    %rax,%rdx
sar    $0xf,%rcx
lea    (%rdx,%rcx,1),%rsi
lea    (%rcx,%rdx,1),%rax
add    $0xffffffff80000001,%rax
mov    $0x80000000,%ecx
cmp    %rcx,%rsi
cmovl  %rsi,%rax
ret

LLVM IR (-O0):
define i64 @libj_lrand(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = and i64 %5, 65535
%7 = mul nsw i64 16807, %6
store i64 %7, i64* %3
%8 = load i64, i64* %2
%9 = ashr i64 %8, 16
%10 = mul nsw i64 16807, %9
store i64 %10, i64* %4
%11 = load i64, i64* %4
%12 = and i64 %11, 32767
%13 = shl i64 %12, 16
%14 = load i64, i64* %3
%15 = add nsw i64 %13, %14
store i64 %15, i64* %2
%16 = load i64, i64* %2
%17 = sub nsw i64 %16, 2147483647
store i64 %17, i64* %2
%18 = load i64, i64* %4
%19 = ashr i64 %18, 15
%20 = load i64, i64* %2
%21 = add nsw i64 %20, %19
store i64 %21, i64* %2
%22 = load i64, i64* %2
%23 = icmp sle i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %1
%25 = load i64, i64* %2
%26 = add nsw i64 %25, 2147483647
store i64 %26, i64* %2
br label %27
27: ; preds = %24, %1
%28 = load i64, i64* %2
ret i64 %28
}

LLVM IR (-O2):
define i64 @libj_lrand(i64 %0) {
%2 = and i64 %0, 65535
%3 = mul nuw nsw i64 %2, 16807
%4 = ashr i64 %0, 16
%5 = mul nsw i64 %4, 16807
%6 = mul i64 %4, 1101463552
%7 = and i64 %6, 2147418112
%8 = add nuw nsw i64 %7, %3
%9 = ashr i64 %5, 15
%10 = add nsw i64 %8, %9
%11 = add nsw i64 %10, -2147483647
%12 = icmp slt i64 %10, 2147483648
%13 = select i1 %12, i64 %10, i64 %11
ret i64 %13
}
/* Variables and functions */
int pop();
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ push(int);
int top();
int main() {
  push(1);
  printf("%d\n", top());
  printf("%d\n", pop());
  printf("%d\n", pop());
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
call   1060 <push@plt>
mov    $0x0,%al
call   1050 <top@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%esi
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1060 <push@plt>
xor    %eax,%eax
call   1050 <top@plt>
lea    0xea7(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <pop@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @push(i32 1)
%2 = tail call i32 (...) @top()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 (...) @pop()
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = tail call i32 (...) @pop()
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret i32 0
}
const char *worker_state_string(int state) {
  static const char *strings[] = {
      "OFF", "BOOTING", "RUNNING", "REBOOTING", "HALTING", "ERROR",
  };
  return strings[state];
}


x86 assembly (clang, -O0):
<worker_state_string>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movslq -0x4(%rbp),%rcx
lea    0x2f1e(%rip),%rax
mov    (%rax,%rcx,8),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<worker_state_string>:
movslq %edi,%rax
lea    0xef6(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret

LLVM IR (-O0):
@worker_state_string.strings = internal global [6 x i8*] [i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i32 0, i32 0)]
@.str = [4 x i8] c"OFF\00"
@.str.1 = [8 x i8] c"BOOTING\00"
@.str.2 = [8 x i8] c"RUNNING\00"
@.str.3 = [10 x i8] c"REBOOTING\00"
@.str.4 = [8 x i8] c"HALTING\00"
@.str.5 = [6 x i8] c"ERROR\00"
define i8* @worker_state_string(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds [6 x i8*], [6 x i8*]* @worker_state_string.strings, i64 0, i64 %4
%6 = load i8*, i8** %5
ret i8* %6
}

LLVM IR (-O2):
@reltable.worker_state_string = internal unnamed_addr constant [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.1 to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.2 to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([8 x i8]* @.str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.5 to i64), i64 ptrtoint ([6 x i32]* @reltable.worker_state_string to i64)) to i32)]
@.str = [4 x i8] c"OFF\00"
@.str.1 = [8 x i8] c"BOOTING\00"
@.str.2 = [8 x i8] c"RUNNING\00"
@.str.3 = [10 x i8] c"REBOOTING\00"
@.str.4 = [8 x i8] c"HALTING\00"
@.str.5 = [6 x i8] c"ERROR\00"
define i8* @worker_state_string(i32 %0) {
%2 = sext i32 %0 to i64
%3 = shl i64 %2, 2
%4 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.worker_state_string to i8*), i64 %3)
ret i8* %4
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  scalar_t__ subwindow;
};
struct TYPE_4__ {
  TYPE_1__ xmotion;
};
typedef TYPE_2__ XEvent;

/* Variables and functions */
unsigned long get_XEvent_xmotion_subwindow(void *_p) {
  return (unsigned long)((XEvent *)_p)->xmotion.subwindow;
}


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

x86 assembly (clang, -O2):
<get_XEvent_xmotion_subwindow>:
mov    (%rdi),%rax
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i64 }
define i64 @get_XEvent_xmotion_subwindow(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to %struct.TYPE_4__*
%5 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %4, i32 0, i32 0
%6 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %5, i32 0, i32 0
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @get_XEvent_xmotion_subwindow(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
void help_none(const char *program, int brief, int argc, char **argv) {}


x86 assembly (clang, -O0):
<help_none>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @help_none(i8* %0, i32 %1, i32 %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
ret void
}

LLVM IR (-O2):
define void @help_none(i8* nocapture %0, i32 %1, i32 %2, i8** nocapture %3) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ jstp_tx_char(char);
void jstp_tx_obj_end() { jstp_tx_char('}'); }


x86 assembly (clang, -O0):
<jstp_tx_obj_end>:
push   %rbp
mov    %rsp,%rbp
mov    $0x7d,%edi
call   1030 <jstp_tx_char@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<jstp_tx_obj_end>:
mov    $0x7d,%edi
jmp    1030 <jstp_tx_char@plt>

LLVM IR (-O0):
define void @jstp_tx_obj_end() {
%1 = call i32 @jstp_tx_char(i8 signext 125)
ret void
}

LLVM IR (-O2):
define void @jstp_tx_obj_end() {
%1 = tail call i32 @jstp_tx_char(i8 signext 125)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void child(void) {
  long i = 0;
  while (1) {
    i = i + 1;
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<child>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    %rax,-0x8(%rbp)
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    1120 <child+0x10>

x86 assembly (clang, -O2):
<child>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <sleep@plt>
jmp    1120 <child+0x10>

LLVM IR (-O0):
define void @child() {
%1 = alloca i64
store i64 0, i64* %1
br label %2
2: ; preds = %0, %2
%3 = load i64, i64* %1
%4 = add nsw i64 %3, 1
store i64 %4, i64* %1
%5 = call i32 @sleep(i32 1)
br label %2
}

LLVM IR (-O2):
define void @child() {
br label %1
1: ; preds = %1, %0
%2 = tail call i32 @sleep(i32 1)
br label %1
}
/* Variables and functions */
int /*<<< orphan*/ tag_read_sessionreg(int, char *);
void print_session_registers(void) {
  char reg;
  int i;
  ;
  for (i = 0; i < 7; i++) {
    tag_read_sessionreg(i, &reg);
    ;
  }
}


x86 assembly (clang, -O0):
<print_session_registers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    1143 <print_session_registers+0x33>
mov    -0x8(%rbp),%edi
lea    -0x1(%rbp),%rsi
call   1030 <tag_read_sessionreg@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    111f <print_session_registers+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_session_registers>:
push   %rbx
sub    $0x10,%rsp
lea    0xf(%rsp),%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x2,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x3,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x4,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
mov    $0x6,%edi
mov    %rbx,%rsi
call   1030 <tag_read_sessionreg@plt>
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @print_session_registers() {
%1 = alloca i8
%2 = call i32 @tag_read_sessionreg(i32 0, i8* %1)
%3 = call i32 @tag_read_sessionreg(i32 1, i8* %1)
%4 = call i32 @tag_read_sessionreg(i32 2, i8* %1)
%5 = call i32 @tag_read_sessionreg(i32 3, i8* %1)
%6 = call i32 @tag_read_sessionreg(i32 4, i8* %1)
%7 = call i32 @tag_read_sessionreg(i32 5, i8* %1)
%8 = call i32 @tag_read_sessionreg(i32 6, i8* %1)
ret void
}