xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ radio_get_hlsi();
int /*<<< orphan*/ rom_write(int, int /*<<< orphan*/);
void radio_write_rom_hlsi(void) { rom_write(53, radio_get_hlsi()); }


x86 assembly (clang, -O0):
<radio_write_rom_hlsi>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <radio_get_hlsi@plt>
mov    %eax,%esi
mov    $0x35,%edi
call   1040 <rom_write@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<radio_write_rom_hlsi>:
push   %rax
xor    %eax,%eax
call   1030 <radio_get_hlsi@plt>
mov    $0x35,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <rom_write@plt>

LLVM IR (-O0):
define void @radio_write_rom_hlsi() {
%1 = call i32 (...) @radio_get_hlsi()
%2 = call i32 @rom_write(i32 53, i32 %1)
ret void
}

LLVM IR (-O2):
define void @radio_write_rom_hlsi() {
%1 = tail call i32 (...) @radio_get_hlsi()
%2 = tail call i32 @rom_write(i32 53, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fp(double *);
int /*<<< orphan*/ inte(int *);
main() {
  double d = 2;
  fp(&d);
  if (d != 5)
    abort();
  int i = 7;
  inte(&i);
  if (i != 10)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
call   1040 <fp@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe9e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    1177 <main+0x47>
jp     1177 <main+0x47>
jmp    117e <main+0x4e>
mov    $0x0,%al
call   1030 <abort@plt>
movl   $0x7,-0x14(%rbp)
lea    -0x14(%rbp),%rdi
call   1050 <inte@plt>
cmpl   $0xa,-0x14(%rbp)
je     119f <main+0x6f>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movabs $0x4000000000000000,%rax
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rdi
call   1040 <fp@plt>
movsd  0x10(%rsp),%xmm0
ucomisd 0xea5(%rip),%xmm0
jne    117f <main+0x4f>
jp     117f <main+0x4f>
movl   $0x7,0xc(%rsp)
lea    0xc(%rsp),%rdi
call   1050 <inte@plt>
cmpl   $0xa,0xc(%rsp)
jne    117f <main+0x4f>
xor    %eax,%eax
add    $0x18,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
store i32 0, i32* %1
store double 2.000000e+00, double* %2
%4 = call i32 @fp(double* %2)
%5 = load double, double* %2
%6 = fcmp une double %5, 5.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
store i32 7, i32* %3
%10 = call i32 @inte(i32* %3)
%11 = load i32, i32* %3
%12 = icmp ne i32 %11, 10
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = call i32 (...) @abort()
unreachable
15: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca double
%2 = alloca i32
%3 = bitcast double* %1 to i8*
store double 2.000000e+00, double* %1
%4 = call i32 @fp(double* %1)
%5 = load double, double* %1
%6 = fcmp une double %5, 5.000000e+00
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %0
%10 = bitcast i32* %2 to i8*
store i32 7, i32* %2
%11 = call i32 @inte(i32* %2)
%12 = load i32, i32* %2
%13 = icmp eq i32 %12, 10
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %9
ret i32 0
}
int f_blt_cr2(float a1) { return !(__builtin_isless(100, a1)); }


x86 assembly (clang, -O0):
<f_blt_cr2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xeea(%rip),%xmm1
ucomiss %xmm1,%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_blt_cr2>:
xor    %eax,%eax
ucomiss 0xef7(%rip),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @f_blt_cr2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fcmp olt float 1.000000e+02, %3
%5 = xor i1 %4, true
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @f_blt_cr2(float %0) {
%2 = fcmp ule float %0, 1.000000e+02
%3 = zext i1 %2 to i32
ret i32 %3
}
void RTStrFormat(void) {}


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

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

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

LLVM IR (-O2):
define void @RTStrFormat() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int do_error(int state, char *message) {
  if (state < 0) {
    perror(message);
    return 1;
  }
}


x86 assembly (clang, -O0):
<do_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    1139 <do_error+0x29>
mov    -0x10(%rbp),%rdi
call   1030 <perror@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_error>:
test   %edi,%edi
js     111a <do_error+0xa>
mov    $0x1,%eax
ret
push   %rax
mov    %rsi,%rdi
call   1030 <perror@plt>
add    $0x8,%rsp
mov    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @do_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = call i32 @perror(i8* %9)
store i32 1, i32* %3
br label %11
11: ; preds = %8, %2
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @do_error(i32 %0, i8* nocapture %1) {
%3 = icmp slt i32 %0, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @perror(i8* %1)
br label %6
6: ; preds = %4, %2
ret i32 1
}
void __attribute__((used, retain)) f2(void) {}


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

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

LLVM IR (-O0):
@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @f2 to i8*)], section "llvm.metadata"
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @f2 to i8*)], section "llvm.metadata"
define void @f2() {
ret void
}

