xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(void *);
int main(void) {
  free((void *)42);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @free(i8* inttoptr (i64 42 to i8*))
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @free(i8* inttoptr (i64 42 to i8*))
ret i32 0
}
void driv(void) { 1 ? 1 : driv(); }


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

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

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

LLVM IR (-O2):
define void @driv() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_list_empty();
int /*<<< orphan*/ test_list_free_func();
int /*<<< orphan*/ test_list_op();
int /*<<< orphan*/ test_list_op_no_meta();
int /*<<< orphan*/ test_queue();
int /*<<< orphan*/ test_stack();
int main() {
  test_list_empty();
  test_list_free_func();
  test_list_op();
  test_list_op_no_meta();
  test_stack();
  test_queue();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1080 <test_list_empty@plt>
mov    $0x0,%al
call   1040 <test_list_free_func@plt>
mov    $0x0,%al
call   1070 <test_list_op@plt>
mov    $0x0,%al
call   1030 <test_list_op_no_meta@plt>
mov    $0x0,%al
call   1060 <test_stack@plt>
mov    $0x0,%al
call   1050 <test_queue@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1080 <test_list_empty@plt>
xor    %eax,%eax
call   1040 <test_list_free_func@plt>
xor    %eax,%eax
call   1070 <test_list_op@plt>
xor    %eax,%eax
call   1030 <test_list_op_no_meta@plt>
xor    %eax,%eax
call   1060 <test_stack@plt>
xor    %eax,%eax
call   1050 <test_queue@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_list_empty()
%3 = call i32 (...) @test_list_free_func()
%4 = call i32 (...) @test_list_op()
%5 = call i32 (...) @test_list_op_no_meta()
%6 = call i32 (...) @test_stack()
%7 = call i32 (...) @test_queue()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_list_empty()
%2 = tail call i32 (...) @test_list_free_func()
%3 = tail call i32 (...) @test_list_op()
%4 = tail call i32 (...) @test_list_op_no_meta()
%5 = tail call i32 (...) @test_stack()
%6 = tail call i32 (...) @test_queue()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ XKeymapEvent;

/* Variables and functions */
int /*<<< orphan*/ abort();
scalar_t__ malloc(int);
void *alloc_XKeymapEvent(void) {
  XKeymapEvent *_p = (XKeymapEvent *)malloc(sizeof(XKeymapEvent));
  if (_p == NULL)
    abort();
  return (void *)_p;
}


x86 assembly (clang, -O0):
<alloc_XKeymapEvent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1148 <alloc_XKeymapEvent+0x28>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alloc_XKeymapEvent>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1132 <alloc_XKeymapEvent+0x12>
pop    %rcx
ret
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i8* @alloc_XKeymapEvent() {
%1 = tail call i64 @malloc(i32 4)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = inttoptr i64 %1 to i8*
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdout;
void helpAndExit(const char *progname, int status) {
  FILE *stream = stderr;
  if (status == EXIT_SUCCESS)
    stream = stdout;
  fprintf(stream, "Usage: %s [file]\n", progname);
  exit(status);
}


x86 assembly (clang, -O0):
<helpAndExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%eax
jne    115d <helpAndExit+0x3d>
mov    0x2e82(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xc(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<helpAndExit>:
push   %rbx
mov    %esi,%ebx
mov    %rdi,%rdx
mov    0x2ea3(%rip),%rax
cmp    %esi,(%rax)
jne    113a <helpAndExit+0x1a>
mov    0x2ea0(%rip),%rax
jmp    1141 <helpAndExit+0x21>
mov    0x2e9f(%rip),%rax
mov    (%rax),%rdi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [18 x i8] c"Usage: %s [file]\0A\00"
define void @helpAndExit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32*, i32** @stderr
store i32* %6, i32** %5
%7 = load i32, i32* %4
%8 = load i32, i32* @EXIT_SUCCESS
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i32*, i32** @stdout
store i32* %11, i32** %5
br label %12
12: ; preds = %10, %2
%13 = load i32*, i32** %5
%14 = load i8*, i8** %3
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %14)
%16 = load i32, i32* %4
%17 = call i32 @exit(i32 %16)
unreachable
}

LLVM IR (-O2):
@stderr = global i32* null
@EXIT_SUCCESS = global i32 0
@stdout = global i32* null
@.str = [18 x i8] c"Usage: %s [file]\0A\00"
define void @helpAndExit(i8* %0, i32 %1) {
%3 = load i32, i32* @EXIT_SUCCESS
%4 = icmp eq i32 %3, %1
%5 = load i32*, i32** @stdout
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %5, i32* %6
%8 = tail call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %0)
%9 = tail call i32 @exit(i32 %1)
unreachable
}
/* Variables and functions */
int BMK_GetMilliStart();
int BMK_GetMilliSpan(int nTimeStart) {
  int nSpan = BMK_GetMilliStart() - nTimeStart;
  if (nSpan < 0)
    nSpan += 0x100000 * 1000;
  return nSpan;
}


x86 assembly (clang, -O0):
<BMK_GetMilliSpan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <BMK_GetMilliStart@plt>
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    113d <BMK_GetMilliSpan+0x2d>
mov    -0x8(%rbp),%eax
add    $0x3e800000,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BMK_GetMilliSpan>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <BMK_GetMilliStart@plt>
sub    %ebx,%eax
lea    0x3e800000(%rax),%ecx
test   %eax,%eax
cmovs  %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @BMK_GetMilliSpan(i32 %0) {
%2 = tail call i32 (...) @BMK_GetMilliStart()
%3 = sub nsw i32 %2, %0
%4 = icmp slt i32 %3, 0
%5 = add nsw i32 %3, 1048576000
%6 = select i1 %4, i32 %5, i32 %3
ret i32 %6
}
_Bool isOdd(int n) { return n % 2; }


x86 assembly (clang, -O0):
<isOdd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isOdd>:
mov    %edi,%eax
and    $0x1,%al
ret

LLVM IR (-O0):
define zeroext i1 @isOdd(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = srem i32 %3, 2
%5 = icmp ne i32 %4, 0
ret i1 %5
}

LLVM IR (-O2):
define zeroext i1 @isOdd(i32 %0) {
%2 = and i32 %0, 1
%3 = icmp ne i32 %2, 0
ret i1 %3
}
void pmp_master_write(unsigned value) {
  while (*(volatile unsigned *)(0xBF800000 + (0x7010)) & 0x8000)
    ;
  *(volatile unsigned *)(0xBF800000 + (0x7040)) = value;
}


x86 assembly (clang, -O0):
<pmp_master_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    $0xbf807010,%eax
mov    (%rax),%eax
and    $0x8000,%eax
cmp    $0x0,%eax
je     1121 <pmp_master_write+0x21>
jmp    1107 <pmp_master_write+0x7>
mov    -0x4(%rbp),%ecx
mov    $0xbf807040,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmp_master_write>:
mov    $0xbf807010,%eax
cs nopw 0x0(%rax,%rax,1)
nop
testl  $0x8000,(%rax)
jne    1110 <pmp_master_write+0x10>
mov    %edi,0x30(%rax)
ret

LLVM IR (-O0):
define void @pmp_master_write(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%5 = and i32 %4, 32768
%6 = icmp ne i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %3
br label %3
8: ; preds = %3
%9 = load i32, i32* %2
store volatile i32 %9, i32* inttoptr (i64 3212865600 to i32*)
ret void
}

LLVM IR (-O2):
define void @pmp_master_write(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 3212865552 to i32*)
%4 = and i32 %3, 32768
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %2
6: ; preds = %2
store volatile i32 %0, i32* inttoptr (i64 3212865600 to i32*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SYS_execve;
int syscall(int /*<<< orphan*/, char const *, char *const *, char *const *);
int execve(const char *filename, char *const argv[], char *const envp[]) {
  return syscall(SYS_execve, filename, argv, envp);
}


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

x86 assembly (clang, -O2):
<execve>:
mov    %rdx,%rcx
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
@SYS_execve = global i32 0
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = load i32, i32* @SYS_execve
%5 = tail call i32 @syscall(i32 %4, i8* %0, i8** %1, i8** %2)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ ftell(int /*<<< orphan*/ *);
void uninit_ftell(void) {
  FILE *fp;
  (void)ftell(fp);
}


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

x86 assembly (clang, -O2):
<uninit_ftell>:
jmp    1030 <ftell@plt>

LLVM IR (-O0):
define void @uninit_ftell() {
%1 = alloca i32*
%2 = load i32*, i32** %1
%3 = call i32 @ftell(i32* %2)
ret void
}

LLVM IR (-O2):
define void @uninit_ftell() {
%1 = tail call i32 @ftell(i32* undef)
ret void
}
int ed_is_big(void) {
  long one = 1;
  return !(*((char *)(&one)));
}


x86 assembly (clang, -O0):
<ed_is_big>:
push   %rbp
mov    %rsp,%rbp
movq   $0x1,-0x8(%rbp)
cmpb   $0x0,-0x8(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @ed_is_big() {
%1 = alloca i64
store i64 1, i64* %1
%2 = bitcast i64* %1 to i8*
%3 = load i8, i8* %2
%4 = icmp ne i8 %3, 0
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ed_is_big() {
ret i32 0
}
int __attribute__((no)) mystrcmp(char *a, char *b) {
  for (int n = 0;; n++) {
    if (a[n] != b[n])
      return 0;
    if (a[n] == 0)
      return 1;
  }
}


x86 assembly (clang, -O0):
<mystrcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
mov    -0x18(%rbp),%rcx
movslq -0x1c(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
je     113f <mystrcmp+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1173 <mystrcmp+0x73>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1160 <mystrcmp+0x60>
movl   $0x1,-0x4(%rbp)
jmp    1173 <mystrcmp+0x73>
jmp    1165 <mystrcmp+0x65>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1113 <mystrcmp+0x13>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mystrcmp>:
mov    (%rdi),%cl
xor    %eax,%eax
cmp    (%rsi),%cl
jne    1124 <mystrcmp+0x24>
mov    $0x1,%edx
nopl   (%rax)
test   %cl,%cl
je     1125 <mystrcmp+0x25>
movzbl (%rdi,%rdx,1),%ecx
lea    0x1(%rdx),%r8
cmp    (%rsi,%rdx,1),%cl
mov    %r8,%rdx
je     1110 <mystrcmp+0x10>
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @mystrcmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp eq i8 %3, %4
br i1 %5, label %12, label %17
6: ; preds = %12
%7 = getelementptr inbounds i8, i8* %0, i64 %16
%8 = load i8, i8* %7
%9 = getelementptr inbounds i8, i8* %1, i64 %16
%10 = load i8, i8* %9
%11 = icmp eq i8 %8, %10
br i1 %11, label %12, label %17
12: ; preds = %2, %6
%13 = phi i64 [ %16, %6 ], [ 0, %2 ]
%14 = phi i8 [ %8, %6 ], [ %3, %2 ]
%15 = icmp eq i8 %14, 0
%16 = add nuw i64 %13, 1
br i1 %15, label %17, label %6
17: ; preds = %6, %12, %2
%18 = phi i32 [ 0, %2 ], [ 1, %12 ], [ 0, %6 ]
ret i32 %18
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ usleep(unsigned int);
void umorse_print_dit(void *args, uint8_t flags) {
  (void)args;
  printf(".");
  if (!(flags & (0x80))) {
    usleep((60U) * 1000U);
  }
}


x86 assembly (clang, -O0):
<umorse_print_dit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
jne    1156 <umorse_print_dit+0x36>
mov    $0xea60,%edi
call   1040 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umorse_print_dit>:
push   %rbx
mov    %esi,%ebx
mov    $0x2e,%edi
call   1030 <putchar@plt>
test   $0x80,%bl
jne    113d <umorse_print_dit+0x1d>
mov    $0xea60,%edi
pop    %rbx
jmp    1040 <usleep@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [2 x i8] c".\00"
define void @umorse_print_dit(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 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = and i32 %7, 128
%9 = icmp ne i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = call i32 @usleep(i32 60000)
br label %12
12: ; preds = %10, %2
ret void
}

LLVM IR (-O2):
define void @umorse_print_dit(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @putchar(i32 46)
%4 = and i32 %1, 128
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @usleep(i32 60000)
br label %8
8: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "Usage: erathostenes [OPTIONS] [LIMIT]\n\n"
                  "Options:\n"
                  "      -?         Display this message.\n"
                  "      -b SIZE    Block size.\n"
                  "      -v         Verbose output.\n"
                  "      -s         No output.\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [178 x i8] c"Usage: erathostenes [OPTIONS] [LIMIT]\0A\0AOptions:\0A -? Display this message.\0A -b SIZE Block size.\0A -v Verbose output.\0A -s No output.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [178 x i8] c"Usage: erathostenes [OPTIONS] [LIMIT]\0A\0AOptions:\0A -? Display this message.\0A -b SIZE Block size.\0A -v Verbose output.\0A -s No output.\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_string(void const *a, void const *b) {
  return strcmp((char *)a, (char *)b);
}


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

x86 assembly (clang, -O2):
<compare_string>:
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compare_string(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void default_event(struct devicelock *s) {}


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

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

LLVM IR (-O0):
%struct.devicelock = type opaque
define void @default_event(%struct.devicelock* %0) {
%2 = alloca %struct.devicelock*
store %struct.devicelock* %0, %struct.devicelock** %2
ret void
}

LLVM IR (-O2):
%struct.devicelock = type opaque
define void @default_event(%struct.devicelock* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
long pathconf(const char *path, int name) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<pathconf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ed6(%rip),%rax
mov    (%rax),%ecx
mov    0x2ebd(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffffffffffff,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathconf>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffffffffffff,%rax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i64 @pathconf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @ENOSYS
store i32 %5, i32* @errno
ret i64 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i64 @pathconf(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @ENOSYS
store i32 %3, i32* @errno
ret i64 -1
}
/* Variables and functions */
int /*<<< orphan*/ primelister(unsigned int);
int /*<<< orphan*/ puts(char *);
unsigned int strtoul(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  if (2 != argc) {
    puts("one argument with number of primes to find.");
  }
  unsigned int primes = strtoul(argv[1], NULL, 10);
  (void)primelister(primes);
  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)
mov    $0x2,%eax
cmp    -0x8(%rbp),%eax
je     1160 <main+0x30>
lea    0xea5(%rip),%rdi
call   1040 <puts@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <primelister@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
je     1145 <main+0x15>
lea    0xec0(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtoul@plt>
mov    %eax,%edi
call   1030 <primelister@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"one argument with number of primes to find.\00"
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
%7 = load i32, i32* %4
%8 = icmp ne i32 2, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @puts(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 1
%14 = load i8*, i8** %13
%15 = call i32 @strtoul(i8* %14, i32* null, i32 10)
store i32 %15, i32* %6
%16 = load i32, i32* %6
%17 = call i32 @primelister(i32 %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [44 x i8] c"one argument with number of primes to find.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @strtoul(i8* nocapture %8, i32* null, i32 10)
%10 = tail call i32 @primelister(i32 %9)
ret i32 0
}
double sample_variance(double s, double x, double n) {
  return (n * s - (x * x)) / (n * (n - 1.0));
}


x86 assembly (clang, -O0):
<sample_variance>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xea8(%rip),%xmm3
subsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_variance>:
mulsd  %xmm1,%xmm1
mulsd  %xmm2,%xmm0
subsd  %xmm1,%xmm0
movsd  0xeec(%rip),%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @sample_variance(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %6
%8 = load double, double* %4
%9 = load double, double* %5
%10 = load double, double* %5
%11 = fmul double %9, %10
%12 = fneg double %11
%13 = call double @llvm.fmuladd.f64(double %7, double %8, double %12)
%14 = load double, double* %6
%15 = load double, double* %6
%16 = fsub double %15, 1.000000e+00
%17 = fmul double %14, %16
%18 = fdiv double %13, %17
ret double %18
}

LLVM IR (-O2):
define double @sample_variance(double %0, double %1, double %2) {
%4 = fneg double %1
%5 = fmul double %4, %1
%6 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %5)
%7 = fadd double %2, -1.000000e+00
%8 = fmul double %7, %2
%9 = fdiv double %6, %8
ret double %9
}
void print_integer(value) int value;
{
  if (value < 0) {
    print_char('-');
    value = ~value + 1;
  }
  if (value / 10 != 0)
    print_integer(value / 10);
  print_char('0' + value % 10);
}


x86 assembly (clang, -O0):
<print_integer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114d <print_integer+0x2d>
mov    $0x2d,%edi
mov    $0x0,%al
call   1040 <print_char@plt>
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
cmp    $0x0,%eax
je     1173 <print_integer+0x53>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <print_integer@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,%edi
add    $0x30,%edi
mov    $0x0,%al
call   1040 <print_char@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_integer>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
test   %edi,%edi
jns    1138 <print_integer+0x18>
mov    $0x2d,%edi
xor    %eax,%eax
call   1040 <print_char@plt>
neg    %ebx
movslq %ebx,%r14
cmp    $0xa,%ebx
jb     1159 <print_integer+0x39>
imul   $0x66666667,%r14,%rdi
mov    %rdi,%rax
shr    $0x3f,%rax
sar    $0x22,%rdi
add    %eax,%edi
call   1030 <print_integer@plt>
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
neg    %eax
lea    (%r14,%rax,1),%edi
add    $0x30,%edi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <print_char@plt>

LLVM IR (-O0):
define void @print_integer(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = call i32 (i32, ...) bitcast (i32 (...)* @print_char to i32 (i32, ...)*)(i32 45)
%7 = load i32, i32* %2
%8 = xor i32 %7, -1
%9 = add nsw i32 %8, 1
store i32 %9, i32* %2
br label %10
10: ; preds = %5, %1
%11 = load i32, i32* %2
%12 = sdiv i32 %11, 10
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %10
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 10
br label %17
17: ; preds = %14, %10
%18 = load i32, i32* %2
%19 = srem i32 %18, 10
%20 = add nsw i32 48, %19
%21 = call i32 (i32, ...) bitcast (i32 (...)* @print_char to i32 (i32, ...)*)(i32 %20)
ret void
}

LLVM IR (-O2):
define void @print_integer(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = tail call i32 (i32, ...) bitcast (i32 (...)* @print_char to i32 (i32, ...)*)(i32 45)
%5 = sub i32 0, %0
br label %6
6: ; preds = %3, %1
%7 = phi i32 [ %5, %3 ], [ %0, %1 ]
%8 = icmp ult i32 %7, 10
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = sdiv i32 %7, 10
tail call void @print_integer(i32 %10)
br label %11
11: ; preds = %9, %6
%12 = srem i32 %7, 10
%13 = add nsw i32 %12, 48
%14 = tail call i32 (i32, ...) bitcast (i32 (...)* @print_char to i32 (i32, ...)*)(i32 %13)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ mediansort(void **, int (*)(void const *, void const *),
                              int /*<<< orphan*/, int);
void sortPointers(void **vals, int n, int (*cmp)(const void *, const void *)) {
  mediansort(vals, cmp, 0, n - 1);
}


x86 assembly (clang, -O0):
<sortPointers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
call   1030 <mediansort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sortPointers>:
lea    -0x1(%rsi),%ecx
mov    %rdx,%rsi
xor    %edx,%edx
jmp    1030 <mediansort@plt>

LLVM IR (-O0):
define void @sortPointers(i8** %0, i32 %1, i32 (i8*, i8*)* %2) {
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32 (i8*, i8*)*
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i32 (i8*, i8*)* %2, i32 (i8*, i8*)** %6
%7 = load i8**, i8*** %4
%8 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %6
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 1
%11 = call i32 @mediansort(i8** %7, i32 (i8*, i8*)* %8, i32 0, i32 %10)
ret void
}

LLVM IR (-O2):
define void @sortPointers(i8** %0, i32 %1, i32 (i8*, i8*)* %2) {
%4 = add nsw i32 %1, -1
%5 = tail call i32 @mediansort(i8** %0, i32 (i8*, i8*)* %2, i32 0, i32 %4)
ret void
}
int min(int a, int b) { return a + ((b - a) & ((b - a) >> 31)); }


x86 assembly (clang, -O0):
<min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%edx
sub    -0x4(%rbp),%edx
sar    $0x1f,%edx
and    %edx,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<min>:
mov    %edi,%eax
cmp    %edi,%esi
cmovl  %esi,%eax
ret

LLVM IR (-O0):
define i32 @min(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 = load i32, i32* %3
%8 = sub nsw i32 %6, %7
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = sub nsw i32 %9, %10
%12 = ashr i32 %11, 31
%13 = and i32 %8, %12
%14 = add nsw i32 %5, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @min(i32 %0, i32 %1) {
%3 = icmp slt i32 %1, %0
%4 = select i1 %3, i32 %1, i32 %0
ret i32 %4
}
/* Type definitions */
struct pci_bus {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ pci_read_bridge_bases(struct pci_bus *);
void pcibios_fixup_bus(struct pci_bus *bus) { pci_read_bridge_bases(bus); }


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

x86 assembly (clang, -O2):
<pcibios_fixup_bus>:
jmp    1030 <pci_read_bridge_bases@plt>

LLVM IR (-O0):
%struct.pci_bus = type { i32 }
define void @pcibios_fixup_bus(%struct.pci_bus* %0) {
%2 = alloca %struct.pci_bus*
store %struct.pci_bus* %0, %struct.pci_bus** %2
%3 = load %struct.pci_bus*, %struct.pci_bus** %2
%4 = call i32 @pci_read_bridge_bases(%struct.pci_bus* %3)
ret void
}

LLVM IR (-O2):
%struct.pci_bus = type { i32 }
define void @pcibios_fixup_bus(%struct.pci_bus* %0) {
%2 = tail call i32 @pci_read_bridge_bases(%struct.pci_bus* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int a) { bar(2 * a); }


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

x86 assembly (clang, -O2):
<foo>:
add    %edi,%edi
jmp    1030 <bar@plt>

LLVM IR (-O0):
define void @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 2, %3
%5 = call i32 @bar(i32 %4)
ret void
}

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = shl nsw i32 %0, 1
%3 = tail call i32 @bar(i32 %2)
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int parity(uint8_t x) {
  x ^= x >> 4;
  x ^= x >> 2;
  x ^= x >> 1;
  return x & 1;
}


x86 assembly (clang, -O0):
<parity>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x4,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x2,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
xor    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<parity>:
mov    %edi,%eax
sar    $0x4,%eax
xor    %edi,%eax
mov    %eax,%ecx
sar    $0x2,%ecx
xor    %eax,%ecx
mov    %ecx,%eax
shr    %eax
xor    %ecx,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @parity(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 4
%5 = load i32, i32* %2
%6 = xor i32 %5, %4
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = ashr i32 %7, 2
%9 = load i32, i32* %2
%10 = xor i32 %9, %8
store i32 %10, i32* %2
%11 = load i32, i32* %2
%12 = ashr i32 %11, 1
%13 = load i32, i32* %2
%14 = xor i32 %13, %12
store i32 %14, i32* %2
%15 = load i32, i32* %2
%16 = and i32 %15, 1
ret i32 %16
}

LLVM IR (-O2):
define i32 @parity(i32 %0) {
%2 = ashr i32 %0, 4
%3 = xor i32 %2, %0
%4 = ashr i32 %3, 2
%5 = xor i32 %4, %3
%6 = lshr i32 %5, 1
%7 = xor i32 %6, %5
%8 = and i32 %7, 1
ret i32 %8
}
void exchange_long(long *p1, long *p2) {
  long t;
  t = *p1;
  *p1 = *p2;
  *p2 = t;
}


x86 assembly (clang, -O0):
<exchange_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @exchange_long(i64* nocapture %0, i64* nocapture %1) {
%3 = load i64, i64* %0
%4 = load i64, i64* %1
store i64 %4, i64* %0
store i64 %3, i64* %1
ret void
}
int main() {
  int a = 3;
  int b = a > 3 ? 4 : 1 ? 5 : 1;
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x8(%rbp)
mov    -0x8(%rbp),%edx
mov    $0x5,%eax
mov    $0x4,%ecx
cmp    $0x3,%edx
cmovg  %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 3, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 3
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 4, i32 5
store i32 %7, i32* %3
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
ret i32 5
}
unsigned pure_div_roundup(unsigned x, unsigned n) {
  if (n == 0)
    return 0;
  return (x + (n - 1)) / n;
}


x86 assembly (clang, -O0):
<pure_div_roundup>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1120 <pure_div_roundup+0x20>
movl   $0x0,-0x4(%rbp)
jmp    1133 <pure_div_roundup+0x33>
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
add    %ecx,%eax
xor    %edx,%edx
divl   -0xc(%rbp)
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pure_div_roundup>:
test   %esi,%esi
je     110f <pure_div_roundup+0xf>
lea    (%rdi,%rsi,1),%eax
add    $0xffffffff,%eax
xor    %edx,%edx
div    %esi
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @pure_div_roundup(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = add i32 %0, -1
%6 = add i32 %5, %1
%7 = udiv i32 %6, %1
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ 0, %2 ]
ret i32 %9
}
int is_in_char_array(const char c, const char *array) {
  for (int i = 0; array[i]; i++) {
    if (c == array[i])
      return (i);
  }
  return (-1);
}


x86 assembly (clang, -O0):
<is_in_char_array>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     115d <is_in_char_array+0x5d>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    114a <is_in_char_array+0x4a>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1164 <is_in_char_array+0x64>
jmp    114f <is_in_char_array+0x4f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1115 <is_in_char_array+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_in_char_array>:
mov    (%rsi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1122 <is_in_char_array+0x22>
xor    %ecx,%ecx
nopl   (%rax)
cmp    %dil,%dl
je     1123 <is_in_char_array+0x23>
movzbl 0x1(%rsi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <is_in_char_array+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @is_in_char_array(i8 signext %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %9
%6 = phi i64 [ %10, %9 ], [ 0, %2 ]
%7 = phi i8 [ %12, %9 ], [ %3, %2 ]
%8 = icmp eq i8 %7, %0
br i1 %8, label %14, label %9
9: ; preds = %5
%10 = add nuw i64 %6, 1
%11 = getelementptr inbounds i8, i8* %1, i64 %10
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %16, label %5
14: ; preds = %5
%15 = trunc i64 %6 to i32
br label %16
16: ; preds = %9, %14, %2
%17 = phi i32 [ -1, %2 ], [ %15, %14 ], [ -1, %9 ]
ret i32 %17
}
/* Type definitions */
struct dns_buf {
  int dummy;
};

/* Variables and functions */
int dns_b_put(struct dns_buf *, void const *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(void const *);
int dns_b_puts(struct dns_buf *b, const void *src) {
  return dns_b_put(b, src, strlen(src));
}


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

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

LLVM IR (-O0):
%struct.dns_buf = type { i32 }
define i32 @dns_b_puts(%struct.dns_buf* %0, i8* %1) {
%3 = alloca %struct.dns_buf*
%4 = alloca i8*
store %struct.dns_buf* %0, %struct.dns_buf** %3
store i8* %1, i8** %4
%5 = load %struct.dns_buf*, %struct.dns_buf** %3
%6 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @dns_b_put(%struct.dns_buf* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.dns_buf = type { i32 }
define i32 @dns_b_puts(%struct.dns_buf* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @dns_b_put(%struct.dns_buf* %0, i8* %1, i32 %3)
ret i32 %4
}
int main() {
  unsigned short int usi;
  usi = 0x5555;
  usi = 0xAAAA;
  usi = 0x0000;
  usi = 0xFFFF;
  usi = 0x8000;
  usi = 0x0001;
  usi = 0x7FFF;
  usi = 0xFFFE;
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movw   $0x5555,-0x6(%rbp)
movw   $0xaaaa,-0x6(%rbp)
movw   $0x0,-0x6(%rbp)
movw   $0xffff,-0x6(%rbp)
movw   $0x8000,-0x6(%rbp)
movw   $0x1,-0x6(%rbp)
movw   $0x7fff,-0x6(%rbp)
movw   $0xfffe,-0x6(%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 i16
store i32 0, i32* %1
store i16 21845, i16* %2
store i16 -21846, i16* %2
store i16 0, i16* %2
store i16 -1, i16* %2
store i16 -32768, i16* %2
store i16 1, i16* %2
store i16 32767, i16* %2
store i16 -2, i16* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
unsigned int ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
unsigned int get_file_size(FILE *file) {
  unsigned int size = 0;
  fseek(file, 0L, SEEK_END);
  size = ftell(file);
  rewind(file);
  return size;
}


x86 assembly (clang, -O0):
<get_file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e9a(%rip),%rax
mov    (%rax),%edx
xor    %eax,%eax
mov    %eax,%esi
call   1050 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ftell@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rewind@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_file_size>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eab(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    %rbx,%rdi
call   1040 <ftell@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <rewind@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_END = global i32 0
define i32 @get_file_size(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %3
%4 = load i32*, i32** %2
%5 = load i32, i32* @SEEK_END
%6 = call i32 @fseek(i32* %4, i64 0, i32 %5)
%7 = load i32*, i32** %2
%8 = call i32 @ftell(i32* %7)
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = call i32 @rewind(i32* %9)
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
@SEEK_END = global i32 0
define i32 @get_file_size(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_END
%3 = tail call i32 @fseek(i32* %0, i64 0, i32 %2)
%4 = tail call i32 @ftell(i32* %0)
%5 = tail call i32 @rewind(i32* %0)
ret i32 %4
}
/* Variables and functions */
double sin(int);
double computeAreaEnclosedEqualSidePolygon(double radius, int numV) {
  return 0.5 * numV * radius * radius * sin(2 * 3.14159265359 / numV);
}


x86 assembly (clang, -O0):
<computeAreaEnclosedEqualSidePolygon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xedb(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm1
movsd  0xeb3(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeAreaEnclosedEqualSidePolygon>:
push   %rax
cvtsi2sd %edi,%xmm2
movsd  0xee3(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movsd  0xed2(%rip),%xmm1
divsd  %xmm2,%xmm1
cvttsd2si %xmm1,%edi
call   1030 <sin@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @computeAreaEnclosedEqualSidePolygon(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
%7 = fmul double 5.000000e-01, %6
%8 = load double, double* %3
%9 = fmul double %7, %8
%10 = load double, double* %3
%11 = fmul double %9, %10
%12 = load i32, i32* %4
%13 = sitofp i32 %12 to double
%14 = fdiv double 0x401921FB54442EEA, %13
%15 = fptosi double %14 to i32
%16 = call double @sin(i32 %15)
%17 = fmul double %11, %16
ret double %17
}

LLVM IR (-O2):
define double @computeAreaEnclosedEqualSidePolygon(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 5.000000e-01
%5 = fmul double %4, %0
%6 = fmul double %5, %0
%7 = fdiv double 0x401921FB54442EEA, %3
%8 = fptosi double %7 to i32
%9 = tail call double @sin(i32 %8)
%10 = fmul double %6, %9
ret double %10
}
void core_cpu_i_op_nop(struct core_cpu *cpu, struct core_instr_params *p) {}


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

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

LLVM IR (-O0):
%struct.core_cpu = type opaque
%struct.core_instr_params = type opaque
define void @core_cpu_i_op_nop(%struct.core_cpu* %0, %struct.core_instr_params* %1) {
%3 = alloca %struct.core_cpu*
%4 = alloca %struct.core_instr_params*
store %struct.core_cpu* %0, %struct.core_cpu** %3
store %struct.core_instr_params* %1, %struct.core_instr_params** %4
ret void
}

LLVM IR (-O2):
%struct.core_cpu = type opaque
%struct.core_instr_params = type opaque
define void @core_cpu_i_op_nop(%struct.core_cpu* nocapture %0, %struct.core_instr_params* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void cw_close(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<cw_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @cw_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}