xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void printArgs(int _argc, char **_argv) {
  while (--_argc) {
    printf("Arg: %s\n", *++_argv);
  }
  printf("All Done\n");
}


x86 assembly (clang, -O0):
<printArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
cmp    $0x0,%eax
je     1157 <printArgs+0x47>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    0x8(%rax),%rsi
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    111f <printArgs+0xf>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printArgs>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    $0x1,%edi
je     1157 <printArgs+0x37>
mov    %rsi,%r15
mov    %edi,%r12d
mov    $0x1,%ebx
lea    0xec1(%rip),%r14
nop
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %ebx,%r12d
jne    1140 <printArgs+0x20>
lea    0xeab(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

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

/* Variables and functions */
int /*<<< orphan*/ free(void *);
void _tree_free(struct libavl_allocator *allocator, void *libavl_block) {
  free(libavl_block);
}


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

x86 assembly (clang, -O2):
<_tree_free>:
mov    %rsi,%rdi
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.libavl_allocator = type { i32 }
define void @_tree_free(%struct.libavl_allocator* %0, i8* %1) {
%3 = alloca %struct.libavl_allocator*
%4 = alloca i8*
store %struct.libavl_allocator* %0, %struct.libavl_allocator** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @free(i8* %5)
ret void
}

LLVM IR (-O2):
%struct.libavl_allocator = type { i32 }
define void @_tree_free(%struct.libavl_allocator* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int SetCharTableEsc(unsigned char *, char const *, char *);
int SetCharTable(unsigned char *table, const char *map) {
  return SetCharTableEsc(table, map, "");
}


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

x86 assembly (clang, -O2):
<SetCharTable>:
lea    0xee9(%rip),%rdx
jmp    1030 <SetCharTableEsc@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
define i32 @SetCharTable(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @SetCharTableEsc(i8* %5, i8* %6, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
define i32 @SetCharTable(i8* %0, i8* %1) {
%3 = tail call i32 @SetCharTableEsc(i8* %0, i8* %1, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int lstat_nomap_nolog(char const *, struct stat *);
int real_lstat(const char *path, struct stat *statbuf) {
  int r;
  r = lstat_nomap_nolog(path, statbuf);
  return (r);
}


x86 assembly (clang, -O0):
<real_lstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <lstat_nomap_nolog@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_lstat>:
jmp    1030 <lstat_nomap_nolog@plt>

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

LLVM IR (-O2):
%struct.stat = type { i32 }
define i32 @real_lstat(i8* %0, %struct.stat* %1) {
%3 = tail call i32 @lstat_nomap_nolog(i8* %0, %struct.stat* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
void __create_3_set_value(void *c, void *k, void *v, bool n) {
  *(uint64_t *)v = *(uint64_t *)c;
}


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

x86 assembly (clang, -O2):
<__create_3_set_value>:
mov    (%rdi),%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @__create_3_set_value(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = load i8*, i8** %7
%13 = bitcast i8* %12 to i32*
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @__create_3_set_value(i8* nocapture %0, i8* nocapture readnone %1, i8* nocapture writeonly %2, i32 %3) {
%5 = bitcast i8* %0 to i32*
%6 = load i32, i32* %5
%7 = bitcast i8* %2 to i32*
store i32 %6, i32* %7
ret void
}
double foo(double a, double b, double c) {
  double arr[5] = {1., 2., 3., 4., 5.};
  double d = 4.;
  double *p = &d;
  return a + b + c + arr[4] + arr[0] + *p;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1030 <memset@plt>
movsd  0xee1(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xeb7(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xe9a(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe95(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe80(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
lea    -0x48(%rbp),%rax
mov    %rax,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
addsd  -0x40(%rbp),%xmm0
mov    -0x50(%rbp),%rax
addsd  (%rax),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
addsd  %xmm1,%xmm0
addsd  %xmm2,%xmm0
addsd  0xef0(%rip),%xmm0
addsd  0xef0(%rip),%xmm0
addsd  0xef0(%rip),%xmm0
ret

LLVM IR (-O0):
define double @foo(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca [5 x double]
%8 = alloca double
%9 = alloca double*
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%10 = bitcast [5 x double]* %7 to i8*
%11 = bitcast i8* %10 to [5 x double]*
%12 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 0
store double 1.000000e+00, double* %12
%13 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 1
store double 2.000000e+00, double* %13
%14 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 2
store double 3.000000e+00, double* %14
%15 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 3
store double 4.000000e+00, double* %15
%16 = getelementptr inbounds [5 x double], [5 x double]* %11, i32 0, i32 4
store double 5.000000e+00, double* %16
store double 4.000000e+00, double* %8
store double* %8, double** %9
%17 = load double, double* %4
%18 = load double, double* %5
%19 = fadd double %17, %18
%20 = load double, double* %6
%21 = fadd double %19, %20
%22 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 4
%23 = load double, double* %22
%24 = fadd double %21, %23
%25 = getelementptr inbounds [5 x double], [5 x double]* %7, i64 0, i64 0
%26 = load double, double* %25
%27 = fadd double %24, %26
%28 = load double*, double** %9
%29 = load double, double* %28
%30 = fadd double %27, %29
ret double %30
}

LLVM IR (-O2):
define double @foo(double %0, double %1, double %2) {
%4 = fadd double %0, %1
%5 = fadd double %4, %2
%6 = fadd double %5, 5.000000e+00
%7 = fadd double %6, 1.000000e+00
%8 = fadd double %7, 4.000000e+00
ret double %8
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ writebyte(unsigned int, int /*<<< orphan*/ *);
void writeword(unsigned int i, FILE *fp) {
  writebyte(i % 256, fp);
  writebyte(i / 256, fp);
}


x86 assembly (clang, -O0):
<writeword>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
and    $0xff,%edi
mov    -0x10(%rbp),%rsi
call   1030 <writebyte@plt>
mov    -0x4(%rbp),%edi
shr    $0x8,%edi
mov    -0x10(%rbp),%rsi
call   1030 <writebyte@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<writeword>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
movzbl %bpl,%edi
call   1030 <writebyte@plt>
shr    $0x8,%ebp
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <writebyte@plt>

LLVM IR (-O0):
define void @writeword(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 = urem i32 %5, 256
%7 = load i32*, i32** %4
%8 = call i32 @writebyte(i32 %6, i32* %7)
%9 = load i32, i32* %3
%10 = udiv i32 %9, 256
%11 = load i32*, i32** %4
%12 = call i32 @writebyte(i32 %10, i32* %11)
ret void
}

LLVM IR (-O2):
define void @writeword(i32 %0, i32* %1) {
%3 = and i32 %0, 255
%4 = tail call i32 @writebyte(i32 %3, i32* %1)
%5 = lshr i32 %0, 8
%6 = tail call i32 @writebyte(i32 %5, i32* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int test();
int /*<<< orphan*/ test1(int);
int main(void) {
  int b;
  printf("%d\n", b);
  b = test();
  printf("%d\n", b);
  test1(b);
  printf("%d\n", b);
  test();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <test@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%edi
call   1030 <test1@plt>
mov    -0x4(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
lea    0xec6(%rip),%rbx
mov    %rbx,%rdi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <test@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %ebp,%edi
call   1030 <test1@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <test@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 undef)
%2 = tail call i32 (...) @test()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @test1(i32 %2)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%6 = tail call i32 (...) @test()
ret i32 0
}
/* Variables and functions */
scalar_t__ exp(double);
double log(scalar_t__);
double log_sum(double log_a, double log_b) {
  double v;
  if (log_a < log_b) {
    v = log_b + log(1 + exp(log_a - log_b));
  } else {
    v = log_a + log(1 + exp(log_b - log_a));
  }
  return (v);
}


x86 assembly (clang, -O0):
<log_sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1181 <log_sum+0x61>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
call   1030 <exp@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11b7 <log_sum+0x97>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1040 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_sum>:
push   %rax
movapd %xmm1,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
movapd %xmm0,%xmm4
cmpltsd %xmm1,%xmm4
andpd  %xmm4,%xmm3
andnpd %xmm2,%xmm4
orpd   %xmm3,%xmm4
maxsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm4,%xmm0
call   1030 <exp@plt>
lea    0x1(%rax),%rdi
call   1040 <log@plt>
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log_sum(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
store double %0, double* %3
store double %1, double* %4
%6 = load double, double* %3
%7 = load double, double* %4
%8 = fcmp olt double %6, %7
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load double, double* %4
%11 = load double, double* %3
%12 = load double, double* %4
%13 = fsub double %11, %12
%14 = call i64 @exp(double %13)
%15 = add nsw i64 1, %14
%16 = call double @log(i64 %15)
%17 = fadd double %10, %16
store double %17, double* %5
br label %27
18: ; preds = %2
%19 = load double, double* %3
%20 = load double, double* %4
%21 = load double, double* %3
%22 = fsub double %20, %21
%23 = call i64 @exp(double %22)
%24 = add nsw i64 1, %23
%25 = call double @log(i64 %24)
%26 = fadd double %19, %25
store double %26, double* %5
br label %27
27: ; preds = %18, %9
%28 = load double, double* %5
ret double %28
}

LLVM IR (-O2):
define double @log_sum(double %0, double %1) {
%3 = fcmp olt double %0, %1
%4 = fsub double %1, %0
%5 = fsub double %0, %1
%6 = select i1 %3, double %5, double %4
%7 = select i1 %3, double %1, double %0
%8 = tail call i64 @exp(double %6)
%9 = add nsw i64 %8, 1
%10 = tail call double @log(i64 %9)
%11 = fadd double %10, %7
ret double %11
}
/* Variables and functions */
int /*<<< orphan*/ Merge(int *, int /*<<< orphan*/, int);
void MergeSort(int *v, int n) { Merge(v, 0, n - 1); }


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

x86 assembly (clang, -O2):
<MergeSort>:
lea    -0x1(%rsi),%edx
xor    %esi,%esi
jmp    1030 <Merge@plt>

LLVM IR (-O0):
define void @MergeSort(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 = sub nsw i32 %6, 1
%8 = call i32 @Merge(i32* %5, i32 0, i32 %7)
ret void
}

LLVM IR (-O2):
define void @MergeSort(i32* %0, i32 %1) {
%3 = add nsw i32 %1, -1
%4 = tail call i32 @Merge(i32* %0, i32 0, i32 %3)
ret void
}
void __attribute__((no_instrument_function))
__cyg_profile_func_enter(void *this_func, void *call_site) {
  printf("%s: func = %p, called by = %p\n", __FUNCTION__, this_func, call_site);
}


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

x86 assembly (clang, -O2):
<__cyg_profile_func_enter>:
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xee3(%rip),%rdi
lea    0xefb(%rip),%rsi
xor    %eax,%eax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [31 x i8] c"%s: func = %p, called by = %p\0A\00"
@__FUNCTION__.__cyg_profile_func_enter = [25 x i8] c"__cyg_profile_func_enter\00"
define void @__cyg_profile_func_enter(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.__cyg_profile_func_enter, i64 0, i64 0), i8* %5, i8* %6)
ret void
}

LLVM IR (-O2):
@.str = [31 x i8] c"%s: func = %p, called by = %p\0A\00"
@__FUNCTION__.__cyg_profile_func_enter = [25 x i8] c"__cyg_profile_func_enter\00"
define void @__cyg_profile_func_enter(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([25 x i8], [25 x i8]* @__FUNCTION__.__cyg_profile_func_enter, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
void cpu_pause(void) { __asm__ volatile("pause" : : : "memory"); }


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

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

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

LLVM IR (-O2):
define void @cpu_pause() {
tail call void asm sideeffect "pause", "~{memory},~{dirflag},~{fpsr},~{flags}"()
ret void
}
int main(void) {
  1 % 1;
  1 / 1;
  int x = 1;
  1 / x;
  1 % x;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
const char *irda_errmsg(void) { return NULL; }


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

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

LLVM IR (-O0):
define i8* @irda_errmsg() {
ret i8* null
}

LLVM IR (-O2):
define noalias i8* @irda_errmsg() {
ret i8* null
}
char *m_skynetpath() { return "/u1/ericp"; }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"/u1/ericp\00"
define i8* @m_skynetpath() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [10 x i8] c"/u1/ericp\00"
define i8* @m_skynetpath() {
ret i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ od_add(double const *, double *, double *);
int /*<<< orphan*/ od_copy(double const *, double *);
int /*<<< orphan*/ od_minus(double *);
void od_sub(const double *a, const double *b, double *c) {
  double minb[8];
  od_copy(b, minb);
  od_minus(minb);
  od_add(a, minb, c);
}


x86 assembly (clang, -O0):
<od_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x60(%rbp),%rsi
call   1040 <od_copy@plt>
lea    -0x60(%rbp),%rdi
call   1050 <od_minus@plt>
mov    -0x8(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <od_add@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<od_sub>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %rdx,%r14
mov    %rdi,%r15
mov    %rsp,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1040 <od_copy@plt>
mov    %rbx,%rdi
call   1050 <od_minus@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %r14,%rdx
call   1030 <od_add@plt>
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @od_sub(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
%7 = alloca [8 x double]
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%8 = load double*, double** %5
%9 = getelementptr inbounds [8 x double], [8 x double]* %7, i64 0, i64 0
%10 = call i32 @od_copy(double* %8, double* %9)
%11 = getelementptr inbounds [8 x double], [8 x double]* %7, i64 0, i64 0
%12 = call i32 @od_minus(double* %11)
%13 = load double*, double** %4
%14 = getelementptr inbounds [8 x double], [8 x double]* %7, i64 0, i64 0
%15 = load double*, double** %6
%16 = call i32 @od_add(double* %13, double* %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @od_sub(double* %0, double* %1, double* %2) {
%4 = alloca [8 x double]
%5 = bitcast [8 x double]* %4 to i8*
%6 = getelementptr inbounds [8 x double], [8 x double]* %4, i64 0, i64 0
%7 = call i32 @od_copy(double* %1, double* %6)
%8 = call i32 @od_minus(double* %6)
%9 = call i32 @od_add(double* %0, double* %6, double* %2)
ret void
}
/* Variables and functions */
int watchoids(int, int *);
int cmd_watch_rssi(int argc, char **argv) {
  int oid = 0x1001;
  return watchoids(1, &oid);
}


x86 assembly (clang, -O0):
<cmd_watch_rssi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1001,-0x14(%rbp)
mov    $0x1,%edi
lea    -0x14(%rbp),%rsi
call   1030 <watchoids@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_watch_rssi>:
push   %rax
movl   $0x1001,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edi
call   1030 <watchoids@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cmd_watch_rssi(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 4097, i32* %5
%6 = call i32 @watchoids(i32 1, i32* %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @cmd_watch_rssi(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
store i32 4097, i32* %3
%5 = call i32 @watchoids(i32 1, i32* %3)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ do_csi(char *, int);
void mc_printer_controller(int flag) { do_csi("%di", flag ? 5 : 4); }


x86 assembly (clang, -O0):
<mc_printer_controller>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
mov    $0x4,%esi
mov    $0x5,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
lea    0xecb(%rip),%rdi
call   1030 <do_csi@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mc_printer_controller>:
cmp    $0x1,%edi
mov    $0x5,%esi
sbb    $0x0,%esi
lea    0xede(%rip),%rdi
jmp    1030 <do_csi@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%di\00"
define void @mc_printer_controller(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 5, i32 4
%7 = call i32 @do_csi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%di\00"
define void @mc_printer_controller(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i32 4, i32 5
%4 = tail call i32 @do_csi(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printlnInt(int data) { printf("%d\n", data); }


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

x86 assembly (clang, -O2):
<printlnInt>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @printlnInt(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int xcrc_calc(char *, int, int);
void xcrc_set(char *packet, int length) {
  int crc = xcrc_calc(packet, 1, length - 3);
  packet[length - 2] = (char)(crc & 0xFF);
  packet[length - 1] = (char)((crc >> 8) & 0xFF);
}


x86 assembly (clang, -O0):
<xcrc_set>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x3,%edx
mov    $0x1,%esi
call   1030 <xcrc_calc@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%dl
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcrc_set>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x3(%rbx),%edx
mov    $0x1,%esi
call   1030 <xcrc_calc@plt>
movslq %ebx,%rcx
mov    %ax,-0x2(%rcx,%r14,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @xcrc_set(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sub nsw i32 %7, 3
%9 = call i32 @xcrc_calc(i8* %6, i32 1, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = and i32 %10, 255
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sub nsw i32 %14, 2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %13, i64 %16
store i8 %12, i8* %17
%18 = load i32, i32* %5
%19 = ashr i32 %18, 8
%20 = and i32 %19, 255
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i8, i8* %22, i64 %25
store i8 %21, i8* %26
ret void
}

LLVM IR (-O2):
define void @xcrc_set(i8* %0, i32 %1) {
%3 = add nsw i32 %1, -3
%4 = tail call i32 @xcrc_calc(i8* %0, i32 1, i32 %3)
%5 = trunc i32 %4 to i8
%6 = add nsw i32 %1, -2
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
store i8 %5, i8* %8
%9 = lshr i32 %4, 8
%10 = trunc i32 %9 to i8
%11 = add nsw i32 %1, -1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
store i8 %10, i8* %13
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_func_2();
void my_func_1() { my_func_2(); }


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

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

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

LLVM IR (-O2):
define void @my_func_1() {
%1 = tail call i32 (...) @my_func_2()
ret void
}
int ti_mul_start(double const *options) {
  (void)options;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @ti_mul_start(double* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_help_port(const char *def) {
  printf(" -P, --port=PORT\n      Port number to use. Defaults to %s\n", def);
}


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

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

LLVM IR (-O0):
@.str = [59 x i8] c" -P, --port=PORT\0A Port number to use. Defaults to %s\0A\00"
define void @print_help_port(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [59 x i8] c" -P, --port=PORT\0A Port number to use. Defaults to %s\0A\00"
define void @print_help_port(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int floatmore(float a, float b) { return a > b; }


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

x86 assembly (clang, -O2):
<floatmore>:
xor    %eax,%eax
ucomiss %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @floatmore(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 = fcmp ogt float %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @floatmore(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void radio_switch_complete_and_phy_end_disable(void) {}


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

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

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

LLVM IR (-O2):
define void @radio_switch_complete_and_phy_end_disable() {
ret void
}
/* Variables and functions */
int pow(float, int);
float df(float x) { return ((3 * pow(x, 2)) - 4); }


x86 assembly (clang, -O0):
<df>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0x3,%eax,%eax
sub    $0x4,%eax
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<df>:
push   %rax
mov    $0x2,%edi
call   1030 <pow@plt>
lea    (%rax,%rax,2),%eax
add    $0xfffffffc,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @df(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @pow(float %3, i32 2)
%5 = mul nsw i32 3, %4
%6 = sub nsw i32 %5, 4
%7 = sitofp i32 %6 to float
ret float %7
}

LLVM IR (-O2):
define float @df(float %0) {
%2 = tail call i32 @pow(float %0, i32 2)
%3 = mul nsw i32 %2, 3
%4 = add nsw i32 %3, -4
%5 = sitofp i32 %4 to float
ret float %5
}
/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int lseek(int, int, int /*<<< orphan*/);
int cal_block(int fd) {
  int pos, end_pos, nr_blocks;
  pos = lseek(fd, 0, SEEK_CUR);
  end_pos = lseek(fd, 0, SEEK_END);
  nr_blocks = (end_pos - pos) / 4096;
  pos = lseek(fd, pos, SEEK_SET);
  return nr_blocks;
}


x86 assembly (clang, -O0):
<cal_block>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ead(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    $0x1000,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    0x2e6b(%rip),%rax
mov    (%rax),%edx
call   1030 <lseek@plt>
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cal_block>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    0x2ec3(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,%r14d
mov    0x2eb8(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
xor    %esi,%esi
call   1030 <lseek@plt>
mov    %eax,%ebp
sub    %r14d,%ebp
lea    0xfff(%rbp),%eax
test   %ebp,%ebp
cmovs  %eax,%ebp
sar    $0xc,%ebp
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    %ebx,%edi
mov    %r14d,%esi
call   1030 <lseek@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @cal_block(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = load i32, i32* @SEEK_CUR
%8 = call i32 @lseek(i32 %6, i32 0, i32 %7)
store i32 %8, i32* %3
%9 = load i32, i32* %2
%10 = load i32, i32* @SEEK_END
%11 = call i32 @lseek(i32 %9, i32 0, i32 %10)
store i32 %11, i32* %4
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = sdiv i32 %14, 4096
store i32 %15, i32* %5
%16 = load i32, i32* %2
%17 = load i32, i32* %3
%18 = load i32, i32* @SEEK_SET
%19 = call i32 @lseek(i32 %16, i32 %17, i32 %18)
store i32 %19, i32* %3
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
define i32 @cal_block(i32 %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @lseek(i32 %0, i32 0, i32 %2)
%4 = load i32, i32* @SEEK_END
%5 = tail call i32 @lseek(i32 %0, i32 0, i32 %4)
%6 = sub nsw i32 %5, %3
%7 = sdiv i32 %6, 4096
%8 = load i32, i32* @SEEK_SET
%9 = tail call i32 @lseek(i32 %0, i32 %3, i32 %8)
ret i32 %7
}
/* Type definitions */
typedef scalar_t__ int32_t;

/* Variables and functions */
scalar_t__ EEXIST;
scalar_t__ errno;
scalar_t__ mkdir(char const *, int);
int32_t mz_os_make_dir(const char *path) {
  int32_t err = 0;
  err = mkdir(path, 0755);
  if (err != 0 && errno != EEXIST)
    return (-104);
  return (0);
}


x86 assembly (clang, -O0):
<mz_os_make_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1168 <mz_os_make_dir+0x58>
mov    0x2e90(%rip),%rax
mov    (%rax),%rax
mov    0x2e8e(%rip),%rcx
cmp    (%rcx),%rax
je     1168 <mz_os_make_dir+0x58>
movq   $0xffffffffffffff98,-0x8(%rbp)
ff
jmp    1170 <mz_os_make_dir+0x60>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mz_os_make_dir>:
push   %rax
mov    $0x1ed,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
je     113d <mz_os_make_dir+0x2d>
mov    0x2eb1(%rip),%rax
mov    (%rax),%rcx
mov    0x2eaf(%rip),%rdx
mov    $0xffffffffffffff98,%rax
cmp    (%rdx),%rcx
jne    113f <mz_os_make_dir+0x2f>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@errno = global i64 0
@EEXIST = global i64 0
define i64 @mz_os_make_dir(i8* %0) {
%2 = alloca i64
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 0, i64* %4
%5 = load i8*, i8** %3
%6 = call i64 @mkdir(i8* %5, i32 493)
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i64, i64* @errno
%11 = load i64, i64* @EEXIST
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %14
13: ; preds = %9
store i64 -104, i64* %2
br label %15
14: ; preds = %9, %1
store i64 0, i64* %2
br label %15
15: ; preds = %14, %13
%16 = load i64, i64* %2
ret i64 %16
}

LLVM IR (-O2):
@errno = global i64 0
@EEXIST = global i64 0
define i64 @mz_os_make_dir(i8* nocapture %0) {
%2 = tail call i64 @mkdir(i8* %0, i32 493)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = load i64, i64* @errno
%6 = load i64, i64* @EEXIST
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %9
8: ; preds = %4, %1
br label %9
9: ; preds = %4, %8
%10 = phi i64 [ 0, %8 ], [ -104, %4 ]
ret i64 %10
}
void single_o() {
  register int out0 = 0;
  register int index = 1;
}


x86 assembly (clang, -O0):
<single_o>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @single_o() {
ret void
}
int nvram_unset(const char *name) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @nvram_unset(i8* nocapture readnone %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int a = '-';
  printf("%x\n", a);
  printf("%d\n", a);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%x\0A\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 45)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 45)
ret i32 0
}
int foo() {
  int a[32];
  int i = 0;
  for (i = 0; i < 32; i++) {
    a[i] = 32;
  }
  return a[31];
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x84(%rbp)
movl   $0x0,-0x84(%rbp)
cmpl   $0x20,-0x84(%rbp)
jge    114c <foo+0x4c>
movslq -0x84(%rbp),%rax
movl   $0x20,-0x80(%rbp,%rax,4)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    111c <foo+0x1c>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo() {
%1 = alloca [32 x i32]
%2 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %2
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 32
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 %8
store i32 32, i32* %9
br label %10
10: ; preds = %6
%11 = load i32, i32* %2
%12 = add nsw i32 %11, 1
store i32 %12, i32* %2
br label %3
13: ; preds = %3
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %1, i64 0, i64 31
%15 = load i32, i32* %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 32
}
/* Variables and functions */
int /*<<< orphan*/ IntEnable(unsigned long);
int /*<<< orphan*/ IntRegister(unsigned long, void (*)());
unsigned long PWMFaultIntGet(unsigned long);
void PWMFaultIntRegister(unsigned long ulBase, void (*pfnIntHandler)(void)) {
  unsigned long ulInt;
  ;
  ulInt = PWMFaultIntGet(ulBase);
  IntRegister(ulInt, pfnIntHandler);
  IntEnable(ulInt);
}


x86 assembly (clang, -O0):
<PWMFaultIntRegister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <PWMFaultIntGet@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <IntRegister@plt>
mov    -0x18(%rbp),%rdi
call   1030 <IntEnable@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PWMFaultIntRegister>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
call   1040 <PWMFaultIntGet@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1050 <IntRegister@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <IntEnable@plt>

LLVM IR (-O0):
define void @PWMFaultIntRegister(i64 %0, void ()* %1) {
%3 = alloca i64
%4 = alloca void ()*
%5 = alloca i64
store i64 %0, i64* %3
store void ()* %1, void ()** %4
%6 = load i64, i64* %3
%7 = call i64 @PWMFaultIntGet(i64 %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = load void ()*, void ()** %4
%10 = bitcast void ()* %9 to void (...)*
%11 = call i32 @IntRegister(i64 %8, void (...)* %10)
%12 = load i64, i64* %5
%13 = call i32 @IntEnable(i64 %12)
ret void
}

LLVM IR (-O2):
define void @PWMFaultIntRegister(i64 %0, void ()* %1) {
%3 = tail call i64 @PWMFaultIntGet(i64 %0)
%4 = bitcast void ()* %1 to void (...)*
%5 = tail call i32 @IntRegister(i64 %3, void (...)* %4)
%6 = tail call i32 @IntEnable(i64 %3)
ret void
}
/* Variables and functions */
scalar_t__ f();
int /*<<< orphan*/ printf(char *);
main() {
  printf("yo\n");
  if (f())
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <f@plt>
cmp    $0x0,%rax
je     1151 <main+0x31>
jmp    1151 <main+0x31>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <f@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"yo\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%3 = call i64 (...) @f()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
br label %6
6: ; preds = %5, %0
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@str = [3 x i8] c"yo\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%2 = tail call i64 (...) @f()
ret i32 0
}
int bsf(unsigned v) { return __builtin_ffs(v) - 1; }


x86 assembly (clang, -O0):
<bsf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
bsf    %edx,%eax
add    $0x1,%eax
xor    %ecx,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
sub    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bsf>:
bsf    %edi,%ecx
mov    $0xffffffff,%eax
cmovne %ecx,%eax
ret

LLVM IR (-O0):
define i32 @bsf(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @llvm.cttz.i32(i32 %3, i1 true)
%5 = add i32 %4, 1
%6 = icmp eq i32 %3, 0
%7 = select i1 %6, i32 0, i32 %5
%8 = sub nsw i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @bsf(i32 %0) {
%2 = tail call i32 @llvm.cttz.i32(i32 %0, i1 true)
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i32 -1, i32 %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ OpcodeNotDone();
void wait(void) { OpcodeNotDone(); }


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

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

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

LLVM IR (-O2):
define void @wait() {
%1 = tail call i32 (...) @OpcodeNotDone()
ret void
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
__attribute__((always_, unused)) uint32_t psnip_builtin_bswap32(uint32_t v) {
  return ((v & (((uint32_t)0xff) << 24)) >> 24) |
         ((v & (((uint32_t)0xff) << 16)) >> 8) |
         ((v & (((uint32_t)0xff) << 8)) << 8) |
         ((v & (((uint32_t)0xff))) << 24);
}


x86 assembly (clang, -O0):
<psnip_builtin_bswap32>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff000000,%eax
sar    $0x18,%eax
mov    -0x4(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff00,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<psnip_builtin_bswap32>:
mov    %edi,%eax
sar    $0x18,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
and    $0xff00,%ecx
mov    %edi,%edx
shl    $0x8,%edx
and    $0xff0000,%edx
shl    $0x18,%edi
or     %edi,%eax
or     %ecx,%eax
or     %edx,%eax
ret

LLVM IR (-O0):
define i32 @psnip_builtin_bswap32(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, -16777216
%5 = ashr i32 %4, 24
%6 = load i32, i32* %2
%7 = and i32 %6, 16711680
%8 = ashr i32 %7, 8
%9 = or i32 %5, %8
%10 = load i32, i32* %2
%11 = and i32 %10, 65280
%12 = shl i32 %11, 8
%13 = or i32 %9, %12
%14 = load i32, i32* %2
%15 = and i32 %14, 255
%16 = shl i32 %15, 24
%17 = or i32 %13, %16
ret i32 %17
}

LLVM IR (-O2):
define i32 @psnip_builtin_bswap32(i32 %0) {
%2 = ashr i32 %0, 24
%3 = lshr i32 %0, 8
%4 = and i32 %3, 65280
%5 = shl i32 %0, 8
%6 = and i32 %5, 16711680
%7 = shl i32 %0, 24
%8 = or i32 %7, %2
%9 = or i32 %8, %4
%10 = or i32 %9, %6
ret i32 %10
}
void isb(void) {}


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

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

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

LLVM IR (-O2):
define void @isb() {
ret void
}
const char *Stream_Name(void) { return "Stream"; }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"Stream\00"
define i8* @Stream_Name() {
ret i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0)
}