xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint16_t;

/* Variables and functions */
int write(int, int /*<<< orphan*/ *, int);
int net_write(int fd, uint16_t len, uint8_t *data) {
  int r;
  ;
  r = write(fd, data, len);
  if (r != len) {

    ;
    return -1;
  };
  return r;
}


x86 assembly (clang, -O0):
<net_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     114c <net_write+0x3c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1152 <net_write+0x42>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_write>:
push   %rbx
mov    %esi,%ebx
mov    %rdx,%rsi
mov    %ebx,%edx
call   1030 <write@plt>
cmp    %ebx,%eax
mov    $0xffffffff,%ecx
cmovne %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @net_write(i32 %0, i32 %1, i32* nocapture %2) {
%4 = tail call i32 @write(i32 %0, i32* %2, i32 %1)
%5 = icmp eq i32 %4, %1
%6 = select i1 %5, i32 %4, i32 -1
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int ffi_connect();
unsigned int ffi_recv(int, int, char *);
int /*<<< orphan*/ printf(char *, unsigned int, char *);
int main() {
  int sock;
  char buffer[1024];
  sock = ffi_connect();
  unsigned int n = ffi_recv(sock, sizeof(buffer), buffer);
  printf("Data received(%d): %s", n, buffer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <ffi_connect@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x410(%rbp),%rdx
mov    $0x400,%esi
call   1040 <ffi_recv@plt>
mov    %eax,-0x414(%rbp)
mov    -0x414(%rbp),%esi
lea    -0x410(%rbp),%rdx
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
xor    %eax,%eax
call   1050 <ffi_connect@plt>
mov    %rsp,%rbx
mov    %eax,%edi
mov    $0x400,%esi
mov    %rbx,%rdx
call   1040 <ffi_recv@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"Data received(%d): %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @ffi_connect()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 @ffi_recv(i32 %6, i32 1024, i8* %7)
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %9, i8* %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"Data received(%d): %s\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @ffi_connect()
%4 = call i32 @ffi_recv(i32 %3, i32 1024, i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %4, i8* %2)
ret i32 0
}
void U_EMRFLATTENPATH_print(const char *contents) { (void)contents; }


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

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

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

LLVM IR (-O2):
define void @U_EMRFLATTENPATH_print(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int usage(char *prog) {
  printf("Usage:\n"
         "\t%s binfile.bin\n",
         prog);
  return 1;
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Usage:\0A\09%s binfile.bin\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %3)
ret i32 1
}

LLVM IR (-O2):
@.str = [24 x i8] c"Usage:\0A\09%s binfile.bin\0A\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int, char *, int, char *);
scalar_t__ isodigit(int);
void t_isodigit_0xf7() {
  Assert_real((isodigit(247) == 0),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_isodigit.c",
              1240, ("isodigit should be 0 for 0xf7"));
}


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

x86 assembly (clang, -O2):
<t_isodigit_0xf7>:
push   %rax
mov    $0xf7,%edi
call   1040 <isodigit@plt>
xor    %edi,%edi
test   %rax,%rax
sete   %dil
lea    0xec5(%rip),%rsi
lea    0xf67(%rip),%rcx
mov    $0x4d8,%edx
pop    %rax
jmp    1030 <Assert_real@plt>

LLVM IR (-O0):
@.str = [169 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_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xf7\00"
define void @t_isodigit_0xf7() {
%1 = call i64 @isodigit(i32 247)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1240, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [169 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_isodigit.c\00"
@.str.1 = [30 x i8] c"isodigit should be 0 for 0xf7\00"
define void @t_isodigit_0xf7() {
%1 = tail call i64 @isodigit(i32 247)
%2 = icmp eq i64 %1, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @Assert_real(i32 %3, i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str, i64 0, i64 0), i32 1240, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dirname(char *);
int /*<<< orphan*/ puts(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int i;
  for (i = 1; i < argc; i++)
    puts(dirname(argv[i]));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    116f <main+0x4f>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1040 <dirname@plt>
mov    %eax,%edi
call   1030 <puts@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
cmp    $0x2,%edi
jl     1159 <main+0x39>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r14,%rbx,8),%rdi
call   1040 <dirname@plt>
mov    %eax,%edi
call   1030 <puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <main+0x20>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 1, %4 ], [ %12, %6 ]
%8 = getelementptr inbounds i8*, i8** %1, i64 %7
%9 = load i8*, i8** %8
%10 = tail call i32 @dirname(i8* %9)
%11 = tail call i32 @puts(i32 %10)
%12 = add nuw nsw i64 %7, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %14, label %6
14: ; preds = %6, %2
ret i32 0
}
/* Variables and functions */
bool match_so_flags(int flags) {
  if ((flags & 0x00ff) != 0x0003)
    return false;
  switch (flags & 0xff00) {
  case 0x0100:
  case 0x0200:
  case 0x0300:
  case 0x0400:
  case 0x0500:
    return (sizeof(void *) == 8);
  }
  return sizeof(void *) == 4;
}


x86 assembly (clang, -O0):
<match_so_flags>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x3,%eax
je     1124 <match_so_flags+0x24>
movl   $0x0,-0x4(%rbp)
jmp    119d <match_so_flags+0x9d>
movzbl -0x7(%rbp),%eax
shl    $0x8,%eax
mov    %eax,-0xc(%rbp)
sub    $0x100,%eax
je     118a <match_so_flags+0x8a>
jmp    113e <match_so_flags+0x3e>
mov    -0xc(%rbp),%eax
sub    $0x200,%eax
je     118a <match_so_flags+0x8a>
jmp    1151 <match_so_flags+0x51>
mov    -0xc(%rbp),%eax
sub    $0x300,%eax
je     118a <match_so_flags+0x8a>
jmp    1164 <match_so_flags+0x64>
mov    -0xc(%rbp),%eax
sub    $0x400,%eax
je     118a <match_so_flags+0x8a>
jmp    1177 <match_so_flags+0x77>
mov    -0xc(%rbp),%eax
sub    $0x500,%eax
jne    1196 <match_so_flags+0x96>
jmp    118a <match_so_flags+0x8a>
movl   $0x1,-0x4(%rbp)
jmp    119d <match_so_flags+0x9d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<match_so_flags>:
cmp    $0x3,%dil
sete   %al
and    $0xff00,%edi
add    $0xffffff00,%edi
cmp    $0x500,%edi
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @match_so_flags(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = and i32 %4, 255
%6 = icmp ne i32 %5, 3
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 0, i32* %2
br label %13
8: ; preds = %1
%9 = load i32, i32* %3
%10 = and i32 %9, 65280
switch i32 %10, label %12 [
i32 256, label %11
i32 512, label %11
i32 768, label %11
i32 1024, label %11
i32 1280, label %11
]
11: ; preds = %8, %8, %8, %8, %8
store i32 1, i32* %2
br label %13
12: ; preds = %8
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @match_so_flags(i32 %0) {
%2 = and i32 %0, 255
%3 = icmp eq i32 %2, 3
%4 = and i32 %0, 65280
%5 = add nsw i32 %4, -256
%6 = icmp ult i32 %5, 1280
%7 = select i1 %3, i1 %6, i1 false
%8 = zext i1 %7 to i32
ret i32 %8
}
long labs(long i) { return i >= 0 ? i : -i; }


x86 assembly (clang, -O0):
<labs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jl     1120 <labs+0x20>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    112a <labs+0x2a>
xor    %eax,%eax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @labs(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = icmp sge i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load i64, i64* %2
br label %10
7: ; preds = %1
%8 = load i64, i64* %2
%9 = sub nsw i64 0, %8
br label %10
10: ; preds = %7, %5
%11 = phi i64 [ %6, %5 ], [ %9, %7 ]
ret i64 %11
}

LLVM IR (-O2):
define i64 @labs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ test_assert_int_eq_fail_add_test();
void test_assert_int_eq_fail_add_test_constructor(void) {
  test_assert_int_eq_fail_add_test();
}


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

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

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

LLVM IR (-O2):
define void @test_assert_int_eq_fail_add_test_constructor() {
%1 = tail call i32 (...) @test_assert_int_eq_fail_add_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
void smallAdjustmentLT(unsigned a) {
  if (a + 1 < 2)
    clang_analyzer_eval(a == 0 || a == (~0U));
}


x86 assembly (clang, -O0):
<smallAdjustmentLT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x2,%eax
jae    1150 <smallAdjustmentLT+0x40>
mov    $0x1,%al
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     1143 <smallAdjustmentLT+0x33>
cmpl   $0xffffffff,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<smallAdjustmentLT>:
add    $0x1,%edi
cmp    $0x1,%edi
ja     1122 <smallAdjustmentLT+0x12>
mov    $0x1,%edi
jmp    1030 <clang_analyzer_eval@plt>
ret

LLVM IR (-O0):
define void @smallAdjustmentLT(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 1
%5 = icmp ult i32 %4, 2
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, -1
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ true, %6 ], [ %11, %9 ]
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
br label %16
16: ; preds = %12, %1
ret void
}

LLVM IR (-O2):
define void @smallAdjustmentLT(i32 %0) {
%2 = add i32 %0, 1
%3 = icmp ult i32 %2, 2
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @clang_analyzer_eval(i32 1)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UnitTest_report();
int /*<<< orphan*/ testFree();
int /*<<< orphan*/ testInsert();
int /*<<< orphan*/ testNew();
int main(int argc, char **argv) {
  testNew();
  testFree();
  testInsert();
  UnitTest_report();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <testNew@plt>
mov    $0x0,%al
call   1060 <testFree@plt>
mov    $0x0,%al
call   1040 <testInsert@plt>
mov    $0x0,%al
call   1050 <UnitTest_report@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <testNew@plt>
xor    %eax,%eax
call   1060 <testFree@plt>
xor    %eax,%eax
call   1040 <testInsert@plt>
xor    %eax,%eax
call   1050 <UnitTest_report@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @testNew()
%4 = tail call i32 (...) @testFree()
%5 = tail call i32 (...) @testInsert()
%6 = tail call i32 (...) @UnitTest_report()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ spipad_spi_init();
int /*<<< orphan*/ spipad_spi_set_ss(int);
void spipad_init(void) {
  spipad_spi_init();
  spipad_spi_set_ss(1);
}


x86 assembly (clang, -O0):
<spipad_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <spipad_spi_init@plt>
mov    $0x1,%edi
call   1040 <spipad_spi_set_ss@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<spipad_init>:
push   %rax
xor    %eax,%eax
call   1030 <spipad_spi_init@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <spipad_spi_set_ss@plt>

LLVM IR (-O0):
define void @spipad_init() {
%1 = call i32 (...) @spipad_spi_init()
%2 = call i32 @spipad_spi_set_ss(i32 1)
ret void
}

LLVM IR (-O2):
define void @spipad_init() {
%1 = tail call i32 (...) @spipad_spi_init()
%2 = tail call i32 @spipad_spi_set_ss(i32 1)
ret void
}
/* Variables and functions */
size_t strlen(const char *cs) {
  size_t ret = 0;
  for (size_t i = 0; cs[i] != '\0'; ++i) {
    ++ret;
  }
  return (ret);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     114a <strlen+0x4a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1118 <strlen+0x18>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %6, %1
%5 = phi i64 [ 0, %1 ], [ %8, %6 ]
ret i64 %5
6: ; preds = %1, %6
%7 = phi i64 [ %8, %6 ], [ 0, %1 ]
%8 = add i64 %7, 1
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %4, label %6
}
/* Type definitions */
struct svc_req {
  int dummy;
};
struct rpc_msg {
  int dummy;
};
typedef enum auth_stat { ____Placeholder_auth_stat } auth_stat;

/* Variables and functions */
int AUTH_OK;
enum auth_stat _svcauth_null(struct svc_req *rqst, struct rpc_msg *msg) {
  return (AUTH_OK);
}


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

x86 assembly (clang, -O2):
<_svcauth_null>:
mov    0x2ef1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.svc_req = type { i32 }
%struct.rpc_msg = type { i32 }
@AUTH_OK = global i32 0
define i32 @_svcauth_null(%struct.svc_req* %0, %struct.rpc_msg* %1) {
%3 = alloca %struct.svc_req*
%4 = alloca %struct.rpc_msg*
store %struct.svc_req* %0, %struct.svc_req** %3
store %struct.rpc_msg* %1, %struct.rpc_msg** %4
%5 = load i32, i32* @AUTH_OK
ret i32 %5
}

LLVM IR (-O2):
%struct.svc_req = type { i32 }
%struct.rpc_msg = type { i32 }
@AUTH_OK = global i32 0
define i32 @_svcauth_null(%struct.svc_req* nocapture readnone %0, %struct.rpc_msg* nocapture readnone %1) {
%3 = load i32, i32* @AUTH_OK
ret i32 %3
}
/* Variables and functions */
void *ralloc_size(void const *, int /*<<< orphan*/);
void *ralloc_context(const void *ctx) { return ralloc_size(ctx, 0); }


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

x86 assembly (clang, -O2):
<ralloc_context>:
xor    %esi,%esi
jmp    1030 <ralloc_size@plt>

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

LLVM IR (-O2):
define i8* @ralloc_context(i8* %0) {
%2 = tail call i8* @ralloc_size(i8* %0, i32 0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printUsage() {
  printf("\n");
  printf("Supported commands:\n");
  printf("Arithmetic: '+', '-', '*', '/'\n");
  printf("Advanced  : 'p'- print stack, 's' - swap the top two in stack,\n"
         " 'd' - duplicate stack, 'c' - clear stack\n");
  printf("\n");
}


x86 assembly (clang, -O0):
<printUsage>:
push   %rbp
mov    %rsp,%rbp
lea    0xf18(%rip),%rdi
call   1030 <printf@plt>
lea    0xed9(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printUsage>:
push   %rax
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xece(%rip),%rdi
call   1040 <puts@plt>
lea    0xed6(%rip),%rdi
call   1040 <puts@plt>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [21 x i8] c"Supported commands:\0A\00"
@.str.2 = [32 x i8] c"Arithmetic: '+', '-', '*', '/'\0A\00"
@.str.3 = [106 x i8] c"Advanced : 'p'- print stack, 's' - swap the top two in stack,\0A 'd' - duplicate stack, 'c' - clear stack\0A\00"
define void @printUsage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [20 x i8] c"Supported commands:\00"
@str.4 = [31 x i8] c"Arithmetic: '+', '-', '*', '/'\00"
@str.5 = [105 x i8] c"Advanced : 'p'- print stack, 's' - swap the top two in stack,\0A 'd' - duplicate stack, 'c' - clear stack\00"
define void @printUsage() {
%1 = tail call i32 @putchar(i32 10)
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.4, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([105 x i8], [105 x i8]* @str.5, i64 0, i64 0))
%5 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ htcp_unregister();
void module_unregister_fake(void) {
  if (0)
    htcp_unregister();
}


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

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

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

LLVM IR (-O2):
define void @module_unregister_fake() {
ret void
}
float calc_discrim(int a, int b, int c) {
  float result = (b * b) - (4 * a * c);
  return result;
}


x86 assembly (clang, -O0):
<calc_discrim>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
imul   -0xc(%rbp),%ecx
sub    %ecx,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<calc_discrim>:
imul   %esi,%esi
imul   %edx,%edi
shl    $0x2,%edi
sub    %edi,%esi
cvtsi2ss %esi,%xmm0
ret

LLVM IR (-O0):
define float @calc_discrim(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %5
%10 = mul nsw i32 %8, %9
%11 = load i32, i32* %4
%12 = mul nsw i32 4, %11
%13 = load i32, i32* %6
%14 = mul nsw i32 %12, %13
%15 = sub nsw i32 %10, %14
%16 = sitofp i32 %15 to float
store float %16, float* %7
%17 = load float, float* %7
ret float %17
}

LLVM IR (-O2):
define float @calc_discrim(i32 %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %1, %1
%5 = mul i32 %0, -4
%6 = mul i32 %5, %2
%7 = add i32 %6, %4
%8 = sitofp i32 %7 to float
ret float %8
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct chirp_client {
  int dummy;
};
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
int /*<<< orphan*/ get_result(struct chirp_client *, int /*<<< orphan*/);
int64_t chirp_client_pwrite_finish(struct chirp_client *c, int64_t fd,
                                   const void *buffer, int64_t length,
                                   int64_t offset, time_t stoptime) {
  return get_result(c, stoptime);
}


x86 assembly (clang, -O0):
<chirp_client_pwrite_finish>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <get_result@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chirp_client_pwrite_finish>:
mov    %r9d,%esi
jmp    1030 <get_result@plt>

LLVM IR (-O0):
%struct.chirp_client = type { i32 }
define i32 @chirp_client_pwrite_finish(%struct.chirp_client* %0, i32 %1, i8* %2, i32 %3, i32 %4, i32 %5) {
%7 = alloca %struct.chirp_client*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store %struct.chirp_client* %0, %struct.chirp_client** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i32 %5, i32* %12
%13 = load %struct.chirp_client*, %struct.chirp_client** %7
%14 = load i32, i32* %12
%15 = call i32 @get_result(%struct.chirp_client* %13, i32 %14)
ret i32 %15
}

LLVM IR (-O2):
%struct.chirp_client = type { i32 }
define i32 @chirp_client_pwrite_finish(%struct.chirp_client* %0, i32 %1, i8* nocapture readnone %2, i32 %3, i32 %4, i32 %5) {
%7 = tail call i32 @get_result(%struct.chirp_client* %0, i32 %5)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ txbuffer;

/* Variables and functions */
int /*<<< orphan*/ spi_transfer(char *, char *);
void spi_write(char port, char value) {
  char txbuffer[] = {0x40, port, value};
  char rxbuffer[(sizeof(txbuffer) / sizeof((txbuffer)[0]))];
  spi_transfer(txbuffer, rxbuffer);
}


x86 assembly (clang, -O0):
<spi_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x40,-0x5(%rbp)
mov    -0x1(%rbp),%al
mov    %al,-0x4(%rbp)
mov    -0x2(%rbp),%al
mov    %al,-0x3(%rbp)
lea    -0x5(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <spi_transfer@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_write>:
push   %rax
movb   $0x40,0x2(%rsp)
mov    %dil,0x3(%rsp)
mov    %sil,0x4(%rsp)
lea    0x2(%rsp),%rdi
lea    0x5(%rsp),%rsi
call   1030 <spi_transfer@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @spi_write(i8 signext %0, i8 signext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca [3 x i8]
%6 = alloca [3 x i8]
store i8 %0, i8* %3
store i8 %1, i8* %4
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
store i8 64, i8* %7
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = load i8, i8* %3
store i8 %9, i8* %8
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %4
store i8 %11, i8* %10
%12 = getelementptr inbounds [3 x i8], [3 x i8]* %5, i64 0, i64 0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %6, i64 0, i64 0
%14 = call i32 @spi_transfer(i8* %12, i8* %13)
ret void
}

LLVM IR (-O2):
define void @spi_write(i8 signext %0, i8 signext %1) {
%3 = alloca [3 x i8]
%4 = alloca [3 x i8]
%5 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
store i8 64, i8* %5
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 1
store i8 %0, i8* %6
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 2
store i8 %1, i8* %7
%8 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%9 = call i32 @spi_transfer(i8* %5, i8* %8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, unsigned long *);
int parse_hex(char *str, unsigned long *ret) {
  sscanf(str, "0x%lx", ret);
  return 1;
}


x86 assembly (clang, -O0):
<parse_hex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xed1(%rip),%rsi
call   1030 <sscanf@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_hex>:
push   %rax
mov    %rsi,%rdx
lea    0xee5(%rip),%rsi
call   1030 <sscanf@plt>
mov    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [6 x i8] c"0x%lx\00"
define i32 @parse_hex(i8* nocapture %0, i64* %1) {
%3 = tail call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i64* %1)
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ ansi_escape(char *);
void term_clear_line() { ansi_escape("2K"); }


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"2K\00"
define void @term_clear_line() {
%1 = tail call i32 @ansi_escape(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __console_tx_hex8(unsigned char);
void print_alert_hex8(unsigned char value) { __console_tx_hex8(value); }


x86 assembly (clang, -O0):
<print_alert_hex8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edi
call   1030 <__console_tx_hex8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_alert_hex8>:
jmp    1030 <__console_tx_hex8@plt>

LLVM IR (-O0):
define void @print_alert_hex8(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @__console_tx_hex8(i8 zeroext %3)
ret void
}

LLVM IR (-O2):
define void @print_alert_hex8(i8 zeroext %0) {
%2 = tail call i32 @__console_tx_hex8(i8 zeroext %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ xcb_connection_t;

/* Variables and functions */
int /*<<< orphan*/ errx(int, char *);
int /*<<< orphan*/ *xcb_connect(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ xcb_connection_has_error(int /*<<< orphan*/ *);
void init_xcb(xcb_connection_t **con) {
  *con = xcb_connect(NULL, NULL);
  if (xcb_connection_has_error(*con))
    errx(1, "unable connect to the X server");
}


x86 assembly (clang, -O0):
<init_xcb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%esi
mov    %rsi,%rdi
call   1030 <xcb_connect@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <xcb_connection_has_error@plt>
cmp    $0x0,%rax
je     1179 <init_xcb+0x49>
mov    $0x1,%edi
lea    0xe8c(%rip),%rsi
call   1040 <errx@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_xcb>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
xor    %esi,%esi
call   1030 <xcb_connect@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
call   1050 <xcb_connection_has_error@plt>
test   %rax,%rax
je     115f <init_xcb+0x2f>
lea    0xeac(%rip),%rsi
mov    $0x1,%edi
pop    %rbx
jmp    1040 <errx@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"unable connect to the X server\00"
define void @init_xcb(i32** %0) {
%2 = alloca i32**
store i32** %0, i32*** %2
%3 = call i32* @xcb_connect(i32* null, i32* null)
%4 = load i32**, i32*** %2
store i32* %3, i32** %4
%5 = load i32**, i32*** %2
%6 = load i32*, i32** %5
%7 = call i64 @xcb_connection_has_error(i32* %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 @errx(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"unable connect to the X server\00"
define void @init_xcb(i32** nocapture writeonly %0) {
%2 = tail call i32* @xcb_connect(i32* null, i32* null)
store i32* %2, i32** %0
%3 = tail call i64 @xcb_connection_has_error(i32* %2)
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @errx(i32 1, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ U_WMRNOTIMPLEMENTED_swap(char *, int);
void U_WMR64_swap(char *record, int torev) {
  U_WMRNOTIMPLEMENTED_swap(record, torev);
}


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

x86 assembly (clang, -O2):
<U_WMR64_swap>:
jmp    1030 <U_WMRNOTIMPLEMENTED_swap@plt>

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

LLVM IR (-O2):
define void @U_WMR64_swap(i8* %0, i32 %1) {
%3 = tail call i32 @U_WMRNOTIMPLEMENTED_swap(i8* %0, i32 %1)
ret void
}
void g_cache_destroy() {}


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

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

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

LLVM IR (-O2):
define void @g_cache_destroy() {
ret void
}
int test_imm_37uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x37 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_37uint64_lowword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
and    $0x37,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_37uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 55
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ serial_init(int);
int /*<<< orphan*/ serial_puts(int, char *);
void kernel(void) {
  serial_init(0x3f8);
  serial_puts(0x3f8, "Ready.\n");
}


x86 assembly (clang, -O0):
<kernel>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3f8,%edi
call   1040 <serial_init@plt>
mov    $0x3f8,%edi
lea    0xec6(%rip),%rsi
call   1030 <serial_puts@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<kernel>:
push   %rax
mov    $0x3f8,%edi
call   1040 <serial_init@plt>
lea    0xece(%rip),%rsi
mov    $0x3f8,%edi
pop    %rax
jmp    1030 <serial_puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Ready.\0A\00"
define void @kernel() {
%1 = call i32 @serial_init(i32 1016)
%2 = call i32 @serial_puts(i32 1016, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"Ready.\0A\00"
define void @kernel() {
%1 = tail call i32 @serial_init(i32 1016)
%2 = tail call i32 @serial_puts(i32 1016, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int getloadavg(double loadavg[], int nelem) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<getloadavg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ec2(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getloadavg>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
define i32 @getloadavg(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
%6 = call i32 @__set_errno(i32 %5)
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @getloadavg(double* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @ENOSYS
%4 = tail call i32 @__set_errno(i32 %3)
ret i32 -1
}
memcmp(s1, s2, n) register char *s1, *s2;
register int n;
{
  short i;
  while (n--)
    if (i = *s1++ - *s2++)
      return i;
  return 0;
}


x86 assembly (clang, -O0):
<memcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     1168 <memcmp+0x68>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x18(%rbp)
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %ax,-0x1e(%rbp)
cmp    $0x0,%ax
je     1163 <memcmp+0x63>
movswl -0x1e(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    116f <memcmp+0x6f>
jmp    110f <memcmp+0xf>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<memcmp>:
mov    %edx,%r8d
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %edx,%r8d
je     1129 <memcmp+0x29>
movsbl (%rdi,%rdx,1),%eax
movsbl (%rsi,%rdx,1),%ecx
sub    %ecx,%eax
add    $0x1,%rdx
test   %ax,%ax
je     1110 <memcmp+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @memcmp(i8* nocapture %0, i8* nocapture %1, i32 %2) {
br label %4
4: ; preds = %9, %3
%5 = phi i8* [ %0, %3 ], [ %11, %9 ]
%6 = phi i8* [ %1, %3 ], [ %14, %9 ]
%7 = phi i32 [ %2, %3 ], [ %10, %9 ]
%8 = icmp eq i32 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %4
%10 = add nsw i32 %7, -1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = load i8, i8* %5
%13 = sext i8 %12 to i16
%14 = getelementptr inbounds i8, i8* %6, i64 1
%15 = load i8, i8* %6
%16 = sext i8 %15 to i16
%17 = sub nsw i16 %13, %16
%18 = icmp eq i16 %17, 0
br i1 %18, label %4, label %19
19: ; preds = %9
%20 = sext i16 %17 to i32
br label %21
21: ; preds = %4, %19
%22 = phi i32 [ %20, %19 ], [ 0, %4 ]
ret i32 %22
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, i, sum = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    sum += i;
  }
  printf("%d", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1170 <main+0x50>
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    114d <main+0x2d>
mov    -0x10(%rbp),%esi
lea    0xe86(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    114f <main+0x2f>
lea    -0x1(%rax),%ecx
lea    -0x2(%rax),%edx
imul   %rcx,%rdx
shr    %rdx
lea    (%rdx,%rax,2),%esi
add    $0xffffffff,%esi
jmp    1151 <main+0x31>
xor    %esi,%esi
lea    0xea8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1
br i1 %5, label %17, label %6
6: ; preds = %0
%7 = shl nuw i32 %4, 1
%8 = add nsw i32 %4, -1
%9 = zext i32 %8 to i33
%10 = add nsw i32 %4, -2
%11 = zext i32 %10 to i33
%12 = mul i33 %9, %11
%13 = lshr i33 %12, 1
%14 = trunc i33 %13 to i32
%15 = add i32 %7, %14
%16 = add i32 %15, -1
br label %17
17: ; preds = %6, %0
%18 = phi i32 [ 0, %0 ], [ %16, %6 ]
%19 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %18)
ret i32 0
}
/* Variables and functions */
scalar_t__ isalpha(char);
int isstr(char *s) {
  for (; *s; s++)
    if (isalpha(*s))
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1161 <isstr+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     114b <isstr+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    1168 <isstr+0x58>
jmp    1150 <isstr+0x40>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <isstr+0xc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isstr>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
xor    %ebp,%ebp
test   %al,%al
je     114f <isstr+0x3f>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <isalpha@plt>
test   %rax,%rax
jne    114a <isstr+0x3a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isstr+0x20>
jmp    114f <isstr+0x3f>
mov    $0x1,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @isstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %7
4: ; preds = %7
%5 = load i8, i8* %12
%6 = icmp eq i8 %5, 0
br i1 %6, label %13, label %7
7: ; preds = %1, %4
%8 = phi i8 [ %5, %4 ], [ %2, %1 ]
%9 = phi i8* [ %12, %4 ], [ %0, %1 ]
%10 = tail call i64 @isalpha(i8 signext %8)
%11 = icmp eq i64 %10, 0
%12 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %11, label %4, label %13
13: ; preds = %7, %4, %1
%14 = phi i32 [ 0, %1 ], [ 0, %4 ], [ 1, %7 ]
ret i32 %14
}
void svg_setcolor(int color) {}


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

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

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

LLVM IR (-O2):
define void @svg_setcolor(i32 %0) {
ret void
}
int ti_crossover_start(double const *options) {
  (void)options;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_crossover_start(double* nocapture readnone %0) {
ret i32 1
}