xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ getgid();
scalar_t__ getuid();
int /*<<< orphan*/ stderr;
void check_id() {
  if (getuid() == 0 || getgid() == 0)
    fprintf(stderr, "[i] warning: running as root !\n");
}


x86 assembly (clang, -O0):
<check_id>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <getuid@plt>
cmp    $0x0,%rax
je     1156 <check_id+0x26>
mov    $0x0,%al
call   1050 <getgid@plt>
cmp    $0x0,%rax
jne    116b <check_id+0x3b>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
lea    0xe9a(%rip),%rsi
call   1040 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_id>:
push   %rax
xor    %eax,%eax
call   1030 <getuid@plt>
test   %rax,%rax
je     114b <check_id+0x1b>
xor    %eax,%eax
call   1050 <getgid@plt>
test   %rax,%rax
je     114b <check_id+0x1b>
pop    %rax
ret
mov    0x2e8e(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
pop    %rax
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"[i] warning: running as root !\0A\00"
define void @check_id() {
%1 = call i64 (...) @getuid()
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = call i64 (...) @getgid()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3, %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %3
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"[i] warning: running as root !\0A\00"
define void @check_id() {
%1 = tail call i64 (...) @getuid()
%2 = icmp eq i64 %1, 0
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i64 (...) @getgid()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3, %0
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %3
ret void
}
int do_706() { return 706; }


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

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

LLVM IR (-O0):
define i32 @do_706() {
ret i32 706
}

LLVM IR (-O2):
define i32 @do_706() {
ret i32 706
}
int enable_raw_bind_capability(int enable) {
  int ret = 0;
  return ret;
}


x86 assembly (clang, -O0):
<enable_raw_bind_capability>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @enable_raw_bind_capability(i32 %0) {
ret i32 0
}
/* Variables and functions */
void _exit(int);
void __exit(int z) { return _exit(z); }


x86 assembly (clang, -O0):
<__exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<__exit>:
push   %rax
call   1030 <_exit@plt>

LLVM IR (-O0):
define void @__exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
unreachable
4: ; No predecessors!
ret void
}

LLVM IR (-O2):
define void @__exit(i32 %0) {
tail call void @_exit(i32 %0)
unreachable
}
int calculate_index(char *initial_position, char *position) {
  return position - initial_position;
}


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

x86 assembly (clang, -O2):
<calculate_index>:
mov    %rsi,%rax
sub    %edi,%eax
ret

LLVM IR (-O0):
define i32 @calculate_index(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %5 to i64
%8 = ptrtoint i8* %6 to i64
%9 = sub i64 %7, %8
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @calculate_index(i8* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = ptrtoint i8* %0 to i64
%5 = sub i64 %3, %4
%6 = trunc i64 %5 to i32
ret i32 %6
}
/* Variables and functions */
int encode_decode_lib(char *, char *, int, char **);
int main(int argc, char **argv) {
  return encode_decode_lib("base64", "decode", argc, argv);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xecc(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1030 <encode_decode_lib@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    %rsi,%rcx
mov    %edi,%edx
lea    0xee4(%rip),%rdi
lea    0xee4(%rip),%rsi
jmp    1030 <encode_decode_lib@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"base64\00"
@.str.1 = [7 x i8] c"decode\00"
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 = load i32, i32* %4
%7 = load i8**, i8*** %5
%8 = call i32 @encode_decode_lib(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %6, i8** %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [7 x i8] c"base64\00"
@.str.1 = [7 x i8] c"decode\00"
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @encode_decode_lib(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %0, i8** %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ fatal_error(char *);
char *strdup(char const *);
char *xstrdup(const char *str) {
  char *ret;
  ret = strdup(str);
  if (ret == NULL)
    fatal_error("There is not enough memory available now.\n");
  return ret;
}


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

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

LLVM IR (-O0):
@.str = [43 x i8] c"There is not enough memory available now.\0A\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strdup(i8* %4)
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 = call i32 @fatal_error(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %10
10: ; preds = %8, %1
%11 = load i8*, i8** %3
ret i8* %11
}

LLVM IR (-O2):
@.str = [43 x i8] c"There is not enough memory available now.\0A\00"
define noalias i8* @xstrdup(i8* nocapture %0) {
%2 = tail call i8* @strdup(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @fatal_error(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void *start_thread(void *argv) {
  printf("hello world\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"hello world\0A\00"
define i8* @start_thread(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [12 x i8] c"hello world\00"
define noalias i8* @start_thread(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @str, i64 0, i64 0))
ret i8* null
}
int max(int a, int b) {
  int max;
  max = a > b ? a : b;
  return max;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1121 <max+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1127 <max+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @max(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* %4
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load i32, i32* %3
br label %13
11: ; preds = %2
%12 = load i32, i32* %4
br label %13
13: ; preds = %11, %9
%14 = phi i32 [ %10, %9 ], [ %12, %11 ]
store i32 %14, i32* %5
%15 = load i32, i32* %5
ret i32 %15
}

LLVM IR (-O2):
define i32 @max(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ testCompiler();
int /*<<< orphan*/ testVM();
int main() {
  testCompiler();
  testVM();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @testCompiler()
%2 = tail call i32 (...) @testVM()
ret i32 0
}
int test_imm_26int64_midword_mem(long long *val) {
  return ((*val >> 16) & (0x26 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_26int64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 16
%6 = and i64 %5, 38
%7 = icmp ne i64 %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_26int64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 2490368
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int SDL_imageFilterSubUintMMX(unsigned char *Src1, unsigned char *Dest,
                              int length, unsigned int C, unsigned int Cs) {
  return (0);
}


x86 assembly (clang, -O0):
<SDL_imageFilterSubUintMMX>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SDL_imageFilterSubUintMMX(i8* %0, i8* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
ret i32 0
}

LLVM IR (-O2):
define i32 @SDL_imageFilterSubUintMMX(i8* nocapture readnone %0, i8* nocapture readnone %1, i32 %2, i32 %3, i32 %4) {
ret i32 0
}
void mul() {
  int x = 50, y = 0;
  while (x) {
    y = x * 2;
    x--;
  }
}


x86 assembly (clang, -O0):
<mul>:
push   %rbp
mov    %rsp,%rbp
movl   $0x32,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1133 <mul+0x33>
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <mul+0x12>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @mul() {
%1 = alloca i32
%2 = alloca i32
store i32 50, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %6, %0
%4 = load i32, i32* %1
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* %1
%8 = mul nsw i32 %7, 2
store i32 %8, i32* %2
%9 = load i32, i32* %1
%10 = add nsw i32 %9, -1
store i32 %10, i32* %1
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @mul() {
ret void
}
int test_imm_3Cint64_lowword_mem(long long *val) {
  return ((*val) & (0x3C << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Cint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 60
%6 = icmp ne i64 %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_3Cint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 60
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ end_test();
int /*<<< orphan*/ start_test(char *);
void test_add_values() {
  start_test("add_values");
  assert((1 / (1.0 / 8 + 1.0 / 8)) == 4);
  assert((1 / (1.0 / 4 + 1.0 / 4)) == 2);
  assert((1 / (1.0 / 2 + 1.0 / 2)) == 1);
  end_test();
}


x86 assembly (clang, -O0):
<test_add_values>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <start_test@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x0,%al
call   1030 <end_test@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_add_values>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <start_test@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
mov    $0x1,%edi
call   1050 <assert@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <end_test@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"add_values\00"
define void @test_add_values() {
%1 = call i32 @start_test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @assert(i32 1)
%3 = call i32 @assert(i32 1)
%4 = call i32 @assert(i32 1)
%5 = call i32 (...) @end_test()
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"add_values\00"
define void @test_add_values() {
%1 = tail call i32 @start_test(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @assert(i32 1)
%3 = tail call i32 @assert(i32 1)
%4 = tail call i32 @assert(i32 1)
%5 = tail call i32 (...) @end_test()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(int argc, char *argv[]) {
  printf("run....");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"run....\00"
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 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"run....\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
size_t strlen(const char *scan) {
  register const char *start = scan + 1;
  if (!scan)
    return 0;
  while (*scan++ != '\0')
    continue;
  return (size_t)((long)scan - (long)start);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    112c <strlen+0x2c>
movq   $0x0,-0x8(%rbp)
jmp    1160 <strlen+0x60>
jmp    1131 <strlen+0x31>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1151 <strlen+0x51>
jmp    1131 <strlen+0x31>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i64 @strlen(i8* %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = icmp eq i8* %0, null
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = load i8, i8* %5
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = ptrtoint i8* %6 to i64
%11 = ptrtoint i8* %2 to i64
%12 = sub nsw i64 %10, %11
br label %13
13: ; preds = %1, %9
%14 = phi i64 [ %12, %9 ], [ 0, %1 ]
ret i64 %14
}
int fun840() { return 840; }


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

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

LLVM IR (-O0):
define i32 @fun840() {
ret i32 840
}

LLVM IR (-O2):
define i32 @fun840() {
ret i32 840
}
/* Variables and functions */
int doubler(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int orig = 12;
  printf("orig: %d\n", orig);
  orig = doubler(orig);
  printf("orig: %d\n", orig);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xc,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <doubler@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xed8(%rip),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
mov    $0xc,%edi
call   1040 <doubler@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"orig: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 12, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @doubler(i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"orig: %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 12)
%2 = tail call i32 @doubler(i32 12)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %2)
ret i32 0
}
/* Variables and functions */
char *modifyNickMode(int, void *);
char *dehalfopCmd(void *args) { return modifyNickMode(6, args); }


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

x86 assembly (clang, -O2):
<dehalfopCmd>:
mov    %rdi,%rsi
mov    $0x6,%edi
jmp    1030 <modifyNickMode@plt>

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

LLVM IR (-O2):
define i8* @dehalfopCmd(i8* %0) {
%2 = tail call i8* @modifyNickMode(i32 6, i8* %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ LRDP(char *);
void uc2_dma_io() { LRDP("uc2:dma_io\n"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"uc2:dma_io\0A\00"
define void @uc2_dma_io() {
%1 = call i32 @LRDP(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"uc2:dma_io\0A\00"
define void @uc2_dma_io() {
%1 = tail call i32 @LRDP(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
char *f() { return "Howdy!"; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Howdy!\00"
define i8* @f() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [7 x i8] c"Howdy!\00"
define i8* @f() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}
char **f() {}


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

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

LLVM IR (-O0):
define i8** @f() {
%1 = alloca i8**
%2 = load i8**, i8*** %1
ret i8** %2
}

LLVM IR (-O2):
define noalias i8** @f() {
ret i8** undef
}
unsigned int hash(n) const char *n;
{
  unsigned int h = 0;
  while (*n != '\0')
    h = 2 * h + *n++;
  return h * 32821;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1141 <hash+0x41>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <hash+0xf>
imul   $0x8035,-0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     1128 <hash+0x28>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
lea    (%rax,%rcx,2),%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
imul   $0x8035,%ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %11, %4 ], [ 0, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = shl i32 %6, 1
%10 = getelementptr inbounds i8, i8* %7, i64 1
%11 = add i32 %9, %8
%12 = load i8, i8* %10
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = mul i32 %11, 32821
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
int foo(int a) {
  int b = a & 0xff;
  if (b > 300)
    return 2;
  else
    return 1;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x12c,-0xc(%rbp)
jle    112b <foo+0x2b>
movl   $0x2,-0x4(%rbp)
jmp    1132 <foo+0x32>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 255
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 300
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 2, i32* %2
br label %11
10: ; preds = %1
store i32 1, i32* %2
br label %11
11: ; preds = %10, %9
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
ret i32 1
}
/* Variables and functions */
scalar_t__ isupper(int);
int tolower(int ch) { return isupper(ch) ? (ch + 'a' - 'A') : ch; }


x86 assembly (clang, -O0):
<tolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isupper@plt>
cmp    $0x0,%rax
je     113e <tolower+0x2e>
mov    -0x4(%rbp),%eax
add    $0x61,%eax
sub    $0x41,%eax
mov    %eax,-0x8(%rbp)
jmp    1144 <tolower+0x34>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tolower>:
push   %rbx
mov    %edi,%ebx
call   1030 <isupper@plt>
lea    0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @tolower(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isupper(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 97
%9 = sub nsw i32 %8, 65
br label %12
10: ; preds = %1
%11 = load i32, i32* %2
br label %12
12: ; preds = %10, %6
%13 = phi i32 [ %9, %6 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @tolower(i32 %0) {
%2 = tail call i64 @isupper(i32 %0)
%3 = icmp eq i64 %2, 0
%4 = add nsw i32 %0, 32
%5 = select i1 %3, i32 %0, i32 %4
ret i32 %5
}
/* Variables and functions */
int logmsg(char *, char *, int);
int eslib_logmsg(char *name, char *msg) { return logmsg(name, msg, 1); }


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

x86 assembly (clang, -O2):
<eslib_logmsg>:
mov    $0x1,%edx
jmp    1030 <logmsg@plt>

LLVM IR (-O0):
define i32 @eslib_logmsg(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 @logmsg(i8* %5, i8* %6, i32 1)
ret i32 %7
}

LLVM IR (-O2):
define i32 @eslib_logmsg(i8* %0, i8* %1) {
%3 = tail call i32 @logmsg(i8* %0, i8* %1, i32 1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ gen_pop();
int /*<<< orphan*/ output_line(char *);
void gen_mod(void) {
  gen_pop();
  output_line("__mod");
}


x86 assembly (clang, -O0):
<gen_mod>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gen_pop@plt>
lea    0xece(%rip),%rdi
call   1040 <output_line@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_mod>:
push   %rax
xor    %eax,%eax
call   1030 <gen_pop@plt>
lea    0xed1(%rip),%rdi
pop    %rax
jmp    1040 <output_line@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"__mod\00"
define void @gen_mod() {
%1 = call i32 (...) @gen_pop()
%2 = call i32 @output_line(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"__mod\00"
define void @gen_mod() {
%1 = tail call i32 (...) @gen_pop()
%2 = tail call i32 @output_line(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *_s2_f2cstr(char *, long);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ pushVRMLname(char *);
void pushVRMLname_(char *iname, long int textlen) {
  char *string = _s2_f2cstr(iname, textlen);
  pushVRMLname(string);
  free(string);
}


x86 assembly (clang, -O0):
<pushVRMLname_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <_s2_f2cstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <pushVRMLname@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pushVRMLname_>:
push   %rbx
call   1050 <_s2_f2cstr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <pushVRMLname@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @pushVRMLname_(i8* %0, i64 %1) {
%3 = tail call i8* @_s2_f2cstr(i8* %0, i64 %1)
%4 = tail call i32 @pushVRMLname(i8* %3)
%5 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
double pow(double, double);
double math_pow(double x, double y) { return pow(x, y); }


x86 assembly (clang, -O0):
<math_pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_pow>:
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @math_pow(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = call double @pow(double %5, double %6)
ret double %7
}

LLVM IR (-O2):
define double @math_pow(double %0, double %1) {
%3 = tail call double @pow(double %0, double %1)
ret double %3
}
void GPMCWriteTypeSelect(unsigned int baseAddr, unsigned int csNum,
                         unsigned int writeType) {
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) &=
      ~(0x08000000u);
  (*((volatile unsigned int *)(baseAddr + (0x60 + (csNum * (0x30)))))) |=
      ((writeType << (0x0000001Bu)) & (0x08000000u));
}


x86 assembly (clang, -O0):
<GPMCWriteTypeSelect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xf7ffffff,%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%edx
shl    $0x1b,%edx
and    $0x8000000,%edx
mov    -0x4(%rbp),%eax
imul   $0x30,-0x8(%rbp),%ecx
add    $0x60,%ecx
add    %ecx,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     %edx,%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCWriteTypeSelect>:
lea    (%rsi,%rsi,2),%eax
shl    $0x4,%eax
add    %edi,%eax
add    $0x60,%eax
andl   $0xf7ffffff,(%rax)
and    $0x1,%edx
shl    $0x1b,%edx
or     %edx,(%rax)
ret

LLVM IR (-O0):
define void @GPMCWriteTypeSelect(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul i32 %8, 48
%10 = add i32 96, %9
%11 = add i32 %7, %10
%12 = zext i32 %11 to i64
%13 = inttoptr i64 %12 to i32*
%14 = load volatile i32, i32* %13
%15 = and i32 %14, -134217729
store volatile i32 %15, i32* %13
%16 = load i32, i32* %6
%17 = shl i32 %16, 27
%18 = and i32 %17, 134217728
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = mul i32 %20, 48
%22 = add i32 96, %21
%23 = add i32 %19, %22
%24 = zext i32 %23 to i64
%25 = inttoptr i64 %24 to i32*
%26 = load volatile i32, i32* %25
%27 = or i32 %26, %18
store volatile i32 %27, i32* %25
ret void
}

LLVM IR (-O2):
define void @GPMCWriteTypeSelect(i32 %0, i32 %1, i32 %2) {
%4 = mul i32 %1, 48
%5 = add i32 %0, 96
%6 = add i32 %5, %4
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
%9 = load volatile i32, i32* %8
%10 = and i32 %9, -134217729
store volatile i32 %10, i32* %8
%11 = shl i32 %2, 27
%12 = and i32 %11, 134217728
%13 = load volatile i32, i32* %8
%14 = or i32 %13, %12
store volatile i32 %14, i32* %8
ret void
}
int netbios_chk() { return (1); }


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

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

LLVM IR (-O0):
define i32 @netbios_chk() {
ret i32 1
}

LLVM IR (-O2):
define i32 @netbios_chk() {
ret i32 1
}
unsigned short correctedLineLength(unsigned short length) {
  unsigned short corrected;
  if (length == 0)
    corrected = 0;
  else {
    corrected = ((length + 2) / 4) * 4;
    if (!corrected)
      corrected = 4;
  }
  return corrected;
}


x86 assembly (clang, -O0):
<correctedLineLength>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x0,%eax
jne    1123 <correctedLineLength+0x23>
movw   $0x0,-0x4(%rbp)
jmp    114f <correctedLineLength+0x4f>
movzwl -0x2(%rbp),%eax
add    $0x2,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
mov    %ax,-0x4(%rbp)
cmpw   $0x0,-0x4(%rbp)
jne    114a <correctedLineLength+0x4a>
movw   $0x4,-0x4(%rbp)
jmp    114f <correctedLineLength+0x4f>
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<correctedLineLength>:
lea    0x2(%rdi),%ecx
and    $0xfffffffc,%ecx
test   %cx,%cx
mov    $0x4,%eax
cmovne %ecx,%eax
test   %edi,%edi
cmove  %edi,%eax
ret

LLVM IR (-O0):
define zeroext i16 @correctedLineLength(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = zext i16 %4 to i32
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i16 0, i16* %3
br label %19
8: ; preds = %1
%9 = load i16, i16* %2
%10 = zext i16 %9 to i32
%11 = add nsw i32 %10, 2
%12 = sdiv i32 %11, 4
%13 = mul nsw i32 %12, 4
%14 = trunc i32 %13 to i16
store i16 %14, i16* %3
%15 = load i16, i16* %3
%16 = icmp ne i16 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %8
store i16 4, i16* %3
br label %18
18: ; preds = %17, %8
br label %19
19: ; preds = %18, %7
%20 = load i16, i16* %3
ret i16 %20
}

LLVM IR (-O2):
define zeroext i16 @correctedLineLength(i16 zeroext %0) {
%2 = icmp eq i16 %0, 0
%3 = add i16 %0, 2
%4 = and i16 %3, -4
%5 = icmp eq i16 %4, 0
%6 = select i1 %5, i16 4, i16 %4
%7 = select i1 %2, i16 0, i16 %6
ret i16 %7
}
void _old_bar(void) {}


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

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

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

LLVM IR (-O2):
define void @_old_bar() {
ret void
}
void g_queue_sort() {}


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

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

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

LLVM IR (-O2):
define void @g_queue_sort() {
ret void
}
int fn9(char **x) { return sizeof x; }


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

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

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

LLVM IR (-O2):
define i32 @fn9(i8** nocapture readnone %0) {
ret i32 8
}
void guncharge(char pos) {
  *((char *)0x4000 + 192 * 32 + 7 * 32 + 2 + pos / 4) = 0x40 + (2 << 3);
}


x86 assembly (clang, -O0):
<guncharge>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
movslq %eax,%rcx
mov    $0x4000,%eax
movb   $0x50,0x18e2(%rax,%rcx,1)
50
pop    %rbp
ret

x86 assembly (clang, -O2):
<guncharge>:
mov    %edi,%eax
sar    $0x7,%al
shr    $0x6,%al
add    %dil,%al
sar    $0x2,%al
movsbq %al,%rax
movb   $0x50,0x58e2(%rax)
ret

LLVM IR (-O0):
define void @guncharge(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sdiv i32 %4, 4
%6 = sext i32 %5 to i64
%7 = getelementptr inbounds i8, i8* getelementptr inbounds (i8, i8* inttoptr (i64 16384 to i8*), i64 6370), i64 %6
store i8 80, i8* %7
ret void
}

LLVM IR (-O2):
define void @guncharge(i8 signext %0) {
%2 = sdiv i8 %0, 4
%3 = sext i8 %2 to i64
%4 = getelementptr inbounds i8, i8* inttoptr (i64 22754 to i8*), i64 %3
store i8 80, i8* %4
ret void
}
double square(double value) { return value * value; }


x86 assembly (clang, -O0):
<square>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<square>:
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @square(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fmul double %3, %4
ret double %5
}

LLVM IR (-O2):
define double @square(double %0) {
%2 = fmul double %0, %0
ret double %2
}
/* Variables and functions */
float exp(float);
float beta(float z, float w) {
  float gammln(float xx);
  return exp(gammln(z) + gammln(w) - gammln(z + w));
}


x86 assembly (clang, -O0):
<beta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <gammln@plt>
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0x10(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
call   1040 <gammln@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
subss  %xmm1,%xmm0
call   1030 <exp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<beta>:
sub    $0x18,%rsp
movss  %xmm1,0x10(%rsp)
movss  %xmm0,0x14(%rsp)
call   1040 <gammln@plt>
movss  %xmm0,0xc(%rsp)
movss  0x10(%rsp),%xmm0
call   1040 <gammln@plt>
addss  0xc(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x14(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
call   1040 <gammln@plt>
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movaps %xmm1,%xmm0
add    $0x18,%rsp
jmp    1030 <exp@plt>

LLVM IR (-O0):
define float @beta(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = call float @gammln(float %5)
%7 = load float, float* %4
%8 = call float @gammln(float %7)
%9 = fadd float %6, %8
%10 = load float, float* %3
%11 = load float, float* %4
%12 = fadd float %10, %11
%13 = call float @gammln(float %12)
%14 = fsub float %9, %13
%15 = call float @exp(float %14)
ret float %15
}

LLVM IR (-O2):
define float @beta(float %0, float %1) {
%3 = tail call float @gammln(float %0)
%4 = tail call float @gammln(float %1)
%5 = fadd float %3, %4
%6 = fadd float %0, %1
%7 = tail call float @gammln(float %6)
%8 = fsub float %5, %7
%9 = tail call float @exp(float %8)
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int rand();
int /*<<< orphan*/ random_printable_string_of_len(char *, int);
void random_printable_string_of_rand_len(char *dest, int maxlen) {
  assert(maxlen >= 2);
  int len = (rand() % (maxlen - 2)) + 2;
  random_printable_string_of_len(dest, len);
}


x86 assembly (clang, -O0):
<random_printable_string_of_rand_len>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    $0x0,%al
call   1050 <rand@plt>
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
cltd
idiv   %ecx
add    $0x2,%edx
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1040 <random_printable_string_of_len@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_printable_string_of_rand_len>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %edi,%edi
cmp    $0x2,%esi
setge  %dil
call   1030 <assert@plt>
xor    %eax,%eax
call   1050 <rand@plt>
add    $0xfffffffe,%ebx
cltd
idiv   %ebx
lea    0x2(%rdx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <random_printable_string_of_len@plt>

LLVM IR (-O0):
define void @random_printable_string_of_rand_len(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* %4
%7 = icmp sge i32 %6, 2
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = call i32 (...) @rand()
%11 = load i32, i32* %4
%12 = sub nsw i32 %11, 2
%13 = srem i32 %10, %12
%14 = add nsw i32 %13, 2
store i32 %14, i32* %5
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = call i32 @random_printable_string_of_len(i8* %15, i32 %16)
ret void
}

LLVM IR (-O2):
define void @random_printable_string_of_rand_len(i8* %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 (...) @rand()
%7 = add nsw i32 %1, -2
%8 = srem i32 %6, %7
%9 = add nsw i32 %8, 2
%10 = tail call i32 @random_printable_string_of_len(i8* %0, i32 %9)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ boo();
gaga() { boo(); }


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

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

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

LLVM IR (-O2):
define i32 @gaga() {
%1 = tail call i32 (...) @boo()
ret i32 undef
}
int div(int x, int y, void(onerror)(int, int)) {
  if (y != 0)
    return x / y;
  else {
    onerror(x, y);
    return 0;
  }
}


x86 assembly (clang, -O0):
<div>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     112b <div+0x2b>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x4(%rbp)
jmp    113e <div+0x3e>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   *%rax
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<div>:
push   %rbx
test   %esi,%esi
je     110e <div+0xe>
mov    %edi,%eax
cltd
idiv   %esi
mov    %eax,%ebx
jmp    1114 <div+0x14>
xor    %ebx,%ebx
xor    %esi,%esi
call   *%rdx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @div(i32 %0, i32 %1, void (i32, i32)* nocapture %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = sdiv i32 %0, %1
br label %8
7: ; preds = %3
tail call void %2(i32 %0, i32 0)
br label %8
8: ; preds = %7, %5
%9 = phi i32 [ %6, %5 ], [ 0, %7 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void f(int x) {
  int i, mask;
  for (i = 31; i >= 0; i--) {
    mask = 1 << i;
    putchar((x & mask) ? '1' : '0');
    if (i % 8 == 0)
      putchar(' ');
  }
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1188 <f+0x78>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edx
and    -0xc(%rbp),%edx
mov    $0x30,%eax
mov    $0x31,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
movsbl %al,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1175 <f+0x65>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    117a <f+0x6a>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <f+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x1f,%ebp
jmp    1125 <f+0x15>
nopl   0x0(%rax)
add    $0xffffffff,%ebp
jae    1147 <f+0x37>
bt     %ebp,%ebx
mov    $0x31,%edi
adc    $0xffffffff,%edi
call   1030 <putchar@plt>
test   $0x7,%bpl
jne    1120 <f+0x10>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1120 <f+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @f(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
store i32 31, i32* %3
br label %5
5: ; preds = %25, %1
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %3
%10 = shl i32 1, %9
store i32 %10, i32* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %4
%13 = and i32 %11, %12
%14 = icmp ne i32 %13, 0
%15 = zext i1 %14 to i64
%16 = select i1 %14, i32 49, i32 48
%17 = trunc i32 %16 to i8
%18 = call i32 @putchar(i8 signext %17)
%19 = load i32, i32* %3
%20 = srem i32 %19, 8
%21 = icmp eq i32 %20, 0
br i1 %21, label %22, label %24
22: ; preds = %8
%23 = call i32 @putchar(i8 signext 32)
br label %24
24: ; preds = %22, %8
br label %25
25: ; preds = %24
%26 = load i32, i32* %3
%27 = add nsw i32 %26, -1
store i32 %27, i32* %3
br label %5
28: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @f(i32 %0) {
br label %2
2: ; preds = %1, %13
%3 = phi i32 [ 31, %1 ], [ %14, %13 ]
%4 = shl nuw i32 1, %3
%5 = and i32 %4, %0
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8 48, i8 49
%8 = tail call i32 @putchar(i8 signext %7)
%9 = and i32 %3, 7
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = tail call i32 @putchar(i8 signext 32)
br label %13
13: ; preds = %2, %11
%14 = add nsw i32 %3, -1
%15 = icmp eq i32 %3, 0
br i1 %15, label %16, label %2
16: ; preds = %13
ret void
}