xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_usage() {
  printf("Usage:\n");
  printf("hello-world-server port\n");
}


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

x86 assembly (clang, -O2):
<print_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Usage:\0A\00"
@.str.1 = [25 x i8] c"hello-world-server port\0A\00"
define void @print_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"Usage:\00"
@str.2 = [24 x i8] c"hello-world-server port\00"
define void @print_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.2, i64 0, i64 0))
ret void
}
int isfinitef(x)
float x;
{
  union {
    float f;
    unsigned short s[2];
    unsigned int i;
  } u;
  u.f = x;
  if (sizeof(int) == 4) {
    if ((u.i & 0x7f800000) != 0x7f800000)
      return 1;
    return (0);
  } else {
    if ((u.s[0] & 0x7f80) != 0x7f80)
      return 1;
    return (0);
  }
}


x86 assembly (clang, -O0):
<isfinitef>:
push   %rbp
mov    %rsp,%rbp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0x7f800000,%eax
cmp    $0x7f800000,%eax
je     1136 <isfinitef+0x36>
movl   $0x1,-0x4(%rbp)
jmp    113d <isfinitef+0x3d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isfinitef>:
cvtsd2ss %xmm0,%xmm0
movd   %xmm0,%ecx
not    %ecx
xor    %eax,%eax
test   $0x7f800000,%ecx
setne  %al
ret

