xunge/DecIR huggingface dataset:
double a_y(double r, double y) { return y * (1. - r) / r - 1.; }


x86 assembly (clang, -O0):
<a_y>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xee5(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  0xecf(%rip),%xmm1
subsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<a_y>:
movsd  0xef8(%rip),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
divsd  %xmm0,%xmm2
addsd  0xeec(%rip),%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @a_y(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fsub double 1.000000e+00, %6
%8 = fmul double %5, %7
%9 = load double, double* %3
%10 = fdiv double %8, %9
%11 = fsub double %10, 1.000000e+00
ret double %11
}

LLVM IR (-O2):
define double @a_y(double %0, double %1) {
%3 = fsub double 1.000000e+00, %0
%4 = fmul double %3, %1
%5 = fdiv double %4, %0
%6 = fadd double %5, -1.000000e+00
ret double %6
}
/* Variables and functions */
int main_sub();
int main(void) {
  int tmp;
  tmp = main_sub();
  return tmp;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @main_sub()
ret i32 %1
}
void sys_console() {
  while (1)
    ;
}


x86 assembly (clang, -O0):
<sys_console>:
push   %rbp
mov    %rsp,%rbp
jmp    1109 <sys_console+0x9>
jmp    1109 <sys_console+0x9>

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

LLVM IR (-O0):
define void @sys_console() {
br label %1
1: ; preds = %0, %1
br label %1
}

LLVM IR (-O2):
define void @sys_console() {
br label %1
1: ; preds = %0, %1
br label %1
}
/* Variables and functions */
double floor(double);
double ml_floor(double x) { return floor(x); }


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

x86 assembly (clang, -O2):
<ml_floor>:
jmp    1030 <floor@plt>

LLVM IR (-O0):
define double @ml_floor(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @llvm.floor.f64(double %3)
ret double %4
}

LLVM IR (-O2):
define double @ml_floor(double %0) {
%2 = tail call double @llvm.floor.f64(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
char *epr_clone_string(char const *);
int /*<<< orphan*/ epr_free_string(char *);
char *epr_assign_string(char **str_clone, const char *str) {
  assert(str_clone != NULL);
  epr_free_string(*str_clone);
  *str_clone = epr_clone_string(str);
  return *str_clone;
}


x86 assembly (clang, -O0):
<epr_assign_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1050 <epr_free_string@plt>
mov    -0x10(%rbp),%rdi
call   1030 <epr_clone_string@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epr_assign_string>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    (%rbx),%rdi
call   1050 <epr_free_string@plt>
mov    %r14,%rdi
call   1030 <epr_clone_string@plt>
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @epr_assign_string(i8** %0, i8* %1) {
%3 = alloca i8**
%4 = alloca i8*
store i8** %0, i8*** %3
store i8* %1, i8** %4
%5 = load i8**, i8*** %3
%6 = icmp ne i8** %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i8**, i8*** %3
%10 = load i8*, i8** %9
%11 = call i32 @epr_free_string(i8* %10)
%12 = load i8*, i8** %4
%13 = call i8* @epr_clone_string(i8* %12)
%14 = load i8**, i8*** %3
store i8* %13, i8** %14
%15 = load i8**, i8*** %3
%16 = load i8*, i8** %15
ret i8* %16
}

LLVM IR (-O2):
define i8* @epr_assign_string(i8** %0, i8* %1) {
%3 = icmp ne i8** %0, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = load i8*, i8** %0
%7 = tail call i32 @epr_free_string(i8* %6)
%8 = tail call i8* @epr_clone_string(i8* %1)
store i8* %8, i8** %0
ret i8* %8
}
/* Variables and functions */
float log(float);
int pow(float, int);
float f(float x) { return 2 * (pow(x, 3)) + log(x) - 5; }


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0x3,%edi
call   1040 <pow@plt>
shl    $0x1,%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movss  -0x8(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  0xe9a(%rip),%xmm1
subss  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rax
movss  %xmm0,0x4(%rsp)
mov    $0x3,%edi
call   1040 <pow@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  %xmm0,(%rsp)
movss  0x4(%rsp),%xmm0
call   1030 <log@plt>
addss  (%rsp),%xmm0
addss  0xea9(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @pow(float %3, i32 3)
%5 = mul nsw i32 2, %4
%6 = sitofp i32 %5 to float
%7 = load float, float* %2
%8 = call float @log(float %7)
%9 = fadd float %6, %8
%10 = fsub float %9, 5.000000e+00
ret float %10
}

LLVM IR (-O2):
define float @f(float %0) {
%2 = tail call i32 @pow(float %0, i32 3)
%3 = shl nsw i32 %2, 1
%4 = sitofp i32 %3 to float
%5 = tail call float @log(float %0)
%6 = fadd float %5, %4
%7 = fadd float %6, -5.000000e+00
ret float %7
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void f2() { fprintf(0, "foo"); }


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
lea    0xee3(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
lea    0xee9(%rip),%rsi
xor    %edi,%edi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"foo\00"
define void @f2() {
%1 = tail call i32 @fprintf(i32 0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
ret void
}
int pn_string_list_count(char **p) {
  int result = 0;
  if (p) {
    for (; *p; ++p) {
      result++;
    }
  }
  return result;
}


x86 assembly (clang, -O0):
<pn_string_list_count>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     114c <pn_string_list_count+0x4c>
jmp    111f <pn_string_list_count+0x1f>
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     1147 <pn_string_list_count+0x47>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
jmp    111f <pn_string_list_count+0x1f>
jmp    114c <pn_string_list_count+0x4c>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pn_string_list_count>:
xor    %eax,%eax
test   %rdi,%rdi
je     111c <pn_string_list_count+0x1c>
cmpq   $0x0,(%rdi)
je     111c <pn_string_list_count+0x1c>
xor    %eax,%eax
nop
cmpq   $0x0,0x8(%rdi,%rax,8)
lea    0x1(%rax),%rax
jne    1110 <pn_string_list_count+0x10>
ret

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

LLVM IR (-O2):
define i32 @pn_string_list_count(i8** %0) {
%2 = icmp eq i8** %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8*, i8** %0
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i32 [ %9, %6 ], [ 0, %3 ]
%8 = phi i8** [ %10, %6 ], [ %0, %3 ]
%9 = add nuw nsw i32 %7, 1
%10 = getelementptr inbounds i8*, i8** %8, i64 1
%11 = load i8*, i8** %10
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
%14 = phi i32 [ 0, %1 ], [ 0, %3 ], [ %9, %6 ]
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ lookNarray(char *, unsigned int);
void lookcomplex32array_(void *x, unsigned int *n) {
  lookNarray((char *)x, (*n * 32));
}


x86 assembly (clang, -O0):
<lookcomplex32array_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
shl    $0x5,%esi
call   1030 <lookNarray@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lookcomplex32array_>:
mov    (%rsi),%esi
shl    $0x5,%esi
jmp    1030 <lookNarray@plt>

LLVM IR (-O0):
define void @lookcomplex32array_(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%5 = load i8*, i8** %3
%6 = load i32*, i32** %4
%7 = load i32, i32* %6
%8 = mul i32 %7, 32
%9 = call i32 @lookNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @lookcomplex32array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 5
%5 = tail call i32 @lookNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ WRITE_VID32(unsigned long, unsigned long);
void gfx_write_vid32(unsigned long offset, unsigned long value) {
  WRITE_VID32(offset, value);
}


x86 assembly (clang, -O0):
<gfx_write_vid32>:
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 <WRITE_VID32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gfx_write_vid32>:
jmp    1030 <WRITE_VID32@plt>

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

LLVM IR (-O2):
define void @gfx_write_vid32(i64 %0, i64 %1) {
%3 = tail call i32 @WRITE_VID32(i64 %0, i64 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ core1_print(char *, char const *);
void U_EMRPOLYLINETO_print(const char *contents) {
  core1_print("U_EMRPOLYLINETO", contents);
}


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

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

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

LLVM IR (-O2):
@.str = [16 x i8] c"U_EMRPOLYLINETO\00"
define void @U_EMRPOLYLINETO_print(i8* %0) {
%2 = tail call i32 @core1_print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int _ada_use_c2phc(int, int *, int *, double *);
int dobldobl_scale_system(int mode, double *cff) {
  int fail, *b;
  fail = _ada_use_c2phc(591, &mode, b, cff);
  return fail;
}


x86 assembly (clang, -O0):
<dobldobl_scale_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x20(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    $0x24f,%edi
lea    -0x4(%rbp),%rsi
call   1030 <_ada_use_c2phc@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dobldobl_scale_system>:
push   %rax
mov    %rsi,%rcx
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x24f,%edi
call   1030 <_ada_use_c2phc@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dobldobl_scale_system(i32 %0, double* %1) {
%3 = alloca i32
%4 = alloca double*
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store double* %1, double** %4
%7 = load i32*, i32** %6
%8 = load double*, double** %4
%9 = call i32 @_ada_use_c2phc(i32 591, i32* %3, i32* %7, double* %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
ret i32 %10
}

LLVM IR (-O2):
define i32 @dobldobl_scale_system(i32 %0, double* %1) {
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 @_ada_use_c2phc(i32 591, i32* %3, i32* undef, double* %1)
ret i32 %4
}
int test_imm_05int32_mem(int *val) {
  return ((*val) & (0x05 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_05int32_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
and    $0x5,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_05int32_mem(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* %3
%5 = and i32 %4, 5
%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_05int32_mem(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = and i32 %2, 5
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int rdsz(char *a) {
  int s;
  s = *a++ & 0xff;
  s |= (*a & 0xff) << 8;
  return (s);
}


x86 assembly (clang, -O0):
<rdsz>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movsbl (%rax),%eax
and    $0xff,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
and    $0xff,%eax
shl    $0x8,%eax
or     -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdsz>:
movzwl (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @rdsz(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i32 1
store i8* %5, i8** %2
%6 = load i8, i8* %4
%7 = sext i8 %6 to i32
%8 = and i32 %7, 255
store i32 %8, i32* %3
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = and i32 %11, 255
%13 = shl i32 %12, 8
%14 = load i32, i32* %3
%15 = or i32 %14, %13
store i32 %15, i32* %3
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @rdsz(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 1
%3 = load i8, i8* %0
%4 = zext i8 %3 to i32
%5 = load i8, i8* %2
%6 = zext i8 %5 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %4
ret i32 %8
}
/* Variables and functions */
scalar_t__ strcasecmp(char const *const, char const *const);
int equals(const char *const val, const char *const other) {
  return strcasecmp(val, other) == 0;
}


x86 assembly (clang, -O0):
<equals>:
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 <strcasecmp@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<equals>:
push   %rax
call   1030 <strcasecmp@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @equals(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i64 @strcasecmp(i8* %5, i8* %6)
%8 = icmp eq i64 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @equals(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i64 @strcasecmp(i8* %0, i8* %1)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ InitCS();
int rtl_tracemutex() {
  InitCS();
  return 1;
}


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

x86 assembly (clang, -O2):
<rtl_tracemutex>:
push   %rax
xor    %eax,%eax
call   1030 <InitCS@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rtl_tracemutex() {
%1 = call i32 (...) @InitCS()
ret i32 1
}

LLVM IR (-O2):
define i32 @rtl_tracemutex() {
%1 = tail call i32 (...) @InitCS()
ret i32 1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct fmc_device {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mprintf(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
uint32_t fmc_readl(struct fmc_device *fmc, int offset) {
  uint32_t *p = (uint32_t *)offset;
  if (offset >= 0x480500 && offset < 0x490000)
    mprintf("[READ ]: fmc_readl -> Dir %08X val %08X\n", p, *p);
  return *p;
}


x86 assembly (clang, -O0):
<fmc_readl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movslq -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
cmpl   $0x480500,-0xc(%rbp)
jl     1157 <fmc_readl+0x47>
cmpl   $0x490000,-0xc(%rbp)
jge    1157 <fmc_readl+0x47>
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xeae(%rip),%rdi
call   1030 <mprintf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmc_readl>:
push   %rbx
movslq %esi,%rbx
lea    -0x480500(%rbx),%eax
cmp    $0xfaff,%eax
ja     1132 <fmc_readl+0x22>
mov    (%rbx),%edx
lea    0xed6(%rip),%rdi
mov    %rbx,%rsi
call   1030 <mprintf@plt>
mov    (%rbx),%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.fmc_device = type { i32 }
@.str = [41 x i8] c"[READ ]: fmc_readl -> Dir %08X val %08X\0A\00"
define i32 @fmc_readl(%struct.fmc_device* %0, i32 %1) {
%3 = alloca %struct.fmc_device*
%4 = alloca i32
%5 = alloca i32*
store %struct.fmc_device* %0, %struct.fmc_device** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %5
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 4719872
br i1 %10, label %11, label %19
11: ; preds = %2
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 4784128
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i32*, i32** %5
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = call i32 @mprintf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* %15, i32 %17)
br label %19
19: ; preds = %14, %11, %2
%20 = load i32*, i32** %5
%21 = load i32, i32* %20
ret i32 %21
}

LLVM IR (-O2):
%struct.fmc_device = type { i32 }
@.str = [41 x i8] c"[READ ]: fmc_readl -> Dir %08X val %08X\0A\00"
define i32 @fmc_readl(%struct.fmc_device* nocapture readnone %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = inttoptr i64 %3 to i32*
%5 = add i32 %1, -4719872
%6 = icmp ult i32 %5, 64256
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32, i32* %4
%9 = tail call i32 @mprintf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32* %4, i32 %8)
br label %10
10: ; preds = %7, %2
%11 = load i32, i32* %4
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ do_a();
int /*<<< orphan*/ do_b();
int /*<<< orphan*/ do_c();
scalar_t__ test_condition();
void test_while() {
  do_a();
  while (test_condition())
    do_b();
  do_c();
}


x86 assembly (clang, -O0):
<test_while>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <do_a@plt>
mov    $0x0,%al
call   1030 <test_condition@plt>
cmp    $0x0,%rax
je     1168 <test_while+0x28>
mov    $0x0,%al
call   1040 <do_b@plt>
jmp    114b <test_while+0xb>
mov    $0x0,%al
call   1060 <do_c@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_while>:
push   %rax
xor    %eax,%eax
call   1050 <do_a@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <test_condition@plt>
test   %rax,%rax
je     1165 <test_while+0x25>
xor    %eax,%eax
call   1040 <do_b@plt>
jmp    1150 <test_while+0x10>
xor    %eax,%eax
pop    %rcx
jmp    1060 <do_c@plt>

LLVM IR (-O0):
define void @test_while() {
%1 = call i32 (...) @do_a()
br label %2
2: ; preds = %5, %0
%3 = call i64 (...) @test_condition()
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = call i32 (...) @do_b()
br label %2
7: ; preds = %2
%8 = call i32 (...) @do_c()
ret void
}

LLVM IR (-O2):
define void @test_while() {
%1 = tail call i32 (...) @do_a()
%2 = tail call i64 (...) @test_condition()
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %0, %4
%5 = tail call i32 (...) @do_b()
%6 = tail call i64 (...) @test_condition()
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %4
8: ; preds = %4, %0
%9 = tail call i32 (...) @do_c()
ret void
}
int main02() {
  int *p;
  printf("p = %d\n", p);
  *p = 100;
  return 0;
}


x86 assembly (clang, -O0):
<main02>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x8(%rbp),%rsi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movl   $0x64,(%rax)
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main02>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"p = %d\0A\00"
define i32 @main02() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32* undef)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ strcspn(char const *, char const *);
char *strpbrk(const char *s, const char *b) {
  s += strcspn(s, b);
  return *s ? (char *)s : 0;
}


x86 assembly (clang, -O0):
<strpbrk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcspn@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     115a <strpbrk+0x4a>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1165 <strpbrk+0x55>
xor    %eax,%eax
mov    %rax,-0x18(%rbp)
jmp    1165 <strpbrk+0x55>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strpbrk>:
push   %rbx
mov    %rdi,%rbx
call   1030 <strcspn@plt>
movslq %eax,%rcx
lea    (%rbx,%rcx,1),%rdx
xor    %eax,%eax
cmpb   $0x0,(%rbx,%rcx,1)
cmovne %rdx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @strpbrk(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @strcspn(i8* %5, i8* %6)
%8 = load i8*, i8** %3
%9 = sext i32 %7 to i64
%10 = getelementptr inbounds i8, i8* %8, i64 %9
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %2
%16 = load i8*, i8** %3
br label %18
17: ; preds = %2
br label %18
18: ; preds = %17, %15
%19 = phi i8* [ %16, %15 ], [ null, %17 ]
ret i8* %19
}

LLVM IR (-O2):
define i8* @strpbrk(i8* %0, i8* nocapture %1) {
%3 = tail call i32 @strcspn(i8* %0, i8* %1)
%4 = sext i32 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = select i1 %7, i8* null, i8* %5
ret i8* %8
}
int test_imm_29uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x29 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_29uint64_midword_mem>:
testb  $0x29,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_29uint64_midword_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, 16
%6 = and i64 %5, 41
%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_29uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 2686976
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void baz(unsigned int b) {
  if ((~b >> 2) & 1)
    bar();
}


x86 assembly (clang, -O0):
<baz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
shr    $0x2,%eax
and    $0x1,%eax
cmp    $0x0,%eax
je     1137 <baz+0x27>
mov    $0x0,%al
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<baz>:
test   $0x4,%dil
jne    111d <baz+0xd>
xor    %eax,%eax
jmp    1030 <bar@plt>
ret

LLVM IR (-O0):
define void @baz(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = lshr i32 %4, 2
%6 = and i32 %5, 1
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @bar()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
define void @baz(i32 %0) {
%2 = and i32 %0, 4
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @bar()
br label %6
6: ; preds = %4, %1
ret void
}
int test_imm_A7uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xA7 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A7uint64_midword_mem>:
testb  $0xa7,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_A7uint64_midword_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, 16
%6 = and i64 %5, 167
%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_A7uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 10944512
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
char getAlphabeticX(int, int);
char getAlphabeticY(int, int);
int getAlphabeticXY(int x, int y, int boardSize, char *letters) {
  letters[0] = getAlphabeticX(x, boardSize);
  letters[1] = getAlphabeticY(y, boardSize);
  letters[2] = '\0';
}


x86 assembly (clang, -O0):
<getAlphabeticXY>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1030 <getAlphabeticX@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <getAlphabeticY@plt>
mov    %al,%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x18(%rbp),%rax
movb   $0x0,0x2(%rax)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getAlphabeticXY>:
push   %rbp
push   %r14
push   %rbx
mov    %rcx,%rbx
mov    %edx,%ebp
mov    %esi,%r14d
mov    %edx,%esi
call   1030 <getAlphabeticX@plt>
mov    %al,(%rbx)
mov    %r14d,%edi
mov    %ebp,%esi
call   1040 <getAlphabeticY@plt>
mov    %al,0x1(%rbx)
movb   $0x0,0x2(%rbx)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @getAlphabeticXY(i32 %0, i32 %1, i32 %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i8* %3, i8** %9
%10 = load i32, i32* %6
%11 = load i32, i32* %8
%12 = call signext i8 @getAlphabeticX(i32 %10, i32 %11)
%13 = load i8*, i8** %9
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 %12, i8* %14
%15 = load i32, i32* %7
%16 = load i32, i32* %8
%17 = call signext i8 @getAlphabeticY(i32 %15, i32 %16)
%18 = load i8*, i8** %9
%19 = getelementptr inbounds i8, i8* %18, i64 1
store i8 %17, i8* %19
%20 = load i8*, i8** %9
%21 = getelementptr inbounds i8, i8* %20, i64 2
store i8 0, i8* %21
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
define i32 @getAlphabeticXY(i32 %0, i32 %1, i32 %2, i8* nocapture writeonly %3) {
%5 = tail call signext i8 @getAlphabeticX(i32 %0, i32 %2)
store i8 %5, i8* %3
%6 = tail call signext i8 @getAlphabeticY(i32 %1, i32 %2)
%7 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %6, i8* %7
%8 = getelementptr inbounds i8, i8* %3, i64 2
store i8 0, i8* %8
ret i32 undef
}
/* Type definitions */
struct edo_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int edo_cmdline_parser_required(struct edo_args_info *args_info,
                                const char *prog_name) {
  (void)(args_info);
  (void)(prog_name);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<edo_cmdline_parser_required>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<edo_cmdline_parser_required>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.edo_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @edo_cmdline_parser_required(%struct.edo_args_info* %0, i8* %1) {
%3 = alloca %struct.edo_args_info*
%4 = alloca i8*
store %struct.edo_args_info* %0, %struct.edo_args_info** %3
store i8* %1, i8** %4
%5 = load %struct.edo_args_info*, %struct.edo_args_info** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
%struct.edo_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @edo_cmdline_parser_required(%struct.edo_args_info* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ Assert_real(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ iscntrl(int);
void t_iscntrl_0x03() {
  Assert_real((iscntrl(3)),
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/"
              "dg/z88dk/test/suites/ctype/test_iscntrl.c",
              20, ("iscntrl should be 1 for 0x03"));
}


x86 assembly (clang, -O0):
<t_iscntrl_0x03>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <iscntrl@plt>
mov    %eax,%edi
lea    0xec9(%rip),%rsi
mov    $0x14,%edx
lea    0xf65(%rip),%rcx
call   1040 <Assert_real@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t_iscntrl_0x03>:
push   %rax
mov    $0x3,%edi
call   1030 <iscntrl@plt>
lea    0xece(%rip),%rsi
lea    0xf6f(%rip),%rcx
mov    %eax,%edi
mov    $0x14,%edx
pop    %rax
jmp    1040 <Assert_real@plt>

LLVM IR (-O0):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 1 for 0x03\00"
define void @t_iscntrl_0x03() {
%1 = call i32 @iscntrl(i32 3)
%2 = call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [168 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/bitfixer/bitfixer/refs/heads/master/dg/z88dk/test/suites/ctype/test_iscntrl.c\00"
@.str.1 = [29 x i8] c"iscntrl should be 1 for 0x03\00"
define void @t_iscntrl_0x03() {
%1 = tail call i32 @iscntrl(i32 3)
%2 = tail call i32 @Assert_real(i32 %1, i8* getelementptr inbounds ([168 x i8], [168 x i8]* @.str, i64 0, i64 0), i32 20, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
long *malloc(size_t);
int do_malloc(void *args) {
  int i;
  size_t size = (long)args;
  volatile long *foo = malloc(size);
  foo[0] = 42;
  return 0;
}


x86 assembly (clang, -O0):
<do_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
movq   $0x2a,(%rax)
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_malloc>:
push   %rax
call   1030 <malloc@plt>
movq   $0x2a,(%rax)
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @do_malloc(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64*
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = ptrtoint i8* %6 to i64
store i64 %7, i64* %4
%8 = load i64, i64* %4
%9 = call i64* @malloc(i64 %8)
store i64* %9, i64** %5
%10 = load i64*, i64** %5
%11 = getelementptr inbounds i64, i64* %10, i64 0
store volatile i64 42, i64* %11
ret i32 0
}

LLVM IR (-O2):
define i32 @do_malloc(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i64* @malloc(i64 %2)
store volatile i64 42, i64* %3
ret i32 0
}
/* Variables and functions */
char const *osal_get_user_datapath();
__attribute__((visibility("default"))) const char *ConfigGetUserDataPath(void) {
  return osal_get_user_datapath();
}


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

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

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

LLVM IR (-O2):
define i8* @ConfigGetUserDataPath() {
%1 = tail call i8* (...) @osal_get_user_datapath()
ret i8* %1
}
/* Type definitions */
typedef int /*<<< orphan*/ ssize_t;

/* Variables and functions */
int /*<<< orphan*/ send(int, char const *, int /*<<< orphan*/,
                        int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char const *);
ssize_t sendString(int sockfd, const char str[]) {
  return send(sockfd, str, strlen(str), 0);
}


x86 assembly (clang, -O0):
<sendString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendString>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <send@plt>

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

LLVM IR (-O2):
define i32 @sendString(i32 %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @send(i32 %0, i8* %1, i32 %3, i32 0)
ret i32 %4
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int rename(char const *, char const *);
int32_t mz_os_rename(const char *source_path, const char *target_path) {
  if (rename(source_path, target_path) == -1)
    return (-107);
  return (0);
}


x86 assembly (clang, -O0):
<mz_os_rename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <rename@plt>
cmp    $0xffffffff,%eax
jne    1142 <mz_os_rename+0x32>
movl   $0xffffff95,-0x4(%rbp)
jmp    1149 <mz_os_rename+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mz_os_rename>:
push   %rax
call   1030 <rename@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
mov    $0xffffff95,%eax
cmovne %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @mz_os_rename(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @rename(i8* %0, i8* %1)
%4 = icmp eq i32 %3, -1
%5 = select i1 %4, i32 -107, i32 0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ sample(int, int, double, double, int);
int main(void) {
  sample(2, 3, 2.51, 2.8, 1 / 16.0);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movsd  0xee7(%rip),%xmm0
movsd  0xee7(%rip),%xmm1
mov    $0x2,%edi
mov    $0x3,%esi
xor    %edx,%edx
call   1030 <sample@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @sample(i32 2, i32 3, double 2.510000e+00, double 2.800000e+00, i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @sample(i32 2, i32 3, double 2.510000e+00, double 2.800000e+00, i32 0)
ret i32 0
}
__attribute__((weak)) int _write(int file, char *buf, int nbytes) { return -1; }


x86 assembly (clang, -O0):
<_write>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define weak i32 @_write(i32 %0, i8* %1, i32 %2) {
ret i32 -1
}
void *xmalloc(size)
unsigned size;
{
  register void *value = (void *)malloc(size);
  if (!value)
    fatal("virtual memory exhausted");
  return value;
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1152 <xmalloc+0x32>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1040 <fatal@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
mov    %edi,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    113e <xmalloc+0x1e>
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1040 <fatal@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = zext i32 %4 to i64
%6 = call i8* @malloc(i64 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = icmp ne i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [25 x i8] c"virtual memory exhausted\00"
define i8* @xmalloc(i32 %0) {
%2 = zext i32 %0 to i64
%3 = tail call i8* @malloc(i64 %2)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, ...)*)(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int /*<<< orphan*/ EPERM;
int /*<<< orphan*/ errno;
int chmod(const char *path, mode_t mode) {
  errno = EPERM;
  return -1;
}


x86 assembly (clang, -O0):
<chmod>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    0x2ebe(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec5(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<chmod>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@EPERM = global i32 0
@errno = global i32 0
define i32 @chmod(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* @EPERM
store i32 %5, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@EPERM = global i32 0
@errno = global i32 0
define i32 @chmod(i8* nocapture readnone %0, i32 %1) {
%3 = load i32, i32* @EPERM
store i32 %3, i32* @errno
ret i32 -1
}
int abc(int param) { return param; }


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

x86 assembly (clang, -O2):
<abc>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @abc(i32 returned %0) {
ret i32 %0
}
int dev_is_parport(int fd) { return (0); }


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

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

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

LLVM IR (-O2):
define i32 @dev_is_parport(i32 %0) {
ret i32 0
}
short q(short a, char b) { return a + b; }


x86 assembly (clang, -O0):
<q>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %al,-0x3(%rbp)
movswl -0x2(%rbp),%eax
movsbl -0x3(%rbp),%ecx
add    %ecx,%eax
cwtl
pop    %rbp
ret

x86 assembly (clang, -O2):
<q>:
lea    (%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define signext i16 @q(i16 signext %0, i8 signext %1) {
%3 = alloca i16
%4 = alloca i8
store i16 %0, i16* %3
store i8 %1, i8* %4
%5 = load i16, i16* %3
%6 = sext i16 %5 to i32
%7 = load i8, i8* %4
%8 = sext i8 %7 to i32
%9 = add nsw i32 %6, %8
%10 = trunc i32 %9 to i16
ret i16 %10
}

LLVM IR (-O2):
define signext i16 @q(i16 signext %0, i8 signext %1) {
%3 = sext i8 %1 to i16
%4 = add i16 %3, %0
ret i16 %4
}
/* Variables and functions */
int /*<<< orphan*/ __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG();
void USBWakeUp_IRQHandler(void) { __HAL_USB_WAKEUP_EXTI_CLEAR_FLAG(); }


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

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

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

LLVM IR (-O2):
define void @USBWakeUp_IRQHandler() {
%1 = tail call i32 (...) @__HAL_USB_WAKEUP_EXTI_CLEAR_FLAG()
ret void
}
/* Variables and functions */
scalar_t__ ath9k_hw_wait(int, int, int, int);
int /*<<< orphan*/ one_int_read(int, unsigned int *);
int one_read_time(unsigned int addree, unsigned int *num) {
  unsigned int tmpint;
  one_int_read(addree, &tmpint);
  if (ath9k_hw_wait(0x15f18, 0x7, 0x4, 1000) < 0)
    return -1;
  one_int_read(0xb8115f1c, num);
  return 0;
}


x86 assembly (clang, -O0):
<one_read_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x14(%rbp),%rsi
call   1030 <one_int_read@plt>
mov    $0x15f18,%edi
mov    $0x7,%esi
mov    $0x4,%edx
mov    $0x3e8,%ecx
call   1040 <ath9k_hw_wait@plt>
cmp    $0x0,%rax
jge    116a <one_read_time+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    117f <one_read_time+0x5f>
mov    -0x10(%rbp),%rsi
mov    $0xb8115f1c,%edi
call   1030 <one_int_read@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<one_read_time>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0xc(%rsp),%rsi
call   1030 <one_int_read@plt>
mov    $0x15f18,%edi
mov    $0x7,%esi
mov    $0x4,%edx
mov    $0x3e8,%ecx
call   1040 <ath9k_hw_wait@plt>
test   %rax,%rax
js     1161 <one_read_time+0x41>
mov    $0xb8115f1c,%edi
mov    %rbx,%rsi
call   1030 <one_int_read@plt>
xor    %eax,%eax
jmp    1166 <one_read_time+0x46>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @one_read_time(i32 %0, i32* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
%7 = load i32, i32* %4
%8 = call i32 @one_int_read(i32 %7, i32* %6)
%9 = call i64 @ath9k_hw_wait(i32 89880, i32 7, i32 4, i32 1000)
%10 = icmp slt i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %15
12: ; preds = %2
%13 = load i32*, i32** %5
%14 = call i32 @one_int_read(i32 -1206821092, i32* %13)
store i32 0, i32* %3
br label %15
15: ; preds = %12, %11
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @one_read_time(i32 %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call i32 @one_int_read(i32 %0, i32* %3)
%6 = call i64 @ath9k_hw_wait(i32 89880, i32 7, i32 4, i32 1000)
%7 = icmp slt i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @one_int_read(i32 -1206821092, i32* %1)
br label %10
10: ; preds = %2, %8
%11 = phi i32 [ 0, %8 ], [ -1, %2 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void xthread_sleep(int milliseconds) { usleep(milliseconds * 1000); }


x86 assembly (clang, -O0):
<xthread_sleep>:
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):
<xthread_sleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @xthread_sleep(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 @xthread_sleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}