xunge/DecIR huggingface dataset:
/* Type definitions */
struct vector {
  int dummy;
};

/* Variables and functions */
struct vector *vector_init_size(size_t);
struct vector *vector_create_size(size_t size) {
  return vector_init_size(size);
}


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

x86 assembly (clang, -O2):
<vector_create_size>:
jmp    1030 <vector_init_size@plt>

LLVM IR (-O0):
%struct.vector = type { i32 }
define %struct.vector* @vector_create_size(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call %struct.vector* @vector_init_size(i64 %3)
ret %struct.vector* %4
}

LLVM IR (-O2):
%struct.vector = type { i32 }
define %struct.vector* @vector_create_size(i64 %0) {
%2 = tail call %struct.vector* @vector_init_size(i64 %0)
ret %struct.vector* %2
}
void foo(unsigned int x, void *p) { __builtin_memcpy(p, &x, sizeof x); }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
mov    %edi,(%rsi)
ret

LLVM IR (-O0):
define void @foo(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i32* %3 to i8*
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0, i8* nocapture writeonly %1) {
%3 = bitcast i8* %1 to i32*
store i32 %0, i32* %3
ret void
}
int month_to_season(int mon) {
  int seas = -1;
  switch (mon) {
  case 12:
  case 1:
  case 2:
    seas = 0;
    break;
  case 3:
  case 4:
  case 5:
    seas = 1;
    break;
  case 6:
  case 7:
  case 8:
    seas = 2;
    break;
  case 9:
  case 10:
  case 11:
    seas = 3;
    break;
  }
  return seas;
}


