xunge/DecIR huggingface dataset:
/* Variables and functions */
scalar_t__ acos(double);
int /*<<< orphan*/ v_nrm(float *, float const *);
void q_as_axisangle(const float q[4], float u[3], float *a) {
  *a = 2.0f * ((float)acos((double)q[0]));
  v_nrm(u, q + 1);
}


x86 assembly (clang, -O0):
<q_as_axisangle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <acos@plt>
cvtsi2ss %rax,%xmm1
movss  0xeae(%rip),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
call   1040 <v_nrm@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q_as_axisangle>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm0
call   1030 <acos@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %rax,%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,(%r15)
add    $0x4,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <v_nrm@plt>

LLVM IR (-O0):
define void @q_as_axisangle(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %4
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = fpext float %9 to double
%11 = call i64 @acos(double %10)
%12 = sitofp i64 %11 to float
%13 = fmul float 2.000000e+00, %12
%14 = load float*, float** %6
store float %13, float* %14
%15 = load float*, float** %5
%16 = load float*, float** %4
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = call i32 @v_nrm(float* %15, float* %17)
ret void
}

LLVM IR (-O2):
define void @q_as_axisangle(float* %0, float* %1, float* nocapture writeonly %2) {
%4 = load float, float* %0
%5 = fpext float %4 to double
%6 = tail call i64 @acos(double %5)
%7 = sitofp i64 %6 to float
%8 = fmul float %7, 2.000000e+00
store float %8, float* %2
%9 = getelementptr inbounds float, float* %0, i64 1
%10 = tail call i32 @v_nrm(float* %1, float* %9)
ret void
}
double restowidth(res, nchannel)
double res;
int nchannel;
{
  double restrans;
  restrans = (nchannel) ? 9723 : 22400;
  return (restrans / res);
}


