xunge/DecIR huggingface dataset:
unsigned short getCoeByPercentErr(float percentErr, unsigned short oldCoe) {
  signed short i = 0;
  unsigned short newCoeFix = 0;
  float newCoeFoat = 0.0;
  newCoeFoat = 3.272;
  newCoeFix |= (((int)newCoeFoat) << 12);
  for (i = 2; i >= 0; i--) {
    newCoeFoat -= (int)newCoeFoat;
    newCoeFoat *= 16;
    newCoeFix |= (((int)newCoeFoat) << (4 * i));
  }
  return newCoeFix;
}


x86 assembly (clang, -O0):
<getCoeByPercentErr>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
movss  %xmm0,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movw   $0x0,-0x8(%rbp)
movw   $0x0,-0xa(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xed4(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
cvttss2si -0x10(%rbp),%ecx
shl    $0xc,%ecx
movzwl -0xa(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
movw   $0x2,-0x8(%rbp)
movswl -0x8(%rbp),%eax
cmp    $0x0,%eax
jl     11aa <getCoeByPercentErr+0xaa>
cvttss2si -0x10(%rbp),%eax
cvtsi2ss %eax,%xmm1
movss  -0x10(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xe8f(%rip),%xmm0
mulss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
cvttss2si -0x10(%rbp),%eax
movswl -0x8(%rbp),%ecx
shl    $0x2,%ecx
shl    %cl,%eax
mov    %eax,%ecx
movzwl -0xa(%rbp),%eax
or     %ecx,%eax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x8(%rbp)
jmp    1149 <getCoeByPercentErr+0x49>
movzwl -0xa(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCoeByPercentErr>:
mov    $0x345a,%ax
ret

LLVM IR (-O0):
define zeroext i16 @getCoeByPercentErr(float %0, i16 zeroext %1) {
%3 = alloca float
%4 = alloca i16
%5 = alloca i16
%6 = alloca i16
%7 = alloca float
store float %0, float* %3
store i16 %1, i16* %4
store i16 0, i16* %5
store i16 0, i16* %6
store float 0.000000e+00, float* %7
store float 0x400A2D0E60000000, float* %7
%8 = load float, float* %7
%9 = fptosi float %8 to i32
%10 = shl i32 %9, 12
%11 = load i16, i16* %6
%12 = zext i16 %11 to i32
%13 = or i32 %12, %10
%14 = trunc i32 %13 to i16
store i16 %14, i16* %6
store i16 2, i16* %5
br label %15
15: ; preds = %37, %2
%16 = load i16, i16* %5
%17 = sext i16 %16 to i32
%18 = icmp sge i32 %17, 0
br i1 %18, label %19, label %40
19: ; preds = %15
%20 = load float, float* %7
%21 = fptosi float %20 to i32
%22 = sitofp i32 %21 to float
%23 = load float, float* %7
%24 = fsub float %23, %22
store float %24, float* %7
%25 = load float, float* %7
%26 = fmul float %25, 1.600000e+01
store float %26, float* %7
%27 = load float, float* %7
%28 = fptosi float %27 to i32
%29 = load i16, i16* %5
%30 = sext i16 %29 to i32
%31 = mul nsw i32 4, %30
%32 = shl i32 %28, %31
%33 = load i16, i16* %6
%34 = zext i16 %33 to i32
%35 = or i32 %34, %32
%36 = trunc i32 %35 to i16
store i16 %36, i16* %6
br label %37
37: ; preds = %19
%38 = load i16, i16* %5
%39 = add i16 %38, -1
store i16 %39, i16* %5
br label %15
40: ; preds = %15
%41 = load i16, i16* %6
ret i16 %41
}

LLVM IR (-O2):
define zeroext i16 @getCoeByPercentErr(float %0, i16 zeroext %1) {
ret i16 13402
}
float df1y(float x, float y) { return (-1); }


x86 assembly (clang, -O0):
<df1y>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  0xeea(%rip),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<df1y>:
movss  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define float @df1y(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
ret float -1.000000e+00
}

LLVM IR (-O2):
define float @df1y(float %0, float %1) {
ret float -1.000000e+00
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int test(int);
int main() {
  printf("%d\n", test(123456));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @test(i32 123456)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
float pow(int, double);
float fa_db2pow(float db) { return pow(10, 0.1 * db); }


x86 assembly (clang, -O0):
<fa_db2pow>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xed2(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    $0xa,%edi
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fa_db2pow>:
cvtss2sd %xmm0,%xmm0
mulsd  0xee4(%rip),%xmm0
mov    $0xa,%edi
jmp    1030 <pow@plt>

LLVM IR (-O0):
define float @fa_db2pow(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = fmul double 1.000000e-01, %4
%6 = call float @pow(i32 10, double %5)
ret float %6
}

LLVM IR (-O2):
define float @fa_db2pow(float %0) {
%2 = fpext float %0 to double
%3 = fmul double %2, 1.000000e-01
%4 = tail call float @pow(i32 10, double %3)
ret float %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long double);
void cx_LongDouble_print(long double *const value) { printf("%LfL", *value); }


x86 assembly (clang, -O0):
<cx_LongDouble_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
fldt   (%rax)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cx_LongDouble_print>:
sub    $0x18,%rsp
fldt   (%rdi)
fstpt  (%rsp)
lea    0xee0(%rip),%rdi
call   1030 <printf@plt>
add    $0x18,%rsp
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%LfL\00"
define void @cx_LongDouble_print(x86_fp80* nocapture %0) {
%2 = load x86_fp80, x86_fp80* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), x86_fp80 %2)
ret void
}
int test_imm_AEuint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xAE << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_AEuint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
shr    $0x20,%rdx
and    $0xae,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_AEuint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 747324309504
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
int yyerror(char const *message) { return fprintf(stderr, "%s\n", message); }


x86 assembly (clang, -O0):
<yyerror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yyerror>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define i32 @yyerror(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 %3
}
void show_blue_screen(void) {}


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

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

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

LLVM IR (-O2):
define void @show_blue_screen() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_version() { printf("wd (in c) version 0.1.2\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"wd (in c) version 0.1.2\0A\00"
define void @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"wd (in c) version 0.1.2\00"
define void @print_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ MyThreadExit();
int /*<<< orphan*/ MyThreadYield();
int /*<<< orphan*/ printf(char *);
void t2(void *dummy) {
  printf("t2\n");
  MyThreadYield();
  printf("t2 again\n");
  MyThreadExit();
}


x86 assembly (clang, -O0):
<t2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <MyThreadYield@plt>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <MyThreadExit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<t2>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <MyThreadYield@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <MyThreadExit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"t2\0A\00"
@.str.1 = [10 x i8] c"t2 again\0A\00"
define void @t2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @MyThreadYield()
%5 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (...) @MyThreadExit()
ret void
}

LLVM IR (-O2):
@str = [3 x i8] c"t2\00"
@str.2 = [9 x i8] c"t2 again\00"
define void @t2(i8* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @MyThreadYield()
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.2, i64 0, i64 0))
%5 = tail call i32 (...) @MyThreadExit()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sectioning_underscore(char *);
void cm_unnumberedsec(void) { sectioning_underscore("unnumberedsec"); }


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"unnumberedsec\00"
define void @cm_unnumberedsec() {
%1 = call i32 @sectioning_underscore(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"unnumberedsec\00"
define void @cm_unnumberedsec() {
%1 = tail call i32 @sectioning_underscore(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
ret void
}
int ld_ne_rm1(long double a1, long double *a2) { return (((a1) != (*a2))); }


x86 assembly (clang, -O0):
<ld_ne_rm1>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setp   %cl
setne  %al
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ne_rm1>:
fldt   0x8(%rsp)
fldt   (%rdi)
fucomip %st(1),%st
fstp   %st(0)
setp   %al
setne  %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ld_ne_rm1(x86_fp80 %0, x86_fp80* %1) {
%3 = alloca x86_fp80
%4 = alloca x86_fp80*
store x86_fp80 %0, x86_fp80* %3
store x86_fp80* %1, x86_fp80** %4
%5 = load x86_fp80, x86_fp80* %3
%6 = load x86_fp80*, x86_fp80** %4
%7 = load x86_fp80, x86_fp80* %6
%8 = fcmp une x86_fp80 %5, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @ld_ne_rm1(x86_fp80 %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %1
%4 = fcmp une x86_fp80 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
int test_imm_30int8_reg(signed char val) {
  return ((val) & (0x30 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_30int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0x30,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_30int8_reg(i8 signext %0) {
%2 = and i8 %0, 48
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
float fahr2cels(float cels) { return cels * (9.0 / 5.0) + 32.0; }


x86 assembly (clang, -O0):
<fahr2cels>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xee6(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee2(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fahr2cels>:
cvtss2sd %xmm0,%xmm0
mulsd  0xef4(%rip),%xmm0
addsd  0xef4(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @fahr2cels(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = fpext float %3 to double
%5 = call double @llvm.fmuladd.f64(double %4, double 1.800000e+00, double 3.200000e+01)
%6 = fptrunc double %5 to float
ret float %6
}

LLVM IR (-O2):
define float @fahr2cels(float %0) {
%2 = fpext float %0 to double
%3 = tail call double @llvm.fmuladd.f64(double %2, double 1.800000e+00, double 3.200000e+01)
%4 = fptrunc double %3 to float
ret float %4
}
int HelpItem113(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @HelpItem113() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *malloc(int);
int /*<<< orphan*/ printf(char *, int, void *);
int main() {
  void *mem;
  for (int i = 0; i < 1000000; i++) {
    mem = malloc(i);
    printf("%d %p\n", i, mem);
    free(mem);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jge    1189 <main+0x59>
mov    -0x14(%rbp),%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1146 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
xor    %ebx,%ebx
lea    0xec2(%rip),%r14
xchg   %ax,%ax
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r15
mov    %r14,%rdi
mov    %ebx,%esi
mov    %rax,%rdx
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <free@plt>
add    $0x1,%ebx
cmp    $0xf4240,%ebx
jne    1140 <main+0x10>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [7 x i8] c"%d %p\0A\00"
define i32 @main() {
br label %2
1: ; preds = %2
ret i32 0
2: ; preds = %0, %2
%3 = phi i32 [ 0, %0 ], [ %7, %2 ]
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i8* %4)
%6 = tail call i32 @free(i8* %4)
%7 = add nuw nsw i32 %3, 1
%8 = icmp eq i32 %7, 1000000
br i1 %8, label %1, label %2
}
/* Type definitions */
typedef int uint8_t;
typedef int const uint16_t;

/* Variables and functions */
uint16_t udp_get_len(const uint8_t *p_udp) {
  return (p_udp[4] << 8) | p_udp[5];
}


x86 assembly (clang, -O0):
<udp_get_len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
or     0x14(%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<udp_get_len>:
mov    0x10(%rdi),%eax
shl    $0x8,%eax
or     0x14(%rdi),%eax
ret

LLVM IR (-O0):
define i32 @udp_get_len(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 4
%5 = load i32, i32* %4
%6 = shl i32 %5, 8
%7 = load i32*, i32** %2
%8 = getelementptr inbounds i32, i32* %7, i64 5
%9 = load i32, i32* %8
%10 = or i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
define i32 @udp_get_len(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 4
%3 = load i32, i32* %2
%4 = shl i32 %3, 8
%5 = getelementptr inbounds i32, i32* %0, i64 5
%6 = load i32, i32* %5
%7 = or i32 %4, %6
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ PlayAudio294(unsigned long, char const *);
void playaudio(unsigned long id, const char *s) { PlayAudio294(id, s); }


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

x86 assembly (clang, -O2):
<playaudio>:
jmp    1030 <PlayAudio294@plt>

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

LLVM IR (-O2):
define void @playaudio(i64 %0, i8* %1) {
%3 = tail call i32 @PlayAudio294(i64 %0, i8* %1)
ret void
}
int test_getByte(int x, int n) {
  union {
    int word;
    unsigned char bytes[4];
  } u;
  int test = 1;
  int littleEndian = (int)*(char *)&test;
  u.word = x;
  return littleEndian ? (unsigned)u.bytes[n] : (unsigned)u.bytes[3 - n];
}


x86 assembly (clang, -O0):
<test_getByte>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0x14(%rbp)
movsbl -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     1139 <test_getByte+0x39>
movslq -0x8(%rbp),%rax
movzbl -0x10(%rbp,%rax,1),%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <test_getByte+0x4b>
mov    $0x3,%eax
sub    -0x8(%rbp),%eax
cltq
movzbl -0x10(%rbp,%rax,1),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_getByte>:
mov    %edi,-0x8(%rsp)
movslq %esi,%rax
movzbl -0x8(%rsp,%rax,1),%eax
ret

LLVM IR (-O0):
%union.anon = type { i32 }
define i32 @test_getByte(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca %union.anon
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 1, i32* %6
%8 = bitcast i32* %6 to i8*
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
store i32 %10, i32* %7
%11 = load i32, i32* %3
%12 = bitcast %union.anon* %5 to i32*
store i32 %11, i32* %12
%13 = load i32, i32* %7
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %22
15: ; preds = %2
%16 = bitcast %union.anon* %5 to [4 x i8]*
%17 = load i32, i32* %4
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [4 x i8], [4 x i8]* %16, i64 0, i64 %18
%20 = load i8, i8* %19
%21 = zext i8 %20 to i32
br label %30
22: ; preds = %2
%23 = bitcast %union.anon* %5 to [4 x i8]*
%24 = load i32, i32* %4
%25 = sub nsw i32 3, %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [4 x i8], [4 x i8]* %23, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = zext i8 %28 to i32
br label %30
30: ; preds = %22, %15
%31 = phi i32 [ %21, %15 ], [ %29, %22 ]
ret i32 %31
}

LLVM IR (-O2):
%union.anon = type { i32 }
define i32 @test_getByte(i32 %0, i32 %1) {
%3 = alloca %union.anon
%4 = bitcast %union.anon* %3 to i8*
%5 = getelementptr inbounds %union.anon, %union.anon* %3, i64 0, i32 0
store i32 %0, i32* %5
%6 = bitcast %union.anon* %3 to [4 x i8]*
%7 = sext i32 %1 to i64
%8 = getelementptr inbounds [4 x i8], [4 x i8]* %6, i64 0, i64 %7
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(int /*<<< orphan*/);
void ft_putstr(char const *s) {
  while (*s)
    ft_putchar(*s++);
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1145 <ft_putstr+0x35>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
jmp    111c <ft_putstr+0xc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1133 <ft_putstr+0x23>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <ft_putstr+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_putstr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
br label %3
3: ; preds = %7, %1
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
%6 = icmp ne i8 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %2
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = call i32 @ft_putchar(i32 %11)
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @ft_putstr(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %10, %4 ], [ %2, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = sext i8 %5 to i32
%9 = tail call i32 @ft_putchar(i32 %8)
%10 = load i8, i8* %7
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ heapify(int *, int, int);
void build_head(int a[], int length) {
  for (int i = length / 2; i >= 0; i--) {
    heapify(a, i, length - 1);
  }
}


x86 assembly (clang, -O0):
<build_head>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1157 <build_head+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
call   1030 <heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <build_head+0x1d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_head>:
push   %rbp
push   %r14
push   %rbx
cmp    $0xffffffff,%esi
jl     1141 <build_head+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
mov    %esi,%ebp
shr    $0x1f,%ebp
add    %esi,%ebp
sar    %ebp
add    $0xffffffff,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <heapify@plt>
add    $0xffffffff,%ebp
jb     1130 <build_head+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @build_head(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, -2
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = sdiv i32 %1, 2
%6 = add nsw i32 %1, -1
br label %8
7: ; preds = %8, %2
ret void
8: ; preds = %4, %8
%9 = phi i32 [ %5, %4 ], [ %11, %8 ]
%10 = tail call i32 @heapify(i32* %0, i32 %9, i32 %6)
%11 = add nsw i32 %9, -1
%12 = icmp eq i32 %9, 0
br i1 %12, label %7, label %8
}
int do_591() { return 591; }


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

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

LLVM IR (-O0):
define i32 @do_591() {
ret i32 591
}

LLVM IR (-O2):
define i32 @do_591() {
ret i32 591
}
unsigned int nextpow2(int of) {
  unsigned int ret;
  for (ret = 1; ret < of; ret *= 2)
    ;
  return ret;
}


x86 assembly (clang, -O0):
<nextpow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    112d <nextpow2+0x2d>
jmp    111f <nextpow2+0x1f>
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    110e <nextpow2+0xe>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nextpow2>:
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ecx,%eax
lea    (%rax,%rax,1),%ecx
cmp    %edi,%eax
jb     1110 <nextpow2+0x10>
ret

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

LLVM IR (-O2):
define i32 @nextpow2(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ 1, %1 ], [ %5, %2 ]
%4 = icmp ult i32 %3, %0
%5 = shl i32 %3, 1
br i1 %4, label %2, label %6
6: ; preds = %2
ret i32 %3
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ ASSERT(int);
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void WatchdogIntUnregister(uint32_t ui32Base) {
  ASSERT((ui32Base == 0x40000000) || (ui32Base == 0x40001000));
  IntDisable(34);
  IntUnregister(34);
}


x86 assembly (clang, -O0):
<WatchdogIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x1,%al
cmpl   $0x40000000,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115a <WatchdogIntUnregister+0x2a>
cmpl   $0x40001000,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <ASSERT@plt>
mov    $0x22,%edi
call   1030 <IntDisable@plt>
mov    $0x22,%edi
call   1050 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WatchdogIntUnregister>:
push   %rax
and    $0xffffefff,%edi
xor    %eax,%eax
cmp    $0x40000000,%edi
sete   %al
mov    %eax,%edi
call   1040 <ASSERT@plt>
mov    $0x22,%edi
call   1030 <IntDisable@plt>
mov    $0x22,%edi
pop    %rax
jmp    1050 <IntUnregister@plt>

LLVM IR (-O0):
define void @WatchdogIntUnregister(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 1073741824
br i1 %4, label %8, label %5
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp eq i32 %6, 1073745920
br label %8
8: ; preds = %5, %1
%9 = phi i1 [ true, %1 ], [ %7, %5 ]
%10 = zext i1 %9 to i32
%11 = call i32 @ASSERT(i32 %10)
%12 = call i32 @IntDisable(i32 34)
%13 = call i32 @IntUnregister(i32 34)
ret void
}

LLVM IR (-O2):
define void @WatchdogIntUnregister(i32 %0) {
%2 = and i32 %0, -4097
%3 = icmp eq i32 %2, 1073741824
%4 = zext i1 %3 to i32
%5 = tail call i32 @ASSERT(i32 %4)
%6 = tail call i32 @IntDisable(i32 34)
%7 = tail call i32 @IntUnregister(i32 34)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct jffs2_raw_dirent {
  int dummy;
};

/* Variables and functions */
struct jffs2_raw_dirent *resolvepath0(char *, size_t, int /*<<< orphan*/,
                                      char *, int /*<<< orphan*/ *,
                                      int /*<<< orphan*/);
struct jffs2_raw_dirent *resolvepath(char *o, size_t size, uint32_t ino,
                                     char *p, uint32_t *inos) {
  return resolvepath0(o, size, ino, p, inos, 0);
}


x86 assembly (clang, -O0):
<resolvepath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
xor    %r9d,%r9d
call   1030 <resolvepath0@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resolvepath>:
xor    %r9d,%r9d
jmp    1030 <resolvepath0@plt>

LLVM IR (-O0):
%struct.jffs2_raw_dirent = type { i32 }
define %struct.jffs2_raw_dirent* @resolvepath(i8* %0, i64 %1, i32 %2, i8* %3, i32* %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i8*
%10 = alloca i32*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
store i32* %4, i32** %10
%11 = load i8*, i8** %6
%12 = load i64, i64* %7
%13 = load i32, i32* %8
%14 = load i8*, i8** %9
%15 = load i32*, i32** %10
%16 = call %struct.jffs2_raw_dirent* @resolvepath0(i8* %11, i64 %12, i32 %13, i8* %14, i32* %15, i32 0)
ret %struct.jffs2_raw_dirent* %16
}

LLVM IR (-O2):
%struct.jffs2_raw_dirent = type { i32 }
define %struct.jffs2_raw_dirent* @resolvepath(i8* %0, i64 %1, i32 %2, i8* %3, i32* %4) {
%6 = tail call %struct.jffs2_raw_dirent* @resolvepath0(i8* %0, i64 %1, i32 %2, i8* %3, i32* %4, i32 0)
ret %struct.jffs2_raw_dirent* %6
}
/* Variables and functions */
char func_b();
char func_c();
int main(void) {
  if (func_b() != 'b') {
    return 1;
  }
  if (func_c() != 'c') {
    return 2;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <func_b@plt>
movsbl %al,%eax
cmp    $0x62,%eax
je     114e <main+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1174 <main+0x54>
mov    $0x0,%al
call   1040 <func_c@plt>
movsbl %al,%eax
cmp    $0x63,%eax
je     116d <main+0x4d>
movl   $0x2,-0x4(%rbp)
jmp    1174 <main+0x54>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <func_b@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cmp    $0x62,%cl
jne    1147 <main+0x27>
xor    %eax,%eax
call   1040 <func_c@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x63,%cl
setne  %al
add    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call signext i8 (...) @func_b()
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 98
br i1 %4, label %5, label %6
5: ; preds = %0
store i32 1, i32* %1
br label %12
6: ; preds = %0
%7 = call signext i8 (...) @func_c()
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 99
br i1 %9, label %10, label %11
10: ; preds = %6
store i32 2, i32* %1
br label %12
11: ; preds = %6
store i32 0, i32* %1
br label %12
12: ; preds = %11, %10, %5
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call signext i8 (...) @func_b()
%2 = icmp eq i8 %1, 98
br i1 %2, label %3, label %7
3: ; preds = %0
%4 = tail call signext i8 (...) @func_c()
%5 = icmp eq i8 %4, 99
%6 = select i1 %5, i32 0, i32 2
br label %7
7: ; preds = %3, %0
%8 = phi i32 [ 1, %0 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
char *run_all_tests();
int main(int argc, char **argv) {
  char *result = run_all_tests();
  if (result != 0) {
    printf("%s\n", result);
  } else {
    printf("ALL TESTS PASSED\n");
  }
  return result != 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1040 <run_all_tests@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1163 <main+0x43>
mov    -0x18(%rbp),%rsi
lea    0xea9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1171 <main+0x51>
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <run_all_tests@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1135 <main+0x15>
mov    %rbx,%rdi
jmp    113c <main+0x1c>
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
test   %rbx,%rbx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [18 x i8] c"ALL TESTS PASSED\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i8* (...) @run_all_tests()
store i8* %7, i8** %6
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %10
%16 = load i8*, i8** %6
%17 = icmp ne i8* %16, null
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
@str = [17 x i8] c"ALL TESTS PASSED\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i8* (...) @run_all_tests()
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @puts(i8* %3)
br label %9
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
%10 = zext i1 %4 to i32
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ printHelloC();
int /*<<< orphan*/ printHelloCpp();
int main() {
  printHelloC();
  printHelloCpp();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @printHelloC()
%2 = tail call i32 (...) @printHelloCpp()
ret i32 0
}
/* Type definitions */
struct mb_interpreter_t {
  int dummy;
};

/* Variables and functions */
int _remove_func(struct mb_interpreter_t *, char *, int);
int mb_remove_reserved_func(struct mb_interpreter_t *s, const char *n) {
  if (!s || !n)
    return 3;
  return _remove_func(s, (char *)n, (1));
}


x86 assembly (clang, -O0):
<mb_remove_reserved_func>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1136 <mb_remove_reserved_func+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1142 <mb_remove_reserved_func+0x32>
movl   $0x3,-0x4(%rbp)
jmp    1157 <mb_remove_reserved_func+0x47>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    $0x1,%edx
call   1030 <_remove_func@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mb_remove_reserved_func>:
test   %rdi,%rdi
je     1124 <mb_remove_reserved_func+0x14>
test   %rsi,%rsi
je     1124 <mb_remove_reserved_func+0x14>
mov    $0x1,%edx
jmp    1030 <_remove_func@plt>
mov    $0x3,%eax
ret

LLVM IR (-O0):
%struct.mb_interpreter_t = type { i32 }
define i32 @mb_remove_reserved_func(%struct.mb_interpreter_t* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.mb_interpreter_t*
%5 = alloca i8*
store %struct.mb_interpreter_t* %0, %struct.mb_interpreter_t** %4
store i8* %1, i8** %5
%6 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%7 = icmp ne %struct.mb_interpreter_t* %6, null
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %8, %2
store i32 3, i32* %3
br label %16
12: ; preds = %8
%13 = load %struct.mb_interpreter_t*, %struct.mb_interpreter_t** %4
%14 = load i8*, i8** %5
%15 = call i32 @_remove_func(%struct.mb_interpreter_t* %13, i8* %14, i32 1)
store i32 %15, i32* %3
br label %16
16: ; preds = %12, %11
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
%struct.mb_interpreter_t = type { i32 }
define i32 @mb_remove_reserved_func(%struct.mb_interpreter_t* %0, i8* %1) {
%3 = icmp ne %struct.mb_interpreter_t* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @_remove_func(%struct.mb_interpreter_t* %0, i8* %1, i32 1)
br label %8
8: ; preds = %2, %6
%9 = phi i32 [ %7, %6 ], [ 3, %2 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           char const *, char const *);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char const *, char const *);
void check_strs(const char *actual, const char *expected, const char *msg) {
  if (strcmp(expected, actual) == 0) {
    return;
  }
  fprintf(stderr, "FAIL: %s Expected '%s' but was '%s'\n", msg, expected,
          actual);
  exit(1);
}


x86 assembly (clang, -O0):
<check_strs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
jne    1161 <check_strs+0x31>
add    $0x20,%rsp
pop    %rbp
ret
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%r8
lea    0xe83(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<check_strs>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
mov    %rbx,%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
jne    1154 <check_strs+0x24>
pop    %rbx
pop    %r14
pop    %r15
ret
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%rcx
mov    %rbx,%r8
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"FAIL: %s Expected '%s' but was '%s'\0A\00"
define void @check_strs(i8* %0, i8* %1, i8* %2) {
%4 = tail call i64 @strcmp(i8* %1, i8* %0)
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %3
ret void
7: ; preds = %3
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %2, i8* %1, i8* %0)
%10 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
double M_LN2;
double log(double);
int round(double);
int period_to_note(int p) {
  if (p <= 0) {
    return 0;
  }
  return round(12.0 * log(13696.0 / p) / M_LN2) + 1;
}


x86 assembly (clang, -O0):
<period_to_note>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1141 <period_to_note+0x21>
movl   $0x0,-0x4(%rbp)
jmp    117c <period_to_note+0x5c>
cvtsi2sdl -0x8(%rbp),%xmm1
movsd  0xeba(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  0xe9e(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x2e73(%rip),%rax
divsd  (%rax),%xmm0
call   1040 <round@plt>
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<period_to_note>:
test   %edi,%edi
jle    115a <period_to_note+0x3a>
push   %rax
cvtsi2sd %edi,%xmm1
movsd  0xecf(%rip),%xmm0
divsd  %xmm1,%xmm0
call   1030 <log@plt>
mulsd  0xec6(%rip),%xmm0
mov    0x2e97(%rip),%rax
divsd  (%rax),%xmm0
call   1040 <round@plt>
add    $0x1,%eax
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
@M_LN2 = global double 0.000000e+00
define i32 @period_to_note(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 0, i32* %2
br label %17
7: ; preds = %1
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = fdiv double 1.369600e+04, %9
%11 = call double @log(double %10)
%12 = fmul double 1.200000e+01, %11
%13 = load double, double* @M_LN2
%14 = fdiv double %12, %13
%15 = call i32 @round(double %14)
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %7, %6
%18 = load i32, i32* %2
ret i32 %18
}

LLVM IR (-O2):
@M_LN2 = global double 0.000000e+00
define i32 @period_to_note(i32 %0) {
%2 = icmp slt i32 %0, 1
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = sitofp i32 %0 to double
%5 = fdiv double 1.369600e+04, %4
%6 = tail call double @log(double %5)
%7 = fmul double %6, 1.200000e+01
%8 = load double, double* @M_LN2
%9 = fdiv double %7, %8
%10 = tail call i32 @round(double %9)
%11 = add nsw i32 %10, 1
br label %12
12: ; preds = %1, %3
%13 = phi i32 [ %11, %3 ], [ 0, %1 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ Section4First(int);
int /*<<< orphan*/ Section4Fourth(int);
int /*<<< orphan*/ Section4Second(int);
int /*<<< orphan*/ Section4Third(int);
int Section4(int number) {
  Section4First(number);
  Section4Second(number);
  Section4Third(number);
  Section4Fourth(number);
  return 0;
}


x86 assembly (clang, -O0):
<Section4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1050 <Section4First@plt>
mov    -0x4(%rbp),%edi
call   1040 <Section4Second@plt>
mov    -0x4(%rbp),%edi
call   1030 <Section4Third@plt>
mov    -0x4(%rbp),%edi
call   1060 <Section4Fourth@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Section4>:
push   %rbx
mov    %edi,%ebx
call   1050 <Section4First@plt>
mov    %ebx,%edi
call   1040 <Section4Second@plt>
mov    %ebx,%edi
call   1030 <Section4Third@plt>
mov    %ebx,%edi
call   1060 <Section4Fourth@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @Section4(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @Section4First(i32 %3)
%5 = load i32, i32* %2
%6 = call i32 @Section4Second(i32 %5)
%7 = load i32, i32* %2
%8 = call i32 @Section4Third(i32 %7)
%9 = load i32, i32* %2
%10 = call i32 @Section4Fourth(i32 %9)
ret i32 0
}

LLVM IR (-O2):
define i32 @Section4(i32 %0) {
%2 = tail call i32 @Section4First(i32 %0)
%3 = tail call i32 @Section4Second(i32 %0)
%4 = tail call i32 @Section4Third(i32 %0)
%5 = tail call i32 @Section4Fourth(i32 %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mfetch(int /*<<< orphan*/);
int /*<<< orphan*/ mpop();
int /*<<< orphan*/ mpush(int /*<<< orphan*/);
void at() { mpush(mfetch(mpop())); }


x86 assembly (clang, -O0):
<at>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mpop@plt>
mov    %eax,%edi
call   1040 <mfetch@plt>
mov    %eax,%edi
call   1050 <mpush@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<at>:
push   %rax
xor    %eax,%eax
call   1030 <mpop@plt>
mov    %eax,%edi
call   1040 <mfetch@plt>
mov    %eax,%edi
pop    %rax
jmp    1050 <mpush@plt>

LLVM IR (-O0):
define void @at() {
%1 = call i32 (...) @mpop()
%2 = call i32 @mfetch(i32 %1)
%3 = call i32 @mpush(i32 %2)
ret void
}

LLVM IR (-O2):
define void @at() {
%1 = tail call i32 (...) @mpop()
%2 = tail call i32 @mfetch(i32 %1)
%3 = tail call i32 @mpush(i32 %2)
ret void
}