x86 assembly (clang, -O0):
<month_to_season>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xb,%eax
ja     1162 <month_to_season+0x62>
mov    -0x10(%rbp),%rax
lea    0xed2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x0,-0x8(%rbp)
jmp    1162 <month_to_season+0x62>
movl   $0x1,-0x8(%rbp)
jmp    1162 <month_to_season+0x62>
movl   $0x2,-0x8(%rbp)
jmp    1162 <month_to_season+0x62>
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<month_to_season>:
add    $0xffffffff,%edi
mov    $0xffffffff,%eax
cmp    $0xb,%edi
ja     111a <month_to_season+0x1a>
movslq %edi,%rax
lea    0xee9(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @month_to_season(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 -1, i32* %3
%4 = load i32, i32* %2
switch i32 %4, label %9 [
i32 12, label %5
i32 1, label %5
i32 2, label %5
i32 3, label %6
i32 4, label %6
i32 5, label %6
i32 6, label %7
i32 7, label %7
i32 8, label %7
i32 9, label %8
i32 10, label %8
i32 11, label %8
]
5: ; preds = %1, %1, %1
store i32 0, i32* %3
br label %9
6: ; preds = %1, %1, %1
store i32 1, i32* %3
br label %9
7: ; preds = %1, %1, %1
store i32 2, i32* %3
br label %9
8: ; preds = %1, %1, %1
store i32 3, i32* %3
br label %9
9: ; preds = %1, %8, %7, %6, %5
%10 = load i32, i32* %3
ret i32 %10
}

LLVM IR (-O2):
@switch.table.month_to_season = [12 x i32] [i32 0, i32 0, i32 1, i32 1, i32 1, i32 2, i32 2, i32 2, i32 3, i32 3, i32 3, i32 0]
define i32 @month_to_season(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 12
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [12 x i32], [12 x i32]* @switch.table.month_to_season, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ -1, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ schedule();
int32_t sched_yield(void) {
  schedule();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @sched_yield() {
%1 = call i32 (...) @schedule()
ret i32 0
}

LLVM IR (-O2):
define i32 @sched_yield() {
%1 = tail call i32 (...) @schedule()
ret i32 0
}
void XtVaSetSubvalues() {}


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

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

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

LLVM IR (-O2):
define void @XtVaSetSubvalues() {
ret void
}
short middle(x)
int x;
{ return 2 * inner(x); }


x86 assembly (clang, -O0):
<middle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <inner@plt>
shl    $0x1,%eax
cwtl
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @middle(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 (i32, ...) bitcast (i32 (...)* @inner to i32 (i32, ...)*)(i32 %3)
%5 = mul nsw i32 2, %4
%6 = trunc i32 %5 to i16
ret i16 %6
}

LLVM IR (-O2):
define signext i16 @middle(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @inner to i32 (i32, ...)*)(i32 %0)
%3 = trunc i32 %2 to i16
%4 = shl i16 %3, 1
ret i16 %4
}
/* Type definitions */
typedef int u_int64_t;
typedef int u_int32_t;

/* Variables and functions */
int /*<<< orphan*/ hashlittle2(char const *, size_t, int *, int *);
u_int64_t memhash(const char *buf, size_t n) {
  u_int32_t c = 0xcafe8881, b = 0x4d6a087c;
  hashlittle2(buf, n, &c, &b);
  return (u_int64_t)c | (((u_int64_t)b) << 32);
}


x86 assembly (clang, -O0):
<memhash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xcafe8881,-0x14(%rbp)
movl   $0x4d6a087c,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <hashlittle2@plt>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%edx
mov    $0x20,%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memhash>:
push   %rax
movl   $0xcafe8881,0x4(%rsp)
ca
movl   $0x4d6a087c,(%rsp)
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
call   1030 <hashlittle2@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @memhash(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i32 -889288575, i32* %5
store i32 1298794620, i32* %6
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @hashlittle2(i8* %7, i64 %8, i32* %5, i32* %6)
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = shl i32 %11, 32
%13 = or i32 %10, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @memhash(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
store i32 -889288575, i32* %3
%6 = bitcast i32* %4 to i8*
store i32 1298794620, i32* %4
%7 = call i32 @hashlittle2(i8* %0, i64 %1, i32* %3, i32* %4)
ret i32 poison
}
/* Variables and functions */
int /*<<< orphan*/ nc_dhcp_net_uninit();
int /*<<< orphan*/ nc_ipcs_table_uninit();
int nc_nvr_sdk_uninit(void) {
  nc_ipcs_table_uninit();
  nc_dhcp_net_uninit();
  return 1;
}


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

x86 assembly (clang, -O2):
<nc_nvr_sdk_uninit>:
push   %rax
xor    %eax,%eax
call   1040 <nc_ipcs_table_uninit@plt>
xor    %eax,%eax
call   1030 <nc_dhcp_net_uninit@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @nc_nvr_sdk_uninit() {
%1 = call i32 (...) @nc_ipcs_table_uninit()
%2 = call i32 (...) @nc_dhcp_net_uninit()
ret i32 1
}

LLVM IR (-O2):
define i32 @nc_nvr_sdk_uninit() {
%1 = tail call i32 (...) @nc_ipcs_table_uninit()
%2 = tail call i32 (...) @nc_dhcp_net_uninit()
ret i32 1
}
void abc2defghijklmnopqrstuvwxzy() {}


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

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

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

LLVM IR (-O2):
define void @abc2defghijklmnopqrstuvwxzy() {
ret void
}
int test_imm_FDint8_mem(signed char *val) {
  return ((*val) & (-0xFD << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FDint8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xffffff03,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_FDint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff03,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_FDint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -253
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isascii(int);
void t_isascii_0x11() {
  Assert_real((isascii(17)),
              "/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_isascii.c",
              90, ("isascii should be 1 for 0x11"));
}


x86 assembly (clang, -O0):
<t_isascii_0x11>:
push   %rbp
mov    %rsp,%rbp
mov    $0x11,%edi
call   1030 <isascii@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x5a,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_isascii_0x11>:
lea    0xee9(%rip),%rsi
lea    0xf8a(%rip),%rcx
mov    $0x1,%edi
mov    $0x5a,%edx
jmp    1030 <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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 1 for 0x11\00"
define void @t_isascii_0x11() {
%1 = call i32 @isascii(i32 17)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 90, 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_isascii.c\00"
@.str.1 = [29 x i8] c"isascii should be 1 for 0x11\00"
define void @t_isascii_0x11() {
%1 = tail call i32 @Assert_real(i32 1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int MPI_Init(int *argc, char ***argv) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @MPI_Init(i32* nocapture readnone %0, i8*** nocapture readnone %1) {
ret i32 0
}
char *strcpy(s1, s2)
register char *s1, *s2;
{
  char *original = s1;
  while (*s1++ = *s2++)
    ;
  return (original);
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
int test_65_4(int *mem) { return __atomic_fetch_nand(mem + 4, 1, 4); }


x86 assembly (clang, -O0):
<test_65_4>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x10,%rcx
mov    %rcx,-0x20(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    %ecx,-0x18(%rbp)
mov    0x10(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%esi
mov    %eax,%edx
and    %esi,%edx
mov    %edx,-0x28(%rbp)
not    %edx
lock cmpxchg %edx,(%rcx)
sete   %cl
mov    %eax,-0x24(%rbp)
test   $0x1,%cl
mov    %eax,-0x14(%rbp)
jne    1158 <test_65_4+0x58>
jmp    112a <test_65_4+0x2a>
mov    -0x24(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_65_4>:
mov    0x10(%rdi),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%ecx
not    %ecx
or     $0xfffffffe,%ecx
lock cmpxchg %ecx,0x10(%rdi)
jne    1110 <test_65_4+0x10>
ret

LLVM IR (-O0):
define i32 @test_65_4(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 4
store i32 1, i32* %3
%7 = load i32, i32* %3
%8 = atomicrmw nand i32* %6, i32 %7 acq_rel
store i32 %8, i32* %4
%9 = load i32, i32* %4
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_65_4(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = atomicrmw nand i32* %2, i32 1 acq_rel
ret i32 %3
}
long __syscall0(long n) {
  unsigned long __ret;
  __asm__ __volatile__("call __vsyscall" : "=a"(__ret) : "a"(n) : "memory");
  return __ret;
}


x86 assembly (clang, -O0):
<__syscall0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
call   1030 <__vsyscall@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__syscall0>:
mov    %rdi,%rax
call   1030 <__vsyscall@plt>
ret

LLVM IR (-O0):
define i64 @__syscall0(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i64 asm sideeffect "call __vsyscall", "={ax},{ax},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %4)
store i64 %5, i64* %3
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
define i64 @__syscall0(i64 %0) {
%2 = tail call i64 asm sideeffect "call __vsyscall", "={ax},{ax},~{memory},~{dirflag},~{fpsr},~{flags}"(i64 %0)
ret i64 %2
}
int serial_valid(unsigned int serial, int disk_bios) { return (serial != 0); }


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

x86 assembly (clang, -O2):
<serial_valid>:
xor    %eax,%eax
test   %edi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @serial_valid(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @serial_valid(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getppid();
int execute(int thread_id, int num_threads, long long length, int test_argc,
            const void **test_argv) {
  long long i;
  for (i = 0; i < length; i++) {
    getppid();
  }
  return 0;
}


x86 assembly (clang, -O0):
<execute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    1157 <execute+0x47>
mov    $0x0,%al
call   1030 <getppid@plt>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1131 <execute+0x21>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<execute>:
push   %rbx
test   %rdx,%rdx
jle    112d <execute+0x1d>
mov    %rdx,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1030 <getppid@plt>
add    $0xffffffffffffffff,%rbx
jne    1120 <execute+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @execute(i32 %0, i32 %1, i64 %2, i32 %3, i8** nocapture readnone %4) {
%6 = icmp sgt i64 %2, 0
br i1 %6, label %7, label %12
7: ; preds = %5, %7
%8 = phi i64 [ %10, %7 ], [ 0, %5 ]
%9 = tail call i32 (...) @getppid()
%10 = add nuw nsw i64 %8, 1
%11 = icmp eq i64 %10, %2
br i1 %11, label %12, label %7
12: ; preds = %7, %5
ret i32 0
}
/* Variables and functions */
unsigned int IFF_LOOPBACK;
signed char if_flags_LOOPBACK(unsigned int flags) {
  return flags & IFF_LOOPBACK;
}


x86 assembly (clang, -O0):
<if_flags_LOOPBACK>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    0x2ee7(%rip),%rcx
and    (%rcx),%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<if_flags_LOOPBACK>:
mov    %edi,%eax
mov    0x2eef(%rip),%rcx
and    (%rcx),%eax
ret

LLVM IR (-O0):
@IFF_LOOPBACK = global i32 0
define signext i8 @if_flags_LOOPBACK(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @IFF_LOOPBACK
%5 = and i32 %3, %4
%6 = trunc i32 %5 to i8
ret i8 %6
}

LLVM IR (-O2):
@IFF_LOOPBACK = global i32 0
define signext i8 @if_flags_LOOPBACK(i32 %0) {
%2 = load i32, i32* @IFF_LOOPBACK
%3 = and i32 %2, %0
%4 = trunc i32 %3 to i8
ret i8 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;

/* Variables and functions */
int /*<<< orphan*/ sg_put_unaligned_be16(int, void *);
int /*<<< orphan*/ sg_put_unaligned_be32(int, int /*<<< orphan*/ *);
void sg_put_unaligned_be48(uint64_t val, void *p) {
  sg_put_unaligned_be16(val >> 32, p);
  sg_put_unaligned_be32(val, (uint8_t *)p + 2);
}


x86 assembly (clang, -O0):
<sg_put_unaligned_be48>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
mov    -0x10(%rbp),%rsi
call   1030 <sg_put_unaligned_be16@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
add    $0x8,%rsi
call   1040 <sg_put_unaligned_be32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sg_put_unaligned_be48>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
call   1030 <sg_put_unaligned_be16@plt>
add    $0x8,%rbx
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <sg_put_unaligned_be32@plt>

LLVM IR (-O0):
define void @sg_put_unaligned_be48(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
%6 = ashr i32 %5, 32
%7 = load i8*, i8** %4
%8 = call i32 @sg_put_unaligned_be16(i32 %6, i8* %7)
%9 = load i32, i32* %3
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i32*
%12 = getelementptr inbounds i32, i32* %11, i64 2
%13 = call i32 @sg_put_unaligned_be32(i32 %9, i32* %12)
ret void
}

LLVM IR (-O2):
define void @sg_put_unaligned_be48(i32 %0, i8* %1) {
%3 = tail call i32 @sg_put_unaligned_be16(i32 poison, i8* %1)
%4 = getelementptr inbounds i8, i8* %1, i64 8
%5 = bitcast i8* %4 to i32*
%6 = tail call i32 @sg_put_unaligned_be32(i32 %0, i32* %5)
ret void
}
/* Variables and functions */
int rand();
void get_food(unsigned char *x, unsigned char *y) {
  *x = rand() % 7;
  *y = rand() % 7;
}


x86 assembly (clang, -O0):
<get_food>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x7,%ecx
cltd
idiv   %ecx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_food>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
mov    %cl,(%rbx)
xor    %eax,%eax
call   1030 <rand@plt>
cltq
imul   $0xffffffff92492493,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x2,%ecx
add    %edx,%ecx
lea    0x0(,%rcx,8),%edx
sub    %edx,%ecx
add    %eax,%ecx
mov    %cl,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @get_food(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = call i32 (...) @rand()
%6 = srem i32 %5, 7
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %3
store i8 %7, i8* %8
%9 = call i32 (...) @rand()
%10 = srem i32 %9, 7
%11 = trunc i32 %10 to i8
%12 = load i8*, i8** %4
store i8 %11, i8* %12
ret void
}

LLVM IR (-O2):
define void @get_food(i8* nocapture writeonly %0, i8* nocapture writeonly %1) {
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 7
%5 = trunc i32 %4 to i8
store i8 %5, i8* %0
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 7
%8 = trunc i32 %7 to i8
store i8 %8, i8* %1
ret void
}
/* Variables and functions */
int memcmp(int *, int *, int);
int f(int *p, int *q, int len) { return memcmp(p, q, len); }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
jmp    1030 <memcmp@plt>

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

LLVM IR (-O2):
define i32 @f(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @memcmp(i32* %0, i32* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t tswap64(uint64_t s) { return s; }


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

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

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

LLVM IR (-O2):
define i32 @tswap64(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ error(char *);
void *malloc(size_t);
void *ckmalloc(size_t nbytes) {
  void *p = malloc(nbytes);
  if (!p)
    error("Not enough memory!");
  return p;
}


x86 assembly (clang, -O0):
<ckmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1150 <ckmalloc+0x30>
lea    0xeb5(%rip),%rdi
call   1040 <error@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ckmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113a <ckmalloc+0x1a>
lea    0xecb(%rip),%rdi
call   1040 <error@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [19 x i8] c"Not enough memory!\00"
define i8* @ckmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [19 x i8] c"Not enough memory!\00"
define noalias i8* @ckmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  short lbearing;
};
struct TYPE_4__ {
  TYPE_1__ max_bounds;
};
typedef TYPE_2__ XFontStruct;

/* Variables and functions */
void set_XFontStruct_max_bounds_lbearing(void *_p, short _v) {
  ((XFontStruct *)_p)->max_bounds.lbearing = (short)_v;
}


x86 assembly (clang, -O0):
<set_XFontStruct_max_bounds_lbearing>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %rdi,-0x8(%rbp)
mov    %ax,-0xa(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x8(%rbp),%rax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_XFontStruct_max_bounds_lbearing>:
mov    %si,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_4__ = type { %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i16 }
define void @set_XFontStruct_max_bounds_lbearing(i8* %0, i16 signext %1) {
%3 = alloca i8*
%4 = alloca i16
store i8* %0, i8** %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to %struct.TYPE_4__*
%8 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %7, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %8, i32 0, i32 0
store i16 %5, i16* %9
ret void
}

LLVM IR (-O2):
define void @set_XFontStruct_max_bounds_lbearing(i8* nocapture writeonly %0, i16 signext %1) {
%3 = bitcast i8* %0 to i16*
store i16 %1, i16* %3
ret void
}
void gdk_window_get_window_type() {}


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

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

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

LLVM IR (-O2):
define void @gdk_window_get_window_type() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("hi\n"); }


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"hi\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [3 x i8] c"hi\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
void *calloc(size_t, size_t);
void *mbedtls_calloc(size_t n, size_t sz) { return calloc(n, sz); }


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

x86 assembly (clang, -O2):
<mbedtls_calloc>:
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define i8* @mbedtls_calloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = call i8* @calloc(i64 %5, i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @mbedtls_calloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned char const,
                           unsigned char const);
const char *mac_sprint_short(const unsigned char *mac) {
  static char etherbuf[5];
  sprintf(etherbuf, "%02x%02x", mac[4], mac[5]);
  return etherbuf;
}


x86 assembly (clang, -O0):
<mac_sprint_short>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%cl
mov    -0x8(%rbp),%rax
lea    0x2efb(%rip),%rdi
lea    0xecb(%rip),%rsi
movzbl %cl,%edx
movzbl 0x5(%rax),%ecx
call   1030 <sprintf@plt>
lea    0x2ee1(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mac_sprint_short>:
push   %rbx
movzbl 0x4(%rdi),%edx
movzbl 0x5(%rdi),%ecx
lea    0x2f09(%rip),%rbx
lea    0xed9(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
@mac_sprint_short.etherbuf = internal global [5 x i8] zeroinitializer
@.str = [9 x i8] c"%02x%02x\00"
define i8* @mac_sprint_short(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 4
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %0, i64 5
%5 = load i8, i8* %4
%6 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @mac_sprint_short.etherbuf, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8 zeroext %3, i8 zeroext %5)
ret i8* getelementptr inbounds ([5 x i8], [5 x i8]* @mac_sprint_short.etherbuf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: %s <json_output> <cwd> <input_file> <compiler> [<invocation> "
          "...]\n",
          getprogname());
  exit(EX_USAGE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2e99(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea0(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    0x2e8f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [74 x i8] c"Usage: %s <json_output> <cwd> <input_file> <compiler> [<invocation> ...]\0A\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @EX_USAGE
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [74 x i8] c"Usage: %s <json_output> <cwd> <input_file> <compiler> [<invocation> ...]\0A\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = load i32, i32* @EX_USAGE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ move(int, int);
void nmstermio_move_cursor(int y, int x) { move(y, x); }


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

x86 assembly (clang, -O2):
<nmstermio_move_cursor>:
jmp    1030 <move@plt>

LLVM IR (-O0):
define void @nmstermio_move_cursor(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @move(i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
define void @nmstermio_move_cursor(i32 %0, i32 %1) {
%3 = tail call i32 @move(i32 %0, i32 %1)
ret void
}
Print(font, string) void *font;
char *string;
{
  int len, i;
  len = strlen(string);
  for (i = 0; i < len; i++) {
    glutBitmapCharacter(font, string[i]);
  }
}


x86 assembly (clang, -O0):
<Print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1174 <Print+0x54>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
mov    $0x0,%al
call   1030 <glutBitmapCharacter@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1143 <Print+0x23>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1158 <Print+0x38>
mov    %eax,%r12d
xor    %ebx,%ebx
nop
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <glutBitmapCharacter@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <Print+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @Print(i8* %0, i8* nocapture %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = trunc i64 %3 to i32
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %2
%7 = and i64 %3, 4294967295
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %14, %8 ]
%10 = getelementptr inbounds i8, i8* %1, i64 %9
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @glutBitmapCharacter to i32 (i8*, i32, ...)*)(i8* %0, i32 %12)
%14 = add nuw nsw i64 %9, 1
%15 = icmp eq i64 %14, %7
br i1 %15, label %16, label %8
16: ; preds = %8, %2
ret i32 undef
}
void kol_board_puti(int n) {
  char c;
  int i = 0;
  do {
    c = n % 10 + '0';
    asm("int $0x40" ::"a"(63), "b"(1), "c"(c));
    i++;
  } while ((n /= 10) > 0);
}


x86 assembly (clang, -O0):
<kol_board_puti>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%cl
mov    $0x3f,%eax
mov    $0x1,%ebx
int    $0x40
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jg     110f <kol_board_puti+0xf>
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<kol_board_puti>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
movslq %edi,%rdx
imul   $0x66666667,%rdx,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
lea    (%rdi,%rdi,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edx,%ecx
sub    %eax,%ecx
add    $0x30,%cl
mov    $0x3f,%eax
int    $0x40
cmp    $0x9,%edx
jg     1110 <kol_board_puti+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @kol_board_puti(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %7, %2 ]
%4 = srem i32 %3, 10
%5 = trunc i32 %4 to i8
%6 = add nsw i8 %5, 48
tail call void asm sideeffect "int $$0x40", "{ax},{bx},{cx},~{dirflag},~{fpsr},~{flags}"(i32 63, i32 1, i8 %6)
%7 = sdiv i32 %3, 10
%8 = icmp sgt i32 %3, 9
br i1 %8, label %2, label %9
9: ; preds = %2
ret void
}
void BSP_ClearAllSpinlock(void) {
  int i;
  unsigned long tmp;
  tmp = 0x1;
  for (i = 0; i < 64; i++)
    ({
      unsigned long __v = tmp;
      (*(volatile unsigned long *)((0x02640000 + 0x100 + i * 0x4)) = (__v));
      __v;
    });
}


x86 assembly (clang, -O0):
<BSP_ClearAllSpinlock>:
push   %rbp
mov    %rsp,%rbp
movq   $0x1,-0x10(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x40,-0x4(%rbp)
jge    114f <BSP_ClearAllSpinlock+0x4f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x4(%rbp),%eax
shl    $0x2,%eax
add    $0x2640100,%eax
cltq
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1113 <BSP_ClearAllSpinlock+0x13>
pop    %rbp
ret

x86 assembly (clang, -O2):
<BSP_ClearAllSpinlock>:
mov    $0x264010c,%eax
cs nopw 0x0(%rax,%rax,1)
nop
movq   $0x1,-0xc(%rax)
movq   $0x1,-0x8(%rax)
movq   $0x1,-0x4(%rax)
movq   $0x1,(%rax)
add    $0x10,%rax
cmp    $0x264020c,%rax
jne    1110 <BSP_ClearAllSpinlock+0x10>
ret

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

LLVM IR (-O2):
define void @BSP_ClearAllSpinlock() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %15, %1 ]
%3 = shl nuw nsw i64 %2, 2
%4 = add nuw nsw i64 %3, 40108288
%5 = inttoptr i64 %4 to i64*
store volatile i64 1, i64* %5
%6 = shl i64 %2, 2
%7 = add i64 %6, 40108292
%8 = inttoptr i64 %7 to i64*
store volatile i64 1, i64* %8
%9 = shl i64 %2, 2
%10 = add i64 %9, 40108296
%11 = inttoptr i64 %10 to i64*
store volatile i64 1, i64* %11
%12 = shl i64 %2, 2
%13 = add i64 %12, 40108300
%14 = inttoptr i64 %13 to i64*
store volatile i64 1, i64* %14
%15 = add nuw nsw i64 %2, 4
%16 = icmp eq i64 %15, 64
br i1 %16, label %17, label %1
17: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
long main() {
  long i;
  for (i = 0; i < 5; i = i + 1) {
    printf("%d\n", i);
  }
  printf("done!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movq   $0x0,-0x10(%rbp)
cmpq   $0x5,-0x10(%rbp)
jge    114e <main+0x3e>
mov    -0x10(%rbp),%rsi
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1120 <main+0x10>
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [7 x i8] c"done!\0A\00"
define i64 @main() {
%1 = alloca i64
%2 = alloca i64
store i64 0, i64* %2
br label %3
3: ; preds = %9, %0
%4 = load i64, i64* %2
%5 = icmp slt i64 %4, 5
br i1 %5, label %6, label %12
6: ; preds = %3
%7 = load i64, i64* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %7)
br label %9
9: ; preds = %6
%10 = load i64, i64* %2
%11 = add nsw i64 %10, 1
store i64 %11, i64* %2
br label %3
12: ; preds = %3
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%14 = load i64, i64* %1
ret i64 %14
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@str = [6 x i8] c"done!\00"
define i64 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 0)
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 1)
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 2)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret i64 undef
}
double OP_Not(double op1, double op2) { return !op1; }


x86 assembly (clang, -O0):
<OP_Not>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
setne  %al
setp   %cl
or     %cl,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
cvtsi2sd %eax,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<OP_Not>:
xorpd  %xmm1,%xmm1
cmpeqsd %xmm1,%xmm0
movsd  0xeef(%rip),%xmm1
andpd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @OP_Not(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = fcmp une double %5, 0.000000e+00
%7 = xor i1 %6, true
%8 = zext i1 %7 to i32
%9 = sitofp i32 %8 to double
ret double %9
}

LLVM IR (-O2):
define double @OP_Not(double %0, double %1) {
%3 = fcmp oeq double %0, 0.000000e+00
%4 = uitofp i1 %3 to double
ret double %4
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
char *strncpy(char *, char *, int);
int getcode(char *reply) {
  int code = 0;
  char *charcode = (char *)malloc(3);
  bzero(charcode, 3);
  charcode = strncpy(charcode, reply, 3);
  if ((code = atoi(charcode)) == 0)
    code = -1;
  free(charcode);
  return code;
}


x86 assembly (clang, -O0):
<getcode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x3,%esi
call   1060 <bzero@plt>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    $0x3,%edx
call   1040 <strncpy@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jne    11b1 <getcode+0x61>
movl   $0xffffffff,-0xc(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getcode>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    $0x3,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    $0x3,%esi
call   1060 <bzero@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1040 <strncpy@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
cmp    $0x1,%eax
sbb    %eax,%eax
or     %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getcode(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
%5 = call i64 @malloc(i32 3)
%6 = inttoptr i64 %5 to i8*
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @bzero(i8* %7, i32 3)
%9 = load i8*, i8** %4
%10 = load i8*, i8** %2
%11 = call i8* @strncpy(i8* %9, i8* %10, i32 3)
store i8* %11, i8** %4
%12 = load i8*, i8** %4
%13 = call i32 @atoi(i8* %12)
store i32 %13, i32* %3
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %1
store i32 -1, i32* %3
br label %16
16: ; preds = %15, %1
%17 = load i8*, i8** %4
%18 = call i32 @free(i8* %17)
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
define i32 @getcode(i8* %0) {
%2 = tail call i64 @malloc(i32 3)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @bzero(i8* %3, i32 3)
%5 = tail call i8* @strncpy(i8* %3, i8* %0, i32 3)
%6 = tail call i32 @atoi(i8* %5)
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i32 -1, i32 %6
%9 = tail call i32 @free(i8* %5)
ret i32 %8
}