LLVM IR (-O0):
%union.anon = type { float }
define i32 @isfinitef(double %0) {
%2 = alloca i32
%3 = alloca float
%4 = alloca %union.anon
%5 = fptrunc double %0 to float
store float %5, float* %3
%6 = load float, float* %3
%7 = bitcast %union.anon* %4 to float*
store float %6, float* %7
%8 = bitcast %union.anon* %4 to i32*
%9 = load i32, i32* %8
%10 = and i32 %9, 2139095040
%11 = icmp ne i32 %10, 2139095040
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 1, i32* %2
br label %14
13: ; preds = %1
store i32 0, i32* %2
br label %14
14: ; preds = %13, %12
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @isfinitef(double %0) {
%2 = fptrunc double %0 to float
%3 = bitcast float %2 to i32
%4 = and i32 %3, 2139095040
%5 = icmp ne i32 %4, 2139095040
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Type definitions */
typedef unsigned int uint32_t;

/* Variables and functions */
uint32_t ror32(uint32_t data, unsigned int rotation) {
  return ((data >> rotation) | (data << (32 - rotation)));
}


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

x86 assembly (clang, -O2):
<ror32>:
mov    %esi,%ecx
mov    %edi,%eax
ror    %cl,%eax
ret

LLVM IR (-O0):
define i32 @ror32(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 = lshr i32 %5, %6
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = sub i32 32, %9
%11 = shl i32 %8, %10
%12 = or i32 %7, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @ror32(i32 %0, i32 %1) {
%3 = lshr i32 %0, %1
%4 = sub i32 32, %1
%5 = shl i32 %0, %4
%6 = or i32 %5, %3
ret i32 %6
}
char mapIntToChar(int i) { return (char)i + 65; }


x86 assembly (clang, -O0):
<mapIntToChar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movsbl %al,%eax
add    $0x41,%eax
movsbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i8 @mapIntToChar(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = sext i8 %4 to i32
%6 = add nsw i32 %5, 65
%7 = trunc i32 %6 to i8
ret i8 %7
}

LLVM IR (-O2):
define signext i8 @mapIntToChar(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 65
ret i8 %3
}
/* Variables and functions */
double pi(int);
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("%f\n", pi(200));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call double @pi(i32 200)
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double @pi(i32 200)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void commandHistory(char **history, int n) {
  for (int i = 0; i < n; i++)
    printf("%s\n", history[i]);
}


x86 assembly (clang, -O0):
<commandHistory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <commandHistory+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <commandHistory+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<commandHistory>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <commandHistory+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <commandHistory+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @commandHistory(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %17, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %20
10: ; preds = %6
%11 = load i8**, i8*** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
store i32 %19, i32* %5
br label %6
20: ; preds = %6
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @commandHistory(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %7
6: ; preds = %7, %2
ret void
7: ; preds = %4, %7
%8 = phi i64 [ 0, %4 ], [ %12, %7 ]
%9 = getelementptr inbounds i8*, i8** %0, i64 %8
%10 = load i8*, i8** %9
%11 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = add nuw nsw i64 %8, 1
%13 = icmp eq i64 %12, %5
br i1 %13, label %6, label %7
}
/* Type definitions */
struct l_vm_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct l_vm_t *);
void l_vm_del(struct l_vm_t *vm) { free(vm); }


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

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

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

LLVM IR (-O2):
%struct.l_vm_t = type { i32 }
define void @l_vm_del(%struct.l_vm_t* nocapture %0) {
%2 = tail call i32 @free(%struct.l_vm_t* %0)
ret void
}
int test_imm_4Aint32_reg(int val) { return ((val) & (0x4A << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_4Aint32_reg(i32 %0) {
%2 = and i32 %0, 74
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ ASN1_VALUE;
typedef int /*<<< orphan*/ ASN1_INTEGER;

/* Variables and functions */
int /*<<< orphan*/ ASN1_INTEGER_it;
scalar_t__ ASN1_item_d2i(int /*<<< orphan*/ **, unsigned char const **, long,
                         int /*<<< orphan*/ *);
ASN1_INTEGER *d2i_ASN1_INTEGER(ASN1_INTEGER **a, const unsigned char **in,
                               long len) {
  return (ASN1_INTEGER *)ASN1_item_d2i((ASN1_VALUE **)a, in, len,
                                       &ASN1_INTEGER_it);
}


x86 assembly (clang, -O0):
<d2i_ASN1_INTEGER>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2eb1(%rip),%rcx
call   1030 <ASN1_item_d2i@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2i_ASN1_INTEGER>:
mov    0x2ed1(%rip),%rcx
jmp    1030 <ASN1_item_d2i@plt>

LLVM IR (-O0):
@ASN1_INTEGER_it = global i32 0
define i32* @d2i_ASN1_INTEGER(i32** %0, i8** %1, i64 %2) {
%4 = alloca i32**
%5 = alloca i8**
%6 = alloca i64
store i32** %0, i32*** %4
store i8** %1, i8*** %5
store i64 %2, i64* %6
%7 = load i32**, i32*** %4
%8 = load i8**, i8*** %5
%9 = load i64, i64* %6
%10 = call i64 @ASN1_item_d2i(i32** %7, i8** %8, i64 %9, i32* @ASN1_INTEGER_it)
%11 = inttoptr i64 %10 to i32*
ret i32* %11
}

LLVM IR (-O2):
@ASN1_INTEGER_it = global i32 0
define i32* @d2i_ASN1_INTEGER(i32** %0, i8** %1, i64 %2) {
%4 = tail call i64 @ASN1_item_d2i(i32** %0, i8** %1, i64 %2, i32* @ASN1_INTEGER_it)
%5 = inttoptr i64 %4 to i32*
ret i32* %5
}
int test_imm_31int16_reg(short val) {
  return ((val) & (0x31 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_31int16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0x31,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_31int16_reg(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = sext i16 %3 to i32
%5 = and i32 %4, 49
%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_31int16_reg(i16 signext %0) {
%2 = and i16 %0, 49
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
testBitOr() { printf("%d | %d = %d\n", 10, 4, 10 | 4); }


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

x86 assembly (clang, -O2):
<testBitOr>:
lea    0xee9(%rip),%rdi
mov    $0xa,%esi
mov    $0x4,%edx
mov    $0xe,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"%d | %d = %d\0A\00"
define i32 @testBitOr() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 14)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [14 x i8] c"%d | %d = %d\0A\00"
define i32 @testBitOr() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 10, i32 4, i32 14)
ret i32 undef
}
int fib(int n) {
  if (n == 0 || n == 1)
    return n;
  else
    return fib(n - 2) + fib(n - 1);
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     112f <fib+0x1f>
cmpl   $0x1,-0x8(%rbp)
jne    113a <fib+0x2a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115d <fib+0x4d>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1030 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fib@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
xor    %ebp,%ebp
cmp    $0x2,%edi
jb     1137 <fib+0x27>
xor    %ebp,%ebp
xchg   %ax,%ax
lea    -0x2(%rbx),%edi
call   1030 <fib@plt>
add    $0xffffffff,%ebx
add    %eax,%ebp
cmp    $0x1,%ebx
ja     1120 <fib+0x10>
mov    $0x1,%ebx
add    %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = phi i32 [ %9, %3 ], [ 0, %1 ]
%6 = add nsw i32 %4, -2
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %4, -1
%9 = add nsw i32 %7, %5
%10 = icmp ult i32 %8, 2
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i32 [ 0, %1 ], [ %9, %3 ]
%13 = phi i32 [ %0, %1 ], [ 1, %3 ]
%14 = add nsw i32 %13, %12
ret i32 %14
}
void g_param_spec_float() {}


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

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

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

LLVM IR (-O2):
define void @g_param_spec_float() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main() {
  double a, b;
  scanf("%lf", &a);
  scanf("%lf", &b);
  printf("MEDIA = %5f", (a + b) / 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed9(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xea6(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xea7(%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    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xea9(%rip),%xmm0
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [12 x i8] c"MEDIA = %5f\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%5 = load double, double* %1
%6 = load double, double* %2
%7 = fadd double %5, %6
%8 = fdiv double %7, 2.000000e+00
%9 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [12 x i8] c"MEDIA = %5f\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = bitcast double* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%6 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%7 = load double, double* %1
%8 = load double, double* %2
%9 = fadd double %7, %8
%10 = fmul double %9, 5.000000e-01
%11 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double %10)
ret i32 0
}
/* Variables and functions */
int calculate(char *, int /*<<< orphan*/, int);
scalar_t__ ft_strlen(char *);
int eval_expr(char *str) { return (calculate(str, 0, (int)ft_strlen(str))); }


x86 assembly (clang, -O0):
<eval_expr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    -0x10(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1040 <calculate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eval_expr>:
push   %rbx
mov    %rdi,%rbx
call   1030 <ft_strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
pop    %rbx
jmp    1040 <calculate@plt>

LLVM IR (-O0):
define i32 @eval_expr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @ft_strlen(i8* %4)
%6 = trunc i64 %5 to i32
%7 = call i32 @calculate(i8* %3, i32 0, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @eval_expr(i8* %0) {
%2 = tail call i64 @ft_strlen(i8* %0)
%3 = trunc i64 %2 to i32
%4 = tail call i32 @calculate(i8* %0, i32 0, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void DoStuff() { printf("Doing stuff!\n"); }


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

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

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

LLVM IR (-O2):
@str = [13 x i8] c"Doing stuff!\00"
define void @DoStuff() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret void
}
extern void flush_cache_mm(struct mm_struct *mm) {}


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

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

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

LLVM IR (-O2):
%struct.mm_struct = type opaque
define void @flush_cache_mm(%struct.mm_struct* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ TabletInfoHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void TabletInfoRequestUpdate() { UAVObjRequestUpdate(TabletInfoHandle()); }


x86 assembly (clang, -O0):
<TabletInfoRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <TabletInfoHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TabletInfoRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1040 <TabletInfoHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @TabletInfoRequestUpdate() {
%1 = call i32 (...) @TabletInfoHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @TabletInfoRequestUpdate() {
%1 = tail call i32 (...) @TabletInfoHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
int heap_pai(int n) { return ((int)n / 2); }


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

x86 assembly (clang, -O2):
<heap_pai>:
mov    %edi,%eax
shr    $0x1f,%eax
add    %edi,%eax
sar    %eax
ret

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

LLVM IR (-O2):
define i32 @heap_pai(i32 %0) {
%2 = sdiv i32 %0, 2
ret i32 %2
}
/* Type definitions */
typedef scalar_t__ uint64_t;

/* Variables and functions */
int gca_cmp_uint64(const void *aa, const void *bb) {
  const uint64_t a = *(const uint64_t *)aa;
  const uint64_t b = *(const uint64_t *)bb;
  return (((a) > (b)) - ((b) > (a)));
}


x86 assembly (clang, -O0):
<gca_cmp_uint64>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
setg   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x20(%rbp),%rcx
cmp    -0x18(%rbp),%rcx
setg   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gca_cmp_uint64>:
mov    (%rdi),%rcx
mov    (%rsi),%rdx
xor    %eax,%eax
xor    %esi,%esi
cmp    %rdx,%rcx
setg   %al
setl   %sil
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @gca_cmp_uint64(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i64*
%9 = load i64, i64* %8
store i64 %9, i64* %5
%10 = load i8*, i8** %4
%11 = bitcast i8* %10 to i64*
%12 = load i64, i64* %11
store i64 %12, i64* %6
%13 = load i64, i64* %5
%14 = load i64, i64* %6
%15 = icmp sgt i64 %13, %14
%16 = zext i1 %15 to i32
%17 = load i64, i64* %6
%18 = load i64, i64* %5
%19 = icmp sgt i64 %17, %18
%20 = zext i1 %19 to i32
%21 = sub nsw i32 %16, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @gca_cmp_uint64(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp sgt i64 %4, %6
%8 = zext i1 %7 to i32
%9 = icmp sgt i64 %6, %4
%10 = sext i1 %9 to i32
%11 = add nsw i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ usart_put(char *);
void log_error(char *string) {
  usart_put("ERROR: ");
  usart_put(string);
  usart_put("\n");
}


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

x86 assembly (clang, -O2):
<log_error>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
call   1030 <usart_put@plt>
mov    %rbx,%rdi
call   1030 <usart_put@plt>
lea    0xed9(%rip),%rdi
pop    %rbx
jmp    1030 <usart_put@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"ERROR: \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @log_error(i8* %0) {
%2 = tail call i32 @usart_put(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @usart_put(i8* %0)
%4 = tail call i32 @usart_put(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
unsigned int hash(int data, int tbl_size) { return data % tbl_size; }


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

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

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

LLVM IR (-O2):
define i32 @hash(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
ret i32 %3
}
/* Variables and functions */
double pow(double, double);
double BMCReverbDelayGainFromRT60(double rt60, double delayTime) {
  return pow(10.0, (-3.0 * delayTime) / rt60);
}


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

x86 assembly (clang, -O2):
<BMCReverbDelayGainFromRT60>:
mulsd  0xee8(%rip),%xmm1
divsd  %xmm0,%xmm1
movsd  0xee4(%rip),%xmm0
jmp    1030 <pow@plt>

LLVM IR (-O0):
define double @BMCReverbDelayGainFromRT60(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = fmul double -3.000000e+00, %5
%7 = load double, double* %3
%8 = fdiv double %6, %7
%9 = call double @pow(double 1.000000e+01, double %8)
ret double %9
}

LLVM IR (-O2):
define double @BMCReverbDelayGainFromRT60(double %0, double %1) {
%3 = fmul double %1, -3.000000e+00
%4 = fdiv double %3, %0
%5 = tail call double @pow(double 1.000000e+01, double %4)
ret double %5
}
int answer2(int n) { return ((n * (n + 1) / 2) * (n * (n + 1)) / 2); }


x86 assembly (clang, -O0):
<answer2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    -0x4(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x1,%edx
imul   %edx,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
pop    %rbp
ret

x86 assembly (clang, -O2):
<answer2>:
lea    0x1(%rdi),%eax
imul   %edi,%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
imul   %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
add    %ecx,%eax
sar    %eax
ret

LLVM IR (-O0):
define i32 @answer2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
%6 = mul nsw i32 %3, %5
%7 = sdiv i32 %6, 2
%8 = load i32, i32* %2
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
%11 = mul nsw i32 %8, %10
%12 = mul nsw i32 %7, %11
%13 = sdiv i32 %12, 2
ret i32 %13
}

LLVM IR (-O2):
define i32 @answer2(i32 %0) {
%2 = add nsw i32 %0, 1
%3 = mul nsw i32 %2, %0
%4 = sdiv i32 %3, 2
%5 = mul nsw i32 %4, %3
%6 = sdiv i32 %5, 2
ret i32 %6
}
/* Variables and functions */
int wycc_type_down(int);
int wycc_type_subsume_tokens(int, int);
int wycc_type_subsume_lists(int itok, int atok) {
  int istp;
  int astp;
  istp = wycc_type_down(itok);
  astp = wycc_type_down(atok);
  return wycc_type_subsume_tokens(istp, astp);
}


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

x86 assembly (clang, -O2):
<wycc_type_subsume_lists>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1030 <wycc_type_down@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <wycc_type_down@plt>
mov    %ebp,%edi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <wycc_type_subsume_tokens@plt>

LLVM IR (-O0):
define i32 @wycc_type_subsume_lists(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = call i32 @wycc_type_down(i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @wycc_type_down(i32 %9)
store i32 %10, i32* %6
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = call i32 @wycc_type_subsume_tokens(i32 %11, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
define i32 @wycc_type_subsume_lists(i32 %0, i32 %1) {
%3 = tail call i32 @wycc_type_down(i32 %0)
%4 = tail call i32 @wycc_type_down(i32 %1)
%5 = tail call i32 @wycc_type_subsume_tokens(i32 %3, i32 %4)
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ CRC_16(int /*<<< orphan*/ *, int, int /*<<< orphan*/);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void add_CRC(uint8_t *buf, int size, uint16_t start_mask) {
  uint16_t crc;
  crc = CRC_16(buf, size - 2, start_mask);
  memcpy(&buf[size - 2], &crc, 2);
  return;
}


x86 assembly (clang, -O0):
<add_CRC>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
sub    $0x2,%esi
mov    -0x10(%rbp),%edx
call   1030 <CRC_16@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%eax
sub    $0x2,%eax
cltq
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x14(%rbp),%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_CRC>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x2(%rbx),%esi
call   1030 <CRC_16@plt>
mov    %eax,0x4(%rsp)
movslq %ebx,%rax
lea    (%r14,%rax,4),%rdi
add    $0xfffffffffffffff8,%rdi
lea    0x4(%rsp),%rsi
mov    $0x2,%edx
call   1040 <memcpy@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @add_CRC(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32*, i32** %4
%9 = load i32, i32* %5
%10 = sub nsw i32 %9, 2
%11 = load i32, i32* %6
%12 = call i32 @CRC_16(i32* %8, i32 %10, i32 %11)
store i32 %12, i32* %7
%13 = load i32*, i32** %4
%14 = load i32, i32* %5
%15 = sub nsw i32 %14, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %13, i64 %16
%18 = call i32 @memcpy(i32* %17, i32* %7, i32 2)
ret void
}

LLVM IR (-O2):
define void @add_CRC(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = bitcast i32* %4 to i8*
%6 = add nsw i32 %1, -2
%7 = tail call i32 @CRC_16(i32* %0, i32 %6, i32 %2)
store i32 %7, i32* %4
%8 = sext i32 %6 to i64
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = call i32 @memcpy(i32* %9, i32* %4, i32 2)
ret void
}
/* Variables and functions */
scalar_t__ atan2(float, float);
float sdATan2(float y, float x) {
  return (float)atan2(y, x) * (180.0 / 3.1415926535f);
}


x86 assembly (clang, -O0):
<sdATan2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
call   1030 <atan2@plt>
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xebe(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdATan2>:
push   %rax
call   1030 <atan2@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  0xed6(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @sdATan2(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = call i64 @atan2(float %5, float %6)
%8 = sitofp i64 %7 to float
%9 = fpext float %8 to double
%10 = fmul double %9, 0x404CA5DC0D03CF26
%11 = fptrunc double %10 to float
ret float %11
}

LLVM IR (-O2):
define float @sdATan2(float %0, float %1) {
%3 = tail call i64 @atan2(float %0, float %1)
%4 = sitofp i64 %3 to float
%5 = fpext float %4 to double
%6 = fmul double %5, 0x404CA5DC0D03CF26
%7 = fptrunc double %6 to float
ret float %7
}
void acpi_gpiochip_free_interrupts(struct gpio_chip *chip) {}


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

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

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

LLVM IR (-O2):
%struct.gpio_chip = type opaque
define void @acpi_gpiochip_free_interrupts(%struct.gpio_chip* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void TimerLoadSet(uint32_t ui32Base, uint32_t ui32Timer, uint32_t ui32Value) {
  ;

  ;
  if (ui32Timer & 0x000000FF) {
    (*((volatile unsigned long *)(ui32Base + 0x00000028))) = ui32Value;
  }
  if (ui32Timer & 0x0000FF00) {
    (*((volatile unsigned long *)(ui32Base + 0x0000002C))) = ui32Value;
  }
}


x86 assembly (clang, -O0):
<TimerLoadSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     112d <TimerLoadSet+0x2d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x28,%eax
cltq
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
je     114d <TimerLoadSet+0x4d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x2c,%eax
cltq
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerLoadSet>:
movslq %edx,%rax
movslq %edi,%rcx
test   %sil,%sil
je     110f <TimerLoadSet+0xf>
mov    %rax,0x28(%rcx)
test   $0xff00,%esi
je     111b <TimerLoadSet+0x1b>
mov    %rax,0x2c(%rcx)
ret

LLVM IR (-O0):
define void @TimerLoadSet(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = and i32 %7, 255
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 40
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i64*
store volatile i64 %12, i64* %16
br label %17
17: ; preds = %10, %3
%18 = load i32, i32* %5
%19 = and i32 %18, 65280
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 44
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i64*
store volatile i64 %23, i64* %27
br label %28
28: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
define void @TimerLoadSet(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, 255
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = add nsw i32 %0, 40
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i64*
store volatile i64 %7, i64* %10
br label %11
11: ; preds = %6, %3
%12 = and i32 %1, 65280
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = sext i32 %2 to i64
%16 = add nsw i32 %0, 44
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
br label %19
19: ; preds = %14, %11
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, int);
void *printer2(void *ptr) {
  char *thread = (char *)ptr;
  printf("%s: %d\n", thread, 4 + 6);
}


x86 assembly (clang, -O0):
<printer2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xed1(%rip),%rdi
mov    $0xa,%edx
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"%s: %d\0A\00"
define noalias i8* @printer2(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* %0, i32 10)
ret i8* undef
}
/* Variables and functions */
int bswap(int);
int main(void) { return bswap(1); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%edi
jmp    1030 <bswap@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @bswap(i32 1)
ret i32 %1
}
/* Type definitions */
typedef scalar_t__ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ __builtin_wrctl(int, int);
void _Nios2_Set_ctlreg_mpuacc(uint32_t value) {
  __builtin_wrctl(15, (int)value);
}


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

x86 assembly (clang, -O2):
<_Nios2_Set_ctlreg_mpuacc>:
mov    %rdi,%rsi
mov    $0xf,%edi
jmp    1030 <__builtin_wrctl@plt>

LLVM IR (-O0):
define void @_Nios2_Set_ctlreg_mpuacc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
%5 = call i32 @__builtin_wrctl(i32 15, i32 %4)
ret void
}

LLVM IR (-O2):
define void @_Nios2_Set_ctlreg_mpuacc(i64 %0) {
%2 = trunc i64 %0 to i32
%3 = tail call i32 @__builtin_wrctl(i32 15, i32 %2)
ret void
}
int compareInt(void *int1, void *int2) {
  int a = *((int *)int1);
  int b = *((int *)int2);
  if (a > b) {
    return 1;
  } else if (a < b) {
    return -1;
  } else
    return 0;
}


x86 assembly (clang, -O0):
<compareInt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    1136 <compareInt+0x36>
movl   $0x1,-0x4(%rbp)
jmp    1155 <compareInt+0x55>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    114e <compareInt+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    1155 <compareInt+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareInt>:
mov    (%rdi),%eax
mov    (%rsi),%ecx
xor    %edx,%edx
cmp    %ecx,%eax
setl   %dl
neg    %edx
cmp    %ecx,%eax
mov    $0x1,%eax
cmovle %edx,%eax
ret

LLVM IR (-O0):
define i32 @compareInt(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
%10 = load i32, i32* %9
store i32 %10, i32* %6
%11 = load i8*, i8** %5
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32, i32* %6
%15 = load i32, i32* %7
%16 = icmp sgt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %24
18: ; preds = %2
%19 = load i32, i32* %6
%20 = load i32, i32* %7
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18
store i32 -1, i32* %3
br label %24
23: ; preds = %18
store i32 0, i32* %3
br label %24
24: ; preds = %23, %22, %17
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
define i32 @compareInt(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp slt i32 %4, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ mltranspose(int, int, double **, double **);
void mtranspose(double A[3][3], double B[3][3]) { mltranspose(3, 3, A, B); }


x86 assembly (clang, -O0):
<mtranspose>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x3,%esi
mov    %esi,%edi
call   1030 <mltranspose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mtranspose>:
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    $0x3,%edi
mov    $0x3,%esi
jmp    1030 <mltranspose@plt>

LLVM IR (-O0):
define void @mtranspose([3 x double]* %0, [3 x double]* %1) {
%3 = alloca [3 x double]*
%4 = alloca [3 x double]*
store [3 x double]* %0, [3 x double]** %3
store [3 x double]* %1, [3 x double]** %4
%5 = load [3 x double]*, [3 x double]** %3
%6 = bitcast [3 x double]* %5 to double**
%7 = load [3 x double]*, [3 x double]** %4
%8 = bitcast [3 x double]* %7 to double**
%9 = call i32 @mltranspose(i32 3, i32 3, double** %6, double** %8)
ret void
}

LLVM IR (-O2):
define void @mtranspose([3 x double]* %0, [3 x double]* %1) {
%3 = bitcast [3 x double]* %0 to double**
%4 = bitcast [3 x double]* %1 to double**
%5 = tail call i32 @mltranspose(i32 3, i32 3, double** %3, double** %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *mymalloc(size_t size, const char *errstring) {
  void *retval;
  if (size) {
    retval = malloc(size);
    if (retval == NULL) {
      fprintf(stderr, "malloc failed '%s'\n", errstring);
      exit(1);
    }
  } else {
    retval = NULL;
  }
  return retval;
}


x86 assembly (clang, -O0):
<mymalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     118b <mymalloc+0x5b>
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1186 <mymalloc+0x56>
mov    0x2e76(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe89(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
jmp    1193 <mymalloc+0x63>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mymalloc>:
push   %rbx
test   %rdi,%rdi
je     1145 <mymalloc+0x15>
mov    %rsi,%rbx
call   1040 <malloc@plt>
test   %rax,%rax
je     1149 <mymalloc+0x19>
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"malloc failed '%s'\0A\00"
define i8* @mymalloc(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
%5 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%6 = load i64, i64* %3
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %19
8: ; preds = %2
%9 = load i64, i64* %3
%10 = call i8* @malloc(i64 %9)
store i8* %10, i8** %5
%11 = load i8*, i8** %5
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %18
13: ; preds = %8
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %4
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = call i32 @exit(i32 1)
unreachable
18: ; preds = %8
br label %20
19: ; preds = %2
store i8* null, i8** %5
br label %20
20: ; preds = %19, %18
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"malloc failed '%s'\0A\00"
define noalias i8* @mymalloc(i64 %0, i8* %1) {
%3 = icmp eq i64 %0, 0
br i1 %3, label %11, label %4
4: ; preds = %2
%5 = tail call i8* @malloc(i64 %0)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %11
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %1)
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %2, %4
%12 = phi i8* [ %5, %4 ], [ null, %2 ]
ret i8* %12
}
int f_impl() { return 21; }


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

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

LLVM IR (-O0):
define i32 @f_impl() {
ret i32 21
}

LLVM IR (-O2):
define i32 @f_impl() {
ret i32 21
}
/* Variables and functions */
bool is_whitespace(char c) {
  return (c == ' ' || c == '\t' || c == '\n' || c == '\r');
}


x86 assembly (clang, -O0):
<is_whitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_whitespace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x9,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_whitespace+0x4d>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     114d <is_whitespace+0x4d>
movsbl -0x1(%rbp),%eax
cmp    $0xd,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_whitespace>:
cmp    $0x20,%dil
ja     1120 <is_whitespace+0x20>
mov    $0x1,%eax
movzbl %dil,%ecx
movabs $0x100000600,%rdx
bt     %rcx,%rdx
jae    1120 <is_whitespace+0x20>
ret
xor    %eax,%eax
cmp    $0xd,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @is_whitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 9
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 10
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 13
br label %18
18: ; preds = %14, %10, %6, %1
%19 = phi i1 [ true, %10 ], [ true, %6 ], [ true, %1 ], [ %17, %14 ]
%20 = zext i1 %19 to i32
ret i32 %20
}

LLVM IR (-O2):
define i32 @is_whitespace(i8 signext %0) {
switch i8 %0, label %2 [
i8 32, label %5
i8 10, label %5
i8 9, label %5
]
2: ; preds = %1
%3 = icmp eq i8 %0, 13
%4 = zext i1 %3 to i32
br label %5
5: ; preds = %1, %1, %1, %2
%6 = phi i32 [ 1, %1 ], [ %4, %2 ], [ 1, %1 ], [ 1, %1 ]
ret i32 %6
}
void highlight(int x, int y) {}


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

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

LLVM IR (-O0):
define void @highlight(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 @highlight(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int ad_turn_off(int, int);
int cmd_close_dev(int dev) { return ad_turn_off(1, dev); }


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

x86 assembly (clang, -O2):
<cmd_close_dev>:
mov    %edi,%esi
mov    $0x1,%edi
jmp    1030 <ad_turn_off@plt>

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

LLVM IR (-O2):
define i32 @cmd_close_dev(i32 %0) {
%2 = tail call i32 @ad_turn_off(i32 1, i32 %0)
ret i32 %2
}