xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ isalpha(int);
void t_isalpha_0x6f() {
  Assert_real((isalpha(111)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isalpha.c",
              560, ("isalpha should be 1 for o"));
}


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

x86 assembly (clang, -O2):
<t_isalpha_0x6f>:
push   %rax
mov    $0x6f,%edi
call   1030 <isalpha@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x230,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for o\00"
define void @t_isalpha_0x6f() {
%1 = call i32 @isalpha(i32 111)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 560, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_isalpha.c\00"
@.str.1 = [26 x i8] c"isalpha should be 1 for o\00"
define void @t_isalpha_0x6f() {
%1 = tail call i32 @isalpha(i32 111)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 560, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned long long bitmap_bits(unsigned long long array_size,
                               unsigned long chunksize) {
  return (array_size * 512 + chunksize - 1) / chunksize;
}


x86 assembly (clang, -O0):
<bitmap_bits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
shl    $0x9,%rax
add    -0x10(%rbp),%rax
sub    $0x1,%rax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x10(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitmap_bits>:
shl    $0x9,%rdi
lea    (%rsi,%rdi,1),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,%rcx
or     %rsi,%rcx
shr    $0x20,%rcx
je     111e <bitmap_bits+0x1e>
xor    %edx,%edx
div    %rsi
ret
xor    %edx,%edx
div    %esi
ret

LLVM IR (-O0):
define i64 @bitmap_bits(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 = mul i64 %5, 512
%7 = load i64, i64* %4
%8 = add i64 %6, %7
%9 = sub i64 %8, 1
%10 = load i64, i64* %4
%11 = udiv i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @bitmap_bits(i64 %0, i64 %1) {
%3 = shl i64 %0, 9
%4 = add i64 %1, -1
%5 = add i64 %4, %3
%6 = udiv i64 %5, %1
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printHeader() {
  printf("------------------------------------\n");
  printf("          smbusb_bootstrap\n");
  printf("------------------------------------\n");
}


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

x86 assembly (clang, -O2):
<printHeader>:
push   %rbx
lea    0xf03(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xed9(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"------------------------------------\0A\00"
@.str.1 = [28 x i8] c" smbusb_bootstrap\0A\00"
define void @printHeader() {
%1 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str.2 = [27 x i8] c" smbusb_bootstrap\00"
@str.3 = [37 x i8] c"------------------------------------\00"
define void @printHeader() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0))
ret void
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int warterm_getch() {
  int rc;
  char inbuf[1024];
  inbuf[1000] = '\0';
  fgets(inbuf, 1000, stdin);
  rc = atoi(inbuf);
  return rc;
}


x86 assembly (clang, -O0):
<warterm_getch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
movb   $0x0,-0x28(%rbp)
lea    -0x410(%rbp),%rdi
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
mov    $0x3e8,%esi
call   1030 <fgets@plt>
lea    -0x410(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<warterm_getch>:
push   %rbx
sub    $0x400,%rsp
movb   $0x0,0x3e8(%rsp)
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x3e8,%esi
call   1030 <fgets@plt>
mov    %rbx,%rdi
call   1040 <atoi@plt>
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
define i32 @warterm_getch() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 1000
store i8 0, i8* %3
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 1000, i32 %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = call i32 @atoi(i8* %7)
store i32 %8, i32* %1
%9 = load i32, i32* %1
ret i32 %9
}

LLVM IR (-O2):
@stdin = global i32 0
define i32 @warterm_getch() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 1000
store i8 0, i8* %3
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %2, i32 1000, i32 %4)
%6 = call i32 @atoi(i8* %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ _Error(long, char *);
void Error_LSyntaxMethodArgumentsDontConform(long p_position) {
  _Error(p_position, "Assignment syntax method arguments must start with "
                     "'input' and then match order of syntax rule");
}


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

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

LLVM IR (-O0):
@.str = [95 x i8] c"Assignment syntax method arguments must start with 'input' and then match order of syntax rule\00"
define void @Error_LSyntaxMethodArgumentsDontConform(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @_Error(i64 %3, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [95 x i8] c"Assignment syntax method arguments must start with 'input' and then match order of syntax rule\00"
define void @Error_LSyntaxMethodArgumentsDontConform(i64 %0) {
%2 = tail call i32 @_Error(i64 %0, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str, i64 0, i64 0))
ret void
}
void avcodec_send_frame() {}


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

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

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

LLVM IR (-O2):
define void @avcodec_send_frame() {
ret void
}
unsigned xrop3_229_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  unsigned stk3;
  stk3 = S & T;
  stk2 = D | stk3;
  stk1 = T ^ stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_229_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
and    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
or     -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
xor    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_229_1_0>:
mov    %edi,%ecx
shl    $0x8,%ecx
mov    %esi,%eax
shl    $0x8,%eax
lea    (%rsi,%rax,1),%edx
and    %ecx,%eax
or     %edi,%ecx
or     $0xff,%eax
xor    %edx,%eax
or     %ecx,%eax
not    %eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_229_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%11 = load i8, i8* %3
%12 = zext i8 %11 to i32
%13 = shl i32 %12, 8
%14 = load i8, i8* %3
%15 = zext i8 %14 to i32
%16 = or i32 %13, %15
store i32 %16, i32* %6
%17 = load i8, i8* %4
%18 = zext i8 %17 to i32
%19 = shl i32 %18, 8
%20 = load i8, i8* %4
%21 = zext i8 %20 to i32
%22 = or i32 %19, %21
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = and i32 %23, %24
store i32 %25, i32* %10
%26 = load i32, i32* %5
%27 = load i32, i32* %10
%28 = or i32 %26, %27
store i32 %28, i32* %9
%29 = load i32, i32* %7
%30 = load i32, i32* %9
%31 = xor i32 %29, %30
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = xor i32 %32, -1
store i32 %33, i32* %8
%34 = load i32, i32* %8
%35 = load i32, i32* %6
%36 = xor i32 %35, -1
%37 = and i32 %34, %36
%38 = load i32, i32* %5
%39 = load i32, i32* %6
%40 = and i32 %38, %39
%41 = or i32 %37, %40
ret i32 %41
}

LLVM IR (-O2):
define i32 @xrop3_229_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %6
%9 = and i32 %7, %4
%10 = or i32 %9, 255
%11 = xor i32 %10, %8
%12 = or i32 %5, %11
%13 = xor i32 %12, -1
%14 = or i32 %13, %3
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "9write [-dU] [-p port] [-u user] addr path\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"9write [-dU] [-p port] [-u user] addr path\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"9write [-dU] [-p port] [-u user] addr path\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void fun() {
  static int a = 2;
  int b = 1;
  a += ++b;
  printf("\n %d %d ", a, b);
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
add    0x2efa(%rip),%eax
mov    %eax,0x2ef4(%rip)
mov    0x2eee(%rip),%esi
mov    -0x4(%rbp),%edx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
mov    0x2f12(%rip),%esi
add    $0x2,%esi
mov    %esi,0x2f09(%rip)
lea    0xeda(%rip),%rdi
mov    $0x2,%edx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@fun.a = internal global i32 2
@.str = [9 x i8] c"\0A %d %d \00"
define void @fun() {
%1 = alloca i32
store i32 1, i32* %1
%2 = load i32, i32* %1
%3 = add nsw i32 %2, 1
store i32 %3, i32* %1
%4 = load i32, i32* @fun.a
%5 = add nsw i32 %4, %3
store i32 %5, i32* @fun.a
%6 = load i32, i32* @fun.a
%7 = load i32, i32* %1
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %7)
ret void
}

LLVM IR (-O2):
@fun.a = internal unnamed_addr global i32 2
@.str = [9 x i8] c"\0A %d %d \00"
define void @fun() {
%1 = load i32, i32* @fun.a
%2 = add nsw i32 %1, 2
store i32 %2, i32* @fun.a
%3 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %2, i32 2)
ret void
}
void smc_outw(unsigned int val, unsigned int addr) {
  *((volatile unsigned short *)addr) = (val << 8) | (val >> 8);
}


x86 assembly (clang, -O0):
<smc_outw>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    -0x8(%rbp),%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<smc_outw>:
mov    %edi,%eax
shl    $0x8,%eax
shr    $0x8,%edi
or     %eax,%edi
mov    %esi,%eax
mov    %di,(%rax)
ret

LLVM IR (-O0):
define void @smc_outw(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 = shl i32 %5, 8
%7 = load i32, i32* %3
%8 = lshr i32 %7, 8
%9 = or i32 %6, %8
%10 = trunc i32 %9 to i16
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i16*
store volatile i16 %10, i16* %13
ret void
}

LLVM IR (-O2):
define void @smc_outw(i32 %0, i32 %1) {
%3 = shl i32 %0, 8
%4 = lshr i32 %0, 8
%5 = or i32 %3, %4
%6 = trunc i32 %5 to i16
%7 = zext i32 %1 to i64
%8 = inttoptr i64 %7 to i16*
store volatile i16 %6, i16* %8
ret void
}
int test_imm_4Buint8_mem(unsigned char *val) {
  return ((*val) & (-0x4B << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Buint8_mem>:
testb  $0xb5,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_4Buint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = and i32 %5, -75
%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_4Buint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -75
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
char *eval(char *s) { return s; }


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

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

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

LLVM IR (-O2):
define i8* @eval(i8* readnone returned %0) {
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() { printf("Usage:\n\tpangvm [-pasm] <file>\n"); }


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"Usage:\0A\09pangvm [-pasm] <file>\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [30 x i8] c"Usage:\0A\09pangvm [-pasm] <file>\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
char *getHold(int hold) { return (hold) ? "[X]" : "[ ]"; }


x86 assembly (clang, -O0):
<getHold>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
lea    0xef3(%rip),%rax
lea    0xee8(%rip),%rcx
cmp    $0x0,%edx
cmovne %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHold>:
test   %edi,%edi
lea    0xefb(%rip),%rcx
lea    0xef0(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [4 x i8] c"[X]\00"
@.str.1 = [4 x i8] c"[ ]\00"
define i8* @getHold(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0)
ret i8* %6
}

LLVM IR (-O2):
@.str = [4 x i8] c"[X]\00"
@.str.1 = [4 x i8] c"[ ]\00"
define i8* @getHold(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ put8(int);
void sar_reg32_cl(unsigned int reg32) {
  put8(0xD3);
  put8(0xF8 + reg32);
}


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

x86 assembly (clang, -O2):
<sar_reg32_cl>:
push   %rbx
mov    %edi,%ebx
mov    $0xd3,%edi
call   1030 <put8@plt>
add    $0xf8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <put8@plt>

LLVM IR (-O0):
define void @sar_reg32_cl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @put8(i32 211)
%4 = load i32, i32* %2
%5 = add i32 248, %4
%6 = call i32 @put8(i32 %5)
ret void
}

LLVM IR (-O2):
define void @sar_reg32_cl(i32 %0) {
%2 = tail call i32 @put8(i32 211)
%3 = add i32 %0, 248
%4 = tail call i32 @put8(i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void sys_thread_sleep(unsigned long time) { usleep(1000 * time); }


x86 assembly (clang, -O0):
<sys_thread_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
imul   $0x3e8,-0x8(%rbp),%rax
mov    %eax,%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_thread_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @sys_thread_sleep(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul i64 1000, %3
%5 = trunc i64 %4 to i32
%6 = call i32 @usleep(i32 %5)
ret void
}

LLVM IR (-O2):
define void @sys_thread_sleep(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = mul i32 %2, 1000
%4 = tail call i32 @usleep(i32 %3)
ret void
}
/* Variables and functions */
int _BigLong(int);
int BigLong(int l) { return _BigLong(l); }


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

x86 assembly (clang, -O2):
<BigLong>:
jmp    1030 <_BigLong@plt>

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

LLVM IR (-O2):
define i32 @BigLong(i32 %0) {
%2 = tail call i32 @_BigLong(i32 %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ __libc_free(void *);
int /*<<< orphan*/ printf(char *);
void myfree(void *ptr) {
  printf("myfree\n");
  __libc_free(ptr);
}


x86 assembly (clang, -O0):
<myfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1030 <__libc_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<myfree>:
push   %rbx
mov    %rdi,%rbx
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <__libc_free@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"myfree\0A\00"
define void @myfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 @__libc_free(i8* %4)
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"myfree\00"
define void @myfree(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @__libc_free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gui_set_status_text_part(int, int, int, char *);
void gui_set_menu_value(char *text) {
  gui_set_status_text_part(3, 14, 13, text);
}


x86 assembly (clang, -O0):
<gui_set_menu_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
mov    $0x3,%edi
mov    $0xe,%esi
mov    $0xd,%edx
call   1030 <gui_set_status_text_part@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_set_menu_value>:
mov    %rdi,%rcx
mov    $0x3,%edi
mov    $0xe,%esi
mov    $0xd,%edx
jmp    1030 <gui_set_status_text_part@plt>

LLVM IR (-O0):
define void @gui_set_menu_value(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @gui_set_status_text_part(i32 3, i32 14, i32 13, i8* %3)
ret void
}

LLVM IR (-O2):
define void @gui_set_menu_value(i8* %0) {
%2 = tail call i32 @gui_set_status_text_part(i32 3, i32 14, i32 13, i8* %0)
ret void
}
/* Variables and functions */
int util_argvlen(char **av) {
  int i = 0;
  while (av[i] != NULL)
    i++;
  return i;
}


x86 assembly (clang, -O0):
<util_argvlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     1130 <util_argvlen+0x30>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <util_argvlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<util_argvlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <util_argvlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @util_argvlen(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = icmp eq i8* %5, null
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
struct vec3i {
  int dummy;
};
struct vec3 {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec3i_round(int /*<<< orphan*/ *, float *);
__attribute__((always_)) struct vec3i *psvec3i_round(struct vec3i *result,
                                                     struct vec3 *a) {
  vec3i_round((int32_t *)result, (float *)a);
  return result;
}


x86 assembly (clang, -O0):
<psvec3i_round>:
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 <vec3i_round@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<psvec3i_round>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec3i_round@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec3i = type { i32 }
%struct.vec3 = type { i32 }
define %struct.vec3i* @psvec3i_round(%struct.vec3i* %0, %struct.vec3* %1) {
%3 = alloca %struct.vec3i*
%4 = alloca %struct.vec3*
store %struct.vec3i* %0, %struct.vec3i** %3
store %struct.vec3* %1, %struct.vec3** %4
%5 = load %struct.vec3i*, %struct.vec3i** %3
%6 = bitcast %struct.vec3i* %5 to i32*
%7 = load %struct.vec3*, %struct.vec3** %4
%8 = bitcast %struct.vec3* %7 to float*
%9 = call i32 @vec3i_round(i32* %6, float* %8)
%10 = load %struct.vec3i*, %struct.vec3i** %3
ret %struct.vec3i* %10
}

LLVM IR (-O2):
%struct.vec3i = type { i32 }
%struct.vec3 = type { i32 }
define %struct.vec3i* @psvec3i_round(%struct.vec3i* returned %0, %struct.vec3* %1) {
%3 = getelementptr %struct.vec3i, %struct.vec3i* %0, i64 0, i32 0
%4 = bitcast %struct.vec3* %1 to float*
%5 = tail call i32 @vec3i_round(i32* %3, float* %4)
ret %struct.vec3i* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int write(int, unsigned char *, int);
int uart_write(int fd, unsigned char tx_buf[], int buf_len) {
  if (fd < 0) {
    return 0;
  }
  int count = write(fd, tx_buf, buf_len);
  if (count < 0) {
    printf("UART TX error\n");
    return -1;
  }
  return count;
}


x86 assembly (clang, -O0):
<uart_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1148 <uart_write+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1182 <uart_write+0x62>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    117c <uart_write+0x5c>
lea    0xe95(%rip),%rdi
call   1040 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1182 <uart_write+0x62>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_write>:
push   %rax
test   %edi,%edi
js     1130 <uart_write+0x10>
call   1040 <write@plt>
test   %eax,%eax
js     1134 <uart_write+0x14>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"UART TX error\0A\00"
define i32 @uart_write(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %3
store i32 0, i32* %4
br label %23
12: ; preds = %3
%13 = load i32, i32* %5
%14 = load i8*, i8** %6
%15 = load i32, i32* %7
%16 = call i32 @write(i32 %13, i8* %14, i32 %15)
store i32 %16, i32* %8
%17 = load i32, i32* %8
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %12
%20 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %4
br label %23
21: ; preds = %12
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %23
23: ; preds = %21, %19, %11
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@str = [14 x i8] c"UART TX error\00"
define i32 @uart_write(i32 %0, i8* nocapture %1, i32 %2) {
%4 = icmp slt i32 %0, 0
br i1 %4, label %10, label %5
5: ; preds = %3
%6 = tail call i32 @write(i32 %0, i8* %1, i32 %2)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %10
10: ; preds = %8, %5, %3
%11 = phi i32 [ 0, %3 ], [ -1, %8 ], [ %6, %5 ]
ret i32 %11
}
/* Variables and functions */
int getchar();
int consoleget(void) {
  int c;
  c = getchar();
  return c;
}


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

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

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

LLVM IR (-O2):
define i32 @consoleget() {
%1 = tail call i32 (...) @getchar()
ret i32 %1
}
/* Type definitions */
struct rbtree_node {
  int dummy;
};
struct rbtree {
  int dummy;
};

/* Variables and functions */
struct rbtree_node *do_lookup(struct rbtree_node const *, struct rbtree const *,
                              struct rbtree_node **, int *);
struct rbtree_node *rbtree_lookup(const struct rbtree_node *key,
                                  const struct rbtree *tree) {
  struct rbtree_node *parent;
  int is_left;
  return do_lookup(key, tree, &parent, &is_left);
}


x86 assembly (clang, -O0):
<rbtree_lookup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x1c(%rbp),%rcx
call   1030 <do_lookup@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rbtree_lookup>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <do_lookup@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.rbtree_node = type { i32 }
%struct.rbtree = type { i32 }
define %struct.rbtree_node* @rbtree_lookup(%struct.rbtree_node* %0, %struct.rbtree* %1) {
%3 = alloca %struct.rbtree_node*
%4 = alloca %struct.rbtree*
%5 = alloca %struct.rbtree_node*
%6 = alloca i32
store %struct.rbtree_node* %0, %struct.rbtree_node** %3
store %struct.rbtree* %1, %struct.rbtree** %4
%7 = load %struct.rbtree_node*, %struct.rbtree_node** %3
%8 = load %struct.rbtree*, %struct.rbtree** %4
%9 = call %struct.rbtree_node* @do_lookup(%struct.rbtree_node* %7, %struct.rbtree* %8, %struct.rbtree_node** %5, i32* %6)
ret %struct.rbtree_node* %9
}

LLVM IR (-O2):
%struct.rbtree_node = type { i32 }
%struct.rbtree = type { i32 }
define %struct.rbtree_node* @rbtree_lookup(%struct.rbtree_node* %0, %struct.rbtree* %1) {
%3 = alloca %struct.rbtree_node*
%4 = alloca i32
%5 = bitcast %struct.rbtree_node** %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call %struct.rbtree_node* @do_lookup(%struct.rbtree_node* %0, %struct.rbtree* %1, %struct.rbtree_node** %3, i32* %4)
ret %struct.rbtree_node* %7
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int solcon_write_solution_dimensions(int len, int dim) {
  int fail;
  double *c;
  fail = _ada_use_c2phc(134, &len, &dim, c);
  return fail;
}


x86 assembly (clang, -O0):
<solcon_write_solution_dimensions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x86,%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solcon_write_solution_dimensions>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
mov    $0x86,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @solcon_write_solution_dimensions(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca double*
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load double*, double** %6
%8 = call i32 @_ada_use_c2phc(i32 134, i32* %3, i32* %4, double* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @solcon_write_solution_dimensions(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @_ada_use_c2phc(i32 134, i32* %3, i32* %4, double* undef)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ menu();
int main(int argc, char *argv[]) {
  menu();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @menu()
ret i32 0
}
/* Variables and functions */
int __WORDSIZE;
unsigned long __ffs(unsigned long b) {
  int i;
  for (i = 0; i < __WORDSIZE; i++)
    if (b & (1UL << i))
      return i;
  return __WORDSIZE;
}


x86 assembly (clang, -O0):
<__ffs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2ecf(%rip),%rcx
cmp    (%rcx),%eax
jge    1160 <__ffs+0x60>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%rdx
mov    %rdx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     114d <__ffs+0x4d>
movslq -0x14(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    116e <__ffs+0x6e>
jmp    1152 <__ffs+0x52>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    110f <__ffs+0xf>
mov    0x2e81(%rip),%rax
movslq (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__ffs>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
test   %eax,%eax
jle    111f <__ffs+0x1f>
xor    %ecx,%ecx
nop
bt     %rcx,%rdi
jb     1122 <__ffs+0x22>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <__ffs+0x10>
cltq
ret
mov    %ecx,%eax
cltq
ret

LLVM IR (-O0):
@__WORDSIZE = global i32 0
define i64 @__ffs(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 0, i32* %4
br label %5
5: ; preds = %20, %1
%6 = load i32, i32* %4
%7 = load i32, i32* @__WORDSIZE
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %23
9: ; preds = %5
%10 = load i64, i64* %3
%11 = load i32, i32* %4
%12 = zext i32 %11 to i64
%13 = shl i64 1, %12
%14 = and i64 %10, %13
%15 = icmp ne i64 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %9
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
store i64 %18, i64* %2
br label %26
19: ; preds = %9
br label %20
20: ; preds = %19
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %5
23: ; preds = %5
%24 = load i32, i32* @__WORDSIZE
%25 = sext i32 %24 to i64
store i64 %25, i64* %2
br label %26
26: ; preds = %23, %16
%27 = load i64, i64* %2
ret i64 %27
}

LLVM IR (-O2):
@__WORDSIZE = global i32 0
define i64 @__ffs(i64 %0) {
%2 = load i32, i32* @__WORDSIZE
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = zext i32 %2 to i64
br label %6
6: ; preds = %4, %11
%7 = phi i64 [ 0, %4 ], [ %12, %11 ]
%8 = shl nuw i64 1, %7
%9 = and i64 %8, %0
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %16, label %6
14: ; preds = %6
%15 = trunc i64 %7 to i32
br label %16
16: ; preds = %11, %14, %1
%17 = phi i32 [ %2, %1 ], [ %15, %14 ], [ %2, %11 ]
%18 = sext i32 %17 to i64
ret i64 %18
}
/* Variables and functions */
int /*<<< orphan*/ append_number(char *, int);
int /*<<< orphan*/ strcpy(char *, char *);
void hour_to_12h_word(int hours, char *word) {
  hours = hours % 12;
  if (hours == 0) {
    hours = 12;
  }
  strcpy(word, "");
  append_number(word, hours);
}


x86 assembly (clang, -O0):
<hour_to_12h_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    114e <hour_to_12h_word+0x2e>
movl   $0xc,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1040 <append_number@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hour_to_12h_word>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
movslq %edi,%rax
imul   $0x2aaaaaab,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x21,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
mov    $0xc,%ebp
cmovne %eax,%ebp
lea    0xeac(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <append_number@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define void @hour_to_12h_word(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 = srem i32 %5, 12
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 12, i32* %3
br label %10
10: ; preds = %9, %2
%11 = load i8*, i8** %4
%12 = call i32 @strcpy(i8* %11, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%13 = load i8*, i8** %4
%14 = load i32, i32* %3
%15 = call i32 @append_number(i8* %13, i32 %14)
ret void
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define void @hour_to_12h_word(i32 %0, i8* %1) {
%3 = srem i32 %0, 12
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 12, i32 %3
%6 = tail call i32 @strcpy(i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @append_number(i8* %1, i32 %5)
ret void
}
void fsemu_recording_end_frame(void) {}


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

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

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

LLVM IR (-O2):
define void @fsemu_recording_end_frame() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(unsigned char *);
int /*<<< orphan*/ vOneTwo0(unsigned char *, int /*<<< orphan*/,
                            unsigned char *);
void vMakeTagStr(unsigned char *pszBinTag, unsigned char *pszAscTag) {
  vOneTwo0(pszBinTag, strlen(pszBinTag), pszAscTag);
}


x86 assembly (clang, -O0):
<vMakeTagStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x18(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1040 <vOneTwo0@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vMakeTagStr>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <vOneTwo0@plt>

LLVM IR (-O0):
define void @vMakeTagStr(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i32 @vOneTwo0(i8* %5, i32 %7, i8* %8)
ret void
}

LLVM IR (-O2):
define void @vMakeTagStr(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @vOneTwo0(i8* %0, i32 %3, i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stdout;
void *guarded_malloc(size_t size) {
  void *result = malloc(size);
  if (!result) {
    fprintf(stdout, "Memory allocation has failed: exiting.");
    abort();
  }
  return result;
}


x86 assembly (clang, -O0):
<guarded_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1170 <guarded_malloc+0x40>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<guarded_malloc>:
push   %rax
call   1050 <malloc@plt>
test   %rax,%rax
je     113d <guarded_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [39 x i8] c"Memory allocation has failed: exiting.\00"
define i8* @guarded_malloc(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 %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stdout
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [39 x i8] c"Memory allocation has failed: exiting.\00"
define noalias i8* @guarded_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stdout
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 (...) @abort()
unreachable
8: ; preds = %1
ret i8* %2
}
int prime(int n) {
  int i = 2;
  for (; i < n / 2; i++)
    if (n % i == 0) {
      return 0;
    }
  return 1;
}


x86 assembly (clang, -O0):
<prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    115b <prime+0x5b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1148 <prime+0x48>
movl   $0x0,-0x4(%rbp)
jmp    1162 <prime+0x62>
jmp    114d <prime+0x4d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prime>:
mov    $0x1,%r8d
cmp    $0x6,%edi
jl     1130 <prime+0x30>
mov    %edi,%esi
shr    %esi
mov    $0x2,%ecx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edi,%eax
cltd
idiv   %ecx
test   %edx,%edx
je     1134 <prime+0x34>
add    $0x1,%ecx
cmp    %ecx,%esi
jne    1120 <prime+0x20>
mov    %r8d,%eax
ret
xor    %r8d,%r8d
mov    %r8d,%eax
ret

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

LLVM IR (-O2):
define i32 @prime(i32 %0) {
%2 = icmp sgt i32 %0, 5
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = lshr i32 %0, 1
br label %7
5: ; preds = %7
%6 = icmp eq i32 %11, %4
br i1 %6, label %12, label %7
7: ; preds = %3, %5
%8 = phi i32 [ %11, %5 ], [ 2, %3 ]
%9 = srem i32 %0, %8
%10 = icmp eq i32 %9, 0
%11 = add nuw nsw i32 %8, 1
br i1 %10, label %12, label %5
12: ; preds = %7, %5, %1
%13 = phi i32 [ 1, %1 ], [ 1, %5 ], [ 0, %7 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ endmntent(int /*<<< orphan*/ *);
void sc_cleanup_endmntent(FILE **ptr) {
  if (ptr != NULL && *ptr != NULL) {
    endmntent(*ptr);
    *ptr = NULL;
  }
}


x86 assembly (clang, -O0):
<sc_cleanup_endmntent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <sc_cleanup_endmntent+0x3c>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114c <sc_cleanup_endmntent+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <endmntent@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sc_cleanup_endmntent>:
push   %rbx
test   %rdi,%rdi
je     112d <sc_cleanup_endmntent+0x1d>
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     112d <sc_cleanup_endmntent+0x1d>
call   1030 <endmntent@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @sc_cleanup_endmntent(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = load i32**, i32*** %2
%4 = icmp ne i32** %3, null
br i1 %4, label %5, label %14
5: ; preds = %1
%6 = load i32**, i32*** %2
%7 = load i32*, i32** %6
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %14
9: ; preds = %5
%10 = load i32**, i32*** %2
%11 = load i32*, i32** %10
%12 = call i32 @endmntent(i32* %11)
%13 = load i32**, i32*** %2
store i32* null, i32** %13
br label %14
14: ; preds = %9, %5, %1
ret void
}

LLVM IR (-O2):
define void @sc_cleanup_endmntent(i32** %0) {
%2 = icmp eq i32** %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32*, i32** %0
%5 = icmp eq i32* %4, null
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = tail call i32 @endmntent(i32* %4)
store i32* null, i32** %0
br label %8
8: ; preds = %6, %3, %1
ret void
}
void nand_cmd(unsigned char cmd) {
  *((unsigned volatile char *)0x70200008) = cmd;
}


x86 assembly (clang, -O0):
<nand_cmd>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
mov    $0x70200008,%eax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<nand_cmd>:
mov    %dil,0x70200008
70
ret

LLVM IR (-O0):
define void @nand_cmd(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
store volatile i8 %3, i8* inttoptr (i64 1881145352 to i8*)
ret void
}

LLVM IR (-O2):
define void @nand_cmd(i8 zeroext %0) {
store volatile i8 %0, i8* inttoptr (i64 1881145352 to i8*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ TCP_NODELAY;
int so_setboolopt(int, int /*<<< orphan*/, int /*<<< orphan*/, _Bool);
int so_nodelay(int fd, _Bool nodelay) {
  return so_setboolopt(fd, IPPROTO_TCP, TCP_NODELAY, nodelay);
}


x86 assembly (clang, -O0):
<so_nodelay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %edi,-0x4(%rbp)
and    $0x1,%al
mov    %al,-0x5(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
mov    0x2eb2(%rip),%rax
mov    (%rax),%edx
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%ecx
call   1030 <so_setboolopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<so_nodelay>:
mov    %esi,%ecx
mov    0x2ec7(%rip),%rax
mov    (%rax),%esi
mov    0x2ec6(%rip),%rax
mov    (%rax),%edx
jmp    1030 <so_setboolopt@plt>

LLVM IR (-O0):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @so_nodelay(i32 %0, i1 zeroext %1) {
%3 = alloca i32
%4 = alloca i8
store i32 %0, i32* %3
%5 = zext i1 %1 to i8
store i8 %5, i8* %4
%6 = load i32, i32* %3
%7 = load i32, i32* @IPPROTO_TCP
%8 = load i32, i32* @TCP_NODELAY
%9 = load i8, i8* %4
%10 = trunc i8 %9 to i1
%11 = call i32 @so_setboolopt(i32 %6, i32 %7, i32 %8, i1 zeroext %10)
ret i32 %11
}

LLVM IR (-O2):
@IPPROTO_TCP = global i32 0
@TCP_NODELAY = global i32 0
define i32 @so_nodelay(i32 %0, i1 zeroext %1) {
%3 = load i32, i32* @IPPROTO_TCP
%4 = load i32, i32* @TCP_NODELAY
%5 = tail call i32 @so_setboolopt(i32 %0, i32 %3, i32 %4, i1 zeroext %1)
ret i32 %5
}