xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("In C, lowercase letters are significant.\n");
  printf("main() is where program execution begins.\n");
  printf(
      "Opening and closing braces enclose program statements in a routine.\n");
  printf("All program statements must be terminated by a semicolon.\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
call   1030 <printf@plt>
lea    0xf17(%rip),%rdi
call   1030 <printf@plt>
lea    0xf50(%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 <puts@plt>
lea    0xf05(%rip),%rdi
call   1030 <puts@plt>
lea    0xf23(%rip),%rdi
call   1030 <puts@plt>
lea    0xf5b(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [42 x i8] c"In C, lowercase letters are significant.\0A\00"
@.str.1 = [43 x i8] c"main() is where program execution begins.\0A\00"
@.str.2 = [69 x i8] c"Opening and closing braces enclose program statements in a routine.\0A\00"
@.str.3 = [59 x i8] c"All program statements must be terminated by a semicolon.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [41 x i8] c"In C, lowercase letters are significant.\00"
@str.4 = [42 x i8] c"main() is where program execution begins.\00"
@str.5 = [68 x i8] c"Opening and closing braces enclose program statements in a routine.\00"
@str.6 = [58 x i8] c"All program statements must be terminated by a semicolon.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.6, i64 0, i64 0))
ret i32 0
}
int config_MODULE_SERIAL(void) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @config_MODULE_SERIAL() {
ret i32 1
}
int show_moose_else_2() {}


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

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

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

LLVM IR (-O2):
define i32 @show_moose_else_2() {
ret i32 undef
}
int is_left(int key) { return key == 0x445b1b; }


x86 assembly (clang, -O0):
<is_left>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x445b1b,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_left>:
xor    %eax,%eax
cmp    $0x445b1b,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @is_left(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 4479771
%5 = zext i1 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @is_left(i32 %0) {
%2 = icmp eq i32 %0, 4479771
%3 = zext i1 %2 to i32
ret i32 %3
}
int ord(char c) { return c - '0'; }


x86 assembly (clang, -O0):
<ord>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
sub    $0x30,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ord>:
lea    -0x30(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @ord(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = sub nsw i32 %4, 48
ret i32 %5
}

LLVM IR (-O2):
define i32 @ord(i8 signext %0) {
%2 = sext i8 %0 to i32
%3 = add nsw i32 %2, -48
ret i32 %3
}
/* Variables and functions */
double ceil(double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("ceil of 2.3 is %.1f\n", ceil(2.3));
  printf("ceil of 3.8 is %.1f\n", ceil(3.8));
  printf("ceil of -2.3 is %.1f\n", ceil(-2.3));
  printf("ceil of -3.8 is %.1f\n", ceil(-3.8));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xef1(%rip),%xmm0
lea    0xef2(%rip),%rdi
call   1030 <printf@plt>
movsd  0xed5(%rip),%xmm0
lea    0xef3(%rip),%rdi
call   1030 <printf@plt>
movsd  0xeb9(%rip),%xmm0
lea    0xef4(%rip),%rdi
call   1030 <printf@plt>
movsd  0xe9d(%rip),%xmm0
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xf08(%rip),%rdi
movsd  0xee0(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf09(%rip),%rdi
movsd  0xed4(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf0a(%rip),%rdi
movsd  0xec8(%rip),%xmm0
call   1030 <printf@plt>
lea    0xf0c(%rip),%rdi
movsd  0xebc(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"ceil of 2.3 is %.1f\0A\00"
@.str.1 = [21 x i8] c"ceil of 3.8 is %.1f\0A\00"
@.str.2 = [22 x i8] c"ceil of -2.3 is %.1f\0A\00"
@.str.3 = [22 x i8] c"ceil of -3.8 is %.1f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @llvm.ceil.f64(double 2.300000e+00)
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double %2)
%4 = call double @llvm.ceil.f64(double 3.800000e+00)
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double %4)
%6 = call double @llvm.ceil.f64(double -2.300000e+00)
%7 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %6)
%8 = call double @llvm.ceil.f64(double -3.800000e+00)
%9 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [21 x i8] c"ceil of 2.3 is %.1f\0A\00"
@.str.1 = [21 x i8] c"ceil of 3.8 is %.1f\0A\00"
@.str.2 = [22 x i8] c"ceil of -2.3 is %.1f\0A\00"
@.str.3 = [22 x i8] c"ceil of -3.8 is %.1f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), double 3.000000e+00)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), double 4.000000e+00)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double -2.000000e+00)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double -3.000000e+00)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ msg_exit(char *, char *, char *, int);
void lsd_fatal_error(char *file, int line, char *mesg) {
  msg_exit("fatal error: %s: %s::%d", mesg, file, line);
}


x86 assembly (clang, -O0):
<lsd_fatal_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xecb(%rip),%rdi
call   1030 <msg_exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lsd_fatal_error>:
mov    %esi,%ecx
mov    %rdi,%rax
lea    0xee4(%rip),%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
jmp    1030 <msg_exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"fatal error: %s: %s::%d\00"
define void @lsd_fatal_error(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = call i32 @msg_exit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %8, i32 %9)
ret void
}

LLVM IR (-O2):
@.str = [24 x i8] c"fatal error: %s: %s::%d\00"
define void @lsd_fatal_error(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @msg_exit(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %0, i32 %1)
ret void
}
void DeleteBase(struct BaseTable **del) {}


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

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

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

LLVM IR (-O2):
%struct.BaseTable = type opaque
define void @DeleteBase(%struct.BaseTable** nocapture %0) {
ret void
}
void portModuleCpuTerm(void) {}


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

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

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

LLVM IR (-O2):
define void @portModuleCpuTerm() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef char int8_t;

/* Variables and functions */
int /*<<< orphan*/ size_buffer(char **, size_t *, size_t);
size_t int8Pack(const int8_t *data, char **buffer, size_t *size, size_t *pos) {
  size_buffer(buffer, size, *pos + sizeof(int8_t));
  (*buffer)[(*pos)++] = *data;
  return sizeof(uint8_t);
}


x86 assembly (clang, -O0):
<int8Pack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rax
mov    (%rax),%rdx
add    $0x1,%rdx
call   1030 <size_buffer@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%dl
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    -0x20(%rbp),%rsi
mov    (%rsi),%rcx
mov    %rcx,%rdi
add    $0x1,%rdi
mov    %rdi,(%rsi)
mov    %dl,(%rax,%rcx,1)
mov    $0x4,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<int8Pack>:
push   %r15
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    (%rcx),%rax
add    $0x1,%rax
mov    %rsi,%rdi
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <size_buffer@plt>
mov    (%r15),%al
mov    (%r14),%rcx
mov    (%rbx),%rdx
lea    0x1(%rdx),%rsi
mov    %rsi,(%rbx)
mov    %al,(%rcx,%rdx,1)
mov    $0x4,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @int8Pack(i8* %0, i8** %1, i64* %2, i64* %3) {
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i64*
%8 = alloca i64*
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i64* %2, i64** %7
store i64* %3, i64** %8
%9 = load i8**, i8*** %6
%10 = load i64*, i64** %7
%11 = load i64*, i64** %8
%12 = load i64, i64* %11
%13 = add i64 %12, 1
%14 = call i32 @size_buffer(i8** %9, i64* %10, i64 %13)
%15 = load i8*, i8** %5
%16 = load i8, i8* %15
%17 = load i8**, i8*** %6
%18 = load i8*, i8** %17
%19 = load i64*, i64** %8
%20 = load i64, i64* %19
%21 = add i64 %20, 1
store i64 %21, i64* %19
%22 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %16, i8* %22
ret i64 4
}

LLVM IR (-O2):
define i64 @int8Pack(i8* nocapture %0, i8** %1, i64* %2, i64* nocapture %3) {
%5 = load i64, i64* %3
%6 = add i64 %5, 1
%7 = tail call i32 @size_buffer(i8** %1, i64* %2, i64 %6)
%8 = load i8, i8* %0
%9 = load i8*, i8** %1
%10 = load i64, i64* %3
%11 = add i64 %10, 1
store i64 %11, i64* %3
%12 = getelementptr inbounds i8, i8* %9, i64 %10
store i8 %8, i8* %12
ret i64 4
}
void ff_h264qpel_init_aarch64() {}


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

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

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

LLVM IR (-O2):
define void @ff_h264qpel_init_aarch64() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ t(int);
int main() {
  t(1);
  t(2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <t@plt>
mov    $0x2,%edi
call   1030 <t@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @t(i32 1)
%2 = call i32 @t(i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @t(i32 1)
%2 = tail call i32 @t(i32 2)
ret i32 0
}
/* Variables and functions */
int CLZ(int);
int foo(int value) {
  if (value == 0)
    return 0;
  int bias = CLZ(value);
  value >>= bias;
  int zeros = CLZ(value << 1);
  value <<= zeros;
  int packed = (unsigned)(value << 9) >> 9;
  return packed;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1131 <foo+0x21>
movl   $0x0,-0x4(%rbp)
jmp    1172 <foo+0x62>
mov    -0x8(%rbp),%edi
call   1030 <CLZ@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%eax
sar    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
shl    $0x1,%edi
call   1030 <CLZ@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%ecx
mov    -0x8(%rbp),%eax
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x9,%eax
shr    $0x9,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbx
test   %edi,%edi
je     1134 <foo+0x24>
mov    %edi,%ebx
call   1030 <CLZ@plt>
mov    %eax,%ecx
sar    %cl,%ebx
lea    (%rbx,%rbx,1),%edi
call   1030 <CLZ@plt>
mov    %eax,%ecx
shl    %cl,%ebx
and    $0x7fffff,%ebx
jmp    1136 <foo+0x26>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %26
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @CLZ(i32 %11)
store i32 %12, i32* %4
%13 = load i32, i32* %4
%14 = load i32, i32* %3
%15 = ashr i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %3
%17 = shl i32 %16, 1
%18 = call i32 @CLZ(i32 %17)
store i32 %18, i32* %5
%19 = load i32, i32* %5
%20 = load i32, i32* %3
%21 = shl i32 %20, %19
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = shl i32 %22, 9
%24 = lshr i32 %23, 9
store i32 %24, i32* %6
%25 = load i32, i32* %6
store i32 %25, i32* %2
br label %26
26: ; preds = %10, %9
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @CLZ(i32 %0)
%5 = ashr i32 %0, %4
%6 = shl i32 %5, 1
%7 = tail call i32 @CLZ(i32 %6)
%8 = shl i32 %5, %7
%9 = and i32 %8, 8388607
br label %10
10: ; preds = %1, %3
%11 = phi i32 [ %9, %3 ], [ 0, %1 ]
ret i32 %11
}
/* Variables and functions */
void *mb_correct_addr_and_bit(int *, void *);
int test_bit(int, void *);
int mb_test_bit(int bit, void *addr) {
  addr = mb_correct_addr_and_bit(&bit, addr);
  return test_bit(bit, addr);
}


x86 assembly (clang, -O0):
<mb_test_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x4(%rbp),%rdi
call   1030 <mb_correct_addr_and_bit@plt>
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_bit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mb_test_bit>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <mb_correct_addr_and_bit@plt>
mov    0x4(%rsp),%edi
mov    %rax,%rsi
call   1040 <test_bit@plt>
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @mb_test_bit(i32 %0, i8* %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i8* @mb_correct_addr_and_bit(i32* %3, i8* %1)
%5 = load i32, i32* %3
%6 = call i32 @test_bit(i32 %5, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ empty_fun();
int fun(char x) {
  x = x + 1;
  ;
  x = x + 1;
  {
    int hej = !!empty_fun();
    (void)hej;
    return x;
  }
}


x86 assembly (clang, -O0):
<fun>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x1,%eax
mov    %al,-0x1(%rbp)
mov    $0x0,%al
call   1030 <empty_fun@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun>:
push   %rbx
mov    %edi,%ebx
add    $0x2,%bl
xor    %eax,%eax
call   1030 <empty_fun@plt>
movsbl %bl,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @fun(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 1
%7 = trunc i32 %6 to i8
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = sext i8 %8 to i32
%10 = add nsw i32 %9, 1
%11 = trunc i32 %10 to i8
store i8 %11, i8* %2
%12 = call i32 (...) @empty_fun()
%13 = icmp ne i32 %12, 0
%14 = xor i1 %13, true
%15 = xor i1 %14, true
%16 = zext i1 %15 to i32
store i32 %16, i32* %3
%17 = load i32, i32* %3
%18 = load i8, i8* %2
%19 = sext i8 %18 to i32
ret i32 %19
}

LLVM IR (-O2):
define i32 @fun(i8 signext %0) {
%2 = add i8 %0, 2
%3 = tail call i32 (...) @empty_fun()
%4 = sext i8 %2 to i32
ret i32 %4
}
OP(dd, df) {
  illegal_1();
  op_df();
}


x86 assembly (clang, -O0):
<OP>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <illegal_1@plt>
mov    $0x0,%al
call   1040 <op_df@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @OP(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = call i32 (...) @illegal_1()
%7 = call i32 (...) @op_df()
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @OP(i32 %0, i32 %1) {
%3 = tail call i32 (...) @illegal_1()
%4 = tail call i32 (...) @op_df()
ret i32 undef
}
/* Type definitions */
struct typ {
  int dummy;
};
struct module {
  int dummy;
};

/* Variables and functions */
struct typ *do_typ_create_tentative_functor(struct module *, struct typ *);
struct typ *typ_create_tentative_functor(struct module *trigger_mod,
                                         struct typ *t) {
  struct typ *r = do_typ_create_tentative_functor(trigger_mod, t);
  return r;
}


x86 assembly (clang, -O0):
<typ_create_tentative_functor>:
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   1030 <do_typ_create_tentative_functor@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<typ_create_tentative_functor>:
jmp    1030 <do_typ_create_tentative_functor@plt>

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

LLVM IR (-O2):
%struct.module = type { i32 }
%struct.typ = type { i32 }
define %struct.typ* @typ_create_tentative_functor(%struct.module* %0, %struct.typ* %1) {
%3 = tail call %struct.typ* @do_typ_create_tentative_functor(%struct.module* %0, %struct.typ* %1)
ret %struct.typ* %3
}
/* Variables and functions */
double exp(double);
double tanh(double x) { return (exp(x) - exp(-x)) / (exp(x) + exp(-x)); }


x86 assembly (clang, -O0):
<tanh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movsd  -0x18(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x10(%rbp),%xmm0
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tanh>:
sub    $0x38,%rsp
movaps %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0xed4(%rip),%xmm0
xorpd  0x10(%rsp),%xmm0
movapd %xmm0,0x20(%rsp)
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movaps 0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x20(%rsp),%xmm0
call   1030 <exp@plt>
addsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

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

LLVM IR (-O2):
define double @tanh(double %0) {
%2 = tail call double @exp(double %0)
%3 = fneg double %0
%4 = tail call double @exp(double %3)
%5 = fsub double %2, %4
%6 = tail call double @exp(double %0)
%7 = tail call double @exp(double %3)
%8 = fadd double %6, %7
%9 = fdiv double %5, %8
ret double %9
}
/* Variables and functions */
unsigned long IND(int);
int /*<<< orphan*/ OUTD(int, unsigned long);
unsigned long gfx_pci_config_read(unsigned long address) {
  unsigned long value = 0xFFFFFFFF;
  OUTD(0x0CF8, address);
  value = IND(0x0CFC);
  return (value);
}


x86 assembly (clang, -O0):
<gfx_pci_config_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xffffffff,%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rsi
mov    $0xcf8,%edi
call   1040 <OUTD@plt>
mov    $0xcfc,%edi
call   1030 <IND@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_pci_config_read>:
push   %rax
mov    %rdi,%rsi
mov    $0xcf8,%edi
call   1040 <OUTD@plt>
mov    $0xcfc,%edi
pop    %rax
jmp    1030 <IND@plt>

LLVM IR (-O0):
define i64 @gfx_pci_config_read(i64 %0) {
%2 = alloca i64
%3 = alloca i64
store i64 %0, i64* %2
store i64 4294967295, i64* %3
%4 = load i64, i64* %2
%5 = call i32 @OUTD(i32 3320, i64 %4)
%6 = call i64 @IND(i32 3324)
store i64 %6, i64* %3
%7 = load i64, i64* %3
ret i64 %7
}

LLVM IR (-O2):
define i64 @gfx_pci_config_read(i64 %0) {
%2 = tail call i32 @OUTD(i32 3320, i64 %0)
%3 = tail call i64 @IND(i32 3324)
ret i64 %3
}
int f15(int x, int y) {
  if (y >= 0 && y <= 24)
    return x % -y;
  return 34;
}


x86 assembly (clang, -O0):
<f15>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     1131 <f15+0x31>
cmpl   $0x18,-0xc(%rbp)
jg     1131 <f15+0x31>
mov    -0x8(%rbp),%eax
xor    %ecx,%ecx
sub    -0xc(%rbp),%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
jmp    1138 <f15+0x38>
movl   $0x22,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f15>:
mov    $0x22,%eax
cmp    $0x18,%esi
ja     1113 <f15+0x13>
neg    %esi
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f15(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %16
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sle i32 %9, 24
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = sub nsw i32 0, %13
%15 = srem i32 %12, %14
store i32 %15, i32* %3
br label %17
16: ; preds = %8, %2
store i32 34, i32* %3
br label %17
17: ; preds = %16, %11
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
define i32 @f15(i32 %0, i32 %1) {
%3 = icmp ult i32 %1, 25
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = sub nsw i32 0, %1
%6 = srem i32 %0, %5
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ %6, %4 ], [ 34, %2 ]
ret i32 %8
}
int function(void) { return 42; }


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

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

LLVM IR (-O0):
define i32 @function() {
ret i32 42
}

LLVM IR (-O2):
define i32 @function() {
ret i32 42
}
/* Variables and functions */
int sub1(int, int);
int sub2(int, int);
extern int sum(int a, int b) {
  int s1 = sub1(a, b);
  int s2 = sub2(a, b);
  return s1 + s2;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <sub1@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <sub2@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %edi,%ebp
call   1040 <sub1@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <sub2@plt>
add    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @sum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @sub1(i32 %7, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = call i32 @sub2(i32 %10, i32 %11)
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = add nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = tail call i32 @sub1(i32 %0, i32 %1)
%4 = tail call i32 @sub2(i32 %0, i32 %1)
%5 = add nsw i32 %4, %3
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main(int argc, char **argv) {
  int number;
  printf("Z-NIX booted, hello world! \n");
  printf("What is your favourite number? ");
  scanf("%s", &number);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeeb(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
call   1040 <printf@plt>
lea    0xed0(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Z-NIX booted, hello world! \0A\00"
@.str.1 = [32 x i8] c"What is your favourite number? \00"
@.str.2 = [3 x i8] c"%s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [32 x i8] c"What is your favourite number? \00"
@.str.2 = [3 x i8] c"%s\00"
@str = [28 x i8] c"Z-NIX booted, hello world! \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
ret i32 0
}
void memvol_async_wait() { debugI("%s (UNIMPLEMENTED m-dummy.c)\n", __func__); }


x86 assembly (clang, -O0):
<memvol_async_wait>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xefc(%rip),%rsi
mov    $0x0,%al
call   1030 <debugI@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<memvol_async_wait>:
lea    0xee9(%rip),%rdi
lea    0xf00(%rip),%rsi
xor    %eax,%eax
jmp    1030 <debugI@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"%s (UNIMPLEMENTED m-dummy.c)\0A\00"
@__func__.memvol_async_wait = [18 x i8] c"memvol_async_wait\00"
define void @memvol_async_wait() {
%1 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @debugI to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.memvol_async_wait, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [30 x i8] c"%s (UNIMPLEMENTED m-dummy.c)\0A\00"
@__func__.memvol_async_wait = [18 x i8] c"memvol_async_wait\00"
define void @memvol_async_wait() {
%1 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @debugI to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.memvol_async_wait, i64 0, i64 0))
ret void
}
const struct cpumask *uv_flush_tlb_others(const struct cpumask *cpumask,
                                          struct mm_struct *mm,
                                          unsigned long va, unsigned int cpu) {
  return cpumask;
}


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

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

LLVM IR (-O0):
%struct.cpumask = type opaque
%struct.mm_struct = type opaque
define %struct.cpumask* @uv_flush_tlb_others(%struct.cpumask* %0, %struct.mm_struct* %1, i64 %2, i32 %3) {
%5 = alloca %struct.cpumask*
%6 = alloca %struct.mm_struct*
%7 = alloca i64
%8 = alloca i32
store %struct.cpumask* %0, %struct.cpumask** %5
store %struct.mm_struct* %1, %struct.mm_struct** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load %struct.cpumask*, %struct.cpumask** %5
ret %struct.cpumask* %9
}

LLVM IR (-O2):
%struct.cpumask = type opaque
%struct.mm_struct = type opaque
define %struct.cpumask* @uv_flush_tlb_others(%struct.cpumask* readnone returned %0, %struct.mm_struct* nocapture readnone %1, i64 %2, i32 %3) {
ret %struct.cpumask* %0
}
unsigned char unsignedchar_ignoring_unsignedlongint(unsigned char x,
                                                    unsigned long int y) {
  return x;
}


x86 assembly (clang, -O0):
<unsignedchar_ignoring_unsignedlongint>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define zeroext i8 @unsignedchar_ignoring_unsignedlongint(i8 zeroext %0, i64 %1) {
%3 = alloca i8
%4 = alloca i64
store i8 %0, i8* %3
store i64 %1, i64* %4
%5 = load i8, i8* %3
ret i8 %5
}

LLVM IR (-O2):
define zeroext i8 @unsignedchar_ignoring_unsignedlongint(i8 returned zeroext %0, i64 %1) {
ret i8 %0
}
/* Variables and functions */
void a_test() {
  int *s = NULL;
  *s = 42;
}


x86 assembly (clang, -O0):
<a_test>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x2a,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
LLVM IR (-O0):
define void @a_test() {
%1 = alloca i32*
store i32* null, i32** %1
%2 = load i32*, i32** %1
store i32 42, i32* %2
ret void
}

LLVM IR (-O2):
/* Variables and functions */
int /*<<< orphan*/ close(int);
void close_file(int fd) { close(fd); }


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @BsdFragHashReset() {
ret void
}
/* Type definitions */
struct vec4i {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ vec4i_normalize(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
__attribute__((always_)) struct vec4i *psvec4i_normalize(struct vec4i *result,
                                                         struct vec4i *a) {
  vec4i_normalize((int32_t *)result, (int32_t *)a);
  return result;
}


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

x86 assembly (clang, -O2):
<psvec4i_normalize>:
push   %rbx
mov    %rdi,%rbx
call   1030 <vec4i_normalize@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i_normalize(%struct.vec4i* %0, %struct.vec4i* %1) {
%3 = alloca %struct.vec4i*
%4 = alloca %struct.vec4i*
store %struct.vec4i* %0, %struct.vec4i** %3
store %struct.vec4i* %1, %struct.vec4i** %4
%5 = load %struct.vec4i*, %struct.vec4i** %3
%6 = bitcast %struct.vec4i* %5 to i32*
%7 = load %struct.vec4i*, %struct.vec4i** %4
%8 = bitcast %struct.vec4i* %7 to i32*
%9 = call i32 @vec4i_normalize(i32* %6, i32* %8)
%10 = load %struct.vec4i*, %struct.vec4i** %3
ret %struct.vec4i* %10
}

LLVM IR (-O2):
%struct.vec4i = type { i32 }
define %struct.vec4i* @psvec4i_normalize(%struct.vec4i* returned %0, %struct.vec4i* %1) {
%3 = getelementptr %struct.vec4i, %struct.vec4i* %0, i64 0, i32 0
%4 = getelementptr %struct.vec4i, %struct.vec4i* %1, i64 0, i32 0
%5 = tail call i32 @vec4i_normalize(i32* %3, i32* %4)
ret %struct.vec4i* %0
}
const char *obs_get_version_string(void) { return "unknown"; }


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"unknown\00"
define i8* @obs_get_version_string() {
ret i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ comprintf(char *, char const *, char const *);
void gen_readword(const char *address, const char *dest) {
  comprintf("\treadword(%s,%s,scratchie);\n", address, dest);
}


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

x86 assembly (clang, -O2):
<gen_readword>:
mov    %rsi,%rdx
mov    %rdi,%rsi
lea    0xee3(%rip),%rdi
jmp    1030 <comprintf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"\09readword(%s,%s,scratchie);\0A\00"
define void @gen_readword(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 @comprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"\09readword(%s,%s,scratchie);\0A\00"
define void @gen_readword(i8* %0, i8* %1) {
%3 = tail call i32 @comprintf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
int test_imm_4Fint8_mem(signed char *val) {
  return ((*val) & (0x4F << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_4Fint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, 79
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int toint(int c) {
  if (c >= '0' && c <= '9') {
    return (c - '0');
  }
  if (c >= 'A' && c <= 'F') {
    return (c - 'A' + 10);
  }
  if (c >= 'a' && c <= 'f') {
    return (c - 'a' + 10);
  }
  return (0);
}


x86 assembly (clang, -O0):
<toint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x30,-0x8(%rbp)
jl     1129 <toint+0x29>
cmpl   $0x39,-0x8(%rbp)
jg     1129 <toint+0x29>
mov    -0x8(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <toint+0x7a>
cmpl   $0x41,-0x8(%rbp)
jl     114e <toint+0x4e>
cmpl   $0x46,-0x8(%rbp)
jg     114e <toint+0x4e>
mov    -0x8(%rbp),%eax
sub    $0x41,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <toint+0x7a>
cmpl   $0x61,-0x8(%rbp)
jl     1173 <toint+0x73>
cmpl   $0x66,-0x8(%rbp)
jg     1173 <toint+0x73>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <toint+0x7a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toint>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
jb     1124 <toint+0x24>
lea    -0x41(%rdi),%eax
cmp    $0x5,%eax
ja     1116 <toint+0x16>
add    $0xffffffc9,%edi
mov    %edi,%eax
ret
lea    -0x61(%rdi),%ecx
add    $0xffffffa9,%edi
xor    %eax,%eax
cmp    $0x6,%ecx
cmovb  %edi,%eax
ret

LLVM IR (-O0):
define i32 @toint(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 57
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 48
store i32 %11, i32* %2
br label %33
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 65
br i1 %14, label %15, label %22
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 70
br i1 %17, label %18, label %22
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 65
%21 = add nsw i32 %20, 10
store i32 %21, i32* %2
br label %33
22: ; preds = %15, %12
%23 = load i32, i32* %3
%24 = icmp sge i32 %23, 97
br i1 %24, label %25, label %32
25: ; preds = %22
%26 = load i32, i32* %3
%27 = icmp sle i32 %26, 102
br i1 %27, label %28, label %32
28: ; preds = %25
%29 = load i32, i32* %3
%30 = sub nsw i32 %29, 97
%31 = add nsw i32 %30, 10
store i32 %31, i32* %2
br label %33
32: ; preds = %25, %22
store i32 0, i32* %2
br label %33
33: ; preds = %32, %28, %18, %9
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @toint(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = add i32 %0, -65
%6 = icmp ult i32 %5, 6
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = add nsw i32 %0, -55
br label %14
9: ; preds = %4
%10 = add i32 %0, -97
%11 = icmp ult i32 %10, 6
%12 = add nsw i32 %0, -87
%13 = select i1 %11, i32 %12, i32 0
br label %14
14: ; preds = %1, %9, %7
%15 = phi i32 [ %8, %7 ], [ %13, %9 ], [ %2, %1 ]
ret i32 %15
}
/* Variables and functions */
double exp(scalar_t__);
scalar_t__ lgamma(int);
double BinomialCoefficient(int n, int k) {
  return exp(lgamma(n + 1) - lgamma(k + 1) - lgamma(n - k + 1));
}


x86 assembly (clang, -O0):
<BinomialCoefficient>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
add    $0x1,%edi
call   1040 <lgamma@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
add    $0x1,%edi
call   1040 <lgamma@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
add    $0x1,%edi
call   1040 <lgamma@plt>
mov    -0x10(%rbp),%rdi
sub    %rax,%rdi
call   1030 <exp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BinomialCoefficient>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%ebp
add    $0x1,%ebp
mov    %ebp,%edi
call   1040 <lgamma@plt>
mov    %rax,%rbx
lea    0x1(%r14),%edi
call   1040 <lgamma@plt>
mov    %rax,%r15
sub    %r14d,%ebp
mov    %ebp,%edi
call   1040 <lgamma@plt>
add    %r15,%rax
sub    %rax,%rbx
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <exp@plt>

LLVM IR (-O0):
define double @BinomialCoefficient(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 = add nsw i32 %5, 1
%7 = call i64 @lgamma(i32 %6)
%8 = load i32, i32* %4
%9 = add nsw i32 %8, 1
%10 = call i64 @lgamma(i32 %9)
%11 = sub nsw i64 %7, %10
%12 = load i32, i32* %3
%13 = load i32, i32* %4
%14 = sub nsw i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = call i64 @lgamma(i32 %15)
%17 = sub nsw i64 %11, %16
%18 = call double @exp(i64 %17)
ret double %18
}

LLVM IR (-O2):
define double @BinomialCoefficient(i32 %0, i32 %1) {
%3 = add i32 %0, 1
%4 = tail call i64 @lgamma(i32 %3)
%5 = add nsw i32 %1, 1
%6 = tail call i64 @lgamma(i32 %5)
%7 = sub i32 %3, %1
%8 = tail call i64 @lgamma(i32 %7)
%9 = add i64 %6, %8
%10 = sub i64 %4, %9
%11 = tail call double @exp(i64 %10)
ret double %11
}
double subb(double f, double g, long l) { return !l ? f : g; }


x86 assembly (clang, -O0):
<subb>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    112c <subb+0x2c>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1136 <subb+0x36>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<subb>:
test   %rdi,%rdi
je     1108 <subb+0x8>
movaps %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @subb(double %0, double %1, i64 %2) {
%4 = icmp eq i64 %2, 0
%5 = select i1 %4, double %0, double %1
ret double %5
}
/* Type definitions */
typedef int /*<<< orphan*/ wint_t;

/* Variables and functions */
int __infer_nondet_int();
int iswgraph(wint_t wc) { return __infer_nondet_int(); }


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

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

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

LLVM IR (-O2):
define i32 @iswgraph(i32 %0) {
%2 = tail call i32 (...) @__infer_nondet_int()
ret i32 %2
}
int ast_hashtab_hash_int(const int x, int modulus) { return (x % modulus); }


x86 assembly (clang, -O0):
<ast_hashtab_hash_int>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ast_hashtab_hash_int>:
mov    %edi,%eax
cltd
idiv   %esi
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @ast_hashtab_hash_int(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 = srem i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @ast_hashtab_hash_int(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
void INT_Excep_PERIB_INTB139(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB139() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void showHelp() {
  printf(
      "Usage: ./steg-encode.o file1.ppm encodedfile.ppm \"text to encode\"\n");
}


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

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

LLVM IR (-O0):
@.str = [67 x i8] c"Usage: ./steg-encode.o file1.ppm encodedfile.ppm \22text to encode\22\0A\00"
define void @showHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [66 x i8] c"Usage: ./steg-encode.o file1.ppm encodedfile.ppm \22text to encode\22\00"
define void @showHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint16_t;

/* Variables and functions */
bool s2010_get_duplicate(const uint16_t *p_s2010) { return p_s2010[0] & 0x01; }


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

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

LLVM IR (-O0):
define i32 @s2010_get_duplicate(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32, i32* %4
%6 = and i32 %5, 1
ret i32 %6
}

LLVM IR (-O2):
define i32 @s2010_get_duplicate(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 1
ret i32 %3
}