LLVM IR (-O2):
@llvm.used = appending global [1 x i8*] [i8* bitcast (void ()* @f2 to i8*)], section "llvm.metadata"
define void @f2() {
ret void
}
/* Type definitions */
typedef unsigned char uint32_t;

/* Variables and functions */
void GPIO_writeDio(uint32_t dioNumber, uint32_t value) {
  ;
  ;
  (*((volatile unsigned char *)(0x40022000 + dioNumber))) = value;
}


x86 assembly (clang, -O0):
<GPIO_writeDio>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%cl
movzbl -0x1(%rbp),%eax
add    $0x40022000,%eax
cltq
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPIO_writeDio>:
mov    %edi,%eax
mov    %sil,0x40022000(%rax)
ret

LLVM IR (-O0):
define void @GPIO_writeDio(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%5 = load i8, i8* %4
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = add nsw i32 1073881088, %7
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
store volatile i8 %5, i8* %10
ret void
}

LLVM IR (-O2):
define void @GPIO_writeDio(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i64
%4 = or i64 %3, 1073881088
%5 = inttoptr i64 %4 to i8*
store volatile i8 %1, i8* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void flushStdout() { fflush(stdout); }


x86 assembly (clang, -O0):
<flushStdout>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<flushStdout>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @flushStdout() {
%1 = load i32, i32* @stdout
%2 = call i32 @fflush(i32 %1)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @flushStdout() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fflush(i32 %1)
ret void
}
void lbal_read(struct session *sp) {}


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

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

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

LLVM IR (-O2):
%struct.session = type opaque
define void @lbal_read(%struct.session* nocapture %0) {
ret void
}
int arm() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @arm() {
ret i32 0
}
/* Variables and functions */
char *appaserver_parameter_file_get_appaserver_data_directory();
char *appaserver_parameter_file_get_data_directory(void) {
  return appaserver_parameter_file_get_appaserver_data_directory();
}


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

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

LLVM IR (-O0):
define i8* @appaserver_parameter_file_get_data_directory() {
%1 = call i8* (...) @appaserver_parameter_file_get_appaserver_data_directory()
ret i8* %1
}

LLVM IR (-O2):
define i8* @appaserver_parameter_file_get_data_directory() {
%1 = tail call i8* (...) @appaserver_parameter_file_get_appaserver_data_directory()
ret i8* %1
}
/* Variables and functions */
size_t root(int *, int);
int size_of(int *p, int a) { return -p[root(p, a)]; }


x86 assembly (clang, -O0):
<size_of>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <root@plt>
mov    -0x18(%rbp),%rcx
mov    %rax,%rdx
xor    %eax,%eax
sub    (%rcx,%rdx,4),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<size_of>:
push   %rbx
mov    %rdi,%rbx
call   1030 <root@plt>
xor    %ecx,%ecx
sub    (%rbx,%rax,4),%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @size_of(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** %3
%7 = load i32, i32* %4
%8 = call i64 @root(i32* %6, i32 %7)
%9 = getelementptr inbounds i32, i32* %5, i64 %8
%10 = load i32, i32* %9
%11 = sub nsw i32 0, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @size_of(i32* %0, i32 %1) {
%3 = tail call i64 @root(i32* %0, i32 %1)
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
%6 = sub nsw i32 0, %5
ret i32 %6
}
unsigned int power(unsigned int base, unsigned int exp) {
  if (exp == 0) {
    return 1;
  } else if (exp % 2) {
    return base * power(base, exp - 1);
  } else {
    unsigned int tmp = power(base, exp / 2);
    return tmp * tmp;
  }
}


x86 assembly (clang, -O0):
<power>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1134 <power+0x24>
movl   $0x1,-0x4(%rbp)
jmp    1182 <power+0x72>
mov    -0xc(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1167 <power+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <power@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1182 <power+0x72>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
shr    $0x1,%esi
call   1030 <power@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<power>:
push   %rbx
test   %esi,%esi
je     113e <power+0x2e>
mov    $0x1,%ebx
test   $0x1,%sil
je     112d <power+0x1d>
add    $0xffffffff,%esi
je     1148 <power+0x38>
mov    %edi,%ebx
test   $0x1,%sil
jne    1145 <power+0x35>
shr    %esi
call   1030 <power@plt>
imul   %eax,%ebx
imul   %eax,%ebx
mov    %ebx,%edi
jmp    1148 <power+0x38>
mov    $0x1,%edi
jmp    1148 <power+0x38>
imul   %edi,%edi
mov    %edi,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @power(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %15, label %4
4: ; preds = %2
%5 = and i32 %1, 1
%6 = icmp eq i32 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %4
%8 = add i32 %1, -1
%9 = icmp eq i32 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %7
%11 = and i32 %8, 1
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = mul i32 %0, %0
br label %15
15: ; preds = %7, %13, %2, %17
%16 = phi i32 [ %23, %17 ], [ 1, %2 ], [ %0, %7 ], [ %14, %13 ]
ret i32 %16
17: ; preds = %10, %4
%18 = phi i32 [ %1, %4 ], [ %8, %10 ]
%19 = phi i32 [ 1, %4 ], [ %0, %10 ]
%20 = lshr i32 %18, 1
%21 = tail call i32 @power(i32 %0, i32 %20)
%22 = mul i32 %21, %19
%23 = mul i32 %22, %21
br label %15
}
/* Variables and functions */
int core9_swap(char *, int);
int U_EMRARCTO_swap(char *record, int torev) {
  return (core9_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRARCTO_swap>:
jmp    1030 <core9_swap@plt>

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

LLVM IR (-O2):
define i32 @U_EMRARCTO_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core9_swap(i8* %0, i32 %1)
ret i32 %3
}
int fun_2(char *a) {
  return *((char *)__builtin_assume_aligned((char *)((unsigned int)a * 2), 1));
}


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

x86 assembly (clang, -O2):
<fun_2>:
add    %edi,%edi
movsbl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @fun_2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i32
%5 = mul i32 %4, 2
%6 = zext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @fun_2(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = shl i64 %2, 1
%4 = and i64 %3, 4294967294
%5 = inttoptr i64 %4 to i8*
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
ret i32 %7
}
/* Variables and functions */
int integer_power(int, int);
int lookup1_values(int dimension, int entry) {
  int ret;
  for (ret = 1; integer_power(ret, dimension) <= entry; ret++)
    ;
  return ret - 1;
}


x86 assembly (clang, -O0):
<lookup1_values>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1030 <integer_power@plt>
cmp    -0x8(%rbp),%eax
jg     114c <lookup1_values+0x3c>
jmp    113e <lookup1_values+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <lookup1_values+0x15>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookup1_values>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0xffffffff,%ebx
xchg   %ax,%ax
lea    0x2(%rbx),%edi
mov    %ebp,%esi
call   1030 <integer_power@plt>
add    $0x1,%ebx
cmp    %r14d,%eax
jle    1120 <lookup1_values+0x10>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @lookup1_values(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i32 [ 1, %2 ], [ %7, %3 ]
%5 = tail call i32 @integer_power(i32 %4, i32 %0)
%6 = icmp sgt i32 %5, %1
%7 = add nuw nsw i32 %4, 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = add nsw i32 %4, -1
ret i32 %9
}
int getTerritoryCode(void) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @getTerritoryCode() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void do_banner() {
  printf(
      "MiniUnz 1.01e, demo of zLib + Unz package written by Gilles Vollant\n");
  printf("more info at http://www.winimage.com/zLibDll/unzip.html\n\n");
}


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

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

LLVM IR (-O0):
@.str = [69 x i8] c"MiniUnz 1.01e, demo of zLib + Unz package written by Gilles Vollant\0A\00"
@.str.1 = [58 x i8] c"more info at http://www.winimage.com/zLibDll/unzip.html\0A\0A\00"
define void @do_banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [68 x i8] c"MiniUnz 1.01e, demo of zLib + Unz package written by Gilles Vollant\00"
@str.2 = [57 x i8] c"more info at http://www.winimage.com/zLibDll/unzip.html\0A\00"
define void @do_banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([68 x i8], [68 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @str.2, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ucgen_ciz(int);
int main() {
  ucgen_ciz(3);
  ucgen_ciz(2);
  ucgen_ciz(4);
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @ucgen_ciz(i32 3)
%2 = tail call i32 @ucgen_ciz(i32 2)
%3 = tail call i32 @ucgen_ciz(i32 4)
ret i32 0
}
extern void _exit(int status) {
  for (;;)
    ;
}


x86 assembly (clang, -O0):
<_exit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
jmp    1107 <_exit+0x7>

x86 assembly (clang, -O2):
<_exit>:
jmp    1100 <_exit>

LLVM IR (-O0):
define void @_exit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %3, %1
br label %3
}

LLVM IR (-O2):
define void @_exit(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
void SPIM_DisableRxInt(void) {}


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

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

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

LLVM IR (-O2):
define void @SPIM_DisableRxInt() {
ret void
}
int nb_len_b(unsigned long nb, int b) {
  double tmp;
  int i;
  tmp = nb;
  i = 1;
  while (tmp >= b) {
    (tmp = tmp / b);
    ++i;
  }
  return (i);
}


x86 assembly (clang, -O0):
<nb_len_b>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movaps 0xeee(%rip),%xmm1
movq   -0x8(%rbp),%xmm0
punpckldq %xmm1,%xmm0
movapd 0xeed(%rip),%xmm1
subpd  %xmm1,%xmm0
movaps %xmm0,%xmm1
unpckhpd %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x1,-0x1c(%rbp)
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1173 <nb_len_b+0x73>
movsd  -0x18(%rbp),%xmm0
cvtsi2sdl -0xc(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    113e <nb_len_b+0x3e>
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nb_len_b>:
movq   %rdi,%xmm2
punpckldq 0xef3(%rip),%xmm2
subpd  0xefb(%rip),%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
cvtsi2sd %esi,%xmm1
addsd  %xmm2,%xmm0
mov    $0x1,%eax
ucomisd %xmm1,%xmm0
jb     114d <nb_len_b+0x4d>
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
divsd  %xmm1,%xmm0
add    $0x1,%eax
ucomisd %xmm1,%xmm0
jae    1140 <nb_len_b+0x40>
ret

LLVM IR (-O0):
define i32 @nb_len_b(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca double
%6 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%7 = load i64, i64* %3
%8 = uitofp i64 %7 to double
store double %8, double* %5
store i32 1, i32* %6
br label %9
9: ; preds = %14, %2
%10 = load double, double* %5
%11 = load i32, i32* %4
%12 = sitofp i32 %11 to double
%13 = fcmp oge double %10, %12
br i1 %13, label %14, label %21
14: ; preds = %9
%15 = load double, double* %5
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to double
%18 = fdiv double %15, %17
store double %18, double* %5
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %9
21: ; preds = %9
%22 = load i32, i32* %6
ret i32 %22
}

LLVM IR (-O2):
define i32 @nb_len_b(i64 %0, i32 %1) {
%3 = uitofp i64 %0 to double
%4 = sitofp i32 %1 to double
%5 = fcmp ult double %3, %4
br i1 %5, label %12, label %6
6: ; preds = %2, %6
%7 = phi i32 [ %10, %6 ], [ 1, %2 ]
%8 = phi double [ %9, %6 ], [ %3, %2 ]
%9 = fdiv double %8, %4
%10 = add nuw nsw i32 %7, 1
%11 = fcmp ult double %9, %4
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = phi i32 [ 1, %2 ], [ %10, %6 ]
ret i32 %13
}
/* Type definitions */
typedef int /*<<< orphan*/ b;
typedef int /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  int a;
  short b;
  printf("%ld %ld", sizeof(a), sizeof(b));
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"%ld %ld\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 4, i32 2)
ret i32 0
}
/* Variables and functions */
double exp(double);
double f3(double x) { return exp(x) - (2 * x + 1); }


x86 assembly (clang, -O0):
<f3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xec8(%rip),%xmm2
addsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f3>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <exp@plt>
movsd  (%rsp),%xmm1
addsd  %xmm1,%xmm1
addsd  0xed4(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @f3(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @exp(double %3)
%5 = load double, double* %2
%6 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %5, double 1.000000e+00)
%7 = fsub double %4, %6
ret double %7
}

LLVM IR (-O2):
define double @f3(double %0) {
%2 = tail call double @exp(double %0)
%3 = tail call double @llvm.fmuladd.f64(double %0, double 2.000000e+00, double 1.000000e+00)
%4 = fsub double %2, %3
ret double %4
}
void foo(void) {
  printf("\n%s\n", __func__);
  char s[] = "star was noel";
  PrintInReverse(s);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    0xecf(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0xec5(%rip),%rax
mov    %rax,-0xe(%rbp)
mov    0xec3(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xebd(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xe(%rbp),%rdi
mov    $0x0,%al
call   1040 <PrintInReverse@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0xed3(%rip),%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movabs $0x6c656f6e207361,%rax
mov    %rax,0xe(%rsp)
movabs $0x7361772072617473,%rax
77 61 73
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
xor    %eax,%eax
call   1040 <PrintInReverse@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\0A%s\0A\00"
@__func__.foo = [4 x i8] c"foo\00"
@__const.foo.s = [14 x i8] c"star was noel\00"
define void @foo() {
%1 = alloca [14 x i8]
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.foo, i64 0, i64 0))
%3 = bitcast [14 x i8]* %1 to i8*
%4 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @PrintInReverse to i32 (i8*, ...)*)(i8* %4)
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"\0A%s\0A\00"
@__func__.foo = [4 x i8] c"foo\00"
@__const.foo.s = [14 x i8] c"star was noel\00"
define void @foo() {
%1 = alloca [14 x i8]
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @__func__.foo, i64 0, i64 0))
%3 = getelementptr inbounds [14 x i8], [14 x i8]* %1, i64 0, i64 0
%4 = call i32 (i8*, ...) bitcast (i32 (...)* @PrintInReverse to i32 (i8*, ...)*)(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void *tfn1(void *arg) {
  printf("the thread\n");
  sleep(5);
  printf("the thread done\n");
  return NULL;
}


x86 assembly (clang, -O0):
<tfn1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tfn1>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x5,%edi
call   1040 <sleep@plt>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"the thread\0A\00"
@.str.1 = [17 x i8] c"the thread done\0A\00"
define i8* @tfn1(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @sleep(i32 5)
%5 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
ret i8* null
}

LLVM IR (-O2):
@str = [11 x i8] c"the thread\00"
@str.2 = [16 x i8] c"the thread done\00"
define noalias i8* @tfn1(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @sleep(i32 5)
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.2, i64 0, i64 0))
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
int print(const char *file_name) {
  printf("%s\n", file_name);
  return 0;
}


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

x86 assembly (clang, -O2):
<print>:
push   %rax
mov    %rdi,%rsi
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @print(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hello(int, int);
int /*<<< orphan*/ hh();
int main() {
  hh();
  hello(4, 5);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <hh@plt>
mov    $0x4,%edi
mov    $0x5,%esi
call   1040 <hello@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @hh()
%2 = tail call i32 @hello(i32 4, i32 5)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
extern void
xmlrpc_client_event_loop_finish_asynch_timeout(unsigned long milliseconds) {
  char *routine = "xmlrpc_client_event_loop_finish_asynch_timeout";
  {
    fprintf(stderr, "%s: xmlrpc not implemented\n", routine);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<xmlrpc_client_event_loop_finish_asynch_timeout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xecd(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xee4(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<xmlrpc_client_event_loop_finish_asynch_timeout>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xefe(%rip),%rsi
lea    0xec8(%rip),%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [47 x i8] c"xmlrpc_client_event_loop_finish_asynch_timeout\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"%s: xmlrpc not implemented\0A\00"
define void @xmlrpc_client_event_loop_finish_asynch_timeout(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0), i8** %3
%4 = load i32, i32* @stderr
%5 = load i8*, i8** %3
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [47 x i8] c"xmlrpc_client_event_loop_finish_asynch_timeout\00"
@stderr = global i32 0
@.str.1 = [28 x i8] c"%s: xmlrpc not implemented\0A\00"
define void @xmlrpc_client_event_loop_finish_asynch_timeout(i64 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @exit(i32 1)
unreachable
}
int host_is_bigendian(void) {
  unsigned char str[] = {0x1, 0x2, 0x3, 0x4};
  unsigned int *ptr;
  ptr = (unsigned int *)str;
  return *ptr == 0x01020304;
}


x86 assembly (clang, -O0):
<host_is_bigendian>:
push   %rbp
mov    %rsp,%rbp
mov    0xef6(%rip),%eax
mov    %eax,-0x4(%rbp)
lea    -0x4(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x1020304,(%rax)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.host_is_bigendian.str = [4 x i8] c"\01\02\03\04"
define i32 @host_is_bigendian() {
%1 = alloca [4 x i8]
%2 = alloca i32*
%3 = bitcast [4 x i8]* %1 to i8*
%4 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%5 = bitcast i8* %4 to i32*
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = load i32, i32* %6
%8 = icmp eq i32 %7, 16909060
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @host_is_bigendian() {
ret i32 0
}
/* Variables and functions */
double sin(double);
double x_func_sin2(double x, void *args) { return sin(x) * sin(x); }


x86 assembly (clang, -O0):
<x_func_sin2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<x_func_sin2>:
sub    $0x18,%rsp
movsd  %xmm0,0x8(%rsp)
call   1030 <sin@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @x_func_sin2(double %0, i8* %1) {
%3 = alloca double
%4 = alloca i8*
store double %0, double* %3
store i8* %1, i8** %4
%5 = load double, double* %3
%6 = call double @sin(double %5)
%7 = load double, double* %3
%8 = call double @sin(double %7)
%9 = fmul double %6, %8
ret double %9
}

LLVM IR (-O2):
define double @x_func_sin2(double %0, i8* nocapture readnone %1) {
%3 = tail call double @sin(double %0)
%4 = tail call double @sin(double %0)
%5 = fmul double %3, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int hive_socket() {
  int sock;
  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1)
    fprintf(stderr, "Creation socket Failed\n");
  return (sock);
}


x86 assembly (clang, -O0):
<hive_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    0x2e98(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,-0x4(%rbp)
cmp    $0xffffffff,%eax
jne    1162 <hive_socket+0x42>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hive_socket>:
push   %rbx
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
mov    0x2e9f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <socket@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1156 <hive_socket+0x36>
mov    0x2e90(%rip),%rax
mov    (%rax),%edi
lea    0xeaf(%rip),%rsi
call   1030 <fprintf@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Creation socket Failed\0A\00"
define i32 @hive_socket() {
%1 = alloca i32
%2 = load i32, i32* @AF_INET
%3 = load i32, i32* @SOCK_STREAM
%4 = call i32 @socket(i32 %2, i32 %3, i32 0)
store i32 %4, i32* %1
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = load i32, i32* @stderr
%8 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %6, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str = [24 x i8] c"Creation socket Failed\0A\00"
define i32 @hive_socket() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %5, %0
ret i32 %3
}
/* Type definitions */
struct sockaddr {
  scalar_t__ sa_family;
};

/* Variables and functions */
int idrnet_sockaddr_family(void *sockaddr) {
  struct sockaddr *addr = (struct sockaddr *)sockaddr;
  return (int)addr->sa_family;
}


x86 assembly (clang, -O0):
<idrnet_sockaddr_family>:
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):
<idrnet_sockaddr_family>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
%struct.sockaddr = type { i64 }
define i32 @idrnet_sockaddr_family(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.sockaddr*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to %struct.sockaddr*
store %struct.sockaddr* %5, %struct.sockaddr** %3
%6 = load %struct.sockaddr*, %struct.sockaddr** %3
%7 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %6, i32 0, i32 0
%8 = load i64, i64* %7
%9 = trunc i64 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @idrnet_sockaddr_family(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
void apple_bl_unregister(void) {}


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

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

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

LLVM IR (-O2):
define void @apple_bl_unregister() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void module_main(void) {
  fprintf(stdout, "Hello from lib1.c\n");
  fflush(stdout);
}


x86 assembly (clang, -O0):
<module_main>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<module_main>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
pop    %rbx
jmp    1040 <fflush@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [19 x i8] c"Hello from lib1.c\0A\00"
define void @module_main() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = call i32 @fflush(i32 %3)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [19 x i8] c"Hello from lib1.c\0A\00"
define void @module_main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
ret void
}
void spi_bitbang_delay() {
  volatile int i = 100;
  while (i--) {
  }
}


x86 assembly (clang, -O0):
<spi_bitbang_delay>:
push   %rbp
mov    %rsp,%rbp
movl   $0x64,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
je     1124 <spi_bitbang_delay+0x24>
jmp    110b <spi_bitbang_delay+0xb>
pop    %rbp
ret

x86 assembly (clang, -O2):
<spi_bitbang_delay>:
movl   $0x64,-0x4(%rsp)
nopl   0x0(%rax,%rax,1)
subl   $0x1,-0x4(%rsp)
jae    1110 <spi_bitbang_delay+0x10>
ret

LLVM IR (-O0):
define void @spi_bitbang_delay() {
%1 = alloca i32
store volatile i32 100, i32* %1
br label %2
2: ; preds = %6, %0
%3 = load volatile i32, i32* %1
%4 = add nsw i32 %3, -1
store volatile i32 %4, i32* %1
%5 = icmp ne i32 %3, 0
br i1 %5, label %6, label %7
6: ; preds = %2
br label %2
7: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @spi_bitbang_delay() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store volatile i32 100, i32* %1
br label %3
3: ; preds = %3, %0
%4 = load volatile i32, i32* %1
%5 = add nsw i32 %4, -1
store volatile i32 %5, i32* %1
%6 = icmp eq i32 %4, 0
br i1 %6, label %7, label %3
7: ; preds = %3
ret void
}
int test_imm_CFuint16_reg(unsigned short val) {
  return ((val) & (0xCF << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_CFuint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 207
%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_CFuint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 207
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct _Unwind_Exception {
  int dummy;
};

/* Variables and functions */
int __pnacl_eh_sjlj_Unwind_RaiseException(struct _Unwind_Exception *);
int _Unwind_RaiseException(struct _Unwind_Exception *exc) {
  return __pnacl_eh_sjlj_Unwind_RaiseException(exc);
}


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

x86 assembly (clang, -O2):
<_Unwind_RaiseException>:
jmp    1030 <__pnacl_eh_sjlj_Unwind_RaiseException@plt>

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

LLVM IR (-O2):
%struct._Unwind_Exception = type { i32 }
define i32 @_Unwind_RaiseException(%struct._Unwind_Exception* %0) {
%2 = tail call i32 @__pnacl_eh_sjlj_Unwind_RaiseException(%struct._Unwind_Exception* %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ test30_Led_off__E();
void test30_Blink5_targetInit__I() { test30_Led_off__E(); }


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

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

LLVM IR (-O0):
define void @test30_Blink5_targetInit__I() {
%1 = call i32 (...) @test30_Led_off__E()
ret void
}

LLVM IR (-O2):
define void @test30_Blink5_targetInit__I() {
%1 = tail call i32 (...) @test30_Led_off__E()
ret void
}
char square_to_rank(int square) { return (square / 8) + 49; }


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

x86 assembly (clang, -O2):
<square_to_rank>:
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
shr    $0x3,%eax
add    $0x31,%al
ret

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

LLVM IR (-O2):
define signext i8 @square_to_rank(i32 %0) {
%2 = sdiv i32 %0, 8
%3 = trunc i32 %2 to i8
%4 = add i8 %3, 49
ret i8 %4
}
void __attribute__((constructor)) init() {
  printf(__func__);
  printf("\n");
}


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

x86 assembly (clang, -O2):
<init>:
push   %rax
lea    0xed8(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@__func__.init = [5 x i8] c"init\00"
@.str = [2 x i8] c"\0A\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.init, i64 0, i64 0))
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@__func__.init = [5 x i8] c"init\00"
@llvm.global_ctors = appending global [1 x { i32, void ()*, i8* }] [{ i32, void ()*, i8* } { i32 65535, void ()* @init, i8* null }]
define void @init() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @__func__.init, i64 0, i64 0))
%2 = tail call i32 @putchar(i32 10)
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void def_usleep(uint32_t us) {
  volatile uint32_t dec = us * 2;
  while (dec--)
    ;
}


x86 assembly (clang, -O0):
<def_usleep>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1129 <def_usleep+0x29>
jmp    1110 <def_usleep+0x10>
pop    %rbp
ret

x86 assembly (clang, -O2):
<def_usleep>:
add    %edi,%edi
mov    %edi,-0x4(%rsp)
cs nopw 0x0(%rax,%rax,1)
subl   $0x1,-0x4(%rsp)
jae    1110 <def_usleep+0x10>
ret

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

LLVM IR (-O2):
define void @def_usleep(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = shl nsw i32 %0, 1
store volatile i32 %4, i32* %2
br label %5
5: ; preds = %5, %1
%6 = load volatile i32, i32* %2
%7 = add nsw i32 %6, -1
store volatile i32 %7, i32* %2
%8 = icmp eq i32 %6, 0
br i1 %8, label %9, label %5
9: ; preds = %5
ret void
}
int empty_get_call_context(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @empty_get_call_context() {
ret i32 0
}