x86 assembly (clang, -O0):
<restowidth>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%edx
mov    $0x5780,%eax
mov    $0x25fb,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
divsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<restowidth>:
test   %edi,%edi
mov    $0x5780,%eax
mov    $0x25fb,%ecx
cmove  %eax,%ecx
cvtsi2sd %ecx,%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @restowidth(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
%5 = alloca double
store double %0, double* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 9723, i32 22400
%10 = sitofp i32 %9 to double
store double %10, double* %5
%11 = load double, double* %5
%12 = load double, double* %3
%13 = fdiv double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @restowidth(double %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = select i1 %3, i32 22400, i32 9723
%5 = sitofp i32 %4 to double
%6 = fdiv double %5, %0
ret double %6
}
/* Variables and functions */
int comp_size(char const *, char const *);
int icomp_size(const char *a, const char *b) { return -comp_size(a, b); }


x86 assembly (clang, -O0):
<icomp_size>:
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 <comp_size@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<icomp_size>:
push   %rax
call   1030 <comp_size@plt>
neg    %eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @icomp_size(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 @comp_size(i8* %5, i8* %6)
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @icomp_size(i8* %0, i8* %1) {
%3 = tail call i32 @comp_size(i8* %0, i8* %1)
%4 = sub nsw i32 0, %3
ret i32 %4
}
unsigned char sn_readb_fast(void *addr) {
  return *(volatile unsigned char *)addr;
}


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

x86 assembly (clang, -O2):
<sn_readb_fast>:
mov    (%rdi),%al
ret

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

LLVM IR (-O2):
define zeroext i8 @sn_readb_fast(i8* %0) {
%2 = load volatile i8, i8* %0
ret i8 %2
}
/* Type definitions */
typedef int uint64_t;
typedef scalar_t__ rax;

/* Variables and functions */
int /*<<< orphan*/ cpuid(int, int *, int *, int *, int *);
int cpuid_pkg_maxLogicalProcessors() {
  uint64_t rax, rbx, rcx, rdx;
  int leaf = 1;
  cpuid(leaf, &rax, &rbx, &rcx, &rdx);
  return (((uint64_t)(rax) &
           ((((uint64_t)1 << (((23)) - ((16)) + 1)) - 1) << ((16)))) >>
          (16));
}


x86 assembly (clang, -O0):
<cpuid_pkg_maxLogicalProcessors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
lea    -0xc(%rbp),%rcx
lea    -0x10(%rbp),%r8
call   1030 <cpuid@plt>
mov    -0x4(%rbp),%eax
and    $0xff0000,%eax
sar    $0x10,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cpuid_pkg_maxLogicalProcessors>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
mov    $0x1,%edi
call   1030 <cpuid@plt>
movzbl 0xa(%rsp),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @cpuid_pkg_maxLogicalProcessors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %5
%6 = load i32, i32* %5
%7 = call i32 @cpuid(i32 %6, i32* %1, i32* %2, i32* %3, i32* %4)
%8 = load i32, i32* %1
%9 = and i32 %8, 16711680
%10 = ashr i32 %9, 16
ret i32 %10
}

LLVM IR (-O2):
define i32 @cpuid_pkg_maxLogicalProcessors() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 @cpuid(i32 1, i32* %1, i32* %2, i32* %3, i32* %4)
%10 = load i32, i32* %1
%11 = lshr i32 %10, 16
%12 = and i32 %11, 255
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ HplAtm128InterruptPinP__1__IrqSignal__fired();
void HplAtm128InterruptSigP__IntSig1__fired(void) {
  HplAtm128InterruptPinP__1__IrqSignal__fired();
}


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

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

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

LLVM IR (-O2):
define void @HplAtm128InterruptSigP__IntSig1__fired() {
%1 = tail call i32 (...) @HplAtm128InterruptPinP__1__IrqSignal__fired()
ret void
}
long sas_atomic_inc_long(volatile long *value) {
  long result;
  long delta = 1;
  result = __atomic_fetch_add(value, delta, 2);
  return result;
}


x86 assembly (clang, -O0):
<sas_atomic_inc_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x1,-0x18(%rbp)
mov    -0x8(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
lock xadd %rax,(%rcx)
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sas_atomic_inc_long>:
mov    $0x1,%eax
lock xadd %rax,(%rdi)
ret

LLVM IR (-O0):
define i64 @sas_atomic_inc_long(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64* %0, i64** %2
store i64 1, i64* %4
%7 = load i64*, i64** %2
%8 = load i64, i64* %4
store i64 %8, i64* %5
%9 = load i64, i64* %5
%10 = atomicrmw volatile add i64* %7, i64 %9 acquire
store i64 %10, i64* %6
%11 = load i64, i64* %6
store i64 %11, i64* %3
%12 = load i64, i64* %3
ret i64 %12
}

LLVM IR (-O2):
define i64 @sas_atomic_inc_long(i64* %0) {
%2 = atomicrmw volatile add i64* %0, i64 1 acquire
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ _irqack();
void irq6() {
endless:
  goto endless;
  _irqack();
}


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

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

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

LLVM IR (-O2):
define void @irq6() {
br label %1
1: ; preds = %1, %0
br label %1
}
/* Type definitions */
typedef int /*<<< orphan*/ SSL;

/* Variables and functions */
int ssl3_read_internal(int /*<<< orphan*/ *, void *, int, int /*<<< orphan*/);
int ssl3_read(SSL *s, void *buf, int len) {
  return ssl3_read_internal(s, buf, len, 0);
}


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

x86 assembly (clang, -O2):
<ssl3_read>:
xor    %ecx,%ecx
jmp    1030 <ssl3_read_internal@plt>

LLVM IR (-O0):
define i32 @ssl3_read(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
%7 = load i32*, i32** %4
%8 = load i8*, i8** %5
%9 = load i32, i32* %6
%10 = call i32 @ssl3_read_internal(i32* %7, i8* %8, i32 %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
define i32 @ssl3_read(i32* %0, i8* %1, i32 %2) {
%4 = tail call i32 @ssl3_read_internal(i32* %0, i8* %1, i32 %2, i32 0)
ret i32 %4
}
int __attribute__((no)) nle(int a, int b) { return -(a <= b); }


x86 assembly (clang, -O0):
<nle>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setle  %al
and    $0x1,%al
movzbl %al,%ecx
xor    %eax,%eax
sub    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nle>:
xor    %eax,%eax
cmp    %esi,%edi
setle  %al
neg    %eax
ret

LLVM IR (-O0):
define i32 @nle(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = icmp sle i32 %5, %6
%8 = zext i1 %7 to i32
%9 = sub nsw i32 0, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @nle(i32 %0, i32 %1) {
%3 = icmp sle i32 %0, %1
%4 = sext i1 %3 to i32
ret i32 %4
}
double boxArea(double length, double width, double height) {
  return 2 * ((length * width) + (width * height) + (height * length));
}


x86 assembly (clang, -O0):
<boxArea>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xeb7(%rip),%xmm0
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<boxArea>:
movapd %xmm0,%xmm3
mulsd  %xmm1,%xmm3
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
ret

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

LLVM IR (-O2):
define double @boxArea(double %0, double %1, double %2) {
%4 = fmul double %1, %2
%5 = tail call double @llvm.fmuladd.f64(double %0, double %1, double %4)
%6 = tail call double @llvm.fmuladd.f64(double %2, double %0, double %5)
%7 = fmul double %6, 2.000000e+00
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ SH_SendChar(char);
void PrintChar(char c) { SH_SendChar(c); }


x86 assembly (clang, -O0):
<PrintChar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edi
call   1030 <SH_SendChar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintChar>:
jmp    1030 <SH_SendChar@plt>

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

LLVM IR (-O2):
define void @PrintChar(i8 signext %0) {
%2 = tail call i32 @SH_SendChar(i8 signext %0)
ret void
}
void x86_64_cpuid2_ffi() {
  asm("movq %%rdi, %%rax\n\t"
      "movq %%rbx, %%r8\n\t"
      "movq %%rcx, %%r9\n\t"
      "movq %%rsi, %%rcx\n\t"
      "cpuid\n\t"
      "mov %%eax, (%%rsi)\n\t"
      "mov %%ebx, 0x04(%%rsi)\n\t"
      "mov %%edx, 0x0c(%%rsi)\n\t"
      "mov %%ecx, 0x08(%%rsi)\n\t"
      "movq %%r8, %%rbx\n\t"
      "movq %%r9, %%rcx\n\t" ::
          :);
}


x86 assembly (clang, -O0):
<x86_64_cpuid2_ffi>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,%rax
mov    %rbx,%r8
mov    %rcx,%r9
mov    %rsi,%rcx
cpuid
mov    %eax,(%rsi)
mov    %ebx,0x4(%rsi)
mov    %edx,0xc(%rsi)
mov    %ecx,0x8(%rsi)
mov    %r8,%rbx
mov    %r9,%rcx
pop    %rbp
ret

x86 assembly (clang, -O2):
<x86_64_cpuid2_ffi>:
mov    %rdi,%rax
mov    %rbx,%r8
mov    %rcx,%r9
mov    %rsi,%rcx
cpuid
mov    %eax,(%rsi)
mov    %ebx,0x4(%rsi)
mov    %edx,0xc(%rsi)
mov    %ecx,0x8(%rsi)
mov    %r8,%rbx
mov    %r9,%rcx
ret

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

LLVM IR (-O2):
define void @x86_64_cpuid2_ffi() {
tail call void asm sideeffect "movq %rdi, %rax\0A\09movq %rbx, %r8\0A\09movq %rcx, %r9\0A\09movq %rsi, %rcx\0A\09cpuid\0A\09mov %eax, (%rsi)\0A\09mov %ebx, 0x04(%rsi)\0A\09mov %edx, 0x0c(%rsi)\0A\09mov %ecx, 0x08(%rsi)\0A\09movq %r8, %rbx\0A\09movq %r9, %rcx\0A\09", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
void steering_set_angle(void *steering_address, int angle) {
  if (angle > 180)
    angle = 180;
  if (angle < 0)
    angle = 0;
  float ms = 0.5 + angle / 180.0 * 2;
  int pwm_with = ms / 20.0 * 2048;
  *((volatile int *)steering_address + 1) = pwm_with;
}


x86 assembly (clang, -O0):
<steering_set_angle>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0xb4,-0xc(%rbp)
jle    111f <steering_set_angle+0x1f>
movl   $0xb4,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jge    1130 <steering_set_angle+0x30>
movl   $0x0,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xedb(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  %xmm0,%xmm0
movsd  0xec3(%rip),%xmm1
addsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe9d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe89(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<steering_set_angle>:
cmp    $0xb4,%esi
mov    $0xb4,%eax
cmovl  %esi,%eax
xor    %ecx,%ecx
test   %eax,%eax
cmovns %eax,%ecx
cvtsi2sd %ecx,%xmm0
divsd  0xedf(%rip),%xmm0
addsd  %xmm0,%xmm0
addsd  0xedb(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
cvtss2sd %xmm0,%xmm0
divsd  0xed3(%rip),%xmm0
mulsd  0xed3(%rip),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @steering_set_angle(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca float
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 180
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 180, i32* %4
br label %10
10: ; preds = %9, %2
%11 = load i32, i32* %4
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* %4
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %4
%16 = sitofp i32 %15 to double
%17 = fdiv double %16, 1.800000e+02
%18 = call double @llvm.fmuladd.f64(double %17, double 2.000000e+00, double 5.000000e-01)
%19 = fptrunc double %18 to float
store float %19, float* %5
%20 = load float, float* %5
%21 = fpext float %20 to double
%22 = fdiv double %21, 2.000000e+01
%23 = fmul double %22, 2.048000e+03
%24 = fptosi double %23 to i32
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = load i8*, i8** %3
%27 = bitcast i8* %26 to i32*
%28 = getelementptr inbounds i32, i32* %27, i64 1
store volatile i32 %25, i32* %28
ret void
}

LLVM IR (-O2):
define void @steering_set_angle(i8* %0, i32 %1) {
%3 = icmp slt i32 %1, 180
%4 = select i1 %3, i32 %1, i32 180
%5 = icmp sgt i32 %4, 0
%6 = select i1 %5, i32 %4, i32 0
%7 = sitofp i32 %6 to double
%8 = fdiv double %7, 1.800000e+02
%9 = tail call double @llvm.fmuladd.f64(double %8, double 2.000000e+00, double 5.000000e-01)
%10 = fptrunc double %9 to float
%11 = fpext float %10 to double
%12 = fdiv double %11, 2.000000e+01
%13 = fmul double %12, 2.048000e+03
%14 = fptosi double %13 to i32
%15 = getelementptr inbounds i8, i8* %0, i64 4
%16 = bitcast i8* %15 to i32*
store volatile i32 %14, i32* %16
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t bext_codh_mode_to_chan(uint8_t mode) {
  switch (mode) {
  case 0x03:
    return 2;
  case 0x02:
    return 2;
  case 0x04:
    return 2;
  case 0x01:
    return 1;
  default:
    return 0;
  }
  return 0;
}


x86 assembly (clang, -O0):
<bext_codh_mode_to_chan>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x3,%eax
ja     1160 <bext_codh_mode_to_chan+0x60>
mov    -0x10(%rbp),%rax
lea    0xed9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0x2,-0x4(%rbp)
jmp    1167 <bext_codh_mode_to_chan+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <bext_codh_mode_to_chan+0x67>
movl   $0x2,-0x4(%rbp)
jmp    1167 <bext_codh_mode_to_chan+0x67>
movl   $0x1,-0x4(%rbp)
jmp    1167 <bext_codh_mode_to_chan+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bext_codh_mode_to_chan>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0x3,%edi
ja     1117 <bext_codh_mode_to_chan+0x17>
movslq %edi,%rax
lea    0xeec(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @bext_codh_mode_to_chan(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %9 [
i32 3, label %5
i32 2, label %6
i32 4, label %7
i32 1, label %8
]
5: ; preds = %1
store i32 2, i32* %2
br label %10
6: ; preds = %1
store i32 2, i32* %2
br label %10
7: ; preds = %1
store i32 2, i32* %2
br label %10
8: ; preds = %1
store i32 1, i32* %2
br label %10
9: ; preds = %1
store i32 0, i32* %2
br label %10
10: ; preds = %9, %8, %7, %6, %5
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
@switch.table.bext_codh_mode_to_chan = [4 x i32] [i32 1, i32 2, i32 2, i32 2]
define i32 @bext_codh_mode_to_chan(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = getelementptr inbounds [4 x i32], [4 x i32]* @switch.table.bext_codh_mode_to_chan, i64 0, i64 %5
%7 = load i32, i32* %6
br label %8
8: ; preds = %1, %4
%9 = phi i32 [ %7, %4 ], [ 0, %1 ]
ret i32 %9
}
void exit(void) {
  asm("movl $42, %ebx \n\t"
      "movl $1, %eax \n\t"
      "int $0x80  \n\t");
}


x86 assembly (clang, -O0):
<exit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2a,%ebx
mov    $0x1,%eax
int    $0x80

x86 assembly (clang, -O2):
<exit>:
mov    $0x2a,%ebx
mov    $0x1,%eax
int    $0x80

LLVM IR (-O0):
define void @exit() {
unreachable
}

LLVM IR (-O2):
define void @exit() {
tail call void asm sideeffect "movl $$42, %ebx \0A\09movl $$1, %eax \0A\09int $$0x80 \0A\09", "~{dirflag},~{fpsr},~{flags}"()
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ opl_timer_over(int /*<<< orphan*/, int /*<<< orphan*/);
void opl_timer_callback00(void *p) { opl_timer_over(0, 0); }


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

x86 assembly (clang, -O2):
xor    %edi,%edi
xor    %esi,%esi
jmp    1030 <opl_timer_over@plt>

LLVM IR (-O0):
define void @opl_timer_callback00(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @opl_timer_over(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @opl_timer_callback00(i8* nocapture readnone %0) {
%2 = tail call i32 @opl_timer_over(i32 0, i32 0)
ret void
}
int product(int x, int y) { return (x * y); }


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

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

LLVM IR (-O0):
define i32 @product(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = mul nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @product(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int *malloc(int);
int /*<<< orphan*/ printf(char *, void *, int);
int main(int argc, char const *argv[]) {
  int n = 5;
  int *p = malloc(n * sizeof(int));
  printf("%p = %d\n", (void *)p, n);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x5,-0x14(%rbp)
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"%p = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i32*
store i32 %0, i32* %3
store i8** %1, i8*** %4
store i32 5, i32* %5
%7 = load i32, i32* %5
%8 = sext i32 %7 to i64
%9 = mul i64 %8, 4
%10 = trunc i64 %9 to i32
%11 = call i32* @malloc(i32 %10)
store i32* %11, i32** %6
%12 = load i32*, i32** %6
%13 = bitcast i32* %12 to i8*
%14 = load i32, i32* %5
%15 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %13, i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"%p = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32* @malloc(i32 20)
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %4, i32 5)
ret i32 0
}
void Draw_SetBlack(void) {}


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

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

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

LLVM IR (-O2):
define void @Draw_SetBlack() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ unknownFunc();
int main() { unknownFunc(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @unknownFunc()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @unknownFunc()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ MD5_stringEx(char *, char *);
char *malloc(int);
char *MD5_string(char *string) {
  char *b = malloc(33);
  MD5_stringEx(string, b);
  return b;
}


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

x86 assembly (clang, -O2):
<MD5_string>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x21,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    %rax,%rsi
call   1030 <MD5_stringEx@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @MD5_string(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = call i8* @malloc(i32 33)
store i8* %4, i8** %3
%5 = load i8*, i8** %2
%6 = load i8*, i8** %3
%7 = call i32 @MD5_stringEx(i8* %5, i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @MD5_string(i8* %0) {
%2 = tail call dereferenceable_or_null(33) i8* @malloc(i32 33)
%3 = tail call i32 @MD5_stringEx(i8* %0, i8* %2)
ret i8* %2
}
void setup_tlb_core_data(void) {}


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

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

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

LLVM IR (-O2):
define void @setup_tlb_core_data() {
ret void
}
int do_377() { return 377; }


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

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

LLVM IR (-O0):
define i32 @do_377() {
ret i32 377
}

LLVM IR (-O2):
define i32 @do_377() {
ret i32 377
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void _delay_us(int us) { usleep(us); }


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

x86 assembly (clang, -O2):
<_delay_us>:
jmp    1030 <usleep@plt>

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

LLVM IR (-O2):
define void @_delay_us(i32 %0) {
%2 = tail call i32 @usleep(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
int /*<<< orphan*/ ued_exec_colon_comm(char *);
int /*<<< orphan*/ ued_goto_lastrow();
int /*<<< orphan*/ ued_save_cursor_pos();
int ued_enter_cmd_mode(void) {
  char comm[10];
  ued_save_cursor_pos();
  ued_goto_lastrow();
  printf("\033[2K");
  printf(":");
  scanf("%9s", (char *)&comm);
  ued_exec_colon_comm(comm);
  return 0;
}


x86 assembly (clang, -O0):
<ued_enter_cmd_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1070 <ued_save_cursor_pos@plt>
mov    $0x0,%al
call   1060 <ued_goto_lastrow@plt>
lea    0xe93(%rip),%rdi
call   1040 <printf@plt>
lea    0xe8c(%rip),%rdi
call   1040 <printf@plt>
lea    -0xa(%rbp),%rsi
lea    0xe7e(%rip),%rdi
call   1050 <scanf@plt>
lea    -0xa(%rbp),%rdi
call   1030 <ued_exec_colon_comm@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ued_enter_cmd_mode>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1080 <ued_save_cursor_pos@plt>
xor    %eax,%eax
call   1070 <ued_goto_lastrow@plt>
lea    0xe86(%rip),%rdi
call   1050 <printf@plt>
mov    $0x3a,%edi
call   1030 <putchar@plt>
lea    0xe75(%rip),%rdi
lea    0x6(%rsp),%rbx
mov    %rbx,%rsi
call   1060 <scanf@plt>
mov    %rbx,%rdi
call   1040 <ued_exec_colon_comm@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"\1B[2K\00"
@.str.1 = [2 x i8] c":\00"
@.str.2 = [4 x i8] c"%9s\00"
define i32 @ued_enter_cmd_mode() {
%1 = alloca [10 x i8]
%2 = call i32 (...) @ued_save_cursor_pos()
%3 = call i32 (...) @ued_goto_lastrow()
%4 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = bitcast [10 x i8]* %1 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%9 = call i32 @ued_exec_colon_comm(i8* %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"\1B[2K\00"
@.str.2 = [4 x i8] c"%9s\00"
define i32 @ued_enter_cmd_mode() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @ued_save_cursor_pos()
%4 = tail call i32 (...) @ued_goto_lastrow()
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @putchar(i32 58)
%7 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%8 = call i32 @ued_exec_colon_comm(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ __flush_tlb_all();
__attribute__((always_)) void flush_tlb_kernel_range(unsigned long start,
                                                     unsigned long end) {
  __flush_tlb_all();
}


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

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

LLVM IR (-O0):
define void @flush_tlb_kernel_range(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = call i32 (...) @__flush_tlb_all()
ret void
}

LLVM IR (-O2):
define void @flush_tlb_kernel_range(i64 %0, i64 %1) {
%3 = tail call i32 (...) @__flush_tlb_all()
ret void
}
int isascii(int c) { return (c & 0x80) == 0; }


x86 assembly (clang, -O0):
<isascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x80,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isascii>:
xor    %eax,%eax
test   $0x80,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @isascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 128
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isascii(i32 %0) {
%2 = lshr i32 %0, 7
%3 = and i32 %2, 1
%4 = xor i32 %3, 1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ foo(char **);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int main(int argc, char *argv[]) {
  if (argc != 2) {
    fprintf(stderr, "target2: argc != 2\n");
    exit(EXIT_FAILURE);
  }
  foo(argv);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1173 <main+0x43>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rdi
call   1040 <foo@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x2,%edi
jne    1142 <main+0x12>
mov    %rsi,%rdi
call   1040 <foo@plt>
xor    %eax,%eax
pop    %rcx
ret
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7a(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"target2: argc != 2\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp ne i32 %6, 2
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = call i32 @foo(i8** %14)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"target2: argc != 2\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = tail call i32 @foo(i8** %1)
ret i32 0
}
/* Variables and functions */
int PAPI_set_domain(int);
void papif_set_domain__(int *domain, int *check) {
  *check = PAPI_set_domain(*domain);
}


x86 assembly (clang, -O0):
<papif_set_domain__>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
call   1030 <PAPI_set_domain@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<papif_set_domain__>:
push   %rbx
mov    %rsi,%rbx
mov    (%rdi),%edi
call   1030 <PAPI_set_domain@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_set_domain__(i32* nocapture %0, i32* nocapture writeonly %1) {
%3 = load i32, i32* %0
%4 = tail call i32 @PAPI_set_domain(i32 %3)
store i32 %4, i32* %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int, size_t);
void lmemset(void *buff, int c, size_t count) { memset(buff, c, count); }


x86 assembly (clang, -O0):
<lmemset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <memset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lmemset>:
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @lmemset(i8* %0, i32 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i64
store i8* %0, i8** %4
store i32 %1, i32* %5
store i64 %2, i64* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i64, i64* %6
%10 = call i32 @memset(i8* %7, i32 %8, i64 %9)
ret void
}

LLVM IR (-O2):
define void @lmemset(i8* %0, i32 %1, i64 %2) {
%4 = tail call i32 @memset(i8* %0, i32 %1, i64 %2)
ret void
}
/* Variables and functions */
int ec_setupnic(char const *, int /*<<< orphan*/);
int ec_init(const char *ifname) { return ec_setupnic(ifname, 0); }


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

x86 assembly (clang, -O2):
<ec_init>:
xor    %esi,%esi
jmp    1030 <ec_setupnic@plt>

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

LLVM IR (-O2):
define i32 @ec_init(i8* %0) {
%2 = tail call i32 @ec_setupnic(i8* %0, i32 0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char const *);
int /*<<< orphan*/ printf(char *);
void die(int code, const char *message) {
  perror(message);
  printf("\n");
  exit(code);
}


x86 assembly (clang, -O0):
<die>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <perror@plt>
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<die>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1040 <perror@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
define void @die(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = call i32 @perror(i8* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %3
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
define void @die(i32 %0, i8* nocapture %1) {
%3 = tail call i32 @perror(i8* %1)
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
int test1() {
  int a, b;
  a = 1;
  b = a + 2;
  a = 3;
  b = a + 4;
  return a + b;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test1() {
%1 = alloca i32
%2 = alloca i32
store i32 1, i32* %1
%3 = load i32, i32* %1
%4 = add nsw i32 %3, 2
store i32 %4, i32* %2
store i32 3, i32* %1
%5 = load i32, i32* %1
%6 = add nsw i32 %5, 4
store i32 %6, i32* %2
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test1() {
ret i32 10
}
/* Variables and functions */
size_t strlen(const char *str) {
  size_t len = 0;
  while (*(str++))
    len++;
  return len;
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1139 <strlen+0x39>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1110 <strlen+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlen>:
cmpb   $0x0,(%rdi)
je     111f <strlen+0x1f>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
lea    0x1(%rcx),%rax
cmpb   $0x0,0x1(%rdi,%rcx,1)
mov    %rax,%rcx
jne    1110 <strlen+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add i64 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i64 [ 0, %1 ], [ %8, %4 ]
ret i64 %12
}
/* Type definitions */
struct sigaction {
  int /*<<< orphan*/ sa_handler;
};

/* Variables and functions */
int /*<<< orphan*/ SIGINT;
int /*<<< orphan*/ SIG_IGN;
int /*<<< orphan*/ sigaction(int /*<<< orphan*/, struct sigaction *,
                             int /*<<< orphan*/ *);
bool block_signals() {
  struct sigaction sigint_handler;
  sigint_handler.sa_handler = SIG_IGN;
  sigaction(SIGINT, &sigint_handler, NULL);
  return true;
}


x86 assembly (clang, -O0):
<block_signals>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <sigaction@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<block_signals>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%eax
mov    %eax,(%rsp)
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <sigaction@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.sigaction = type { i32 }
@SIG_IGN = global i32 0
@SIGINT = global i32 0
define i32 @block_signals() {
%1 = alloca %struct.sigaction
%2 = load i32, i32* @SIG_IGN
%3 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i32 0, i32 0
store i32 %2, i32* %3
%4 = load i32, i32* @SIGINT
%5 = call i32 @sigaction(i32 %4, %struct.sigaction* %1, i32* null)
ret i32 1
}

LLVM IR (-O2):
%struct.sigaction = type { i32 }
@SIG_IGN = global i32 0
@SIGINT = global i32 0
define i32 @block_signals() {
%1 = alloca %struct.sigaction
%2 = bitcast %struct.sigaction* %1 to i8*
%3 = load i32, i32* @SIG_IGN
%4 = getelementptr inbounds %struct.sigaction, %struct.sigaction* %1, i64 0, i32 0
store i32 %3, i32* %4
%5 = load i32, i32* @SIGINT
%6 = call i32 @sigaction(i32 %5, %struct.sigaction* %1, i32* null)
ret i32 1
}
int checkxy(int x, int y) {
  return ((x >= 0) && (x < 67) && (y >= 0) && (y < 17));
}


x86 assembly (clang, -O0):
<checkxy>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jl     1141 <checkxy+0x41>
xor    %eax,%eax
cmpl   $0x43,-0x4(%rbp)
mov    %al,-0x9(%rbp)
jge    1141 <checkxy+0x41>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
jl     1141 <checkxy+0x41>
cmpl   $0x11,-0x8(%rbp)
setl   %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkxy>:
cmp    $0x43,%edi
setb   %al
cmp    $0x11,%esi
setb   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @checkxy(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 67
br i1 %9, label %10, label %16
10: ; preds = %7
%11 = load i32, i32* %4
%12 = icmp sge i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %10
%14 = load i32, i32* %4
%15 = icmp slt i32 %14, 17
br label %16
16: ; preds = %13, %10, %7, %2
%17 = phi i1 [ false, %10 ], [ false, %7 ], [ false, %2 ], [ %15, %13 ]
%18 = zext i1 %17 to i32
ret i32 %18
}

LLVM IR (-O2):
define i32 @checkxy(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, 67
%4 = icmp ult i32 %1, 17
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned next_pow2(unsigned v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  v++;
  return v;
}


x86 assembly (clang, -O0):
<next_pow2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x2,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x4,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x8,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x10,%eax
or     -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_pow2>:
lea    -0x1(%rdi),%eax
mov    %eax,%ecx
shr    %ecx
or     %eax,%ecx
mov    %ecx,%eax
shr    $0x2,%eax
or     %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
or     %eax,%ecx
mov    %ecx,%edx
shr    $0x8,%edx
or     %ecx,%edx
mov    %edx,%eax
shr    $0x10,%eax
or     %edx,%eax
add    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @next_pow2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, -1
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = lshr i32 %5, 1
%7 = load i32, i32* %2
%8 = or i32 %7, %6
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = lshr i32 %9, 2
%11 = load i32, i32* %2
%12 = or i32 %11, %10
store i32 %12, i32* %2
%13 = load i32, i32* %2
%14 = lshr i32 %13, 4
%15 = load i32, i32* %2
%16 = or i32 %15, %14
store i32 %16, i32* %2
%17 = load i32, i32* %2
%18 = lshr i32 %17, 8
%19 = load i32, i32* %2
%20 = or i32 %19, %18
store i32 %20, i32* %2
%21 = load i32, i32* %2
%22 = lshr i32 %21, 16
%23 = load i32, i32* %2
%24 = or i32 %23, %22
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = add i32 %25, 1
store i32 %26, i32* %2
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @next_pow2(i32 %0) {
%2 = add i32 %0, -1
%3 = lshr i32 %2, 1
%4 = or i32 %3, %2
%5 = lshr i32 %4, 2
%6 = or i32 %5, %4
%7 = lshr i32 %6, 4
%8 = or i32 %7, %6
%9 = lshr i32 %8, 8
%10 = or i32 %9, %8
%11 = lshr i32 %10, 16
%12 = or i32 %11, %10
%13 = add i32 %12, 1
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ RSL_SetTrackDuration(void *, int);
void OnCodecWrapper_DurationUpdate(int duration, void *codecSpecific,
                                   void *streamTag) {
  RSL_SetTrackDuration(streamTag, duration);
}


x86 assembly (clang, -O0):
<OnCodecWrapper_DurationUpdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x4(%rbp),%esi
call   1030 <RSL_SetTrackDuration@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OnCodecWrapper_DurationUpdate>:
mov    %edi,%esi
mov    %rdx,%rdi
jmp    1030 <RSL_SetTrackDuration@plt>

LLVM IR (-O0):
define void @OnCodecWrapper_DurationUpdate(i32 %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %6
%8 = load i32, i32* %4
%9 = call i32 @RSL_SetTrackDuration(i8* %7, i32 %8)
ret void
}

LLVM IR (-O2):
define void @OnCodecWrapper_DurationUpdate(i32 %0, i8* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @RSL_SetTrackDuration(i8* %2, i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("Hello from file1.c\n");
  return 0;
}


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"Hello from file1.c\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret i32 0
}
void rlSetEnvironmentConnection(int envConnection) {}


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

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

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

LLVM IR (-O2):
define void @rlSetEnvironmentConnection(i32 %0) {
ret void
}