xunge/DecIR huggingface dataset:
void diffAllPmc() {}


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

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

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

LLVM IR (-O2):
define void @diffAllPmc() {
ret void
}
/* Variables and functions */
double RAND_MAX;
double rand();
double unif(double lower, double upper) {
  return lower + ((upper - lower) * rand()) / RAND_MAX;
}


x86 assembly (clang, -O0):
<unif>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
mov    0x2e8e(%rip),%rax
divsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<unif>:
sub    $0x18,%rsp
movsd  %xmm0,0x10(%rsp)
subsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
xor    %eax,%eax
call   1030 <rand@plt>
mulsd  0x8(%rsp),%xmm0
mov    0x2eb0(%rip),%rax
divsd  (%rax),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
@RAND_MAX = global double 0.000000e+00
define double @unif(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = load double, double* %3
%8 = fsub double %6, %7
%9 = call double (...) @rand()
%10 = fmul double %8, %9
%11 = load double, double* @RAND_MAX
%12 = fdiv double %10, %11
%13 = fadd double %5, %12
ret double %13
}

LLVM IR (-O2):
@RAND_MAX = global double 0.000000e+00
define double @unif(double %0, double %1) {
%3 = fsub double %1, %0
%4 = tail call double (...) @rand()
%5 = fmul double %3, %4
%6 = load double, double* @RAND_MAX
%7 = fdiv double %5, %6
%8 = fadd double %7, %0
ret double %8
}
int accel_z() {}


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

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

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

LLVM IR (-O2):
define i32 @accel_z() {
ret i32 undef
}
/* Variables and functions */
double sin(double);
double sqrt(double);
double Xlay(double scaleH, double zend, double Press) {
  double a = sin(zend) / (1.0 + (scaleH / 6378136.6));
  return Press / 1013.0 / sqrt(1.0 - a * a);
}


