xunge/DecIR huggingface dataset:
/* Variables and functions */
double pow(int, int);
double truncf(double);
double truncar(double num, int exp) {
  double fac = pow(10, exp);
  return truncf(num * fac) / fac;
}


x86 assembly (clang, -O0):
<truncar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%esi
mov    $0xa,%edi
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <truncf@plt>
divsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<truncar>:
sub    $0x18,%rsp
mov    %edi,%esi
movsd  %xmm0,0x10(%rsp)
mov    $0xa,%edi
call   1030 <pow@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <truncf@plt>
divsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @truncar(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 = call double @pow(i32 10, i32 %6)
store double %7, double* %5
%8 = load double, double* %3
%9 = load double, double* %5
%10 = fmul double %8, %9
%11 = call double @truncf(double %10)
%12 = load double, double* %5
%13 = fdiv double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @truncar(double %0, i32 %1) {
%3 = tail call double @pow(i32 10, i32 %1)
%4 = fmul double %3, %0
%5 = tail call double @truncf(double %4)
%6 = fdiv double %5, %3
ret double %6
}
int system(const char *command) {
  int retval;
  asm volatile("movl $0x1, %%eax; int $0x80; movl %%eax, %0"
               : "=a"(retval)
               : "b"(command)
               : "%ecx", "edx");
  return retval;
}


x86 assembly (clang, -O0):
<system>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rbx
mov    $0x1,%eax
int    $0x80
mov    %eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<system>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%eax
int    $0x80
mov    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @system(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 asm sideeffect "movl $$0x1, %eax; int $$0x80; movl %eax, $0", "={ax},{bx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"(i8* %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @system(i8* %0) {
%2 = tail call i32 asm sideeffect "movl $$0x1, %eax; int $$0x80; movl %eax, $0", "={ax},{bx},~{ecx},~{edx},~{dirflag},~{fpsr},~{flags}"(i8* %0)
ret i32 %2
}
int test_imm_0Buint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x0B << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_0Buint64_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, 11
%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_0Buint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 720896
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ g(void *);
void *i;
void f() {
  void *i = &i;
  g(i);
}


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

x86 assembly (clang, -O2):
<f>:
push   %rax
mov    %rsp,%rdi
mov    %rdi,(%rsp)
call   1030 <g@plt>
pop    %rax
ret

LLVM IR (-O0):
@i = global i8* null
define void @f() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @g(i8* %3)
ret void
}

LLVM IR (-O2):
@i = global i8* null
define void @f() {
%1 = alloca i8*
%2 = bitcast i8** %1 to i8*
%3 = bitcast i8** %1 to i8***
store i8** %1, i8*** %3
%4 = call i32 @g(i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
size_t fread(char *, size_t, int, int /*<<< orphan*/ *);
size_t Mem_FreadStr(char *str, size_t len, FILE *fp) {
  size_t nbytes;
  nbytes = fread(str, len, sizeof(*str), fp);
  return nbytes;
}


x86 assembly (clang, -O0):
<Mem_FreadStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Mem_FreadStr>:
mov    %rdx,%rcx
mov    $0x1,%edx
jmp    1030 <fread@plt>

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

LLVM IR (-O2):
define i64 @Mem_FreadStr(i8* nocapture %0, i64 %1, i32* nocapture %2) {
%4 = tail call i64 @fread(i8* %0, i64 %1, i32 1, i32* %2)
ret i64 %4
}
void I422ToARGB1555Row_C() {}


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

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

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

LLVM IR (-O2):
define void @I422ToARGB1555Row_C() {
ret void
}
void finn_vec3_forward(float *vec) {
  vec[0] = 0;
  vec[1] = 0;
  vec[2] = 1;
}


x86 assembly (clang, -O0):
<finn_vec3_forward>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x8(%rbp),%rax
movss  0xed5(%rip),%xmm0
movss  %xmm0,0x8(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<finn_vec3_forward>:
movq   $0x0,(%rdi)
movl   $0x3f800000,0x8(%rdi)
ret

LLVM IR (-O0):
define void @finn_vec3_forward(float* %0) {
%2 = alloca float*
store float* %0, float** %2
%3 = load float*, float** %2
%4 = getelementptr inbounds float, float* %3, i64 0
store float 0.000000e+00, float* %4
%5 = load float*, float** %2
%6 = getelementptr inbounds float, float* %5, i64 1
store float 0.000000e+00, float* %6
%7 = load float*, float** %2
%8 = getelementptr inbounds float, float* %7, i64 2
store float 1.000000e+00, float* %8
ret void
}

LLVM IR (-O2):
define void @finn_vec3_forward(float* nocapture writeonly %0) {
store float 0.000000e+00, float* %0
%2 = getelementptr inbounds float, float* %0, i64 1
store float 0.000000e+00, float* %2
%3 = getelementptr inbounds float, float* %0, i64 2
store float 1.000000e+00, float* %3
ret void
}
void done(void) {}


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

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

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

LLVM IR (-O2):
define void @done() {
ret void
}
/* Variables and functions */
int _ada_use_c2phc4c(int, int *, int *, double *, int /*<<< orphan*/);
int copy_quaddobl_container_to_start_system(void) {
  int *a, *b, fail;
  double *c;
  fail = _ada_use_c2phc4c(264, a, b, c, 0);
  return fail;
}


x86 assembly (clang, -O0):
<copy_quaddobl_container_to_start_system>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    $0x108,%edi
xor    %r8d,%r8d
call   1030 <_ada_use_c2phc4c@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<copy_quaddobl_container_to_start_system>:
mov    $0x108,%edi
xor    %r8d,%r8d
jmp    1030 <_ada_use_c2phc4c@plt>

LLVM IR (-O0):
define i32 @copy_quaddobl_container_to_start_system() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32
%4 = alloca double*
%5 = load i32*, i32** %1
%6 = load i32*, i32** %2
%7 = load double*, double** %4
%8 = call i32 @_ada_use_c2phc4c(i32 264, i32* %5, i32* %6, double* %7, i32 0)
store i32 %8, i32* %3
%9 = load i32, i32* %3
ret i32 %9
}

LLVM IR (-O2):
define i32 @copy_quaddobl_container_to_start_system() {
%1 = tail call i32 @_ada_use_c2phc4c(i32 264, i32* undef, i32* undef, double* undef, i32 0)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() { printf("size of short int is %d\n", sizeof(short int)); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"size of short int is %d\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"size of short int is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}
__attribute__((no)) void *_pc() { return __builtin_return_address(0); }


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

x86 assembly (clang, -O2):
<_pc>:
mov    (%rsp),%rax
ret

LLVM IR (-O0):
define i8* @_pc() {
%1 = call i8* @llvm.returnaddress(i32 0)
ret i8* %1
}

LLVM IR (-O2):
define i8* @_pc() {
%1 = tail call i8* @llvm.returnaddress(i32 0)
ret i8* %1
}
XSetClassHint() {}


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

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

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

LLVM IR (-O2):
define i32 @XSetClassHint() {
ret i32 undef
}
unsigned long insert_mb6(unsigned long insn, long value,
                         int dialect __attribute__((unused)),
                         const char **errmsg __attribute__((unused))) {
  return insn | ((value & 0x1f) << 6) | (value & 0x20);
}


x86 assembly (clang, -O0):
<insert_mb6>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
and    $0x1f,%rcx
shl    $0x6,%rcx
or     %rcx,%rax
mov    -0x10(%rbp),%rcx
and    $0x20,%rcx
or     %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_mb6>:
mov    %esi,%eax
and    $0x1f,%eax
shl    $0x6,%rax
and    $0x20,%esi
or     %rdi,%rsi
or     %rsi,%rax
ret

LLVM IR (-O0):
define i64 @insert_mb6(i64 %0, i64 %1, i32 %2, i8** %3) {
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i8**
store i64 %0, i64* %5
store i64 %1, i64* %6
store i32 %2, i32* %7
store i8** %3, i8*** %8
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = and i64 %10, 31
%12 = shl i64 %11, 6
%13 = or i64 %9, %12
%14 = load i64, i64* %6
%15 = and i64 %14, 32
%16 = or i64 %13, %15
ret i64 %16
}

LLVM IR (-O2):
define i64 @insert_mb6(i64 %0, i64 %1, i32 %2, i8** nocapture readnone %3) {
%5 = shl i64 %1, 6
%6 = and i64 %5, 1984
%7 = and i64 %1, 32
%8 = or i64 %7, %0
%9 = or i64 %8, %6
ret i64 %9
}
int test_imm_04uint16_reg(unsigned short val) {
  return ((val) & (-0x04 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_04uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0xfffffffc,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_04uint16_reg>:
cmp    $0x4,%di
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovb  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_04uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, -4
%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_04uint16_reg(i16 zeroext %0) {
%2 = icmp ult i16 %0, 4
%3 = select i1 %2, i32 -40, i32 -20
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ CALC_appendString(char *);
void CALC_add1() { CALC_appendString("1"); }


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

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

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

LLVM IR (-O2):
@.str = [2 x i8] c"1\00"
define void @CALC_add1() {
%1 = tail call i32 @CALC_appendString(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ AT_FDCWD;
int symlink(char *, char *);
int symlinkat(char *, int /*<<< orphan*/, char *);
int main(int argc, char **argv) {
  return symlinkat("foobar", AT_FDCWD, "tmp/new-symlink") +
         symlink("foo", "tmp/other-link");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    0xeba(%rip),%rdi
lea    0xeba(%rip),%rdx
call   1040 <symlinkat@plt>
mov    %eax,-0x14(%rbp)
lea    0xebb(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1030 <symlink@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
lea    0xecf(%rip),%rdx
call   1040 <symlinkat@plt>
mov    %eax,%ebx
lea    0xed1(%rip),%rdi
lea    0xece(%rip),%rsi
call   1030 <symlink@plt>
add    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"foobar\00"
@AT_FDCWD = global i32 0
@.str.1 = [16 x i8] c"tmp/new-symlink\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [15 x i8] c"tmp/other-link\00"
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* @AT_FDCWD
%7 = call i32 @symlinkat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @symlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%9 = add nsw i32 %7, %8
ret i32 %9
}

LLVM IR (-O2):
@.str = [7 x i8] c"foobar\00"
@AT_FDCWD = global i32 0
@.str.1 = [16 x i8] c"tmp/new-symlink\00"
@.str.2 = [4 x i8] c"foo\00"
@.str.3 = [15 x i8] c"tmp/other-link\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @AT_FDCWD
%4 = tail call i32 @symlinkat(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @symlink(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%6 = add nsw i32 %5, %4
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ cfg_error(char *, char const *);
unsigned int strtoul(char const *, char **, int /*<<< orphan*/);
unsigned char cvt_byte(const char *s) {
  char *end;
  unsigned int value;
  value = strtoul(s, &end, 0);
  if (value > 255 || *end)
    cfg_error("\"%s\" is not a byte value", s);
  return value;
}


x86 assembly (clang, -O0):
<cvt_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xff,-0x14(%rbp)
ja     115b <cvt_byte+0x3b>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116b <cvt_byte+0x4b>
mov    -0x8(%rbp),%rsi
lea    0xe9a(%rip),%rdi
call   1030 <cfg_error@plt>
mov    -0x14(%rbp),%eax
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvt_byte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    %rsp,%rsi
xor    %edx,%edx
call   1040 <strtoul@plt>
mov    %eax,%ebp
cmp    $0xff,%eax
ja     1142 <cvt_byte+0x22>
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
je     1151 <cvt_byte+0x31>
lea    0xeb7(%rip),%rdi
mov    %rbx,%rsi
call   1030 <cfg_error@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"\22%s\22 is not a byte value\00"
define zeroext i8 @cvt_byte(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strtoul(i8* %5, i8** %3, i32 0)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ugt i32 %7, 255
br i1 %8, label %14, label %9
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %9, %1
%15 = load i8*, i8** %2
%16 = call i32 @cfg_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %15)
br label %17
17: ; preds = %14, %9
%18 = load i32, i32* %4
%19 = trunc i32 %18 to i8
ret i8 %19
}

LLVM IR (-O2):
@.str = [25 x i8] c"\22%s\22 is not a byte value\00"
define zeroext i8 @cvt_byte(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i32 @strtoul(i8* %0, i8** %2, i32 0)
%5 = icmp ugt i32 %4, 255
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %6, %1
%11 = tail call i32 @cfg_error(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %12
12: ; preds = %10, %6
%13 = trunc i32 %4 to i8
ret i8 %13
}
int security_sysctl(struct ctl_table *table, int op) { return 0; }


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

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

LLVM IR (-O0):
%struct.ctl_table = type opaque
define i32 @security_sysctl(%struct.ctl_table* %0, i32 %1) {
%3 = alloca %struct.ctl_table*
%4 = alloca i32
store %struct.ctl_table* %0, %struct.ctl_table** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.ctl_table = type opaque
define i32 @security_sysctl(%struct.ctl_table* nocapture readnone %0, i32 %1) {
ret i32 0
}
long long free_memory() { return 0; }


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

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

LLVM IR (-O0):
define i64 @free_memory() {
ret i64 0
}

LLVM IR (-O2):
define i64 @free_memory() {
ret i64 0
}
/* Type definitions */
typedef int /*<<< orphan*/ sem_t;

/* Variables and functions */
int sem_post(int /*<<< orphan*/ *);
__attribute__((weak)) int __real_sem_post(sem_t *sem) { return sem_post(sem); }


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

x86 assembly (clang, -O2):
<__real_sem_post>:
jmp    1030 <sem_post@plt>

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

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

/* Variables and functions */
char *malloc(int /*<<< orphan*/);
int /*<<< orphan*/ memset(char *, int, int /*<<< orphan*/);
char *mkrecord(uint32_t size, int pattern) {
  char *record;
  if ((record = malloc(size)) == NULL)
    return NULL;
  memset(record, pattern, size);
  return record;
}


x86 assembly (clang, -O0):
<mkrecord>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1151 <mkrecord+0x31>
movq   $0x0,-0x8(%rbp)
jmp    1168 <mkrecord+0x48>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <memset@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mkrecord>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebx
call   1040 <malloc@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1143 <mkrecord+0x23>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %ebx,%edx
call   1030 <memset@plt>
mov    %rbp,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @mkrecord(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
%7 = load i32, i32* %4
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %6
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %11
10: ; preds = %2
store i8* null, i8** %3
br label %17
11: ; preds = %2
%12 = load i8*, i8** %6
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call i32 @memset(i8* %12, i32 %13, i32 %14)
%16 = load i8*, i8** %6
store i8* %16, i8** %3
br label %17
17: ; preds = %11, %10
%18 = load i8*, i8** %3
ret i8* %18
}

LLVM IR (-O2):
define i8* @mkrecord(i32 %0, i32 %1) {
%3 = tail call i8* @malloc(i32 %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memset(i8* %3, i32 %1, i32 %0)
br label %7
7: ; preds = %2, %5
ret i8* %3
}
/* Type definitions */
struct timespec {
  int tv_sec;
  int tv_nsec;
};

/* Variables and functions */
int nanosleep(struct timespec *, int /*<<< orphan*/ *);
int wait_msec(int msec) {
  struct timespec req;
  req.tv_sec = msec / 1000;
  req.tv_nsec = (msec % 1000) * 1000 * 1000;
  return nanosleep(&req, NULL);
}


x86 assembly (clang, -O0):
<wait_msec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
imul   $0x3e8,%edx,%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0xc(%rbp)
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <nanosleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_msec>:
push   %rax
movslq %edi,%rax
imul   $0x10624dd3,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rcx
add    %edx,%ecx
mov    %ecx,(%rsp)
imul   $0x3e8,%ecx,%ecx
sub    %ecx,%eax
imul   $0xf4240,%eax,%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <nanosleep@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32, i32 }
define i32 @wait_msec(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.timespec
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = sdiv i32 %4, 1000
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
store i32 %5, i32* %6
%7 = load i32, i32* %2
%8 = srem i32 %7, 1000
%9 = mul nsw i32 %8, 1000
%10 = mul nsw i32 %9, 1000
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
store i32 %10, i32* %11
%12 = call i32 @nanosleep(%struct.timespec* %3, i32* null)
ret i32 %12
}

LLVM IR (-O2):
%struct.timespec = type { i32, i32 }
define i32 @wait_msec(i32 %0) {
%2 = alloca %struct.timespec
%3 = bitcast %struct.timespec* %2 to i8*
%4 = sdiv i32 %0, 1000
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 0
store i32 %4, i32* %5
%6 = srem i32 %0, 1000
%7 = mul nsw i32 %6, 1000000
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = call i32 @nanosleep(%struct.timespec* %2, i32* null)
ret i32 %9
}
int do_697() { return 697; }


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

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

LLVM IR (-O0):
define i32 @do_697() {
ret i32 697
}

LLVM IR (-O2):
define i32 @do_697() {
ret i32 697
}
void ble_rsp_gap_set_directed_connectable_mode(
    const struct ble_msg_gap_set_directed_connectable_mode_rsp_t *msg) {}


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

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

LLVM IR (-O0):
%struct.ble_msg_gap_set_directed_connectable_mode_rsp_t = type opaque
define void @ble_rsp_gap_set_directed_connectable_mode(%struct.ble_msg_gap_set_directed_connectable_mode_rsp_t* %0) {
%2 = alloca %struct.ble_msg_gap_set_directed_connectable_mode_rsp_t*
store %struct.ble_msg_gap_set_directed_connectable_mode_rsp_t* %0, %struct.ble_msg_gap_set_directed_connectable_mode_rsp_t** %2
ret void
}

LLVM IR (-O2):
%struct.ble_msg_gap_set_directed_connectable_mode_rsp_t = type opaque
define void @ble_rsp_gap_set_directed_connectable_mode(%struct.ble_msg_gap_set_directed_connectable_mode_rsp_t* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ malloc(scalar_t__);
int /*<<< orphan*/ strcat(char *, char const *);
scalar_t__ strlen(char const *);
char *string_append(const char *prefix, const char *suffix) {
  char *buf = (char *)malloc(strlen(prefix) + strlen(suffix));
  buf[0] = '\0';
  strcat(buf, prefix);
  strcat(buf, suffix);
  return buf;
}


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

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

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

LLVM IR (-O2):
define i8* @string_append(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%5 = add nsw i64 %4, %3
%6 = tail call i64 @malloc(i64 %5)
%7 = inttoptr i64 %6 to i8*
store i8 0, i8* %7
%8 = tail call i32 @strcat(i8* %7, i8* %0)
%9 = tail call i32 @strcat(i8* %7, i8* %1)
ret i8* %7
}
void foo712(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo712(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ show_info_a();
int /*<<< orphan*/ show_info_b();
int main() {
  show_info_a();
  show_info_b();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @show_info_a()
%2 = tail call i32 (...) @show_info_b()
ret i32 0
}
int intSize() {
  int intArray[10];
  int *intPtr1;
  int *intPtr2;
  return 2;
}


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

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

LLVM IR (-O0):
define i32 @intSize() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = alloca i32*
ret i32 2
}

LLVM IR (-O2):
define i32 @intSize() {
ret i32 2
}
int my_strlen(char *str) {
  int i;
  i = 0;
  while (str[i] != '\0') {
    i = i + 1;
  }
  return (i);
}


x86 assembly (clang, -O0):
<my_strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <my_strlen+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <my_strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_strlen>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <my_strlen+0x10>
ret

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

LLVM IR (-O2):
define i32 @my_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t nibble2ascii(uint8_t value) {
  uint8_t result = value & 0x0f;
  if (result > 9)
    return result + 0x41 - 0x0A;
  else
    return result + 0x30;
}


x86 assembly (clang, -O0):
<nibble2ascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x9,-0xc(%rbp)
jle    112b <nibble2ascii+0x2b>
mov    -0xc(%rbp),%eax
add    $0x41,%eax
sub    $0xa,%eax
mov    %eax,-0x4(%rbp)
jmp    1134 <nibble2ascii+0x34>
mov    -0xc(%rbp),%eax
add    $0x30,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<nibble2ascii>:
and    $0xf,%edi
lea    0x37(%rdi),%ecx
lea    0x30(%rdi),%eax
cmp    $0xa,%edi
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @nibble2ascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = and i32 %5, 15
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 9
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = load i32, i32* %4
%11 = add nsw i32 %10, 65
%12 = sub nsw i32 %11, 10
store i32 %12, i32* %2
br label %16
13: ; preds = %1
%14 = load i32, i32* %4
%15 = add nsw i32 %14, 48
store i32 %15, i32* %2
br label %16
16: ; preds = %13, %9
%17 = load i32, i32* %2
ret i32 %17
}

LLVM IR (-O2):
define i32 @nibble2ascii(i32 %0) {
%2 = and i32 %0, 15
%3 = icmp ugt i32 %2, 9
%4 = add nuw nsw i32 %2, 55
%5 = or i32 %2, 48
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, unsigned int);
char *nx_str(unsigned int nx) {
  static char string[30];
  if (nx == 0)
    return "-1";
  sprintf(string, "%u", nx);
  return string;
}


x86 assembly (clang, -O0):
<nx_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1135 <nx_str+0x25>
lea    0xed4(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1156 <nx_str+0x46>
mov    -0xc(%rbp),%edx
lea    0x2f01(%rip),%rdi
lea    0xebd(%rip),%rsi
call   1030 <sprintf@plt>
lea    0x2eee(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nx_str>:
push   %rbx
test   %edi,%edi
je     112f <nx_str+0x1f>
mov    %edi,%edx
lea    0x2f22(%rip),%rbx
lea    0xede(%rip),%rsi
mov    %rbx,%rdi
call   1030 <sprintf@plt>
jmp    1136 <nx_str+0x26>
lea    0xeca(%rip),%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@nx_str.string = internal global [30 x i8] zeroinitializer
@.str = [3 x i8] c"-1\00"
@.str.1 = [3 x i8] c"%u\00"
define i8* @nx_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8** %2
br label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i32 @sprintf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @nx_str.string, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %8)
store i8* getelementptr inbounds ([30 x i8], [30 x i8]* @nx_str.string, i64 0, i64 0), i8** %2
br label %10
10: ; preds = %7, %6
%11 = load i8*, i8** %2
ret i8* %11
}

LLVM IR (-O2):
@nx_str.string = internal global [30 x i8] zeroinitializer
@.str = [3 x i8] c"-1\00"
@.str.1 = [3 x i8] c"%u\00"
define i8* @nx_str(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @sprintf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @nx_str.string, i64 0, i64 0), i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ getelementptr inbounds ([30 x i8], [30 x i8]* @nx_str.string, i64 0, i64 0), %3 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), %1 ]
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, double *);
int main(void) {
  int distancia;
  double combustivel;
  scanf("%d %lf", &distancia, &combustivel);
  printf("%.3f km/l\n", distancia / combustivel);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0x10(%rbp),%rdx
call   1040 <scanf@plt>
cvtsi2sdl -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1040 <scanf@plt>
cvtsi2sdl 0xc(%rsp),%xmm0
divsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [11 x i8] c"%.3f km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
store i32 0, i32* %1
%4 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2, double* %3)
%5 = load i32, i32* %2
%6 = sitofp i32 %5 to double
%7 = load double, double* %3
%8 = fdiv double %6, %7
%9 = fptosi double %8 to i32
%10 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %lf\00"
@.str.1 = [11 x i8] c"%.3f km/l\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %1, double* %2)
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to double
%8 = load double, double* %2
%9 = fdiv double %7, %8
%10 = fptosi double %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}
/* Type definitions */
typedef scalar_t__ time_t;

/* Variables and functions */
double timespec2dtime(time_t tv_sec, long tv_nsec) {
  return (double)tv_sec + (double)tv_nsec / 1000000000.0;
}


x86 assembly (clang, -O0):
<timespec2dtime>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cvtsi2sdq -0x8(%rbp),%xmm0
cvtsi2sdq -0x10(%rbp),%xmm1
movsd  0xee0(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<timespec2dtime>:
cvtsi2sd %rdi,%xmm1
cvtsi2sd %rsi,%xmm0
divsd  0xeee(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @timespec2dtime(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 = sitofp i64 %5 to double
%7 = load i64, i64* %4
%8 = sitofp i64 %7 to double
%9 = fdiv double %8, 1.000000e+09
%10 = fadd double %6, %9
ret double %10
}

LLVM IR (-O2):
define double @timespec2dtime(i64 %0, i64 %1) {
%3 = sitofp i64 %0 to double
%4 = sitofp i64 %1 to double
%5 = fdiv double %4, 1.000000e+09
%6 = fadd double %5, %3
ret double %6
}
/* Type definitions */
struct genlist {
  int dummy;
};
struct clause_list_link {
  int dummy;
};
struct clause_list {
  int dummy;
};

/* Variables and functions */
scalar_t__ genlist_link(struct genlist const *, int);
struct clause_list_link *clause_list_link(const struct clause_list *tthis,
                                          int index) {
  return ((struct clause_list_link *)genlist_link((const struct genlist *)tthis,
                                                  index));
}


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

x86 assembly (clang, -O2):
<clause_list_link>:
jmp    1030 <genlist_link@plt>

LLVM IR (-O0):
%struct.clause_list_link = type { i32 }
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.clause_list_link* @clause_list_link(%struct.clause_list* %0, i32 %1) {
%3 = alloca %struct.clause_list*
%4 = alloca i32
store %struct.clause_list* %0, %struct.clause_list** %3
store i32 %1, i32* %4
%5 = load %struct.clause_list*, %struct.clause_list** %3
%6 = bitcast %struct.clause_list* %5 to %struct.genlist*
%7 = load i32, i32* %4
%8 = call i64 @genlist_link(%struct.genlist* %6, i32 %7)
%9 = inttoptr i64 %8 to %struct.clause_list_link*
ret %struct.clause_list_link* %9
}

LLVM IR (-O2):
%struct.clause_list_link = type { i32 }
%struct.clause_list = type { i32 }
%struct.genlist = type { i32 }
define %struct.clause_list_link* @clause_list_link(%struct.clause_list* %0, i32 %1) {
%3 = bitcast %struct.clause_list* %0 to %struct.genlist*
%4 = tail call i64 @genlist_link(%struct.genlist* %3, i32 %1)
%5 = inttoptr i64 %4 to %struct.clause_list_link*
ret %struct.clause_list_link* %5
}
int calcu__(unsigned char *s) {
  int score = 0;
  for (; *s;)
    score += *s++;
  return (score % 100) + 1;
}


x86 assembly (clang, -O0):
<calcu__>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1139 <calcu__+0x39>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    110f <calcu__+0xf>
mov    -0xc(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcu__>:
mov    (%rdi),%cl
test   %cl,%cl
je     1138 <calcu__+0x38>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <calcu__+0x10>
mov    %eax,%ecx
imul   $0x51eb851f,%rcx,%rcx
shr    $0x25,%rcx
imul   $0x64,%ecx,%ecx
neg    %ecx
add    %ecx,%eax
add    $0x1,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @calcu__(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %11, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %8, %4 ], [ %0, %1 ]
%8 = getelementptr inbounds i8, i8* %7, i64 1
%9 = zext i8 %5 to i32
%10 = add nuw nsw i32 %6, %9
%11 = load i8, i8* %8
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4
%14 = urem i32 %10, 100
%15 = add nuw nsw i32 %14, 1
br label %16
16: ; preds = %13, %1
%17 = phi i32 [ 1, %1 ], [ %15, %13 ]
ret i32 %17
}
void foo266() {}


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

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

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

LLVM IR (-O2):
define void @foo266() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int main(int argc, char **argv) {
  int control;
  char buffer[64];
  printf("You win this game if you can change variable control'\n");
  control = 0;
  gets(buffer);
  if (control != 0) {
    printf("YOU WIN!!!\n");
  } else {
    printf("Try again...\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x14(%rbp)
lea    -0x60(%rbp),%rdi
call   1040 <gets@plt>
cmpl   $0x0,-0x14(%rbp)
je     116d <main+0x4d>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1179 <main+0x59>
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rdi
call   1040 <gets@plt>
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@.str = [55 x i8] c"You win this game if you can change variable control'\0A\00"
@.str.1 = [12 x i8] c"YOU WIN!!!\0A\00"
@.str.2 = [14 x i8] c"Try again...\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca [64 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %6
%9 = getelementptr inbounds [64 x i8], [64 x i8]* %7, i64 0, i64 0
%10 = call i32 @gets(i8* %9)
%11 = load i32, i32* %6
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
br label %17
15: ; preds = %2
%16 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
br label %17
17: ; preds = %15, %13
%18 = load i32, i32* %3
ret i32 %18
}

LLVM IR (-O2):
@str = [54 x i8] c"You win this game if you can change variable control'\00"
@str.3 = [13 x i8] c"Try again...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [64 x i8]
%4 = getelementptr inbounds [64 x i8], [64 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%6 = call i32 @gets(i8* %4)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}
void mt_lbprof_update_state_has_lock(int cpu, int rq_cnt) {}


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

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

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

LLVM IR (-O2):
define void @mt_lbprof_update_state_has_lock(i32 %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ q();
int /*<<< orphan*/ q1();
int /*<<< orphan*/ t();
void threading(int a, int b) {
  if (a > b)
    t();
  else
    q();
  if (a <= b)
    q1();
}


x86 assembly (clang, -O0):
<threading>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jle    1156 <threading+0x26>
mov    $0x0,%al
call   1030 <t@plt>
jmp    115d <threading+0x2d>
mov    $0x0,%al
call   1050 <q@plt>
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1170 <threading+0x40>
mov    $0x0,%al
call   1040 <q1@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<threading>:
cmp    %esi,%edi
jle    113b <threading+0xb>
xor    %eax,%eax
jmp    1030 <t@plt>
push   %rax
xor    %eax,%eax
call   1050 <q@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <q1@plt>

LLVM IR (-O0):
define void @threading(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 sgt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = call i32 (...) @t()
br label %12
10: ; preds = %2
%11 = call i32 (...) @q()
br label %12
12: ; preds = %10, %8
%13 = load i32, i32* %3
%14 = load i32, i32* %4
%15 = icmp sle i32 %13, %14
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 (...) @q1()
br label %18
18: ; preds = %16, %12
ret void
}

LLVM IR (-O2):
define void @threading(i32 %0, i32 %1) {
%3 = icmp sgt i32 %0, %1
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @t()
br label %9
6: ; preds = %2
%7 = tail call i32 (...) @q()
%8 = tail call i32 (...) @q1()
br label %9
9: ; preds = %4, %6
ret void
}
int test_imm_C2int64_midword_reg(long long val) {
  return ((val >> 16) & (0xC2 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_C2int64_midword_reg>:
test   $0xc20000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_C2int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 194
%6 = icmp ne i64 %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_C2int64_midword_reg(i64 %0) {
%2 = and i64 %0, 12713984
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}