xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float milhas;
  scanf("%f", &milhas);
  printf("%f", (milhas * 1.61));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xed2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeb0(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xedc(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xeb5(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fmul double %5, 1.610000e+00
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%4 = load float, float* %1
%5 = fpext float %4 to double
%6 = fmul double %5, 1.610000e+00
%7 = fptrunc double %6 to float
%8 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ operand(int /*<<< orphan*/, int);
lea() { operand(0, 0x08); }


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

x86 assembly (clang, -O2):
<lea>:
xor    %edi,%edi
mov    $0x8,%esi
jmp    1030 <operand@plt>

LLVM IR (-O0):
define i32 @lea() {
%1 = alloca i32
%2 = call i32 @operand(i32 0, i32 8)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @lea() {
%1 = tail call i32 @operand(i32 0, i32 8)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ fixpt_add(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fixpt_from_int(int);
int fixpt_to_int(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  assert(fixpt_to_int(fixpt_add(fixpt_from_int(1), fixpt_from_int(1))) == 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x1,%edi
call   1030 <fixpt_from_int@plt>
mov    %eax,-0x14(%rbp)
mov    $0x1,%edi
call   1030 <fixpt_from_int@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%esi
call   1060 <fixpt_add@plt>
mov    %eax,%edi
call   1050 <fixpt_to_int@plt>
cmp    $0x2,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%edi
call   1030 <fixpt_from_int@plt>
mov    %eax,%ebx
mov    $0x1,%edi
call   1030 <fixpt_from_int@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1060 <fixpt_add@plt>
mov    %eax,%edi
call   1050 <fixpt_to_int@plt>
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @fixpt_from_int(i32 1)
%7 = call i32 @fixpt_from_int(i32 1)
%8 = call i32 @fixpt_add(i32 %6, i32 %7)
%9 = call i32 @fixpt_to_int(i32 %8)
%10 = icmp eq i32 %9, 2
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @fixpt_from_int(i32 1)
%4 = tail call i32 @fixpt_from_int(i32 1)
%5 = tail call i32 @fixpt_add(i32 %3, i32 %4)
%6 = tail call i32 @fixpt_to_int(i32 %5)
%7 = icmp eq i32 %6, 2
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
ret i32 0
}
/* Variables and functions */
int LITTLE_ENDIAN;
int get_system_endian(void) { return LITTLE_ENDIAN; }


x86 assembly (clang, -O0):
<get_system_endian>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_system_endian>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
@LITTLE_ENDIAN = global i32 0
define i32 @get_system_endian() {
%1 = load i32, i32* @LITTLE_ENDIAN
ret i32 %1
}

LLVM IR (-O2):
@LITTLE_ENDIAN = global i32 0
define i32 @get_system_endian() {
%1 = load i32, i32* @LITTLE_ENDIAN
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void SchemeAbort(void) {
  abort();
  for (;;)
    exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<SchemeAbort>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<SchemeAbort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
define void @SchemeAbort() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
define void @SchemeAbort() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ChangeIntWithPointer(int *, int);
int *GetIntPointer(char *);
int *malloc(int);
int /*<<< orphan*/ printf(char *, int);
void Ex7_Pointers() {
  int *ptr = malloc(sizeof(*ptr));
  ptr = GetIntPointer("Give input: ");
  printf("%d\n", *ptr);
  ChangeIntWithPointer(ptr, 10);
  printf("%d\n", *ptr);
}


x86 assembly (clang, -O0):
<Ex7_Pointers>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,-0x8(%rbp)
lea    0xea3(%rip),%rdi
call   1060 <GetIntPointer@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1040 <ChangeIntWithPointer@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Ex7_Pointers>:
push   %r14
push   %rbx
push   %rax
mov    $0x4,%edi
call   1050 <malloc@plt>
lea    0xeab(%rip),%rdi
call   1060 <GetIntPointer@plt>
mov    %rax,%rbx
mov    (%rax),%esi
lea    0xea7(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <ChangeIntWithPointer@plt>
mov    (%rbx),%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"Give input: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @Ex7_Pointers() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 4)
store i32* %2, i32** %1
%3 = call i32* @GetIntPointer(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
store i32* %3, i32** %1
%4 = load i32*, i32** %1
%5 = load i32, i32* %4
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%7 = load i32*, i32** %1
%8 = call i32 @ChangeIntWithPointer(i32* %7, i32 10)
%9 = load i32*, i32** %1
%10 = load i32, i32* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Give input: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
define void @Ex7_Pointers() {
%1 = tail call i32* @malloc(i32 4)
%2 = tail call i32* @GetIntPointer(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %2
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = tail call i32 @ChangeIntWithPointer(i32* %2, i32 10)
%6 = load i32, i32* %2
%7 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %6)
ret void
}
int ht_hfdef(const char *s) {
  int rv;
  for (rv = 0; *s; s++)
    rv = rv * 31 + *s;
  return rv;
}


x86 assembly (clang, -O0):
<ht_hfdef>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     113d <ht_hfdef+0x3d>
imul   $0x1f,-0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
movsbl (%rcx),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <ht_hfdef+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ht_hfdef>:
mov    (%rdi),%cl
test   %cl,%cl
je     1128 <ht_hfdef+0x28>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
movsbl %cl,%eax
add    %edx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <ht_hfdef+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @ht_hfdef(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = mul nsw i32 %6, 31
%9 = sext i8 %5 to i32
%10 = add nsw i32 %8, %9
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %15
}
/* Variables and functions */
double cos(double);
double cos_(double x) { return cos(x); }


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

x86 assembly (clang, -O2):
<cos_>:
jmp    1030 <cos@plt>

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

LLVM IR (-O2):
define double @cos_(double %0) {
%2 = tail call double @cos(double %0)
ret double %2
}
void wrmsrl(unsigned long msr, unsigned long long val) {
  unsigned long lo, hi;
  lo = (unsigned long)val;
  hi = val >> 32;
  __asm__ __volatile__("wrmsr" : : "c"(msr), "a"(lo), "d"(hi));
}


x86 assembly (clang, -O0):
<wrmsrl>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
shr    $0x20,%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rdx
wrmsr
pop    %rbp
ret

x86 assembly (clang, -O2):
<wrmsrl>:
mov    %rsi,%rax
mov    %rdi,%rcx
mov    %rsi,%rdx
shr    $0x20,%rdx
wrmsr
ret

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

LLVM IR (-O2):
define void @wrmsrl(i64 %0, i64 %1) {
%3 = lshr i64 %1, 32
tail call void asm sideeffect "wrmsr", "{cx},{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i64 %0, i64 %1, i64 %3)
ret void
}
int test_imm_B9int32_mem(int *val) {
  return ((*val) & (0xB9 << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_B9int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 185
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
float Section2Perim(float radius) { return radius * 2 * 3.141592; }


x86 assembly (clang, -O0):
<Section2Perim>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef7(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xede(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section2Perim>:
addss  %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xef0(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @Section2Perim(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fmul float %3, 2.000000e+00
%5 = fpext float %4 to double
%6 = fmul double %5, 0x400921FAFC8B007A
%7 = fptrunc double %6 to float
ret float %7
}

LLVM IR (-O2):
define float @Section2Perim(float %0) {
%2 = fmul float %0, 2.000000e+00
%3 = fpext float %2 to double
%4 = fmul double %3, 0x400921FAFC8B007A
%5 = fptrunc double %4 to float
ret float %5
}
int liq2(liquid)
int liquid;
{
  switch (liquid) {
  case 4:
    return (81);
  case 5:
    return (83);
  case 6:
    return (85);
  default:
    return (0);
  }
}


x86 assembly (clang, -O0):
<liq2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x4,%eax
je     113d <liq2+0x3d>
jmp    111b <liq2+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x5,%eax
je     1149 <liq2+0x49>
jmp    112c <liq2+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x6,%eax
je     1155 <liq2+0x55>
jmp    1161 <liq2+0x61>
movl   $0x51,-0x4(%rbp)
jmp    1168 <liq2+0x68>
movl   $0x53,-0x4(%rbp)
jmp    1168 <liq2+0x68>
movl   $0x55,-0x4(%rbp)
jmp    1168 <liq2+0x68>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<liq2>:
lea    -0x4(%rdi),%eax
xor    %ecx,%ecx
cmp    $0x3,%eax
lea    0x49(%rdi,%rdi,1),%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @liq2(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %8 [
i32 4, label %5
i32 5, label %6
i32 6, label %7
]
5: ; preds = %1
store i32 81, i32* %2
br label %9
6: ; preds = %1
store i32 83, i32* %2
br label %9
7: ; preds = %1
store i32 85, i32* %2
br label %9
8: ; preds = %1
store i32 0, i32* %2
br label %9
9: ; preds = %8, %7, %6, %5
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
define i32 @liq2(i32 %0) {
%2 = add i32 %0, -4
%3 = icmp ult i32 %2, 3
%4 = shl i32 %2, 1
%5 = add i32 %4, 81
%6 = select i1 %3, i32 %5, i32 0
ret i32 %6
}
void g_unichar_isdefined() {}


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

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

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

LLVM IR (-O2):
define void @g_unichar_isdefined() {
ret void
}
cbuf3(f, n) int f, n;
{ cbuf(f, n, 3); }


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

x86 assembly (clang, -O2):
<cbuf3>:
mov    $0x3,%edx
xor    %eax,%eax
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf3(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* %4
%7 = load i32, i32* %5
%8 = call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %6, i32 %7, i32 3)
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @cbuf3(i32 %0, i32 %1) {
%3 = tail call i32 (i32, i32, i32, ...) bitcast (i32 (...)* @cbuf to i32 (i32, i32, i32, ...)*)(i32 %0, i32 %1, i32 3)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_thread_new() {
  printf("NOT IMPLEMENTED:"
         "pa_thread_new"
         "\n");
}


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

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

LLVM IR (-O0):
@.str = [31 x i8] c"NOT IMPLEMENTED:pa_thread_new\0A\00"
define i32 @pa_thread_new() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [30 x i8] c"NOT IMPLEMENTED:pa_thread_new\00"
define i32 @pa_thread_new() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ do_csi(char *, int, int);
void brc(int pn, int c) { do_csi("%d%c", pn, c); }


x86 assembly (clang, -O0):
<brc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xed5(%rip),%rdi
call   1030 <do_csi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<brc>:
mov    %esi,%edx
mov    %edi,%esi
lea    0xee5(%rip),%rdi
jmp    1030 <do_csi@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%d%c\00"
define void @brc(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 = call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%c\00"
define void @brc(i32 %0, i32 %1) {
%3 = tail call i32 @do_csi(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ right_rotate();
int main() {
  right_rotate();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <right_rotate@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @right_rotate()
%2 = tail call i32 @exit(i32 0)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void SysCtlUSBPLLEnable(void) {
  (*((volatile uint32_t *)(0x400FE070))) &= ~0x00004000;
}


x86 assembly (clang, -O0):
<SysCtlUSBPLLEnable>:
push   %rbp
mov    %rsp,%rbp
mov    $0x400fe070,%eax
mov    (%rax),%ecx
and    $0xffffbfff,%ecx
mov    $0x400fe070,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SysCtlUSBPLLEnable>:
andl   $0xffffbfff,0x400fe070
ff bf ff ff
ret

LLVM IR (-O0):
define void @SysCtlUSBPLLEnable() {
%1 = load volatile i32, i32* inttoptr (i64 1074782320 to i32*)
%2 = and i32 %1, -16385
store volatile i32 %2, i32* inttoptr (i64 1074782320 to i32*)
ret void
}

LLVM IR (-O2):
define void @SysCtlUSBPLLEnable() {
%1 = load volatile i32, i32* inttoptr (i64 1074782320 to i32*)
%2 = and i32 %1, -16385
store volatile i32 %2, i32* inttoptr (i64 1074782320 to i32*)
ret void
}
/* Variables and functions */
unsigned int const RAND_MAX;
int rand();
unsigned int rand_interval(unsigned int min, unsigned int max) {
  int r;
  const unsigned int range = 1 + max - min;
  const unsigned int buckets = RAND_MAX / range;
  const unsigned int limit = buckets * range;
  do {
    r = rand();
  } while (r >= limit);
  return min + (r / buckets);
}


x86 assembly (clang, -O0):
<rand_interval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2eb7(%rip),%rax
mov    (%rax),%eax
xor    %edx,%edx
divl   -0x10(%rbp)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x18(%rbp),%eax
jae    1145 <rand_interval+0x35>
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
xor    %edx,%edx
divl   -0x14(%rbp)
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_interval>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <rand@plt>
jmp    1120 <rand_interval+0x10>

LLVM IR (-O0):
@RAND_MAX = constant i32 0
define i32 @rand_interval(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%9 = load i32, i32* %4
%10 = add i32 1, %9
%11 = load i32, i32* %3
%12 = sub i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* @RAND_MAX
%14 = load i32, i32* %6
%15 = udiv i32 %13, %14
store i32 %15, i32* %7
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = mul i32 %16, %17
store i32 %18, i32* %8
br label %19
19: ; preds = %21, %2
%20 = call i32 (...) @rand()
store i32 %20, i32* %5
br label %21
21: ; preds = %19
%22 = load i32, i32* %5
%23 = load i32, i32* %8
%24 = icmp uge i32 %22, %23
br i1 %24, label %19, label %25
25: ; preds = %21
%26 = load i32, i32* %3
%27 = load i32, i32* %5
%28 = load i32, i32* %7
%29 = udiv i32 %27, %28
%30 = add i32 %26, %29
ret i32 %30
}

LLVM IR (-O2):
@RAND_MAX = constant i32 0
define i32 @rand_interval(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 (...) @rand()
br label %3
}
int float_check(double a, double b) { return (a - b) < 0.0000001; }


x86 assembly (clang, -O0):
<float_check>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
movsd  0xee0(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<float_check>:
subsd  %xmm1,%xmm0
movsd  0xef4(%rip),%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
ret

LLVM IR (-O0):
define i32 @float_check(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 = fsub double %5, %6
%8 = fcmp olt double %7, 0x3E7AD7F29ABCAF48
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @float_check(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fcmp olt double %3, 0x3E7AD7F29ABCAF48
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ dma_memory(unsigned long, int /*<<< orphan*/, unsigned int);
int /*<<< orphan*/ virtual_to_physical(unsigned char *);
void flashrom_block_read_z180dma(unsigned long address, unsigned char *buffer,
                                 unsigned int length) {
  dma_memory((address), virtual_to_physical(buffer), length);
}


x86 assembly (clang, -O0):
<flashrom_block_read_z180dma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <virtual_to_physical@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x14(%rbp),%edx
call   1040 <dma_memory@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flashrom_block_read_z180dma>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1030 <virtual_to_physical@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %ebp,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <dma_memory@plt>

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

LLVM IR (-O2):
define void @flashrom_block_read_z180dma(i64 %0, i8* %1, i32 %2) {
%4 = tail call i32 @virtual_to_physical(i8* %1)
%5 = tail call i32 @dma_memory(i64 %0, i32 %4, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void httpClose(int pSockId) { close(pSockId); }


x86 assembly (clang, -O0):
<httpClose>:
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):
<httpClose>:
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @httpClose(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 @httpClose(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint8_t _check_format(uint16_t fmt) {
  switch (fmt) {
  case 2:
    return 0;
  case 4:
    return 0;
  case 8:
    return 0;
  case 16:
    return 0;
  case 64:
    return 0;
  default:
    return 1;
  }
}


x86 assembly (clang, -O0):
<_check_format>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x2,%eax
je     115f <_check_format+0x5f>
jmp    111b <_check_format+0x1b>
mov    -0xc(%rbp),%eax
sub    $0x4,%eax
je     116b <_check_format+0x6b>
jmp    112c <_check_format+0x2c>
mov    -0xc(%rbp),%eax
sub    $0x8,%eax
je     1177 <_check_format+0x77>
jmp    113d <_check_format+0x3d>
mov    -0xc(%rbp),%eax
sub    $0x10,%eax
je     1183 <_check_format+0x83>
jmp    114e <_check_format+0x4e>
mov    -0xc(%rbp),%eax
sub    $0x40,%eax
je     118f <_check_format+0x8f>
jmp    119b <_check_format+0x9b>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <_check_format+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <_check_format+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <_check_format+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <_check_format+0xa2>
movl   $0x0,-0x4(%rbp)
jmp    11a2 <_check_format+0xa2>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_check_format>:
add    $0xfffffffe,%edi
cmp    $0x3e,%edi
ja     111b <_check_format+0x1b>
xor    %eax,%eax
movabs $0x4000000000004045,%rcx
bt     %rdi,%rcx
jae    111b <_check_format+0x1b>
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @_check_format(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 2, label %5
i32 4, label %6
i32 8, label %7
i32 16, label %8
i32 64, label %9
]
5: ; preds = %1
store i32 0, i32* %2
br label %11
6: ; preds = %1
store i32 0, i32* %2
br label %11
7: ; preds = %1
store i32 0, i32* %2
br label %11
8: ; preds = %1
store i32 0, i32* %2
br label %11
9: ; preds = %1
store i32 0, i32* %2
br label %11
10: ; preds = %1
store i32 1, i32* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
define i32 @_check_format(i32 %0) {
switch i32 %0, label %2 [
i32 2, label %3
i32 4, label %3
i32 8, label %3
i32 16, label %3
i32 64, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %2
%4 = phi i32 [ 1, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i32 %4
}
void draw_init(void) { ; }


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

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

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

LLVM IR (-O2):
define void @draw_init() {
ret void
}
/* Type definitions */
typedef char *uint32_t;

/* Variables and functions */
uint32_t crc32c_intel_le_hw_byte(uint32_t crc, unsigned char const *data,
                                 unsigned long length) {
  while (length--) {
    __asm__ __volatile__(".byte 0xf2, 0xf, 0x38, 0xf0, 0xf1"
                         : "=S"(crc)
                         : "0"(crc), "c"(*data));
    data++;
  }
  return crc;
}


x86 assembly (clang, -O0):
<crc32c_intel_le_hw_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x18(%rbp)
cmp    $0x0,%rax
je     114d <crc32c_intel_le_hw_byte+0x4d>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
crc32  %cl,%esi
mov    %rsi,-0x8(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <crc32c_intel_le_hw_byte+0x10>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crc32c_intel_le_hw_byte>:
mov    %rsi,%rax
mov    %rdi,%rsi
test   %rdx,%rdx
je     1122 <crc32c_intel_le_hw_byte+0x22>
xor    %edi,%edi
nopl   (%rax)
movzbl (%rax,%rdi,1),%ecx
crc32  %cl,%esi
add    $0x1,%rdi
cmp    %rdi,%rdx
jne    1110 <crc32c_intel_le_hw_byte+0x10>
mov    %rsi,%rax
ret

LLVM IR (-O0):
define i8* @crc32c_intel_le_hw_byte(i8* %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
br label %7
7: ; preds = %11, %3
%8 = load i64, i64* %6
%9 = add i64 %8, -1
store i64 %9, i64* %6
%10 = icmp ne i64 %8, 0
br i1 %10, label %11, label %18
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = load i8*, i8** %5
%14 = load i8, i8* %13
%15 = call i8* asm sideeffect ".byte 0xf2, 0xf, 0x38, 0xf0, 0xf1", "={si},0,{cx},~{dirflag},~{fpsr},~{flags}"(i8* %12, i8 %14)
store i8* %15, i8** %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %5
br label %7
18: ; preds = %7
%19 = load i8*, i8** %4
ret i8* %19
}

LLVM IR (-O2):
define i8* @crc32c_intel_le_hw_byte(i8* %0, i8* nocapture %1, i64 %2) {
%4 = icmp eq i64 %2, 0
br i1 %4, label %14, label %5
5: ; preds = %3, %5
%6 = phi i64 [ %9, %5 ], [ %2, %3 ]
%7 = phi i8* [ %12, %5 ], [ %1, %3 ]
%8 = phi i8* [ %11, %5 ], [ %0, %3 ]
%9 = add i64 %6, -1
%10 = load i8, i8* %7
%11 = tail call i8* asm sideeffect ".byte 0xf2, 0xf, 0x38, 0xf0, 0xf1", "={si},0,{cx},~{dirflag},~{fpsr},~{flags}"(i8* %8, i8 %10)
%12 = getelementptr inbounds i8, i8* %7, i64 1
%13 = icmp eq i64 %9, 0
br i1 %13, label %14, label %5
14: ; preds = %5, %3
%15 = phi i8* [ %0, %3 ], [ %11, %5 ]
ret i8* %15
}
/* Type definitions */
struct timeval {
  unsigned int tv_sec;
  unsigned long tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
unsigned long getMicrotime() {
  struct timeval currentTime;
  gettimeofday(&currentTime, NULL);
  return currentTime.tv_sec * (unsigned int)1e6 + currentTime.tv_usec;
}


x86 assembly (clang, -O0):
<getMicrotime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
mov    %eax,%eax
add    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMicrotime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,0x8(%rsp),%eax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @getMicrotime() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load i32, i32* %3
%5 = mul i32 %4, 1000000
%6 = zext i32 %5 to i64
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i64, i64* %7
%9 = add i64 %6, %8
ret i64 %9
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @getMicrotime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul i32 %5, 1000000
%7 = zext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add i64 %9, %7
ret i64 %10
}
int len() {
  int i;
  unsigned v = (unsigned)~0;
  for (i = 1; (v = v >> 1) > 0; i++)
    ;
  return i;
}


x86 assembly (clang, -O0):
<len>:
push   %rbp
mov    %rsp,%rbp
movl   $0xffffffff,-0x8(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x1,%eax
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jbe    1137 <len+0x37>
jmp    1129 <len+0x29>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1112 <len+0x12>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @len() {
ret i32 32
}
void dnk_log(unsigned char *key, unsigned char *val) {}


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

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

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

LLVM IR (-O2):
define void @dnk_log(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
double skewness_double(int, double *);
double skewness(int n, double *data) { return skewness_double(n, data); }


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

x86 assembly (clang, -O2):
<skewness>:
jmp    1030 <skewness_double@plt>

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

LLVM IR (-O2):
define double @skewness(i32 %0, double* %1) {
%3 = tail call double @skewness_double(i32 %0, double* %1)
ret double %3
}
/* Type definitions */
struct file_header {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ print_dbppc_restart(char *, char *, int, char,
                                       struct file_header *);
void print_ppc_restart(int *tab, int action, char *cur_date, char *cur_time,
                       int utc, struct file_header *file_hdr) {
  if (action == 0x02) {
    print_dbppc_restart(cur_date, cur_time, utc, '\t', file_hdr);
  }
}


x86 assembly (clang, -O0):
<print_ppc_restart>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    %r9,-0x30(%rbp)
cmpl   $0x2,-0xc(%rbp)
jne    1152 <print_ppc_restart+0x42>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
mov    -0x30(%rbp),%r8
mov    $0x9,%ecx
call   1030 <print_dbppc_restart@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_ppc_restart>:
cmp    $0x2,%esi
jne    112b <print_ppc_restart+0x1b>
mov    %rdx,%rdi
mov    %rcx,%rsi
mov    %r8d,%edx
mov    $0x9,%ecx
mov    %r9,%r8
jmp    1030 <print_dbppc_restart@plt>
ret

LLVM IR (-O0):
%struct.file_header = type { i32 }
define void @print_ppc_restart(i32* %0, i32 %1, i8* %2, i8* %3, i32 %4, %struct.file_header* %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca %struct.file_header*
store i32* %0, i32** %7
store i32 %1, i32* %8
store i8* %2, i8** %9
store i8* %3, i8** %10
store i32 %4, i32* %11
store %struct.file_header* %5, %struct.file_header** %12
%13 = load i32, i32* %8
%14 = icmp eq i32 %13, 2
br i1 %14, label %15, label %21
15: ; preds = %6
%16 = load i8*, i8** %9
%17 = load i8*, i8** %10
%18 = load i32, i32* %11
%19 = load %struct.file_header*, %struct.file_header** %12
%20 = call i32 @print_dbppc_restart(i8* %16, i8* %17, i32 %18, i8 signext 9, %struct.file_header* %19)
br label %21
21: ; preds = %15, %6
ret void
}

LLVM IR (-O2):
%struct.file_header = type { i32 }
define void @print_ppc_restart(i32* nocapture readnone %0, i32 %1, i8* %2, i8* %3, i32 %4, %struct.file_header* %5) {
%7 = icmp eq i32 %1, 2
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @print_dbppc_restart(i8* %2, i8* %3, i32 %4, i8 signext 9, %struct.file_header* %5)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ perror(char const *);
void error(const char *msg) {
  perror(msg);
  abort();
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <perror@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<error>:
push   %rax
call   1040 <perror@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @error(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 (...) @abort()
unreachable
}
vspen(s) char *s;
{ return (point(s) && (strcmp((char *)(s), (char *)("\\^")) == 0)); }


x86 assembly (clang, -O0):
<vspen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <point@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     1160 <vspen+0x40>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
sete   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vspen>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <point@plt>
test   %eax,%eax
je     114a <vspen+0x2a>
lea    0xec5(%rip),%rsi
mov    %r14,%rdi
call   1030 <strcmp@plt>
xor    %ebx,%ebx
test   %eax,%eax
sete   %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"\\^\00"
define i32 @vspen(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @point to i32 (i8*, ...)*)(i8* %3)
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = call i32 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
@.str = [3 x i8] c"\\^\00"
define i32 @vspen(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @point to i32 (i8*, ...)*)(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 0, %1 ], [ %7, %4 ]
ret i32 %9
}
void answer_rating(void) {}


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

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

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

LLVM IR (-O2):
define void @answer_rating() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ btree_test_1();
int tree_main(void) {
  btree_test_1();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @tree_main() {
%1 = call i32 (...) @btree_test_1()
ret i32 0
}

LLVM IR (-O2):
define i32 @tree_main() {
%1 = tail call i32 (...) @btree_test_1()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ OneFunc();
int /*<<< orphan*/ TwoFunc();
int main() {
  OneFunc();
  TwoFunc();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @OneFunc()
%2 = tail call i32 (...) @TwoFunc()
ret i32 0
}
unsigned long htab_ulong_hash(const void *buf) {
  const unsigned long *v = buf;
  return *v;
}


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

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

LLVM IR (-O0):
define i64 @htab_ulong_hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i64*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i64*
store i64* %5, i64** %3
%6 = load i64*, i64** %3
%7 = load i64, i64* %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @htab_ulong_hash(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
ret i64 %3
}
void _iter_itoa(const int n, char *s, const int i) {
  if (n) {
    s[i] = n % 10 + 48;
    _iter_itoa(n / 10, s, i + 1);
  }
}


x86 assembly (clang, -O0):
<_iter_itoa>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1161 <_iter_itoa+0x51>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
call   1030 <_iter_itoa@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_iter_itoa>:
test   %edi,%edi
je     1142 <_iter_itoa+0x42>
movslq %edx,%rax
add    %rax,%rsi
nopw   0x0(%rax,%rax,1)
movslq %edi,%rax
imul   $0x66666667,%rax,%rdi
mov    %rdi,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rdi
add    %ecx,%edi
lea    (%rdi,%rdi,1),%ecx
lea    (%rcx,%rcx,4),%ecx
mov    %eax,%edx
sub    %ecx,%edx
add    $0x30,%dl
mov    %dl,(%rsi)
add    $0x9,%eax
add    $0x1,%rsi
cmp    $0x12,%eax
ja     1110 <_iter_itoa+0x10>
ret

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

LLVM IR (-O2):
define void @_iter_itoa(i32 %0, i8* nocapture writeonly %1, i32 %2) {
%4 = icmp eq i32 %0, 0
br i1 %4, label %18, label %5
5: ; preds = %3
%6 = sext i32 %2 to i64
br label %7
7: ; preds = %5, %7
%8 = phi i64 [ %6, %5 ], [ %15, %7 ]
%9 = phi i32 [ %0, %5 ], [ %14, %7 ]
%10 = srem i32 %9, 10
%11 = trunc i32 %10 to i8
%12 = add nsw i8 %11, 48
%13 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 %12, i8* %13
%14 = sdiv i32 %9, 10
%15 = add i64 %8, 1
%16 = add i32 %9, 9
%17 = icmp ult i32 %16, 19
br i1 %17, label %18, label %7
18: ; preds = %7, %3
ret void
}
void cosfree(p) char *p;
{
  append(p);
  return;
}


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

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

LLVM IR (-O0):
define void @cosfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @append to i32 (i8*, ...)*)(i8* %3)
ret void
}

LLVM IR (-O2):
define void @cosfree(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @append to i32 (i8*, ...)*)(i8* %0)
ret void
}
int ramster_do_preload_flnode(struct tmem_pool *p) { return -1; }


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

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

LLVM IR (-O0):
%struct.tmem_pool = type opaque
define i32 @ramster_do_preload_flnode(%struct.tmem_pool* %0) {
%2 = alloca %struct.tmem_pool*
store %struct.tmem_pool* %0, %struct.tmem_pool** %2
ret i32 -1
}

LLVM IR (-O2):
%struct.tmem_pool = type opaque
define i32 @ramster_do_preload_flnode(%struct.tmem_pool* nocapture readnone %0) {
ret i32 -1
}
/* Variables and functions */
int colmgr_alloc_pair(int, int);
int count_available_pairs(void) {
  int i = 0;
  while (colmgr_alloc_pair(i, i) != -1) {
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<count_available_pairs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <colmgr_alloc_pair@plt>
cmp    $0xffffffff,%eax
je     1141 <count_available_pairs+0x31>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <count_available_pairs+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<count_available_pairs>:
push   %rbx
mov    $0xffffffff,%ebx
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%ebx
mov    %ebx,%edi
mov    %ebx,%esi
call   1030 <colmgr_alloc_pair@plt>
cmp    $0xffffffff,%eax
jne    1120 <count_available_pairs+0x10>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @count_available_pairs() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 0, %0 ], [ %5, %1 ]
%3 = tail call i32 @colmgr_alloc_pair(i32 %2, i32 %2)
%4 = icmp eq i32 %3, -1
%5 = add nuw nsw i32 %2, 1
br i1 %4, label %6, label %1
6: ; preds = %1
ret i32 %2
}