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

/* Variables and functions */
int /*<<< orphan*/ bubble_sort(int *, int);
int /*<<< orphan*/ print(int *, int);
int main() {
  int a[] = {1, 9, 7, 3, 2, 5, 6, 4, 0, 8};
  int n = sizeof(a) / sizeof(int);
  bubble_sort(a, n);
  print(a, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x28,%edx
call   1040 <memcpy@plt>
movl   $0xa,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1050 <bubble_sort@plt>
lea    -0x30(%rbp),%rdi
mov    -0x34(%rbp),%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    0xef4(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebc(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <bubble_sort@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1030 <print@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [10 x i32] [i32 1, i32 9, i32 7, i32 3, i32 2, i32 5, i32 6, i32 4, i32 0, i32 8]
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [10 x i32]* %2 to i8*
store i32 10, i32* %3
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @bubble_sort(i32* %5, i32 %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%9 = load i32, i32* %3
%10 = call i32 @print(i32* %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [10 x i32] [i32 1, i32 9, i32 7, i32 3, i32 2, i32 5, i32 6, i32 4, i32 0, i32 8]
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @bubble_sort(i32* %3, i32 10)
%5 = call i32 @print(i32* %3, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int nicintel_spi_i210_shutdown(void *data) {
  free(data);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @nicintel_spi_i210_shutdown(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ esempio_stampaElementi(int /*<<< orphan*/);
int main() {
  esempio_stampaElementi(0);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @esempio_stampaElementi(i32 0)
ret i32 0
}
/* Variables and functions */
char *strrchr(char const *, char);
char *removePath(const char *path) {
  char *filename = strrchr(path, '\\');
  if (filename == NULL)
    filename = path;
  else
    filename++;
  return filename;
}


x86 assembly (clang, -O0):
<removePath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x5c,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1146 <removePath+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1152 <removePath+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<removePath>:
push   %rbx
mov    %rdi,%rbx
mov    $0x5c,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @removePath(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 92)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Variables and functions */
char *dngettext(int /*<<< orphan*/, char const *, char const *, unsigned long);
char *ngettext(const char *msgid1, const char *msgid2, unsigned long int n) {
  return dngettext(0, msgid1, msgid2, n);
}


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

x86 assembly (clang, -O2):
<ngettext>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
xor    %edi,%edi
jmp    1030 <dngettext@plt>

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

LLVM IR (-O2):
define i8* @ngettext(i8* %0, i8* %1, i64 %2) {
%4 = tail call i8* @dngettext(i32 0, i8* %0, i8* %1, i64 %2)
ret i8* %4
}
int IsBigEndian() {
  union {
    unsigned char c[sizeof(int)];
    unsigned u;
  } x;
  x.u = 1;
  return x.c[0] == 0;
}


x86 assembly (clang, -O0):
<IsBigEndian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x8(%rbp)
movzbl -0x8(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @IsBigEndian() {
%1 = alloca %union.anon
%2 = bitcast %union.anon* %1 to i32*
store i32 1, i32* %2
%3 = bitcast %union.anon* %1 to [4 x i8]*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %4
%6 = zext i8 %5 to i32
%7 = icmp eq i32 %6, 0
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @IsBigEndian() {
ret i32 0
}
int test_imm_D3uint8_mem(unsigned char *val) {
  return ((*val) & (-0xD3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_D3uint8_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, -211
%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_D3uint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 45
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ a9(int);
void a8(int n) { a9(n); }


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

x86 assembly (clang, -O2):
<a8>:
jmp    1030 <a9@plt>

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

LLVM IR (-O2):
define void @a8(i32 %0) {
%2 = tail call i32 @a9(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void foo(int X) {
  if (X + 1 < 0)
    printf("success\n");
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x0,%eax
jge    1136 <foo+0x26>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
cmp    $0xfffffffe,%edi
jg     1121 <foo+0x11>
lea    0xee4(%rip),%rdi
jmp    1030 <puts@plt>
ret

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

LLVM IR (-O2):
@str = [8 x i8] c"success\00"
define void @foo(i32 %0) {
%2 = icmp slt i32 %0, -1
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %5
5: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int UINT64_C(int);
uint64_t ledger_oid_to_data_oid(uint64_t oid) {
  return ~(UINT64_C(1) << 59) & oid;
}


x86 assembly (clang, -O0):
<ledger_oid_to_data_oid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%edi
call   1030 <UINT64_C@plt>
mov    $0x3b,%ecx
shl    %cl,%eax
xor    $0xffffffff,%eax
and    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ledger_oid_to_data_oid>:
mov    $0x1,%edi
jmp    1030 <UINT64_C@plt>

LLVM IR (-O0):
define i32 @ledger_oid_to_data_oid(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @UINT64_C(i32 1)
%4 = shl i32 %3, 59
%5 = xor i32 %4, -1
%6 = load i32, i32* %2
%7 = and i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ledger_oid_to_data_oid(i32 %0) {
%2 = tail call i32 @UINT64_C(i32 1)
ret i32 poison
}
void __prussintc_set_hmr(volatile unsigned int *pruintc_io,
                         unsigned short channel, unsigned short host) {
  pruintc_io[(0x800 + (channel & ~(0x3))) >> 2] =
      pruintc_io[(0x800 + (channel & ~(0x3))) >> 2] |
      (((host)&0xF) << (((channel)&0x3) << 3));
}


x86 assembly (clang, -O0):
<__prussintc_set_hmr>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %si,%cx
mov    %rdi,-0x8(%rbp)
mov    %cx,-0xa(%rbp)
mov    %ax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movzwl -0xa(%rbp),%ecx
and    $0xfffffffc,%ecx
add    $0x800,%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%edx
movzwl -0xc(%rbp),%eax
and    $0xf,%eax
movzwl -0xa(%rbp),%ecx
and    $0x3,%ecx
shl    $0x3,%ecx
shl    %cl,%eax
or     %eax,%edx
mov    -0x8(%rbp),%rax
movzwl -0xa(%rbp),%ecx
and    $0xfffffffc,%ecx
add    $0x800,%ecx
sar    $0x2,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
pop    %rbp
ret

x86 assembly (clang, -O2):
<__prussintc_set_hmr>:
lea    0x0(,%rsi,8),%ecx
and    $0xf,%edx
shl    %cl,%edx
and    $0xfffffffc,%esi
or     %edx,0x800(%rsi,%rdi,1)
ret

LLVM IR (-O0):
define void @__prussintc_set_hmr(i32* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = alloca i32*
%5 = alloca i16
%6 = alloca i16
store i32* %0, i32** %4
store i16 %1, i16* %5
store i16 %2, i16* %6
%7 = load i32*, i32** %4
%8 = load i16, i16* %5
%9 = zext i16 %8 to i32
%10 = and i32 %9, -4
%11 = add nsw i32 2048, %10
%12 = ashr i32 %11, 2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %7, i64 %13
%15 = load volatile i32, i32* %14
%16 = load i16, i16* %6
%17 = zext i16 %16 to i32
%18 = and i32 %17, 15
%19 = load i16, i16* %5
%20 = zext i16 %19 to i32
%21 = and i32 %20, 3
%22 = shl i32 %21, 3
%23 = shl i32 %18, %22
%24 = or i32 %15, %23
%25 = load i32*, i32** %4
%26 = load i16, i16* %5
%27 = zext i16 %26 to i32
%28 = and i32 %27, -4
%29 = add nsw i32 2048, %28
%30 = ashr i32 %29, 2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %25, i64 %31
store volatile i32 %24, i32* %32
ret void
}

LLVM IR (-O2):
define void @__prussintc_set_hmr(i32* %0, i16 zeroext %1, i16 zeroext %2) {
%4 = zext i16 %1 to i32
%5 = and i32 %4, 65532
%6 = add nuw nsw i32 %5, 2048
%7 = lshr exact i32 %6, 2
%8 = zext i32 %7 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load volatile i32, i32* %9
%11 = and i16 %2, 15
%12 = zext i16 %11 to i32
%13 = shl nuw nsw i32 %4, 3
%14 = and i32 %13, 24
%15 = shl nuw nsw i32 %12, %14
%16 = or i32 %10, %15
store volatile i32 %16, i32* %9
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int massert(int b, char *s) {
  if (!b) {
    printf("ASSERTION FAILURE: %s\n", s);
    if (0) {
      exit(1);
    }
  }
}


x86 assembly (clang, -O0):
<massert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1139 <massert+0x29>
mov    -0x10(%rbp),%rsi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<massert>:
test   %edi,%edi
je     1115 <massert+0x5>
ret
push   %rax
lea    0xee3(%rip),%rdi
call   1030 <printf@plt>
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [23 x i8] c"ASSERTION FAILURE: %s\0A\00"
define i32 @massert(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
@.str = [23 x i8] c"ASSERTION FAILURE: %s\0A\00"
define i32 @massert(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %6
6: ; preds = %4, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ tapNibbleHex(unsigned char);
void tapByteHex(unsigned char v) {
  tapNibbleHex(v >> 4);
  tapNibbleHex(v & 0xf);
}


x86 assembly (clang, -O0):
<tapByteHex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
sar    $0x4,%eax
movzbl %al,%edi
call   1030 <tapNibbleHex@plt>
movzbl -0x1(%rbp),%eax
and    $0xf,%eax
movzbl %al,%edi
call   1030 <tapNibbleHex@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tapByteHex>:
push   %rbx
mov    %edi,%ebx
mov    %ebx,%eax
shr    $0x4,%al
movzbl %al,%edi
call   1030 <tapNibbleHex@plt>
and    $0xf,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <tapNibbleHex@plt>

LLVM IR (-O0):
define void @tapByteHex(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = zext i8 %3 to i32
%5 = ashr i32 %4, 4
%6 = trunc i32 %5 to i8
%7 = call i32 @tapNibbleHex(i8 zeroext %6)
%8 = load i8, i8* %2
%9 = zext i8 %8 to i32
%10 = and i32 %9, 15
%11 = trunc i32 %10 to i8
%12 = call i32 @tapNibbleHex(i8 zeroext %11)
ret void
}

LLVM IR (-O2):
define void @tapByteHex(i8 zeroext %0) {
%2 = lshr i8 %0, 4
%3 = tail call i32 @tapNibbleHex(i8 zeroext %2)
%4 = and i8 %0, 15
%5 = tail call i32 @tapNibbleHex(i8 zeroext %4)
ret void
}
int test_imm_BEint8_reg(signed char val) {
  return ((val) & (-0xBE << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_BEint8_reg>:
test   $0xffffff42,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BEint8_reg(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = and i32 %2, -190
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
void version() {
  printf("cguess-%s\n", "unknown");
  exit(0);
}


x86 assembly (clang, -O0):
<version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
lea    0xed9(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<version>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"cguess-%s\0A\00"
@.str.1 = [8 x i8] c"unknown\00"
define void @version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [11 x i8] c"cguess-%s\0A\00"
@.str.1 = [8 x i8] c"unknown\00"
define void @version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int test_imm_FEuint16_reg(unsigned short val) {
  return ((val) & (0xFE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_FEuint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xfe,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_FEuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 254
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getLine(char *, int);
int /*<<< orphan*/ parseInput(char *);
int /*<<< orphan*/ printf(char *);
int main() {
  char sentence[80];
  printf("Please enter the conversion you would like to make\n");
  printf(" ( Example - 'Convert 20 miles to kilometres' )\n> ");
  getLine(sentence, 80);
  parseInput(sentence);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xee2(%rip),%rdi
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x50,%esi
call   1050 <getLine@plt>
lea    -0x60(%rbp),%rdi
call   1040 <parseInput@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
lea    0xea8(%rip),%rdi
call   1040 <printf@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x50,%esi
call   1060 <getLine@plt>
mov    %rbx,%rdi
call   1050 <parseInput@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"Please enter the conversion you would like to make\0A\00"
@.str.1 = [51 x i8] c" ( Example - 'Convert 20 miles to kilometres' )\0A> \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%6 = call i32 @getLine(i8* %5, i32 80)
%7 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%8 = call i32 @parseInput(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [51 x i8] c" ( Example - 'Convert 20 miles to kilometres' )\0A> \00"
@str = [51 x i8] c"Please enter the conversion you would like to make\00"
define i32 @main() {
%1 = alloca [80 x i8]
%2 = getelementptr inbounds [80 x i8], [80 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @getLine(i8* %2, i32 80)
%6 = call i32 @parseInput(i8* %2)
ret i32 0
}
void exchange(int *first, int *second) {
  int tmp;
  tmp = *first;
  *first = *second;
  *second = tmp;
}


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

x86 assembly (clang, -O2):
<exchange>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
mov    %ecx,(%rdi)
mov    %eax,(%rsi)
ret

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

LLVM IR (-O2):
define void @exchange(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = load i32, i32* %1
store i32 %4, i32* %0
store i32 %3, i32* %1
ret void
}
void foo734(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo734(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_key(char *key, int nkey) {
  for (int i = 0; i < nkey; i++) {
    printf("%x", *((char *)&key[i]));
  }
}


x86 assembly (clang, -O0):
<print_key>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <print_key+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xebf(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_key+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_key>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <print_key+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_key+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%x\00"
define void @print_key(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
%10 = load i8, i8* %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Variables and functions */
size_t hash(const char *word) {
  size_t x;
  for (x = 0; *word; ++word)
    x = (x + (x << 5)) ^ *word;
  return x;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114c <hash+0x4c>
mov    -0x10(%rbp),%rax
mov    -0x10(%rbp),%rcx
shl    $0x5,%rcx
add    %rcx,%rax
mov    -0x8(%rbp),%rcx
movsbq (%rcx),%rcx
xor    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <hash+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     112d <hash+0x2d>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %rax,%rdx
shl    $0x5,%rdx
add    %rax,%rdx
movsbq %cl,%rax
xor    %rdx,%rax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i64 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul i64 %6, 33
%9 = sext i8 %5 to i64
%10 = xor i64 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i64 [ 0, %1 ], [ %10, %4 ]
ret i64 %15
}
int __attribute__((no, noclone)) foo(void *p) { return *(int *)p; }


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

x86 assembly (clang, -O2):
<foo>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @foo(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void vInitModul2(void) { printf("\n Init Modul2"); }


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"\0A Init Modul2\00"
define void @vInitModul2() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void write_double(double d) { printf("%f\n", d); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define void @write_double(double %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %0)
ret void
}
/* Type definitions */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int inorder(struct TreeNode *, int *, int);
int kthSmallest(struct TreeNode *root, int k) {
  int count = 0;
  return inorder(root, &count, k);
}


x86 assembly (clang, -O0):
<kthSmallest>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    -0x10(%rbp),%rsi
call   1030 <inorder@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kthSmallest>:
push   %rax
mov    %esi,%edx
movl   $0x0,0x4(%rsp)
lea    0x4(%rsp),%rsi
call   1030 <inorder@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @kthSmallest(%struct.TreeNode* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%5 = call i32 @inorder(%struct.TreeNode* %0, i32* %3, i32 %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ putchar(float);
int /*<<< orphan*/ puts(char *);
void linemod(char *s) {
  putchar('f');
  puts(s);
}


x86 assembly (clang, -O0):
<linemod>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movss  0xecc(%rip),%xmm0
call   1030 <putchar@plt>
mov    -0x8(%rbp),%rdi
call   1040 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<linemod>:
push   %rbx
mov    %rdi,%rbx
movss  0xed4(%rip),%xmm0
call   1030 <putchar@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <puts@plt>

LLVM IR (-O0):
define void @linemod(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @putchar(float 1.020000e+02)
%4 = load i8*, i8** %2
%5 = call i32 @puts(i8* %4)
ret void
}

LLVM IR (-O2):
define void @linemod(i8* nocapture %0) {
%2 = tail call i32 @putchar(float 1.020000e+02)
%3 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Type definitions */
typedef int uint64_t;
struct timespec {
  int tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
uint64_t ns_time() {
  struct timespec ts;
  clock_gettime(CLOCK_MONOTONIC, &ts);
  return (1000000000 * (uint64_t)ts.tv_sec + ts.tv_nsec);
}


x86 assembly (clang, -O0):
<ns_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    -0x8(%rbp),%rax
imul   $0x3b9aca00,%eax,%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns_time>:
sub    $0x18,%rsp
mov    0x2ecd(%rip),%rax
mov    (%rax),%edi
lea    0x8(%rsp),%rsi
call   1030 <clock_gettime@plt>
imul   $0x3b9aca00,0x10(%rsp),%eax
3b
add    0x8(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define i32 @ns_time() {
%1 = alloca %struct.timespec
%2 = load i32, i32* @CLOCK_MONOTONIC
%3 = call i32 @clock_gettime(i32 %2, %struct.timespec* %1)
%4 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = mul nsw i32 1000000000, %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%9 = load i32, i32* %8
%10 = add nsw i32 %7, %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timespec = type { i32, i64 }
@CLOCK_MONOTONIC = global i32 0
define i32 @ns_time() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_MONOTONIC
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%6 = load i64, i64* %5
%7 = trunc i64 %6 to i32
%8 = mul nsw i32 %7, 1000000000
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%10 = load i32, i32* %9
%11 = add nsw i32 %8, %10
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void *runner2(void *args) {
  int *a = (int *)args;
  int i, sum = 0;
  for (i = 1; i < *a; i += 2) {
    sum += i;
  }
  printf("Odd Sum: %d\n", sum);
}


x86 assembly (clang, -O0):
<runner2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%rcx
cmp    (%rcx),%eax
jge    1158 <runner2+0x48>
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x1c(%rbp)
jmp    1132 <runner2+0x22>
mov    -0x20(%rbp),%esi
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runner2>:
mov    (%rdi),%eax
xor    %esi,%esi
cmp    $0x2,%eax
jl     1130 <runner2+0x20>
add    $0xfffffffe,%eax
shr    %eax
lea    (%rax,%rax,2),%ecx
lea    -0x1(%rax),%edx
imul   %eax,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rcx,1),%esi
add    $0x1,%esi
lea    0xec9(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"Odd Sum: %d\0A\00"
define noalias i8* @runner2(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = icmp sgt i32 %3, 1
br i1 %4, label %5, label %15
5: ; preds = %1
%6 = add nsw i32 %3, -2
%7 = lshr i32 %6, 1
%8 = mul nuw i32 %7, 3
%9 = lshr i32 %6, 1
%10 = add nsw i32 %7, -1
%11 = mul i32 %9, %10
%12 = and i32 %11, -2
%13 = add i32 %8, %12
%14 = add i32 %13, 1
br label %15
15: ; preds = %5, %1
%16 = phi i32 [ 0, %1 ], [ %14, %5 ]
%17 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i8* undef
}
/* Variables and functions */
void *malloc(size_t);
void *mem_try_alloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<mem_try_alloc>:
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @mem_try_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
long getHash(long l, long r, long logHashTableSize) {
  long i = logHashTableSize / 2;
  return ((314159257 * l + 271828171 * r) & ((1 << (16 + i)) - 1)) >>
         ((16 + i) - logHashTableSize);
}


x86 assembly (clang, -O0):
<getHash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    $0x2,%ecx
cqto
idiv   %rcx
mov    %rax,-0x20(%rbp)
imul   $0x12b9b099,-0x8(%rbp),%rax
12
imul   $0x1033c4cb,-0x10(%rbp),%rcx
10
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
add    $0x10,%rcx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
mov    -0x20(%rbp),%rcx
add    $0x10,%rcx
sub    -0x18(%rbp),%rcx
sar    %cl,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getHash>:
mov    %rdx,%rcx
shr    $0x3f,%rcx
add    %rdx,%rcx
sar    %rcx
imul   $0x12b9b099,%rdi,%rax
imul   $0x1033c4cb,%rsi,%rsi
add    $0x10,%rcx
mov    $0xffffffff,%edi
shl    %cl,%edi
add    %rax,%rsi
not    %edi
movslq %edi,%rax
and    %rsi,%rax
sub    %edx,%ecx
sar    %cl,%rax
ret

LLVM IR (-O0):
define i64 @getHash(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64, i64* %6
%9 = sdiv i64 %8, 2
store i64 %9, i64* %7
%10 = load i64, i64* %4
%11 = mul nsw i64 314159257, %10
%12 = load i64, i64* %5
%13 = mul nsw i64 271828171, %12
%14 = add nsw i64 %11, %13
%15 = load i64, i64* %7
%16 = add nsw i64 16, %15
%17 = trunc i64 %16 to i32
%18 = shl i32 1, %17
%19 = sub nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = and i64 %14, %20
%22 = load i64, i64* %7
%23 = add nsw i64 16, %22
%24 = load i64, i64* %6
%25 = sub nsw i64 %23, %24
%26 = ashr i64 %21, %25
ret i64 %26
}

LLVM IR (-O2):
define i64 @getHash(i64 %0, i64 %1, i64 %2) {
%4 = sdiv i64 %2, 2
%5 = mul nsw i64 %0, 314159257
%6 = mul nsw i64 %1, 271828171
%7 = add nsw i64 %6, %5
%8 = add nsw i64 %4, 16
%9 = trunc i64 %8 to i32
%10 = shl nsw i32 -1, %9
%11 = xor i32 %10, -1
%12 = sext i32 %11 to i64
%13 = and i64 %7, %12
%14 = sub nsw i64 %8, %2
%15 = ashr i64 %13, %14
ret i64 %15
}
/* Variables and functions */
int strlen(char *);
void chomp_string(char *str) {
  int last_index = strlen(str) - 1;
  if (str[last_index] == '\n') {
    str[last_index] = '\0';
  }
}


x86 assembly (clang, -O0):
<chomp_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    114c <chomp_string+0x3c>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<chomp_string>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%rbx,1)
jne    1127 <chomp_string+0x17>
movb   $0x0,-0x1(%rbx,%rax,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @chomp_string(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, -1
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 10
br i1 %7, label %8, label %9
8: ; preds = %1
store i8 0, i8* %5
br label %9
9: ; preds = %8, %1
ret void
}
/* Type definitions */
struct mloop_async {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct mloop_async *);
int /*<<< orphan*/ mloop__free_context(struct mloop_async *);
__attribute__((visibility("default"))) void
mloop_async_free(struct mloop_async *self) {
  mloop__free_context(self);
  free(self);
}


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

x86 assembly (clang, -O2):
<mloop_async_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <mloop__free_context@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.mloop_async = type { i32 }
define void @mloop_async_free(%struct.mloop_async* %0) {
%2 = alloca %struct.mloop_async*
store %struct.mloop_async* %0, %struct.mloop_async** %2
%3 = load %struct.mloop_async*, %struct.mloop_async** %2
%4 = call i32 @mloop__free_context(%struct.mloop_async* %3)
%5 = load %struct.mloop_async*, %struct.mloop_async** %2
%6 = call i32 @free(%struct.mloop_async* %5)
ret void
}

LLVM IR (-O2):
%struct.mloop_async = type { i32 }
define void @mloop_async_free(%struct.mloop_async* %0) {
%2 = tail call i32 @mloop__free_context(%struct.mloop_async* %0)
%3 = tail call i32 @free(%struct.mloop_async* %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void show_bool(FILE *fp, const bool c) {
  fprintf(fp, (c == true) ? "true" : "false");
}


x86 assembly (clang, -O0):
<show_bool>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xed8(%rip),%rsi
lea    0xecc(%rip),%rax
cmp    $0x1,%ecx
cmove  %rax,%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_bool>:
cmp    $0x1,%esi
lea    0xee6(%rip),%rax
lea    0xee4(%rip),%rsi
cmove  %rax,%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define void @show_bool(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i64
%9 = select i1 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%10 = call i32 @fprintf(i32* %5, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"true\00"
@.str.1 = [6 x i8] c"false\00"
define void @show_bool(i32* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 1
%4 = select i1 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @fprintf(i32* %0, i8* %4)
ret void
}
int fun693() { return 693; }


x86 assembly (clang, -O0):
<fun693>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2b5,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @fun693() {
ret i32 693
}

LLVM IR (-O2):
define i32 @fun693() {
ret i32 693
}
/* Variables and functions */
int EXIT_SUCCESS;
int Index(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("%d\n", Index("aaaaacefghij", "aaac"));
  return EXIT_SUCCESS;
}


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)
lea    0xec7(%rip),%rdi
lea    0xecd(%rip),%rsi
call   1030 <Index@plt>
mov    %eax,%esi
lea    0xeae(%rip),%rdi
call   1040 <printf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0xee2(%rip),%rsi
call   1030 <Index@plt>
lea    0xec5(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [13 x i8] c"aaaaacefghij\00"
@.str.2 = [5 x i8] c"aaac\00"
@EXIT_SUCCESS = global i32 0
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 @Index(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [13 x i8] c"aaaaacefghij\00"
@.str.2 = [5 x i8] c"aaac\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @Index(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}
int disp_release(struct inode *inode, struct file *file) { return 0; }


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.file = type opaque
define i32 @disp_release(%struct.inode* %0, %struct.file* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.file*
store %struct.inode* %0, %struct.inode** %3
store %struct.file* %1, %struct.file** %4
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.file = type opaque
define i32 @disp_release(%struct.inode* nocapture readnone %0, %struct.file* nocapture readnone %1) {
ret i32 0
}
void startCapturing2LPAR() {}


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

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

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

LLVM IR (-O2):
define void @startCapturing2LPAR() {
ret void
}
int main() {
  int r, h, s;
  s = 2 * 3 * r * (h + r);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
imul   $0x6,-0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    -0x4(%rbp),%ecx
imul   %ecx,%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = load i32, i32* %1
%5 = mul nsw i32 6, %4
%6 = load i32, i32* %2
%7 = load i32, i32* %1
%8 = add nsw i32 %6, %7
%9 = mul nsw i32 %5, %8
store i32 %9, i32* %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}