xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ getchar();
int /*<<< orphan*/ partition_array(int *, int);
int /*<<< orphan*/ stdout;
int main() {
  int a[4] = {100, 190, 10, 280};
  partition_array(a, 4);
  fprintf(stdout, "Press any key to exit...\n");
  getchar();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x4,%esi
call   1030 <partition_array@plt>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
lea    0xe9d(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xec5(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x4,%esi
call   1030 <partition_array@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
lea    0xeb4(%rip),%rsi
call   1050 <fprintf@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [4 x i32] [i32 100, i32 190, i32 10, i32 280]
@stdout = global i32 0
@.str = [26 x i8] c"Press any key to exit...\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = bitcast [4 x i32]* %2 to i8*
%4 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%5 = call i32 @partition_array(i32* %4, i32 4)
%6 = load i32, i32* @stdout
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @getchar()
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [4 x i32] [i32 100, i32 190, i32 10, i32 280]
@stdout = global i32 0
@.str = [26 x i8] c"Press any key to exit...\0A\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%4 = call i32 @partition_array(i32* %3, i32 4)
%5 = load i32, i32* @stdout
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (...) @getchar()
ret i32 0
}
/* Variables and functions */
int __VERIFIER_nondet_int();
scalar_t__ alloca(int);
int sumOfThirdBytes(int *, int);
int main() {
  int array_size = __VERIFIER_nondet_int();
  if (array_size < 1 || array_size >= 2147483647 / sizeof(int)) {
    array_size = 1;
  }
  int *numbers = (int *)alloca(array_size * sizeof(int));
  return sumOfThirdBytes(numbers, array_size);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <__VERIFIER_nondet_int@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     1163 <main+0x33>
movslq -0x8(%rbp),%rax
cmp    $0x1fffffff,%rax
jb     116a <main+0x3a>
movl   $0x1,-0x8(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <alloca@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1030 <sumOfThirdBytes@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <__VERIFIER_nondet_int@plt>
lea    -0x1fffffff(%rax),%ecx
cmp    $0xe0000002,%ecx
mov    $0x1,%ebx
cmovae %eax,%ebx
lea    0x0(,%rbx,4),%edi
call   1040 <alloca@plt>
mov    %rax,%rdi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <sumOfThirdBytes@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
%4 = call i32 (...) @__VERIFIER_nondet_int()
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 1
br i1 %6, label %11, label %7
7: ; preds = %0
%8 = load i32, i32* %2
%9 = sext i32 %8 to i64
%10 = icmp uge i64 %9, 536870911
br i1 %10, label %11, label %12
11: ; preds = %7, %0
store i32 1, i32* %2
br label %12
12: ; preds = %11, %7
%13 = load i32, i32* %2
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 4
%16 = trunc i64 %15 to i32
%17 = call i64 @alloca(i32 %16)
%18 = inttoptr i64 %17 to i32*
store i32* %18, i32** %3
%19 = load i32*, i32** %3
%20 = load i32, i32* %2
%21 = call i32 @sumOfThirdBytes(i32* %19, i32 %20)
ret i32 %21
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__VERIFIER_nondet_int()
%2 = add i32 %1, -536870911
%3 = icmp ult i32 %2, -536870910
%4 = select i1 %3, i32 1, i32 %1
%5 = shl nuw nsw i32 %4, 2
%6 = tail call i64 @alloca(i32 %5)
%7 = inttoptr i64 %6 to i32*
%8 = tail call i32 @sumOfThirdBytes(i32* %7, i32 %4)
ret i32 %8
}
void mdp4_dsi_cmd_pipe_commit(int cndx, int wait) {}


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

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

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

LLVM IR (-O2):
define void @mdp4_dsi_cmd_pipe_commit(i32 %0, i32 %1) {
ret void
}
unsigned char *reformat_short(unsigned char *ptr) {
  register unsigned short x;
  register unsigned short *temp;
  x = (unsigned short)*ptr;
  x |= (((unsigned short)*(ptr + 1)) << 8);
  temp = (unsigned short *)ptr;
  *temp++ = x;
  return ((unsigned char *)temp);
}


x86 assembly (clang, -O0):
<reformat_short>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
movzwl %ax,%ecx
shl    $0x8,%ecx
movzwl -0xa(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xa(%rbp),%cx
mov    -0x18(%rbp),%rax
mov    %rax,%rdx
add    $0x2,%rdx
mov    %rdx,-0x18(%rbp)
mov    %cx,(%rax)
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<reformat_short>:
lea    0x2(%rdi),%rax
ret

LLVM IR (-O0):
define i8* @reformat_short(i8* %0) {
%2 = alloca i8*
%3 = alloca i16
%4 = alloca i16*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i16
store i16 %7, i16* %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = zext i8 %10 to i16
%12 = zext i16 %11 to i32
%13 = shl i32 %12, 8
%14 = load i16, i16* %3
%15 = zext i16 %14 to i32
%16 = or i32 %15, %13
%17 = trunc i32 %16 to i16
store i16 %17, i16* %3
%18 = load i8*, i8** %2
%19 = bitcast i8* %18 to i16*
store i16* %19, i16** %4
%20 = load i16, i16* %3
%21 = load i16*, i16** %4
%22 = getelementptr inbounds i16, i16* %21, i32 1
store i16* %22, i16** %4
store i16 %20, i16* %21
%23 = load i16*, i16** %4
%24 = bitcast i16* %23 to i8*
ret i8* %24
}

LLVM IR (-O2):
define i8* @reformat_short(i8* %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = zext i8 %4 to i16
%6 = shl nuw i16 %5, 8
%7 = zext i8 %2 to i16
%8 = or i16 %6, %7
%9 = bitcast i8* %0 to i16*
%10 = getelementptr inbounds i8, i8* %0, i64 2
store i16 %8, i16* %9
ret i8* %10
}
/* Variables and functions */
int /*<<< orphan*/ IO_put_low_16b_hex(int);
int /*<<< orphan*/ IO_put_string(char const *);
void put_argument4(const char pre[], int word, const char post[]) {
  IO_put_string(pre);
  IO_put_low_16b_hex(word);
  IO_put_string(post);
}


x86 assembly (clang, -O0):
<put_argument4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <IO_put_string@plt>
mov    -0xc(%rbp),%edi
call   1040 <IO_put_low_16b_hex@plt>
mov    -0x18(%rbp),%rdi
call   1030 <IO_put_string@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_argument4>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%ebp
call   1030 <IO_put_string@plt>
mov    %ebp,%edi
call   1040 <IO_put_low_16b_hex@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <IO_put_string@plt>

LLVM IR (-O0):
define void @put_argument4(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** %4
%8 = call i32 @IO_put_string(i8* %7)
%9 = load i32, i32* %5
%10 = call i32 @IO_put_low_16b_hex(i32 %9)
%11 = load i8*, i8** %6
%12 = call i32 @IO_put_string(i8* %11)
ret void
}

LLVM IR (-O2):
define void @put_argument4(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @IO_put_string(i8* %0)
%5 = tail call i32 @IO_put_low_16b_hex(i32 %1)
%6 = tail call i32 @IO_put_string(i8* %2)
ret void
}
/* Variables and functions */
int b1_get_byte(unsigned int);
unsigned int b1_get_word(unsigned int base) {
  unsigned int val = 0;
  val |= b1_get_byte(base);
  val |= (b1_get_byte(base) << 8);
  val |= (b1_get_byte(base) << 16);
  val |= (b1_get_byte(base) << 24);
  return val;
}


x86 assembly (clang, -O0):
<b1_get_word>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <b1_get_byte@plt>
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <b1_get_byte@plt>
shl    $0x8,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <b1_get_byte@plt>
shl    $0x10,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <b1_get_byte@plt>
shl    $0x18,%eax
or     -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<b1_get_word>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %edi,%r15d
call   1030 <b1_get_byte@plt>
mov    %eax,%r14d
mov    %r15d,%edi
call   1030 <b1_get_byte@plt>
mov    %eax,%ebp
shl    $0x8,%ebp
or     %r14d,%ebp
mov    %r15d,%edi
call   1030 <b1_get_byte@plt>
mov    %eax,%ebx
shl    $0x10,%ebx
mov    %r15d,%edi
call   1030 <b1_get_byte@plt>
shl    $0x18,%eax
or     %ebx,%eax
or     %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @b1_get_word(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
%4 = load i32, i32* %2
%5 = call i32 @b1_get_byte(i32 %4)
%6 = load i32, i32* %3
%7 = or i32 %6, %5
store i32 %7, i32* %3
%8 = load i32, i32* %2
%9 = call i32 @b1_get_byte(i32 %8)
%10 = shl i32 %9, 8
%11 = load i32, i32* %3
%12 = or i32 %11, %10
store i32 %12, i32* %3
%13 = load i32, i32* %2
%14 = call i32 @b1_get_byte(i32 %13)
%15 = shl i32 %14, 16
%16 = load i32, i32* %3
%17 = or i32 %16, %15
store i32 %17, i32* %3
%18 = load i32, i32* %2
%19 = call i32 @b1_get_byte(i32 %18)
%20 = shl i32 %19, 24
%21 = load i32, i32* %3
%22 = or i32 %21, %20
store i32 %22, i32* %3
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
define i32 @b1_get_word(i32 %0) {
%2 = tail call i32 @b1_get_byte(i32 %0)
%3 = tail call i32 @b1_get_byte(i32 %0)
%4 = shl i32 %3, 8
%5 = or i32 %4, %2
%6 = tail call i32 @b1_get_byte(i32 %0)
%7 = shl i32 %6, 16
%8 = or i32 %5, %7
%9 = tail call i32 @b1_get_byte(i32 %0)
%10 = shl i32 %9, 24
%11 = or i32 %8, %10
ret i32 %11
}
int test_imm_E4uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xE4 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_E4uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 979252543488
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
char *gai_strerror(int errcode) {
  ;
  errno = ENOSYS;
  return NULL;
  ;
}


x86 assembly (clang, -O0):
<gai_strerror>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0x2eda(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec1(%rip),%rax
mov    %ecx,(%rax)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define noalias i8* @gai_strerror(i32 %0) {
%2 = load i32, i32* @ENOSYS
store i32 %2, i32* @errno
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ use_and_mayinit(int, int *);
void call_to_use_and_mayinit_bad() {
  int x;
  use_and_mayinit(x, &x);
}


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

x86 assembly (clang, -O2):
<call_to_use_and_mayinit_bad>:
push   %rax
lea    0x4(%rsp),%rsi
call   1030 <use_and_mayinit@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @call_to_use_and_mayinit_bad() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @use_and_mayinit(i32 undef, i32* %1)
ret void
}
float graddotp2(float gx, float gy, float x, float y) {
  return gx * x + gy * y;
}


x86 assembly (clang, -O0):
<graddotp2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0x10(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<graddotp2>:
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @graddotp2(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %7
%11 = load float, float* %6
%12 = load float, float* %8
%13 = fmul float %11, %12
%14 = call float @llvm.fmuladd.f32(float %9, float %10, float %13)
ret float %14
}

LLVM IR (-O2):
define float @graddotp2(float %0, float %1, float %2, float %3) {
%5 = fmul float %1, %3
%6 = tail call float @llvm.fmuladd.f32(float %0, float %2, float %5)
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ sscanf(char *, char *, void **);
void *argsfromperl(char *arg) {
  void *my_arg;
  sscanf(arg, "%p", &my_arg);
  return my_arg;
}


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

x86 assembly (clang, -O2):
<argsfromperl>:
push   %rax
lea    0xee8(%rip),%rsi
mov    %rsp,%rdx
call   1030 <sscanf@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%p\00"
define i8* @argsfromperl(i8* nocapture %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @sscanf(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2)
%5 = load i8*, i8** %2
ret i8* %5
}
/* Variables and functions */
int /*<<< orphan*/ pad_set(int, int);
int(cmd_b)(int c, char **v) {
  pad_set((0x20), v[0][0] == '+');
  return 0;
}


x86 assembly (clang, -O0):
<cmd_b>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
sete   %al
and    $0x1,%al
movzbl %al,%esi
mov    $0x20,%edi
call   1030 <pad_set@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_b>:
push   %rax
mov    (%rsi),%rax
xor    %esi,%esi
cmpb   $0x2b,(%rax)
sete   %sil
mov    $0x20,%edi
call   1030 <pad_set@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cmd_b(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 = getelementptr inbounds i8*, i8** %5, i64 0
%7 = load i8*, i8** %6
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 43
%12 = zext i1 %11 to i32
%13 = call i32 @pad_set(i32 32, i32 %12)
ret i32 0
}

LLVM IR (-O2):
define i32 @cmd_b(i32 %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = load i8, i8* %3
%5 = icmp eq i8 %4, 43
%6 = zext i1 %5 to i32
%7 = tail call i32 @pad_set(i32 32, i32 %6)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t rgph_d2u64(double d) {
  uint64_t res;
  union {
    double d;
    uint64_t u;
  } u = {d};
  res = u.u;
  return res;
}


x86 assembly (clang, -O0):
<rgph_d2u64>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rgph_d2u64>:
movq   %xmm0,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i32 @rgph_d2u64(double %0) {
%2 = alloca double
%3 = alloca i32
%4 = alloca %union.anon
store double %0, double* %2
%5 = bitcast %union.anon* %4 to double*
%6 = load double, double* %2
store double %6, double* %5
%7 = bitcast %union.anon* %4 to i32*
%8 = load i32, i32* %7
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @rgph_d2u64(double %0) {
%2 = bitcast double %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
unsigned char f79(unsigned char x, int y) {
  return (x << y) + (x >> (8 * sizeof(unsigned char) - y));
}


x86 assembly (clang, -O0):
<f79>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
mov    -0x8(%rbp),%ecx
shl    %cl,%eax
movzbl -0x1(%rbp),%edx
movslq -0x8(%rbp),%rsi
mov    $0x8,%ecx
sub    %rsi,%rcx
sar    %cl,%edx
mov    %edx,%ecx
add    %ecx,%eax
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f79>:
mov    %esi,%ecx
mov    %edi,%eax
shl    %cl,%eax
mov    $0x8,%dl
sub    %cl,%dl
mov    %edx,%ecx
shr    %cl,%edi
add    %edi,%eax
ret

LLVM IR (-O0):
define zeroext i8 @f79(i8 zeroext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
%5 = load i8, i8* %3
%6 = zext i8 %5 to i32
%7 = load i32, i32* %4
%8 = shl i32 %6, %7
%9 = load i8, i8* %3
%10 = zext i8 %9 to i32
%11 = load i32, i32* %4
%12 = sext i32 %11 to i64
%13 = sub i64 8, %12
%14 = trunc i64 %13 to i32
%15 = ashr i32 %10, %14
%16 = add nsw i32 %8, %15
%17 = trunc i32 %16 to i8
ret i8 %17
}

LLVM IR (-O2):
define zeroext i8 @f79(i8 zeroext %0, i32 %1) {
%3 = zext i8 %0 to i32
%4 = shl i32 %3, %1
%5 = sub i32 8, %1
%6 = lshr i32 %3, %5
%7 = add nsw i32 %6, %4
%8 = trunc i32 %7 to i8
ret i8 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *);
int usage(char *progname) {
  printf("Usage: %s <directory> <file-for-output>\n", progname);
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: %s <directory> <file-for-output>\0A\00"
define i32 @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [41 x i8] c"Usage: %s <directory> <file-for-output>\0A\00"
define i32 @usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int addNumbers(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = 3, b = 4;
  int d = addNumbers(a, b);
  printf("Result %d", d);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <addNumbers@plt>
lea    0xec9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"Result %d\00"
define i32 @main() {
%1 = tail call i32 @addNumbers(i32 3, i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
size_t nmin(size_t a, size_t b) { return (a < b) ? a : b; }


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

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

LLVM IR (-O0):
define i64 @nmin(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 @nmin(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
void bu_compile_cdr(args) struct conscell *args;
{
  int n = bu_compile_arg_list(args);
  if (n != 1)
    goto er;
  EMIT1ATM("CDR");
  EMITEND();
  return;
er:
  cerror("cdr: wrong # of args", args);
}


x86 assembly (clang, -O0):
<bu_compile_cdr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <bu_compile_arg_list@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
je     1169 <bu_compile_cdr+0x29>
jmp    1183 <bu_compile_cdr+0x43>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1050 <EMIT1ATM@plt>
mov    $0x0,%al
call   1030 <EMITEND@plt>
jmp    1195 <bu_compile_cdr+0x55>
mov    -0x8(%rbp),%rsi
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1060 <cerror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bu_compile_cdr>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <bu_compile_arg_list@plt>
cmp    $0x1,%eax
jne    1166 <bu_compile_cdr+0x26>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1050 <EMIT1ATM@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <EMITEND@plt>
lea    0xe97(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1060 <cerror@plt>

LLVM IR (-O0):
%struct.conscell = type opaque
@.str = [4 x i8] c"CDR\00"
@.str.1 = [21 x i8] c"cdr: wrong # of args\00"
define void @bu_compile_cdr(%struct.conscell* %0) {
%2 = alloca %struct.conscell*
%3 = alloca i32
store %struct.conscell* %0, %struct.conscell** %2
%4 = load %struct.conscell*, %struct.conscell** %2
%5 = call i32 (%struct.conscell*, ...) bitcast (i32 (...)* @bu_compile_arg_list to i32 (%struct.conscell*, ...)*)(%struct.conscell* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 1
br i1 %7, label %8, label %9
8: ; preds = %1
br label %12
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @EMIT1ATM to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (...) @EMITEND()
br label %15
12: ; preds = %8
%13 = load %struct.conscell*, %struct.conscell** %2
%14 = call i32 (i8*, %struct.conscell*, ...) bitcast (i32 (...)* @cerror to i32 (i8*, %struct.conscell*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %struct.conscell* %13)
br label %15
15: ; preds = %12, %9
ret void
}

LLVM IR (-O2):
%struct.conscell = type opaque
@.str = [4 x i8] c"CDR\00"
@.str.1 = [21 x i8] c"cdr: wrong # of args\00"
define void @bu_compile_cdr(%struct.conscell* %0) {
%2 = tail call i32 (%struct.conscell*, ...) bitcast (i32 (...)* @bu_compile_arg_list to i32 (%struct.conscell*, ...)*)(%struct.conscell* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @EMIT1ATM to i32 (i8*, ...)*)(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (...) @EMITEND()
br label %9
7: ; preds = %1
%8 = tail call i32 (i8*, %struct.conscell*, ...) bitcast (i32 (...)* @cerror to i32 (i8*, %struct.conscell*, ...)*)(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), %struct.conscell* %0)
br label %9
9: ; preds = %7, %4
ret void
}
heynow() {
  long long int x = 10LL;
  unsigned long long int y = 9ULL;
  __complex__ float c, d, e;
  float f;
  c = 10.0 + 3.0fi;
  d = ~c;
  f = __real__ c;
  f = __imag__ d;
}


x86 assembly (clang, -O0):
<heynow>:
push   %rbp
mov    %rsp,%rbp
movq   $0xa,-0x10(%rbp)
movq   $0x9,-0x18(%rbp)
movss  0xee8(%rip),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x20(%rbp),%xmm1
movss  -0x1c(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  %xmm1,-0x28(%rbp)
movss  %xmm0,-0x24(%rbp)
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @heynow() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca { float, float }
%5 = alloca { float, float }
%6 = alloca { float, float }
%7 = alloca float
store i64 10, i64* %2
store i64 9, i64* %3
%8 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%9 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
store float 1.000000e+01, float* %8
store float 3.000000e+00, float* %9
%10 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%11 = load float, float* %10
%12 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 1
%13 = load float, float* %12
%14 = fneg float %13
%15 = getelementptr inbounds { float, float }, { float, float }* %5, i32 0, i32 0
%16 = getelementptr inbounds { float, float }, { float, float }* %5, i32 0, i32 1
store float %11, float* %15
store float %14, float* %16
%17 = getelementptr inbounds { float, float }, { float, float }* %4, i32 0, i32 0
%18 = load float, float* %17
store float %18, float* %7
%19 = getelementptr inbounds { float, float }, { float, float }* %5, i32 0, i32 1
%20 = load float, float* %19
store float %20, float* %7
%21 = load i32, i32* %1
ret i32 %21
}

LLVM IR (-O2):
define i32 @heynow() {
ret i32 undef
}
const char *circle_name() {
  char *foo = "Hello world";
  return foo;
}


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Hello world\00"
define i8* @circle_name() {
%1 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
%2 = load i8*, i8** %1
ret i8* %2
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello world\00"
define i8* @circle_name() {
ret i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int EXIT_SUCCESS;
long atol(char *);
long fakul(long);
int /*<<< orphan*/ printf(char *, long);
int main(int argc, char **args) {
  long zahl;
  zahl = atol(args[1]);
  zahl = fakul(zahl);
  printf("Ergebnis: %lu\n", zahl);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <fakul@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xe91(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e65(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1040 <atol@plt>
mov    %rax,%rdi
call   1050 <fakul@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
mov    0x2e88(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Ergebnis: %lu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i8**, i8*** %5
%8 = getelementptr inbounds i8*, i8** %7, i64 1
%9 = load i8*, i8** %8
%10 = call i64 @atol(i8* %9)
store i64 %10, i64* %6
%11 = load i64, i64* %6
%12 = call i64 @fakul(i64 %11)
store i64 %12, i64* %6
%13 = load i64, i64* %6
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %13)
%15 = load i32, i32* @EXIT_SUCCESS
ret i32 %15
}

LLVM IR (-O2):
@.str = [15 x i8] c"Ergebnis: %lu\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i64 @atol(i8* %4)
%6 = tail call i64 @fakul(i64 %5)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i64 %6)
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
struct proto_hdr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ proto_field_set_bytes(struct proto_hdr *, int /*<<< orphan*/,
                                         int /*<<< orphan*/ *);
void proto_field_set_u32(struct proto_hdr *hdr, uint32_t fid, uint32_t val) {
  proto_field_set_bytes(hdr, fid, (uint8_t *)&val);
}


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

x86 assembly (clang, -O2):
<proto_field_set_u32>:
push   %rax
mov    %edx,0x4(%rsp)
lea    0x4(%rsp),%rdx
call   1030 <proto_field_set_bytes@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.proto_hdr = type { i32 }
define void @proto_field_set_u32(%struct.proto_hdr* %0, i32 %1, i32 %2) {
%4 = alloca %struct.proto_hdr*
%5 = alloca i32
%6 = alloca i32
store %struct.proto_hdr* %0, %struct.proto_hdr** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load %struct.proto_hdr*, %struct.proto_hdr** %4
%8 = load i32, i32* %5
%9 = call i32 @proto_field_set_bytes(%struct.proto_hdr* %7, i32 %8, i32* %6)
ret void
}

LLVM IR (-O2):
%struct.proto_hdr = type { i32 }
define void @proto_field_set_u32(%struct.proto_hdr* %0, i32 %1, i32 %2) {
%4 = alloca i32
store i32 %2, i32* %4
%5 = call i32 @proto_field_set_bytes(%struct.proto_hdr* %0, i32 %1, i32* %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void timer_phase(unsigned int frequency) {
  int divisor = 1193180 / frequency;
  outb(0x43, 0x36);
  outb(0x40, divisor & 0xFF);
  outb(0x40, divisor >> 8);
}


x86 assembly (clang, -O0):
<timer_phase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1234dc,%eax
xor    %edx,%edx
divl   -0x4(%rbp)
mov    %eax,-0x8(%rbp)
mov    $0x43,%edi
mov    $0x36,%esi
call   1030 <outb@plt>
mov    -0x8(%rbp),%esi
and    $0xff,%esi
mov    $0x40,%edi
call   1030 <outb@plt>
mov    -0x8(%rbp),%esi
sar    $0x8,%esi
mov    $0x40,%edi
call   1030 <outb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_phase>:
push   %rbx
mov    $0x1234dc,%eax
xor    %edx,%edx
div    %edi
mov    %eax,%ebx
mov    $0x43,%edi
mov    $0x36,%esi
call   1030 <outb@plt>
movzbl %bl,%esi
mov    $0x40,%edi
call   1030 <outb@plt>
shr    $0x8,%ebx
mov    $0x40,%edi
mov    %ebx,%esi
pop    %rbx
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @timer_phase(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 1193180, %4
store i32 %5, i32* %3
%6 = call i32 @outb(i32 67, i32 54)
%7 = load i32, i32* %3
%8 = and i32 %7, 255
%9 = call i32 @outb(i32 64, i32 %8)
%10 = load i32, i32* %3
%11 = ashr i32 %10, 8
%12 = call i32 @outb(i32 64, i32 %11)
ret void
}

LLVM IR (-O2):
define void @timer_phase(i32 %0) {
%2 = udiv i32 1193180, %0
%3 = tail call i32 @outb(i32 67, i32 54)
%4 = and i32 %2, 255
%5 = tail call i32 @outb(i32 64, i32 %4)
%6 = lshr i32 %2, 8
%7 = tail call i32 @outb(i32 64, i32 %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ get_3();
main() {
  get_3();
  goto end;
end:;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <get_3@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @get_3()
br label %2
2: ; preds = %0
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @get_3()
ret i32 0
}
void ex1() {}


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

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

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

LLVM IR (-O2):
define void @ex1() {
ret void
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ die(char *);
void *ecalloc(size_t num, size_t size) {
  void *ret;
  if (NULL == (ret = calloc(num, size)))
    die("out of memory");
  return ret;
}


x86 assembly (clang, -O0):
<ecalloc>:
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 <calloc@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    115b <ecalloc+0x3b>
lea    0xeaa(%rip),%rdi
call   1040 <die@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"out of memory\00"
define i8* @ecalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = icmp eq i8* null, %8
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %2
%13 = load i8*, i8** %5
ret i8* %13
}

LLVM IR (-O2):
@.str = [14 x i8] c"out of memory\00"
define noalias i8* @ecalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @die(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void _old_bar() {}


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

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

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

LLVM IR (-O2):
define void @_old_bar() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ timer_t;

/* Variables and functions */
int /*<<< orphan*/ guitp(char *, int);
void g_timer_t() { guitp("timer_t", sizeof(timer_t)); }


x86 assembly (clang, -O0):
<g_timer_t>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x4,%esi
call   1030 <guitp@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_timer_t>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
jmp    1030 <guitp@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"timer_t\00"
define void @g_timer_t() {
%1 = call i32 @guitp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"timer_t\00"
define void @g_timer_t() {
%1 = tail call i32 @guitp(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
/* Variables and functions */
scalar_t__ printf(char *);
void main() {
  if (printf("Hello World")) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x0,%rax
je     112f <main+0x1f>
jmp    112f <main+0x1f>
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [12 x i8] c"Hello World\00"
define void @main() {
%1 = call i64 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %4
3: ; preds = %0
br label %4
4: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hello World\00"
define void @main() {
%1 = tail call i64 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
int main() {
  char *mem = __builtin_alloca(40);
  __builtin___clear_cache(mem, mem + 40);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rax
mov    %rax,-0x10(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [40 x i8]
%2 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 0
%3 = getelementptr inbounds [40 x i8], [40 x i8]* %1, i64 0, i64 40
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ check(char *);
int /*<<< orphan*/ init(char *);
scalar_t__ malloc(int);
int main() {
  char *p;
  init(p);
  p = (char *)malloc(42);
  check(p);
  p[0] = '\n';
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rdi
call   1030 <init@plt>
mov    $0x2a,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <check@plt>
mov    -0x8(%rbp),%rax
movb   $0xa,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
call   1030 <init@plt>
mov    $0x2a,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <check@plt>
movb   $0xa,(%rbx)
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i8*
%2 = load i8*, i8** %1
%3 = call i32 @init(i8* %2)
%4 = call i64 @malloc(i32 42)
%5 = inttoptr i64 %4 to i8*
store i8* %5, i8** %1
%6 = load i8*, i8** %1
%7 = call i32 @check(i8* %6)
%8 = load i8*, i8** %1
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 10, i8* %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @init(i8* undef)
%2 = tail call i64 @malloc(i32 42)
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @check(i8* %3)
store i8 10, i8* %3
ret i32 0
}
/* Variables and functions */
int protect(int fd, size_t count, unsigned long offset, int prot) { return 0; }


x86 assembly (clang, -O0):
<protect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @protect(i32 %0, i64 %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i64 %1, i64* %6
store i64 %2, i64* %7
store i32 %3, i32* %8
ret i32 0
}

LLVM IR (-O2):
define i32 @protect(i32 %0, i64 %1, i64 %2, i32 %3) {
ret i32 0
}
/* Variables and functions */
double fmod(double, double);
double js_fmod(double d, double d2) { return fmod(d, d2); }


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

x86 assembly (clang, -O2):
<js_fmod>:
jmp    1030 <fmod@plt>

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

LLVM IR (-O2):
define double @js_fmod(double %0, double %1) {
%3 = tail call double @fmod(double %0, double %1)
ret double %3
}
int __svgalib_rendition_ingra(int index) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @__svgalib_rendition_ingra(i32 %0) {
ret i32 0
}
int vm86_mine(struct vm86_struct *v86) {
  int __res;
  __asm__ __volatile__("int $0x80\n"
                       : "=a"(__res)
                       : "a"((int)113), "b"((int)v86));
  return __res;
}


x86 assembly (clang, -O0):
<vm86_mine>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ebx
mov    $0x71,%eax
int    $0x80
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<vm86_mine>:
push   %rbx
mov    %rdi,%rbx
mov    $0x71,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
%struct.vm86_struct = type opaque
define i32 @vm86_mine(%struct.vm86_struct* %0) {
%2 = alloca %struct.vm86_struct*
%3 = alloca i32
store %struct.vm86_struct* %0, %struct.vm86_struct** %2
%4 = load %struct.vm86_struct*, %struct.vm86_struct** %2
%5 = ptrtoint %struct.vm86_struct* %4 to i32
%6 = call i32 asm sideeffect "int $$0x80\0A", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 113, i32 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
ret i32 %7
}

LLVM IR (-O2):
%struct.vm86_struct = type opaque
define i32 @vm86_mine(%struct.vm86_struct* %0) {
%2 = ptrtoint %struct.vm86_struct* %0 to i64
%3 = trunc i64 %2 to i32
%4 = tail call i32 asm sideeffect "int $$0x80\0A", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 113, i32 %3)
ret i32 %4
}
int bad_suppression_of_file_size() {}


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

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

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

LLVM IR (-O2):
define i32 @bad_suppression_of_file_size() {
ret i32 undef
}
void a7bcdefghijklmnopqrstuvwxzy() {}


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

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

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

LLVM IR (-O2):
define void @a7bcdefghijklmnopqrstuvwxzy() {
ret void
}
/* Variables and functions */
double fabs(int /*<<< orphan*/);
int /*<<< orphan*/ sqrt(int);
double distance(int x1, int y1, int x2, int y2) {
  int dx = x1 - x2;
  int dy = y1 - y2;
  return fabs(sqrt(dx * dx + dy * dy));
}


x86 assembly (clang, -O0):
<distance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
imul   -0x14(%rbp),%edi
mov    -0x18(%rbp),%eax
imul   -0x18(%rbp),%eax
add    %eax,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
call   1030 <fabs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<distance>:
push   %rax
sub    %edx,%edi
sub    %ecx,%esi
imul   %edi,%edi
imul   %esi,%esi
add    %esi,%edi
call   1040 <sqrt@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <fabs@plt>

LLVM IR (-O0):
define double @distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %7
%13 = sub nsw i32 %11, %12
store i32 %13, i32* %9
%14 = load i32, i32* %6
%15 = load i32, i32* %8
%16 = sub nsw i32 %14, %15
store i32 %16, i32* %10
%17 = load i32, i32* %9
%18 = load i32, i32* %9
%19 = mul nsw i32 %17, %18
%20 = load i32, i32* %10
%21 = load i32, i32* %10
%22 = mul nsw i32 %20, %21
%23 = add nsw i32 %19, %22
%24 = call i32 @sqrt(i32 %23)
%25 = call double @fabs(i32 %24)
ret double %25
}

LLVM IR (-O2):
define double @distance(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = sub nsw i32 %0, %2
%6 = sub nsw i32 %1, %3
%7 = mul nsw i32 %5, %5
%8 = mul nsw i32 %6, %6
%9 = add nuw nsw i32 %8, %7
%10 = tail call i32 @sqrt(i32 %9)
%11 = tail call double @fabs(i32 %10)
ret double %11
}
/* Type definitions */
struct katcp_dispatch {
  int dummy;
};

/* Variables and functions */
int update_flags_katcp(struct katcp_dispatch *, int, int);
int hide_cmd_katcp(struct katcp_dispatch *d, int argc) {
  return update_flags_katcp(d, argc, 0x1);
}


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

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

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

LLVM IR (-O2):
%struct.katcp_dispatch = type { i32 }
define i32 @hide_cmd_katcp(%struct.katcp_dispatch* %0, i32 %1) {
%3 = tail call i32 @update_flags_katcp(%struct.katcp_dispatch* %0, i32 %1, i32 1)
ret i32 %3
}