xunge/DecIR huggingface dataset:
int constant_test_bit(int nr, const volatile unsigned long *addr) {
  unsigned long index = nr / 32;
  unsigned long *tmp = (unsigned long *)&((addr)[index]);
  unsigned char bit = 32 - (nr % 32) - 1;
  if (*tmp & (1 << bit))
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<constant_test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x20,%ecx
cltd
idiv   %ecx
mov    $0x20,%eax
sub    %edx,%eax
sub    $0x1,%eax
mov    %al,-0x21(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movzbl -0x21(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
movslq %ecx,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
je     1177 <constant_test_bit+0x77>
movl   $0x1,-0x4(%rbp)
jmp    117e <constant_test_bit+0x7e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<constant_test_bit>:
mov    %edi,%ecx
lea    0x1f(%rcx),%eax
test   %edi,%edi
cmovns %edi,%eax
sar    $0x5,%eax
movslq %eax,%rdx
mov    $0x80000000,%eax
shr    %cl,%eax
movslq %eax,%rcx
xor    %eax,%eax
test   %rcx,(%rsi,%rdx,8)
setne  %al
ret

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

LLVM IR (-O2):
define i32 @constant_test_bit(i32 %0, i64* nocapture %1) {
%3 = sdiv i32 %0, 32
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i64, i64* %1, i64 %4
%6 = load i64, i64* %5
%7 = and i32 %0, 31
%8 = lshr i32 -2147483648, %7
%9 = sext i32 %8 to i64
%10 = and i64 %6, %9
%11 = icmp ne i64 %10, 0
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
int /*<<< orphan*/ difftime(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t t0;
  int i = 7;
  int y;
  t0 = time(NULL);
  while (i > 0) {
    i--;
    y = 0xFFFFFFF;
    while (y > 0)
      y--;
  }
  printf("Executed in %lf seconds.\n", difftime(time(NULL), t0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    1189 <main+0x59>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
movl   $0xfffffff,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    1184 <main+0x54>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    116c <main+0x3c>
jmp    1152 <main+0x22>
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
mov    -0x8(%rbp),%esi
call   1040 <difftime@plt>
mov    %eax,%esi
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%ebx
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <difftime@plt>
lea    0xeaf(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Executed in %lf seconds.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 7, i32* %3
%5 = call i32 @time(i32* null)
store i32 %5, i32* %2
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %3
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, -1
store i32 %11, i32* %3
store i32 268435455, i32* %4
br label %12
12: ; preds = %15, %9
%13 = load i32, i32* %4
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %4
%17 = add nsw i32 %16, -1
store i32 %17, i32* %4
br label %12
18: ; preds = %12
br label %6
19: ; preds = %6
%20 = call i32 @time(i32* null)
%21 = load i32, i32* %2
%22 = call i32 @difftime(i32 %20, i32 %21)
%23 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %22)
ret i32 0
}

LLVM IR (-O2):
@.str = [26 x i8] c"Executed in %lf seconds.\0A\00"
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @time(i32* null)
%3 = tail call i32 @difftime(i32 %2, i32 %1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  if (argc > 0) {
    printf("%s", argv[0]);
  } else {
    printf("No args.");
  }
  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)
cmpl   $0x0,-0x8(%rbp)
jle    114a <main+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xec2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1158 <main+0x48>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
test   %edi,%edi
jle    1128 <main+0x18>
mov    (%rsi),%rsi
lea    0xee1(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1136 <main+0x26>
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"No args.\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 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %8
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [9 x i8] c"No args.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %9
7: ; preds = %2
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
ret i32 0
}
/* Type definitions */
struct snck_string {
  int dummy;
};
struct snck_ctxt {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char snck_builtin_exit(struct snck_ctxt const *const p_ctxt,
                       struct snck_string const *const p_line) {
  (void)(p_ctxt);
  (void)(p_line);
  exit(0);
  return 1;
}


x86 assembly (clang, -O0):
<snck_builtin_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<snck_builtin_exit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
%struct.snck_ctxt = type { i32 }
%struct.snck_string = type { i32 }
define signext i8 @snck_builtin_exit(%struct.snck_ctxt* %0, %struct.snck_string* %1) {
%3 = alloca %struct.snck_ctxt*
%4 = alloca %struct.snck_string*
store %struct.snck_ctxt* %0, %struct.snck_ctxt** %3
store %struct.snck_string* %1, %struct.snck_string** %4
%5 = load %struct.snck_ctxt*, %struct.snck_ctxt** %3
%6 = load %struct.snck_string*, %struct.snck_string** %4
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.snck_ctxt = type { i32 }
%struct.snck_string = type { i32 }
define signext i8 @snck_builtin_exit(%struct.snck_ctxt* nocapture readnone %0, %struct.snck_string* nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void h(const char *name) { printf("Hello %s!\n", name); }


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

x86 assembly (clang, -O2):
<h>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"Hello %s!\0A\00"
define void @h(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void _M2_RTgenif_init(__attribute__((unused)) int argc,
                      __attribute__((unused)) char *argv[]) {}


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

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

LLVM IR (-O0):
define void @_M2_RTgenif_init(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
ret void
}

LLVM IR (-O2):
define void @_M2_RTgenif_init(i32 %0, i8** nocapture %1) {
ret void
}
char *gdb_terminated() {}


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

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

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

LLVM IR (-O2):
define noalias i8* @gdb_terminated() {
ret i8* undef
}
int func(const int i) { return i; }


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

x86 assembly (clang, -O2):
<func>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @func(i32 returned %0) {
ret i32 %0
}
int test_imm_41int32_reg(int val) { return ((val) & (0x41 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_41int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x41,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_41int32_reg(i32 %0) {
%2 = and i32 %0, 65
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
size_t minzu(size_t a, size_t b) { return a < b ? a : b; }


x86 assembly (clang, -O0):
<minzu>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1127 <minzu+0x27>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    112f <minzu+0x2f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<minzu>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovb  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @minzu(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int strcmp(char const *const, char const *const);
int cmp_cstr_ptr(const void *a, const void *b) {
  return strcmp(*(const char *const *)a, *(const char *const *)b);
}


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

x86 assembly (clang, -O2):
<cmp_cstr_ptr>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cmp_cstr_ptr(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 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @cmp_cstr_ptr(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite_check(char *, int, int, int /*<<< orphan*/ *,
                                char const *);
void serialize_byte(FILE *out, signed char n, long long *fpos,
                    const char *fname) {
  fwrite_check(&n, sizeof(signed char), 1, out, fname);
  *fpos += sizeof(signed char);
}


x86 assembly (clang, -O0):
<serialize_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    -0x9(%rbp),%rdi
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fwrite_check@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<serialize_byte>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r8
mov    %rdx,%rbx
mov    %rdi,%rcx
mov    %sil,0xf(%rsp)
lea    0xf(%rsp),%rdi
mov    $0x1,%esi
mov    $0x1,%edx
call   1030 <fwrite_check@plt>
addq   $0x1,(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @serialize_byte(i32* %0, i8 signext %1, i64* %2, i8* %3) {
%5 = alloca i32*
%6 = alloca i8
%7 = alloca i64*
%8 = alloca i8*
store i32* %0, i32** %5
store i8 %1, i8* %6
store i64* %2, i64** %7
store i8* %3, i8** %8
%9 = load i32*, i32** %5
%10 = load i8*, i8** %8
%11 = call i32 @fwrite_check(i8* %6, i32 1, i32 1, i32* %9, i8* %10)
%12 = load i64*, i64** %7
%13 = load i64, i64* %12
%14 = add i64 %13, 1
store i64 %14, i64* %12
ret void
}

LLVM IR (-O2):
define void @serialize_byte(i32* %0, i8 signext %1, i64* nocapture %2, i8* %3) {
%5 = alloca i8
store i8 %1, i8* %5
%6 = call i32 @fwrite_check(i8* %5, i32 1, i32 1, i32* %0, i8* %3)
%7 = load i64, i64* %2
%8 = add i64 %7, 1
store i64 %8, i64* %2
ret void
}
int compareByReference(void *v1, void *v2) { return v1 == v2; }


x86 assembly (clang, -O0):
<compareByReference>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareByReference>:
xor    %eax,%eax
cmp    %rsi,%rdi
sete   %al
ret

LLVM IR (-O0):
define i32 @compareByReference(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 = icmp eq i8* %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @compareByReference(i8* readnone %0, i8* readnone %1) {
%3 = icmp eq i8* %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ start_game();
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  start_game();
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %eax,%eax
call   1050 <start_game@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @time(i32* null)
%3 = call i32 @srand(i32 %2)
%4 = call i32 (...) @start_game()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @time(i32* null)
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @start_game()
ret i32 0
}
branch(lab) { outcode("BN", 111, lab); }


x86 assembly (clang, -O0):
<branch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edx
lea    0xedb(%rip),%rdi
mov    $0x6f,%esi
mov    $0x0,%al
call   1030 <outcode@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<branch>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
mov    $0x6f,%esi
xor    %eax,%eax
jmp    1030 <outcode@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"BN\00"
define i32 @branch(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @outcode to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 111, i32 %4)
%6 = load i32, i32* %2
ret i32 %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"BN\00"
define i32 @branch(i32 %0) {
%2 = tail call i32 (i8*, i32, i32, ...) bitcast (i32 (...)* @outcode to i32 (i8*, i32, i32, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 111, i32 %0)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int go(char *);
int /*<<< orphan*/ stderr;
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "usage: mips_features <feature>\n");
    exit(3);
  }
  return go(argv[1]);
}


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)
cmpl   $0x2,-0x8(%rbp)
je     116f <main+0x3f>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x3,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <go@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1140 <main+0x10>
mov    0x8(%rsi),%rdi
pop    %rax
jmp    1030 <go@plt>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x3,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [32 x i8] c"usage: mips_features <feature>\0A\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 = icmp ne i32 %6, 2
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 3)
unreachable
12: ; preds = %2
%13 = load i8**, i8*** %5
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
%16 = call i32 @go(i8* %15)
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"usage: mips_features <feature>\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 3)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @go(i8* %10)
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bitcount_to_bytecount(uint8_t bitcount) { return ((bitcount + 7) / 8); }


x86 assembly (clang, -O0):
<bitcount_to_bytecount>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7,%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<bitcount_to_bytecount>:
lea    0x7(%rdi),%ecx
lea    0xe(%rdi),%eax
test   %ecx,%ecx
cmovns %ecx,%eax
sar    $0x3,%eax
ret

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

LLVM IR (-O2):
define i32 @bitcount_to_bytecount(i32 %0) {
%2 = add nsw i32 %0, 7
%3 = sdiv i32 %2, 8
ret i32 %3
}
void __attribute__((no)) badref(void *from, void *ptr) {}


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

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

LLVM IR (-O0):
define void @badref(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @badref(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
char *getenv(char const *);
int check_env_nonzero(const char *param) {
  const char *p;
  p = getenv(param);
  return !!(p && *p != '\0' && *p != '0');
}


x86 assembly (clang, -O0):
<check_env_nonzero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     115e <check_env_nonzero+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     115e <check_env_nonzero+0x4e>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_env_nonzero>:
push   %rax
call   1030 <getenv@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     112e <check_env_nonzero+0x1e>
mov    (%rcx),%cl
test   %cl,%cl
je     112e <check_env_nonzero+0x1e>
xor    %eax,%eax
cmp    $0x30,%cl
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @check_env_nonzero(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @getenv(i8* %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %18
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 48
br label %18
18: ; preds = %13, %8, %1
%19 = phi i1 [ false, %8 ], [ false, %1 ], [ %17, %13 ]
%20 = xor i1 %19, true
%21 = xor i1 %20, true
%22 = zext i1 %21 to i32
ret i32 %22
}

LLVM IR (-O2):
define i32 @check_env_nonzero(i8* nocapture %0) {
%2 = tail call i8* @getenv(i8* %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = icmp ne i8 %5, 48
%9 = zext i1 %8 to i32
br label %10
10: ; preds = %7, %4, %1
%11 = phi i32 [ 0, %4 ], [ 0, %1 ], [ %9, %7 ]
ret i32 %11
}
int is_device_mounted(const char *path) {
  (void)path;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @is_device_mounted(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ parallelExec();
int /*<<< orphan*/ sequentialExec();
void switchOptions(int value) {
  switch (value) {
  case 1:
    sequentialExec();
    break;
  case 2:
    parallelExec();
    break;
  }
}


x86 assembly (clang, -O0):
<switchOptions>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0x1,%eax
je     1150 <switchOptions+0x30>
jmp    113f <switchOptions+0x1f>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
je     115c <switchOptions+0x3c>
jmp    1163 <switchOptions+0x43>
mov    $0x0,%al
call   1040 <sequentialExec@plt>
jmp    1163 <switchOptions+0x43>
mov    $0x0,%al
call   1030 <parallelExec@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<switchOptions>:
cmp    $0x2,%edi
je     1131 <switchOptions+0x11>
cmp    $0x1,%edi
jne    1138 <switchOptions+0x18>
xor    %eax,%eax
jmp    1040 <sequentialExec@plt>
xor    %eax,%eax
jmp    1030 <parallelExec@plt>
ret

LLVM IR (-O0):
define void @switchOptions(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %8 [
i32 1, label %4
i32 2, label %6
]
4: ; preds = %1
%5 = call i32 (...) @sequentialExec()
br label %8
6: ; preds = %1
%7 = call i32 (...) @parallelExec()
br label %8
8: ; preds = %1, %6, %4
ret void
}

LLVM IR (-O2):
define void @switchOptions(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %2
i32 2, label %4
]
2: ; preds = %1
%3 = tail call i32 (...) @sequentialExec()
br label %6
4: ; preds = %1
%5 = tail call i32 (...) @parallelExec()
br label %6
6: ; preds = %1, %4, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ReadAllAD();
int /*<<< orphan*/ ReadAllIO();
void ReadAll(void) {
  ReadAllIO();
  ReadAllAD();
}


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

x86 assembly (clang, -O2):
<ReadAll>:
push   %rax
xor    %eax,%eax
call   1040 <ReadAllIO@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ReadAllAD@plt>

LLVM IR (-O0):
define void @ReadAll() {
%1 = call i32 (...) @ReadAllIO()
%2 = call i32 (...) @ReadAllAD()
ret void
}

LLVM IR (-O2):
define void @ReadAll() {
%1 = tail call i32 (...) @ReadAllIO()
%2 = tail call i32 (...) @ReadAllAD()
ret void
}
void glutPostWindowOverlayRedisplay(int win) {}


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

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

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

LLVM IR (-O2):
define void @glutPostWindowOverlayRedisplay(i32 %0) {
ret void
}
/* Variables and functions */
char const *prj_get_target_for(int);
const char *prj_get_relativetarget_for(int i) { return prj_get_target_for(i); }


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

x86 assembly (clang, -O2):
<prj_get_relativetarget_for>:
jmp    1030 <prj_get_target_for@plt>

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

LLVM IR (-O2):
define i8* @prj_get_relativetarget_for(i32 %0) {
%2 = tail call i8* @prj_get_target_for(i32 %0)
ret i8* %2
}
int f(int n) { return -n; }


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

x86 assembly (clang, -O2):
<f>:
mov    %edi,%eax
neg    %eax
ret

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

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = sub nsw i32 0, %0
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_SETMASK;
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/);
void sig_blocknone(void) {
  sigset_t ss;
  sigemptyset(&ss);
  sigprocmask(SIG_SETMASK, &ss, 0);
}


x86 assembly (clang, -O0):
<sig_blocknone>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    0x2eb0(%rip),%rax
mov    (%rax),%edi
lea    -0x4(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_blocknone>:
push   %rbx
sub    $0x10,%rsp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <sigemptyset@plt>
mov    0x2eaf(%rip),%rax
mov    (%rax),%edi
mov    %rbx,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@SIG_SETMASK = global i32 0
define void @sig_blocknone() {
%1 = alloca i32
%2 = call i32 @sigemptyset(i32* %1)
%3 = load i32, i32* @SIG_SETMASK
%4 = call i32 @sigprocmask(i32 %3, i32* %1, i32 0)
ret void
}

LLVM IR (-O2):
@SIG_SETMASK = global i32 0
define void @sig_blocknone() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @sigemptyset(i32* %1)
%4 = load i32, i32* @SIG_SETMASK
%5 = call i32 @sigprocmask(i32 %4, i32* %1, i32 0)
ret void
}
char *copystr(s)
char *s;
{ return s; }


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

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

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

LLVM IR (-O2):
define i8* @copystr(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
struct varyad {
  int dummy;
};

/* Variables and functions */
scalar_t__ _foot(struct varyad const *);
size_t *_size_ptr(const struct varyad *v, size_t i) {
  return ((size_t *)_foot(v)) - i - 1;
}


x86 assembly (clang, -O0):
<_size_ptr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <_foot@plt>
xor    %ecx,%ecx
sub    -0x10(%rbp),%rcx
shl    $0x3,%rcx
add    %rcx,%rax
add    $0xfffffffffffffff8,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_size_ptr>:
push   %rbx
mov    %rsi,%rbx
call   1030 <_foot@plt>
shl    $0x3,%rbx
neg    %rbx
add    %rbx,%rax
add    $0xfffffffffffffff8,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.varyad = type { i32 }
define i64* @_size_ptr(%struct.varyad* %0, i64 %1) {
%3 = alloca %struct.varyad*
%4 = alloca i64
store %struct.varyad* %0, %struct.varyad** %3
store i64 %1, i64* %4
%5 = load %struct.varyad*, %struct.varyad** %3
%6 = call i64 @_foot(%struct.varyad* %5)
%7 = inttoptr i64 %6 to i64*
%8 = load i64, i64* %4
%9 = sub i64 0, %8
%10 = getelementptr inbounds i64, i64* %7, i64 %9
%11 = getelementptr inbounds i64, i64* %10, i64 -1
ret i64* %11
}

LLVM IR (-O2):
%struct.varyad = type { i32 }
define i64* @_size_ptr(%struct.varyad* %0, i64 %1) {
%3 = tail call i64 @_foot(%struct.varyad* %0)
%4 = inttoptr i64 %3 to i64*
%5 = sub i64 0, %1
%6 = getelementptr inbounds i64, i64* %4, i64 %5
%7 = getelementptr inbounds i64, i64* %6, i64 -1
ret i64* %7
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int *);
void main() {
  int a[10];
  a[1] = 117;
  f(1, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x75,-0x2c(%rbp)
lea    -0x30(%rbp),%rsi
mov    $0x1,%edi
call   1030 <f@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movl   $0x75,0x4(%rsp)
mov    %rsp,%rsi
mov    $0x1,%edi
call   1030 <f@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
define void @main() {
%1 = alloca [10 x i32]
%2 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 117, i32* %2
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @f(i32 1, i32* %3)
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
store i32 117, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @f(i32 1, i32* %4)
ret void
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int fstat(int, struct stat *);
int /*<<< orphan*/ reportError(struct stat *);
int target(int fd) {
  struct stat s;
  int b = fstat(fd, &s);
  if (b < 0) {
    reportError(&s);
    return -22;
  }
  return b + 1;
}


x86 assembly (clang, -O0):
<target>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    1159 <target+0x39>
lea    -0x10(%rbp),%rdi
call   1030 <reportError@plt>
movl   $0xffffffea,-0x4(%rbp)
jmp    1162 <target+0x42>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target>:
push   %rax
mov    %rsp,%rsi
call   1040 <fstat@plt>
test   %eax,%eax
js     1132 <target+0x12>
add    $0x1,%eax
pop    %rcx
ret
mov    %rsp,%rdi
call   1030 <reportError@plt>
mov    $0xffffffea,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
define i32 @target(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.stat
%5 = alloca i32
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = call i32 @fstat(i32 %6, %struct.stat* %4)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @reportError(%struct.stat* %4)
store i32 -22, i32* %2
br label %15
12: ; preds = %1
%13 = load i32, i32* %5
%14 = add nsw i32 %13, 1
store i32 %14, i32* %2
br label %15
15: ; preds = %12, %10
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @target(i32 %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @fstat(i32 %0, %struct.stat* %2)
%5 = icmp slt i32 %4, 0
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @reportError(%struct.stat* %2)
br label %10
8: ; preds = %1
%9 = add nuw nsw i32 %4, 1
br label %10
10: ; preds = %8, %6
%11 = phi i32 [ -22, %6 ], [ %9, %8 ]
ret i32 %11
}
void smp_yield(void) {}


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

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

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

LLVM IR (-O2):
define void @smp_yield() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
int sigignore(int sig) {
  __set_errno(ENOSYS);
  return -1;
}


x86 assembly (clang, -O0):
<sigignore>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@ENOSYS = global i32 0
define i32 @sigignore(i32 %0) {
%2 = load i32, i32* @ENOSYS
%3 = tail call i32 @__set_errno(i32 %2)
ret i32 -1
}
int execute_epoll_pwait() { return 0; }


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

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

LLVM IR (-O0):
define i32 @execute_epoll_pwait() {
ret i32 0
}

LLVM IR (-O2):
define i32 @execute_epoll_pwait() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
void require64BitLongs(void) {
  if (sizeof(long) != 8)
    die("The C long type is not 64 bits wide.");
}


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

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

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

LLVM IR (-O2):
define void @require64BitLongs() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ p(int *);
int q(void) {
  int x __attribute__((aligned(16)));
  p(&x);
  return x;
}


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

x86 assembly (clang, -O2):
<q>:
push   %rax
mov    %rsp,%rdi
call   1030 <p@plt>
mov    (%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @q() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @p(i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ htobe32(int /*<<< orphan*/);
void htonu32(unsigned char *buf, uint32_t number) {
  *(uint32_t *)buf = htobe32(number);
}


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

x86 assembly (clang, -O2):
<htonu32>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htobe32@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @htonu32(i8* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @htobe32(i32 %1)
%4 = bitcast i8* %0 to i32*
store i32 %3, i32* %4
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
scalar_t__ usrsctp_finish();
int /*<<< orphan*/ usrsctp_init(int /*<<< orphan*/, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *);
int main(void) {
  int i;
  for (i = 0; i < 10000; i++) {
    usrsctp_init(0, NULL, NULL);
    while (usrsctp_finish() != 0) {
      sleep(1);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x2710,-0x8(%rbp)
jge    1194 <main+0x64>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1040 <usrsctp_init@plt>
mov    $0x0,%al
call   1030 <usrsctp_finish@plt>
cmp    $0x0,%rax
je     1181 <main+0x51>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1161 <main+0x31>
jmp    1186 <main+0x56>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
jmp    114b <main+0x1b>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%ebx
cmp    $0x2710,%ebx
je     1178 <main+0x48>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1040 <usrsctp_init@plt>
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <usrsctp_finish@plt>
test   %rax,%rax
je     1140 <main+0x10>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1160 <main+0x30>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
br label %3
3: ; preds = %14, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 10000
br i1 %5, label %6, label %17
6: ; preds = %3
%7 = call i32 @usrsctp_init(i32 0, i32* null, i32* null)
br label %8
8: ; preds = %11, %6
%9 = call i64 (...) @usrsctp_finish()
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = call i32 @sleep(i32 1)
br label %8
13: ; preds = %8
br label %14
14: ; preds = %13
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %3
17: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %10
%2 = phi i32 [ 0, %0 ], [ %11, %10 ]
%3 = tail call i32 @usrsctp_init(i32 0, i32* null, i32* null)
%4 = tail call i64 (...) @usrsctp_finish()
%5 = icmp eq i64 %4, 0
br i1 %5, label %10, label %6
6: ; preds = %1, %6
%7 = tail call i32 @sleep(i32 1)
%8 = tail call i64 (...) @usrsctp_finish()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %6
10: ; preds = %6, %1
%11 = add nuw nsw i32 %2, 1
%12 = icmp eq i32 %11, 10000
br i1 %12, label %13, label %1
13: ; preds = %10
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ia_setbit32(uint32_t word, int i) { return word | (1 << i); }


x86 assembly (clang, -O0):
<ia_setbit32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x1,%edx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ia_setbit32>:
mov    %edi,%eax
bts    %esi,%eax
ret

LLVM IR (-O0):
define i32 @ia_setbit32(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 = shl i32 1, %6
%8 = or i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @ia_setbit32(i32 %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = or i32 %3, %0
ret i32 %4
}
void INFO() {}


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

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

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

LLVM IR (-O2):
define void @INFO() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ lib_g(int, void (*)(int));
void lib_f(int i, ...) { lib_g(i + 1, &lib_f); }


x86 assembly (clang, -O0):
<lib_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
mov    0x2ec0(%rip),%rsi
call   1030 <lib_g@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lib_f>:
add    $0x1,%edi
mov    0x2ece(%rip),%rsi
jmp    1030 <lib_g@plt>

LLVM IR (-O0):
define void @lib_f(i32 %0, ...) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 1
%5 = call i32 @lib_g(i32 %4, void (i32)* bitcast (void (i32, ...)* @lib_f to void (i32)*))
ret void
}

LLVM IR (-O2):
define void @lib_f(i32 %0, ...) {
%2 = add nsw i32 %0, 1
%3 = tail call i32 @lib_g(i32 %2, void (i32)* bitcast (void (i32, ...)* @lib_f to void (i32)*))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void display_version() {
  printf("Throttler "
         "0.1"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"Throttler 0.1\00"
define void @display_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int int16_t;

/* Variables and functions */
int levno();
int16_t levplan(void) {
  int16_t l = levno();
  if (l > 8)
    l = (l & 3) + 5;
  return l;
}


x86 assembly (clang, -O0):
<levplan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <levno@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x8,-0x4(%rbp)
jle    1138 <levplan+0x28>
mov    -0x4(%rbp),%eax
and    $0x3,%eax
add    $0x5,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<levplan>:
push   %rax
xor    %eax,%eax
call   1030 <levno@plt>
mov    %eax,%ecx
and    $0x3,%ecx
add    $0x5,%ecx
cmp    $0x9,%eax
cmovge %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @levplan() {
%1 = alloca i32
%2 = call i32 (...) @levno()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp sgt i32 %3, 8
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i32, i32* %1
%7 = and i32 %6, 3
%8 = add nsw i32 %7, 5
store i32 %8, i32* %1
br label %9
9: ; preds = %5, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @levplan() {
%1 = tail call i32 (...) @levno()
%2 = icmp sgt i32 %1, 8
%3 = and i32 %1, 3
%4 = add nuw nsw i32 %3, 5
%5 = select i1 %2, i32 %4, i32 %1
ret i32 %5
}
void NET_keypressed(int key) {}


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

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

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

LLVM IR (-O2):
define void @NET_keypressed(i32 %0) {
ret void
}
/* Type definitions */
struct l2conn {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct l2conn *);
void l2conn_free(struct l2conn *conn) { free(conn); }


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

x86 assembly (clang, -O2):
<l2conn_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
%struct.l2conn = type { i32 }
define void @l2conn_free(%struct.l2conn* nocapture %0) {
%2 = tail call i32 @free(%struct.l2conn* %0)
ret void
}
/* Variables and functions */
float __ocml_fma_rtn_f32(float, float, float);
float __fmaf_ru(float x, float y, float z) {
  return __ocml_fma_rtn_f32(x, y, z);
}


x86 assembly (clang, -O0):
<__fmaf_ru>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
call   1030 <__ocml_fma_rtn_f32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__fmaf_ru>:
jmp    1030 <__ocml_fma_rtn_f32@plt>

LLVM IR (-O0):
define float @__fmaf_ru(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %5
%9 = load float, float* %6
%10 = call float @__ocml_fma_rtn_f32(float %7, float %8, float %9)
ret float %10
}

LLVM IR (-O2):
define float @__fmaf_ru(float %0, float %1, float %2) {
%4 = tail call float @__ocml_fma_rtn_f32(float %0, float %1, float %2)
ret float %4
}