x86 assembly (clang, -O0):
<Xlay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x8(%rbp),%xmm2
movsd  0xec2(%rip),%xmm1
divsd  %xmm1,%xmm2
movsd  0xea6(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xe56(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Xlay>:
sub    $0x18,%rsp
movsd  %xmm2,0x8(%rsp)
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
movsd  0x10(%rsp),%xmm2
divsd  0xeb5(%rip),%xmm2
movsd  0xeb5(%rip),%xmm0
addsd  %xmm0,%xmm2
divsd  %xmm2,%xmm1
movsd  0x8(%rsp),%xmm2
divsd  0xea7(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
mulsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1187 <Xlay+0x67>
sqrtsd %xmm0,%xmm0
jmp    118c <Xlay+0x6c>
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @Xlay(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = call double @sin(double %8)
%10 = load double, double* %4
%11 = fdiv double %10, 0x415854A626666666
%12 = fadd double 1.000000e+00, %11
%13 = fdiv double %9, %12
store double %13, double* %7
%14 = load double, double* %6
%15 = fdiv double %14, 1.013000e+03
%16 = load double, double* %7
%17 = load double, double* %7
%18 = fneg double %16
%19 = call double @llvm.fmuladd.f64(double %18, double %17, double 1.000000e+00)
%20 = call double @sqrt(double %19)
%21 = fdiv double %15, %20
ret double %21
}

LLVM IR (-O2):
define double @Xlay(double %0, double %1, double %2) {
%4 = tail call double @sin(double %1)
%5 = fdiv double %0, 0x415854A626666666
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double %4, %6
%8 = fdiv double %2, 1.013000e+03
%9 = fneg double %7
%10 = tail call double @llvm.fmuladd.f64(double %9, double %7, double 1.000000e+00)
%11 = tail call double @sqrt(double %10)
%12 = fdiv double %8, %11
ret double %12
}
/* Variables and functions */
int rand();
int rand_level() {
  int level = 0;
  while ((rand() & 1) == 1) {
    level++;
    if (level == 32) {
      break;
    }
  }
  return level;
}


x86 assembly (clang, -O0):
<rand_level>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
and    $0x1,%eax
cmp    $0x1,%eax
jne    114f <rand_level+0x3f>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x20,-0x4(%rbp)
jne    114a <rand_level+0x3a>
jmp    114f <rand_level+0x3f>
jmp    111f <rand_level+0xf>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_level>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1030 <rand@plt>
test   $0x1,%al
je     1138 <rand_level+0x28>
add    $0x1,%ebx
cmp    $0x20,%ebx
jne    1120 <rand_level+0x10>
mov    $0x20,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rand_level() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %12, %0
%3 = call i32 (...) @rand()
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i32, i32* %1
%8 = add nsw i32 %7, 1
store i32 %8, i32* %1
%9 = load i32, i32* %1
%10 = icmp eq i32 %9, 32
br i1 %10, label %11, label %12
11: ; preds = %6
br label %13
12: ; preds = %6
br label %2
13: ; preds = %11, %2
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @rand_level() {
br label %1
1: ; preds = %6, %0
%2 = phi i32 [ 0, %0 ], [ %7, %6 ]
%3 = tail call i32 (...) @rand()
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = add nuw nsw i32 %2, 1
%8 = icmp eq i32 %7, 32
br i1 %8, label %9, label %1
9: ; preds = %6, %1
%10 = phi i32 [ 32, %6 ], [ %2, %1 ]
ret i32 %10
}
int y(double i) { return i > (i + 2.0); }


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

x86 assembly (clang, -O2):
<y>:
movsd  0xef8(%rip),%xmm1
addsd  %xmm0,%xmm1
xor    %eax,%eax
ucomisd %xmm1,%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @y(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = load double, double* %2
%5 = fadd double %4, 2.000000e+00
%6 = fcmp ogt double %3, %5
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @y(double %0) {
%2 = fadd double %0, 2.000000e+00
%3 = fcmp olt double %2, %0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
char *malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char const *);
scalar_t__ strlen(char const *);
char *concat_strings(const char *s1, const char *s2) {
  char *ret = malloc(strlen(s1) + strlen(s2) + 1);
  ret[0] = '\0';
  strcat(ret, s1);
  strcat(ret, s2);
  return ret;
}


x86 assembly (clang, -O0):
<concat_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
add    %rax,%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <strcat@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<concat_strings>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %r14,%rdi
call   1030 <strlen@plt>
lea    (%r15,%rax,1),%rdi
add    $0x1,%rdi
call   1040 <malloc@plt>
mov    %rax,%rbx
movb   $0x0,(%rax)
mov    %rax,%rdi
mov    %r12,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <strcat@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @concat_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = call i64 @strlen(i8* %6)
%8 = load i8*, i8** %4
%9 = call i64 @strlen(i8* %8)
%10 = add nsw i64 %7, %9
%11 = add nsw i64 %10, 1
%12 = call i8* @malloc(i64 %11)
store i8* %12, i8** %5
%13 = load i8*, i8** %5
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 0, i8* %14
%15 = load i8*, i8** %5
%16 = load i8*, i8** %3
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = load i8*, i8** %5
%19 = load i8*, i8** %4
%20 = call i32 @strcat(i8* %18, i8* %19)
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @concat_strings(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add i64 %3, 1
%6 = add i64 %5, %4
%7 = tail call i8* @malloc(i64 %6)
store i8 0, i8* %7
%8 = tail call i32 @strcat(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i8* %7, i8* %1)
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: what [-qs] [file ...]\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"usage: what [-qs] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"usage: what [-qs] [file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ dst_run_test();
int /*<<< orphan*/ dst_src_run_test();
int /*<<< orphan*/ rp_run_test();
int /*<<< orphan*/ src_run_test();
int main(int argc, const char *argv[]) {
  dst_run_test();
  src_run_test();
  rp_run_test();
  dst_src_run_test();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <dst_run_test@plt>
mov    $0x0,%al
call   1060 <src_run_test@plt>
mov    $0x0,%al
call   1040 <rp_run_test@plt>
mov    $0x0,%al
call   1050 <dst_src_run_test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <dst_run_test@plt>
xor    %eax,%eax
call   1060 <src_run_test@plt>
xor    %eax,%eax
call   1040 <rp_run_test@plt>
xor    %eax,%eax
call   1050 <dst_src_run_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @dst_run_test()
%7 = call i32 (...) @src_run_test()
%8 = call i32 (...) @rp_run_test()
%9 = call i32 (...) @dst_src_run_test()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @dst_run_test()
%4 = tail call i32 (...) @src_run_test()
%5 = tail call i32 (...) @rp_run_test()
%6 = tail call i32 (...) @dst_src_run_test()
ret i32 0
}
void gart_iommu_init(void) {}


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

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

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

LLVM IR (-O2):
define void @gart_iommu_init() {
ret void
}
void __DELETE_org_apache_harmony_luni_platform_OSMemory(void *me,
                                                        void *client_data) {}


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

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

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

LLVM IR (-O2):
define void @__DELETE_org_apache_harmony_luni_platform_OSMemory(i8* nocapture %0, i8* nocapture %1) {
ret void
}
int delay(int seconds) {
  while (seconds--)
    ;
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1120 <delay+0x20>
jmp    1107 <delay+0x7>
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @delay(i32 %0) {
ret i32 undef
}
int unexpect(int c, int state, int level) {
  ;
  return (-1);
}


x86 assembly (clang, -O0):
<unexpect>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @unexpect(i32 %0, i32 %1, i32 %2) {
ret i32 -1
}
__attribute__((always_)) void *ERR_CAST(const void *ptr) { return (void *)ptr; }


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

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

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

LLVM IR (-O2):
define i8* @ERR_CAST(i8* readnone returned %0) {
ret i8* %0
}
/* Type definitions */
typedef int /*<<< orphan*/ GLint;

/* Variables and functions */
int /*<<< orphan*/ glTexCoord1i(int /*<<< orphan*/);
void TexCoord1i(GLint s) { glTexCoord1i(s); }


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

x86 assembly (clang, -O2):
<TexCoord1i>:
jmp    1030 <glTexCoord1i@plt>

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

LLVM IR (-O2):
define void @TexCoord1i(i32 %0) {
%2 = tail call i32 @glTexCoord1i(i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ volatile uint32_t;

/* Variables and functions */
uint32_t readl(void *where) { return *(volatile uint32_t *)where; }


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

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

LLVM IR (-O0):
define i32 @readl(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = bitcast i8* %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @readl(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = load volatile i32, i32* %2
ret i32 %3
}
extern void outsl(unsigned short port, const void *addr, unsigned long count) {
  __asm__ __volatile__("cld ; rep ; outs"
                       "l"
                       : "=S"(addr), "=c"(count)
                       : "d"(port), "0"(addr), "1"(count));
}


x86 assembly (clang, -O0):
<outsl>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x2(%rbp),%dx
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
cld
rep outsl %ds:(%rsi),(%dx)
mov    %rsi,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outsl>:
mov    %rdx,%rcx
mov    %edi,%edx
cld
rep outsl %ds:(%rsi),(%dx)
ret

LLVM IR (-O0):
define void @outsl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i64
store i16 %0, i16* %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = load i16, i16* %4
%8 = load i8*, i8** %5
%9 = load i64, i64* %6
%10 = call { i8*, i64 } asm sideeffect "cld ; rep ; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %7, i8* %8, i64 %9)
%11 = extractvalue { i8*, i64 } %10, 0
%12 = extractvalue { i8*, i64 } %10, 1
store i8* %11, i8** %5
store i64 %12, i64* %6
ret void
}

LLVM IR (-O2):
define void @outsl(i16 zeroext %0, i8* %1, i64 %2) {
%4 = tail call { i8*, i64 } asm sideeffect "cld ; rep ; outsl", "={si},={cx},{dx},0,1,~{dirflag},~{fpsr},~{flags}"(i16 %0, i8* %1, i64 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ default_handler();
__attribute__((weak)) void EXTI15_10_IRQHandler() { default_handler(); }


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

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

LLVM IR (-O0):
define weak void @EXTI15_10_IRQHandler() {
%1 = call i32 (...) @default_handler()
ret void
}

LLVM IR (-O2):
define weak void @EXTI15_10_IRQHandler() {
%1 = tail call i32 (...) @default_handler()
ret void
}
/* Variables and functions */
bool isParallel(double AB, double AC, double AD, double AE) {
  return ((AB / AC) == (AD / AE));
}


x86 assembly (clang, -O0):
<isParallel>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
ucomisd %xmm1,%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isParallel>:
unpcklpd %xmm2,%xmm0
unpcklpd %xmm3,%xmm1
divpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
cmpeqsd %xmm0,%xmm1
movq   %xmm1,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @isParallel(double %0, double %1, double %2, double %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double %3, double* %8
%9 = load double, double* %5
%10 = load double, double* %6
%11 = fdiv double %9, %10
%12 = load double, double* %7
%13 = load double, double* %8
%14 = fdiv double %12, %13
%15 = fcmp oeq double %11, %14
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @isParallel(double %0, double %1, double %2, double %3) {
%5 = insertelement <2 x double> poison, double %0, i64 0
%6 = insertelement <2 x double> %5, double %2, i64 1
%7 = insertelement <2 x double> poison, double %1, i64 0
%8 = insertelement <2 x double> %7, double %3, i64 1
%9 = fdiv <2 x double> %6, %8
%10 = extractelement <2 x double> %9, i64 0
%11 = extractelement <2 x double> %9, i64 1
%12 = fcmp oeq double %10, %11
%13 = zext i1 %12 to i32
ret i32 %13
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  scalar_t__ y;
};
typedef TYPE_1__ XButtonReleasedEvent;

/* Variables and functions */
int get_XButtonReleasedEvent_y(void *_p) {
  return (int)((XButtonReleasedEvent *)_p)->y;
}


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

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

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

LLVM IR (-O2):
define i32 @get_XButtonReleasedEvent_y(i8* nocapture %0) {
%2 = bitcast i8* %0 to i64*
%3 = load i64, i64* %2
%4 = trunc i64 %3 to i32
ret i32 %4
}
/* Variables and functions */
int errno;
int pwrite64(int, char const *, int, unsigned long long);
int write_file(int fd, unsigned long long *offset, const char *buf, int len) {
  int n;
  n = pwrite64(fd, buf, len, *offset);
  if (n < 0)
    return -errno;
  *offset += n;
  return n;
}


x86 assembly (clang, -O0):
<write_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x10(%rbp),%rax
mov    (%rax),%rcx
call   1030 <pwrite64@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    115c <write_file+0x4c>
xor    %eax,%eax
mov    0x2e8e(%rip),%rcx
sub    (%rcx),%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <write_file+0x60>
movslq -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
add    (%rax),%rcx
mov    %rcx,(%rax)
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_file>:
push   %rbx
mov    %rsi,%rbx
mov    (%rsi),%rax
mov    %rdx,%rsi
mov    %ecx,%edx
mov    %rax,%rcx
call   1030 <pwrite64@plt>
test   %eax,%eax
js     112f <write_file+0x1f>
mov    %eax,%ecx
add    %rcx,(%rbx)
pop    %rbx
ret
mov    0x2eaa(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
pop    %rbx
ret

LLVM IR (-O0):
@errno = global i32 0
define i32 @write_file(i32 %0, i64* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i64*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %6
store i64* %1, i64** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%11 = load i32, i32* %6
%12 = load i8*, i8** %8
%13 = load i32, i32* %9
%14 = load i64*, i64** %7
%15 = load i64, i64* %14
%16 = call i32 @pwrite64(i32 %11, i8* %12, i32 %13, i64 %15)
store i32 %16, i32* %10
%17 = load i32, i32* %10
%18 = icmp slt i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i32, i32* @errno
%21 = sub nsw i32 0, %20
store i32 %21, i32* %5
br label %29
22: ; preds = %4
%23 = load i32, i32* %10
%24 = sext i32 %23 to i64
%25 = load i64*, i64** %7
%26 = load i64, i64* %25
%27 = add i64 %26, %24
store i64 %27, i64* %25
%28 = load i32, i32* %10
store i32 %28, i32* %5
br label %29
29: ; preds = %22, %19
%30 = load i32, i32* %5
ret i32 %30
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @write_file(i32 %0, i64* nocapture %1, i8* %2, i32 %3) {
%5 = load i64, i64* %1
%6 = tail call i32 @pwrite64(i32 %0, i8* %2, i32 %3, i64 %5)
%7 = icmp slt i32 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %4
%9 = load i32, i32* @errno
%10 = sub nsw i32 0, %9
br label %15
11: ; preds = %4
%12 = zext i32 %6 to i64
%13 = load i64, i64* %1
%14 = add i64 %13, %12
store i64 %14, i64* %1
br label %15
15: ; preds = %11, %8
%16 = phi i32 [ %10, %8 ], [ %6, %11 ]
ret i32 %16
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ foo(unsigned int *, int, void **);
int main(void) {
  unsigned int one = 1;
  void *p;
  foo(&one, 1, &p);
  abort();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x1,%esi
lea    -0x10(%rbp),%rdx
call   1040 <foo@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movl   $0x1,0xc(%rsp)
lea    0xc(%rsp),%rdi
lea    0x10(%rsp),%rdx
mov    $0x1,%esi
call   1040 <foo@plt>
xor    %eax,%eax
call   1030 <abort@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%4 = bitcast i8** %2 to i8*
%5 = call i32 @foo(i32* %1, i32 1, i8** %2)
%6 = call i32 (...) @abort()
unreachable
}
int g(int a) { return a - 32; }


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x20,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @g(i32 %0) {
%2 = add nsw i32 %0, -32
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
nofork() {
  printf("Fork failed.  Not enough memory.\n");
  exit(1);
}


x86 assembly (clang, -O0):
<nofork>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@.str = [34 x i8] c"Fork failed. Not enough memory.\0A\00"
define i32 @nofork() {
%1 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [33 x i8] c"Fork failed. Not enough memory.\00"
define i32 @nofork() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int SPI_CSR_SCBR(int);
int /*<<< orphan*/ assert(int);
int pmc_get_peripheral_clock(int);
uint32_t _spi_compute_scbr(uint32_t bitrate, uint32_t periph_id) {
  assert(bitrate > 0);
  return SPI_CSR_SCBR(pmc_get_peripheral_clock(periph_id) / (bitrate * 1000));
}


x86 assembly (clang, -O0):
<_spi_compute_scbr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%edi
call   1050 <pmc_get_peripheral_clock@plt>
imul   $0x3e8,-0x4(%rbp),%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <SPI_CSR_SCBR@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_spi_compute_scbr>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %edi,%edi
test   %ebp,%ebp
setg   %dil
call   1040 <assert@plt>
mov    %ebx,%edi
call   1050 <pmc_get_peripheral_clock@plt>
imul   $0x3e8,%ebp,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <SPI_CSR_SCBR@plt>

LLVM IR (-O0):
define i32 @_spi_compute_scbr(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 = icmp sgt i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @pmc_get_peripheral_clock(i32 %9)
%11 = load i32, i32* %3
%12 = mul nsw i32 %11, 1000
%13 = sdiv i32 %10, %12
%14 = call i32 @SPI_CSR_SCBR(i32 %13)
ret i32 %14
}

LLVM IR (-O2):
define i32 @_spi_compute_scbr(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, 0
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = tail call i32 @pmc_get_peripheral_clock(i32 %1)
%7 = mul nsw i32 %0, 1000
%8 = sdiv i32 %6, %7
%9 = tail call i32 @SPI_CSR_SCBR(i32 %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ consume_item(int);
int *create_shared_mem_buffer();
int /*<<< orphan*/ print_buffer(int *);
int remove_item(int *);
int /*<<< orphan*/ sleep(int);
int main() {
  int *shared_buffer = create_shared_mem_buffer();
  int item = 0;
  while (1) {
    item = remove_item(shared_buffer);
    print_buffer(shared_buffer);
    sleep(1);
    consume_item(item);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <create_shared_mem_buffer@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <remove_item@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <print_buffer@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    -0x14(%rbp),%edi
call   1030 <consume_item@plt>
jmp    1171 <main+0x21>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1050 <create_shared_mem_buffer@plt>
mov    %rax,%rbx
nopl   (%rax)
mov    %rbx,%rdi
call   1040 <remove_item@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <print_buffer@plt>
mov    $0x1,%edi
call   1070 <sleep@plt>
mov    %ebp,%edi
call   1030 <consume_item@plt>
jmp    1160 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32* (...) @create_shared_mem_buffer()
store i32* %4, i32** %2
store i32 0, i32* %3
br label %5
5: ; preds = %0, %5
%6 = load i32*, i32** %2
%7 = call i32 @remove_item(i32* %6)
store i32 %7, i32* %3
%8 = load i32*, i32** %2
%9 = call i32 @print_buffer(i32* %8)
%10 = call i32 @sleep(i32 1)
%11 = load i32, i32* %3
%12 = call i32 @consume_item(i32 %11)
br label %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32* (...) @create_shared_mem_buffer()
br label %2
2: ; preds = %2, %0
%3 = tail call i32 @remove_item(i32* %1)
%4 = tail call i32 @print_buffer(i32* %1)
%5 = tail call i32 @sleep(i32 1)
%6 = tail call i32 @consume_item(i32 %3)
br label %2
}
int test_imm_BAint32_reg(int val) { return ((val) & (0xBA << 0)) ? -20 : -40; }


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

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

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

LLVM IR (-O2):
define i32 @test_imm_BAint32_reg(i32 %0) {
%2 = and i32 %0, 186
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef scalar_t__ volatile uint16_t;

/* Variables and functions */
uint16_t sdmmc_read16(uint16_t reg) {
  return *(volatile uint16_t *)(0x10006000 + reg);
}


x86 assembly (clang, -O0):
<sdmmc_read16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10006000,%rax
mov    (%rax),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdmmc_read16>:
mov    %rdi,-0x8(%rsp)
mov    -0x8(%rsp),%rax
mov    0x10006000(%rax),%rax
ret

LLVM IR (-O0):
define i64 @sdmmc_read16(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 268460032, %3
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @sdmmc_read16(i64 %0) {
%2 = alloca i64
store volatile i64 %0, i64* %2
%3 = load volatile i64, i64* %2
%4 = add nsw i64 %3, 268460032
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
ret i64 %6
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, long);
int /*<<< orphan*/ stdout;
void printcount(int count, long int tot) {
  fprintf(stdout, "Wait: %d to %li\r", count, tot);
}


x86 assembly (clang, -O0):
<printcount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x10(%rbp),%rcx
lea    0xeca(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printcount>:
mov    %rsi,%rcx
mov    %edi,%edx
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
lea    0xedb(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [17 x i8] c"Wait: %d to %li\0D\00"
define void @printcount(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
store i32 %0, i32* %3
store i64 %1, i64* %4
%5 = load i32, i32* @stdout
%6 = load i32, i32* %3
%7 = load i64, i64* %4
%8 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %6, i64 %7)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [17 x i8] c"Wait: %d to %li\0D\00"
define void @printcount(i32 %0, i64 %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void twirly(void) {
  printf("|\r");
  printf("/\r");
  printf("-\r");
  printf("\\\r");
}


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

x86 assembly (clang, -O2):
<twirly>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
call   1030 <printf@plt>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    0xecd(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"|\0D\00"
@.str.1 = [3 x i8] c"/\0D\00"
@.str.2 = [3 x i8] c"-\0D\00"
@.str.3 = [3 x i8] c"\\\0D\00"
define void @twirly() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"|\0D\00"
@.str.1 = [3 x i8] c"/\0D\00"
@.str.2 = [3 x i8] c"-\0D\00"
@.str.3 = [3 x i8] c"\\\0D\00"
define void @twirly() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}
unsigned xrop3_123_1_1(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = D ^ T;
  stk2 = ~stk2;
  stk1 = S & stk2;
  stk1 = ~stk1;
  return (stk1 & (~S) & (~T)) | (D & S) | (D & T);
}


x86 assembly (clang, -O0):
<xrop3_123_1_1>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
xor    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
and    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0x10(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_123_1_1>:
mov    %edi,%ecx
shl    $0x8,%ecx
or     %edi,%ecx
mov    %esi,%eax
shl    $0x8,%eax
or     %esi,%eax
or     %ecx,%eax
not    %eax
or     %edi,%esi
or     %esi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_123_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %5
%23 = load i32, i32* %7
%24 = xor i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %9
%26 = xor i32 %25, -1
store i32 %26, i32* %9
%27 = load i32, i32* %6
%28 = load i32, i32* %9
%29 = and i32 %27, %28
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = xor i32 %30, -1
store i32 %31, i32* %8
%32 = load i32, i32* %8
%33 = load i32, i32* %6
%34 = xor i32 %33, -1
%35 = and i32 %32, %34
%36 = load i32, i32* %7
%37 = xor i32 %36, -1
%38 = and i32 %35, %37
%39 = load i32, i32* %5
%40 = load i32, i32* %6
%41 = and i32 %39, %40
%42 = or i32 %38, %41
%43 = load i32, i32* %5
%44 = load i32, i32* %7
%45 = and i32 %43, %44
%46 = or i32 %42, %45
ret i32 %46
}

LLVM IR (-O2):
define i32 @xrop3_123_1_1(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = mul nuw nsw i32 %3, 257
%5 = zext i8 %1 to i32
%6 = mul nuw nsw i32 %5, 257
%7 = or i32 %6, %4
%8 = xor i32 %7, -1
%9 = or i8 %1, %0
%10 = zext i8 %9 to i32
%11 = or i32 %10, %8
ret i32 %11
}
/* Variables and functions */
int pow(double, int);
double calculate_discriminant(double a, double b, double c) {
  double result = pow(b, 2) - 4 * a * c;
  return result;
}


x86 assembly (clang, -O0):
<calculate_discriminant>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
cvtsi2sd %eax,%xmm1
movsd  0xebe(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calculate_discriminant>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
movaps %xmm1,%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0xebe(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @calculate_discriminant(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%8 = load double, double* %5
%9 = call i32 @pow(double %8, i32 2)
%10 = sitofp i32 %9 to double
%11 = load double, double* %4
%12 = fmul double 4.000000e+00, %11
%13 = load double, double* %6
%14 = fneg double %12
%15 = call double @llvm.fmuladd.f64(double %14, double %13, double %10)
store double %15, double* %7
%16 = load double, double* %7
ret double %16
}

LLVM IR (-O2):
define double @calculate_discriminant(double %0, double %1, double %2) {
%4 = tail call i32 @pow(double %1, i32 2)
%5 = sitofp i32 %4 to double
%6 = fmul double %0, -4.000000e+00
%7 = tail call double @llvm.fmuladd.f64(double %6, double %2, double %5)
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ death();
int /*<<< orphan*/ normend();
void dwarfend(void) {
  death();
  normend();
}


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

x86 assembly (clang, -O2):
<dwarfend>:
push   %rax
xor    %eax,%eax
call   1030 <death@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <normend@plt>

LLVM IR (-O0):
define void @dwarfend() {
%1 = call i32 (...) @death()
%2 = call i32 (...) @normend()
ret void
}

LLVM IR (-O2):
define void @dwarfend() {
%1 = tail call i32 (...) @death()
%2 = tail call i32 (...) @normend()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ done();
int /*<<< orphan*/ f1(int);
void main(void) {
  f1(0x1234);
  done();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1234,%edi
call   1040 <f1@plt>
mov    $0x0,%al
call   1030 <done@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1234,%edi
call   1040 <f1@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <done@plt>

LLVM IR (-O0):
define void @main() {
%1 = call i32 @f1(i32 4660)
%2 = call i32 (...) @done()
ret void
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @f1(i32 4660)
%2 = tail call i32 (...) @done()
ret void
}
int f_bge_mm2(float *a1, float *a2) {
  return !(__builtin_isgreaterequal(*a1, *a2));
}


x86 assembly (clang, -O0):
<f_bge_mm2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomiss (%rax),%xmm0
setae  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_bge_mm2>:
movss  (%rdi),%xmm0
xor    %eax,%eax
ucomiss (%rsi),%xmm0
setb   %al
ret

LLVM IR (-O0):
define i32 @f_bge_mm2(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* %5
%7 = load float*, float** %4
%8 = load float, float* %7
%9 = fcmp oge float %6, %8
%10 = xor i1 %9, true
%11 = zext i1 %10 to i32
ret i32 %11
}

LLVM IR (-O2):
define i32 @f_bge_mm2(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = fcmp ult float %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
/* Variables and functions */
void *malloc(size_t);
void *stdlib_malloc(void *rtdata, size_t size) { return malloc(size); }


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

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

LLVM IR (-O0):
define i8* @stdlib_malloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = call i8* @malloc(i64 %5)
ret i8* %6
}

LLVM IR (-O2):
define noalias i8* @stdlib_malloc(i8* nocapture readnone %0, i64 %1) {
%3 = tail call i8* @malloc(i64 %1)
ret i8* %3
}
int find_nth_term(int n, int a, int b, int c) {
  if (n == 1)
    return a;
  else if (n == 2)
    return b;
  else if (n == 3)
    return c;
  else
    return (n - 1) + (n - 2) + (n - 3);
}


x86 assembly (clang, -O0):
<find_nth_term>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1125 <find_nth_term+0x25>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <find_nth_term+0x68>
cmpl   $0x2,-0x8(%rbp)
jne    113a <find_nth_term+0x3a>
mov    -0x10(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <find_nth_term+0x68>
cmpl   $0x3,-0x8(%rbp)
jne    114f <find_nth_term+0x4f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1168 <find_nth_term+0x68>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    -0x8(%rbp),%ecx
sub    $0x2,%ecx
add    %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    $0x3,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_nth_term>:
mov    %esi,%eax
cmp    $0x1,%edi
je     111b <find_nth_term+0x1b>
mov    %ecx,%eax
cmp    $0x3,%edi
je     111b <find_nth_term+0x1b>
mov    %edx,%eax
cmp    $0x2,%edi
je     111b <find_nth_term+0x1b>
lea    (%rdi,%rdi,2),%eax
add    $0xfffffffa,%eax
ret

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

LLVM IR (-O2):
define i32 @find_nth_term(i32 %0, i32 %1, i32 %2, i32 %3) {
switch i32 %0, label %7 [
i32 1, label %10
i32 2, label %5
i32 3, label %6
]
5: ; preds = %4
br label %10
6: ; preds = %4
br label %10
7: ; preds = %4
%8 = mul i32 %0, 3
%9 = add i32 %8, -6
br label %10
10: ; preds = %4, %7, %6, %5
%11 = phi i32 [ %2, %5 ], [ %3, %6 ], [ %9, %7 ], [ %1, %4 ]
ret i32 %11
}
unsigned long PSEgetLibType(void) { return 2; }


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

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

LLVM IR (-O0):
define i64 @PSEgetLibType() {
ret i64 2
}

LLVM IR (-O2):
define i64 @PSEgetLibType() {
ret i64 2
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void wait2(int nmillis) { usleep(nmillis * 1000); }


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

x86 assembly (clang, -O2):
<wait2>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @wait2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @wait2(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}