xunge/DecIR huggingface dataset:
void pmv2i_(x, y) int *x, *y;
{ pmv((float)*x, (float)*y, 0.0); }


x86 assembly (clang, -O0):
<pmv2i_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cvtsi2ssl (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
mov    -0x10(%rbp),%rax
cvtsi2ssl (%rax),%xmm1
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
call   1030 <pmv@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmv2i_>:
cvtsi2ssl (%rdi),%xmm0
cvtsi2ssl (%rsi),%xmm1
cvtss2sd %xmm0,%xmm0
cvtss2sd %xmm1,%xmm1
xorps  %xmm2,%xmm2
mov    $0x3,%al
jmp    1030 <pmv@plt>

LLVM IR (-O0):
define void @pmv2i_(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 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = load i32*, i32** %4
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to float
%12 = fpext float %11 to double
%13 = call i32 (double, double, double, ...) bitcast (i32 (...)* @pmv to i32 (double, double, double, ...)*)(double %8, double %12, double 0.000000e+00)
ret void
}

LLVM IR (-O2):
define void @pmv2i_(i32* nocapture %0, i32* nocapture %1) {
%3 = load i32, i32* %0
%4 = sitofp i32 %3 to float
%5 = fpext float %4 to double
%6 = load i32, i32* %1
%7 = sitofp i32 %6 to float
%8 = fpext float %7 to double
%9 = tail call i32 (double, double, double, ...) bitcast (i32 (...)* @pmv to i32 (double, double, double, ...)*)(double %5, double %8, double 0.000000e+00)
ret void
}
/* Variables and functions */
double fabs(double);
int cs_nonzero(int i, int j, double aij, void *other) {
  return (fabs(aij) > 2.3e-16);
}


x86 assembly (clang, -O0):
<cs_nonzero>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movaps 0xef1(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xed5(%rip),%xmm1
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cs_nonzero>:
andpd  0xef8(%rip),%xmm0
xor    %eax,%eax
ucomisd 0xefe(%rip),%xmm0
seta   %al
ret

LLVM IR (-O0):
define i32 @cs_nonzero(i32 %0, i32 %1, double %2, i8* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double
%8 = alloca i8*
store i32 %0, i32* %5
store i32 %1, i32* %6
store double %2, double* %7
store i8* %3, i8** %8
%9 = load double, double* %7
%10 = call double @llvm.fabs.f64(double %9)
%11 = fcmp ogt double %10, 2.300000e-16
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cs_nonzero(i32 %0, i32 %1, double %2, i8* nocapture readnone %3) {
%5 = tail call double @llvm.fabs.f64(double %2)
%6 = fcmp ogt double %5, 2.300000e-16
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ togo_m_cache_init();
int /*<<< orphan*/ togo_m_counter_init();
int /*<<< orphan*/ togo_m_lock_init();
int /*<<< orphan*/ togo_m_queue_init();
void togo_module_init() {
  togo_m_queue_init();
  togo_m_counter_init();
  togo_m_lock_init();
  togo_m_cache_init();
}


x86 assembly (clang, -O0):
<togo_module_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <togo_m_queue_init@plt>
mov    $0x0,%al
call   1060 <togo_m_counter_init@plt>
mov    $0x0,%al
call   1050 <togo_m_lock_init@plt>
mov    $0x0,%al
call   1040 <togo_m_cache_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<togo_module_init>:
push   %rax
xor    %eax,%eax
call   1030 <togo_m_queue_init@plt>
xor    %eax,%eax
call   1060 <togo_m_counter_init@plt>
xor    %eax,%eax
call   1050 <togo_m_lock_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <togo_m_cache_init@plt>

LLVM IR (-O0):
define void @togo_module_init() {
%1 = call i32 (...) @togo_m_queue_init()
%2 = call i32 (...) @togo_m_counter_init()
%3 = call i32 (...) @togo_m_lock_init()
%4 = call i32 (...) @togo_m_cache_init()
ret void
}

LLVM IR (-O2):
define void @togo_module_init() {
%1 = tail call i32 (...) @togo_m_queue_init()
%2 = tail call i32 (...) @togo_m_counter_init()
%3 = tail call i32 (...) @togo_m_lock_init()
%4 = tail call i32 (...) @togo_m_cache_init()
ret void
}
void RTLdrGetSuff(void) {}


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

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

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

LLVM IR (-O2):
define void @RTLdrGetSuff() {
ret void
}
int plat_midi_get_num_devs(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @plat_midi_get_num_devs() {
ret i32 0
}
void SobelYRow_NEON() {}


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

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

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

LLVM IR (-O2):
define void @SobelYRow_NEON() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ loop();
int /*<<< orphan*/ platform_init();
int /*<<< orphan*/ platform_init_data();
int /*<<< orphan*/ platform_init_post();
int /*<<< orphan*/ platform_timer_init();
int /*<<< orphan*/ setup();
void main() {
  platform_init();
  platform_init_data();
  platform_init_post();
  platform_timer_init();
  setup();
  while (1) {
    loop();
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <platform_init@plt>
mov    $0x0,%al
call   1070 <platform_init_data@plt>
mov    $0x0,%al
call   1030 <platform_init_post@plt>
mov    $0x0,%al
call   1060 <platform_timer_init@plt>
mov    $0x0,%al
call   1080 <setup@plt>
mov    $0x0,%al
call   1050 <loop@plt>
jmp    1187 <main+0x27>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <platform_init@plt>
xor    %eax,%eax
call   1070 <platform_init_data@plt>
xor    %eax,%eax
call   1030 <platform_init_post@plt>
xor    %eax,%eax
call   1060 <platform_timer_init@plt>
xor    %eax,%eax
call   1080 <setup@plt>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1050 <loop@plt>
jmp    1190 <main+0x30>

LLVM IR (-O0):
define void @main() {
%1 = call i32 (...) @platform_init()
%2 = call i32 (...) @platform_init_data()
%3 = call i32 (...) @platform_init_post()
%4 = call i32 (...) @platform_timer_init()
%5 = call i32 (...) @setup()
br label %6
6: ; preds = %0, %6
%7 = call i32 (...) @loop()
br label %6
}

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 (...) @platform_init()
%2 = tail call i32 (...) @platform_init_data()
%3 = tail call i32 (...) @platform_init_post()
%4 = tail call i32 (...) @platform_timer_init()
%5 = tail call i32 (...) @setup()
br label %6
6: ; preds = %0, %6
%7 = tail call i32 (...) @loop()
br label %6
}
int main() {
  int a = 5, b = 10, c = 0;
  int *p = &a, *q = &b;
  c = p - q;
  printf("%d %d %d\n", c, p, q);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0x8(%rbp)
movl   $0xa,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    -0xc(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
sub    %rcx,%rax
sar    $0x2,%rax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x5,0x4(%rsp)
movl   $0xa,(%rsp)
mov    %rsp,%rcx
lea    0x4(%rsp),%rdx
mov    %rdx,%rsi
sub    %rcx,%rsi
shr    $0x2,%rsi
lea    0xec7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 5, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 10, i32* %2
%5 = ptrtoint i32* %1 to i64
%6 = ptrtoint i32* %2 to i64
%7 = sub i64 %5, %6
%8 = lshr exact i64 %7, 2
%9 = trunc i64 %8 to i32
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %9, i32* %1, i32* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void spi0_close(int fd) { close(fd); }


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

x86 assembly (clang, -O2):
<spi0_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define void @spi0_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int assert_(bool statement, const char *error) {
  if (statement) {
    printf("AssertPass\n");
    return 1;
  }
  printf("AssertFail: %s\n", error);
  return 0;
}


x86 assembly (clang, -O0):
<assert_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1143 <assert_+0x33>
lea    0xed0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    115c <assert_+0x4c>
mov    -0x10(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assert_>:
push   %rbx
test   %edi,%edi
je     1138 <assert_+0x18>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    1148 <assert_+0x28>
lea    0xec1(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str.1 = [16 x i8] c"AssertFail: %s\0A\00"
@str = [11 x i8] c"AssertPass\00"
define i32 @assert_(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @str, i64 0, i64 0))
br label %8
6: ; preds = %2
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %8
8: ; preds = %6, %4
%9 = phi i32 [ 1, %4 ], [ 0, %6 ]
ret i32 %9
}
void b(int *j) {}


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

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

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

LLVM IR (-O2):
define void @b(i32* nocapture %0) {
ret void
}
/* Type definitions */
typedef int uint32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ sram_write_u16(int /*<<< orphan*/ *, int);
void sram_write_u32(FILE *file, uint32_t value) {
  sram_write_u16(file, value >> 16);
  sram_write_u16(file, value & 0xFFFF);
}


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

x86 assembly (clang, -O2):
<sram_write_u32>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
sar    $0x10,%esi
call   1030 <sram_write_u16@plt>
movzwl %bx,%esi
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <sram_write_u16@plt>

LLVM IR (-O0):
define void @sram_write_u32(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 = ashr i32 %6, 16
%8 = call i32 @sram_write_u16(i32* %5, i32 %7)
%9 = load i32*, i32** %3
%10 = load i32, i32* %4
%11 = and i32 %10, 65535
%12 = call i32 @sram_write_u16(i32* %9, i32 %11)
ret void
}

LLVM IR (-O2):
define void @sram_write_u32(i32* %0, i32 %1) {
%3 = ashr i32 %1, 16
%4 = tail call i32 @sram_write_u16(i32* %0, i32 %3)
%5 = and i32 %1, 65535
%6 = tail call i32 @sram_write_u16(i32* %0, i32 %5)
ret void
}
/* Variables and functions */
int _f(int, int, double const, double const *);
double _I_33(const double omega, const double vertices_omegas[4]) {
  return (_f(3, 0, omega, vertices_omegas) + _f(3, 1, omega, vertices_omegas) +
          _f(3, 2, omega, vertices_omegas)) /
         3;
}


x86 assembly (clang, -O0):
<_I_33>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
xor    %esi,%esi
call   1030 <_f@plt>
mov    %eax,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
mov    $0x1,%esi
call   1030 <_f@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    -0x10(%rbp),%rdx
mov    $0x3,%edi
mov    $0x2,%esi
call   1030 <_f@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_I_33>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movsd  %xmm0,0x8(%rsp)
mov    $0x3,%edi
xor    %esi,%esi
mov    %rbx,%rdx
call   1030 <_f@plt>
mov    %eax,%r14d
mov    $0x3,%edi
mov    $0x1,%esi
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdx
call   1030 <_f@plt>
mov    %eax,%ebp
add    %r14d,%ebp
mov    $0x3,%edi
mov    $0x2,%esi
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdx
call   1030 <_f@plt>
add    %ebp,%eax
cltq
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define double @_I_33(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
store double %0, double* %3
store double* %1, double** %4
%5 = load double, double* %3
%6 = load double*, double** %4
%7 = call i32 @_f(i32 3, i32 0, double %5, double* %6)
%8 = load double, double* %3
%9 = load double*, double** %4
%10 = call i32 @_f(i32 3, i32 1, double %8, double* %9)
%11 = add nsw i32 %7, %10
%12 = load double, double* %3
%13 = load double*, double** %4
%14 = call i32 @_f(i32 3, i32 2, double %12, double* %13)
%15 = add nsw i32 %11, %14
%16 = sdiv i32 %15, 3
%17 = sitofp i32 %16 to double
ret double %17
}

LLVM IR (-O2):
define double @_I_33(double %0, double* %1) {
%3 = tail call i32 @_f(i32 3, i32 0, double %0, double* %1)
%4 = tail call i32 @_f(i32 3, i32 1, double %0, double* %1)
%5 = add nsw i32 %4, %3
%6 = tail call i32 @_f(i32 3, i32 2, double %0, double* %1)
%7 = add nsw i32 %5, %6
%8 = sdiv i32 %7, 3
%9 = sitofp i32 %8 to double
ret double %9
}
unsigned int test_06(unsigned int a) { return ~a >> 31; }


x86 assembly (clang, -O0):
<test_06>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
shr    $0x1f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_06>:
mov    %edi,%eax
not    %eax
shr    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @test_06(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = xor i32 %3, -1
%5 = lshr i32 %4, 31
ret i32 %5
}

LLVM IR (-O2):
define i32 @test_06(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
ret i32 %3
}
int test28(int a, int b, int c, int d) {
  int x = a != b;
  int y = c == 0;
  return x * y;
}


x86 assembly (clang, -O0):
<test28>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
imul   -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test28>:
cmp    %esi,%edi
setne  %al
test   %edx,%edx
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @test28(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = load i32, i32* %6
%13 = icmp ne i32 %11, %12
%14 = zext i1 %13 to i32
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = icmp eq i32 %15, 0
%17 = zext i1 %16 to i32
store i32 %17, i32* %10
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = mul nsw i32 %18, %19
ret i32 %20
}

LLVM IR (-O2):
define i32 @test28(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %0, %1
%6 = icmp eq i32 %2, 0
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void Is_Success(int flag) {
  if (flag)
    printf("operator success!\n");
  else
    printf("operator failuer!\n");
}


x86 assembly (clang, -O0):
<Is_Success>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1136 <Is_Success+0x26>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
jmp    1142 <Is_Success+0x32>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Is_Success>:
test   %edi,%edi
lea    0xee7(%rip),%rax
lea    0xef2(%rip),%rdi
cmove  %rax,%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"operator success!\0A\00"
@.str.1 = [19 x i8] c"operator failuer!\0A\00"
define void @Is_Success(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
@str = [18 x i8] c"operator failuer!\00"
@str.2 = [18 x i8] c"operator success!\00"
define void @Is_Success(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str.2, i64 0, i64 0)
%4 = tail call i32 @puts(i8* dereferenceable(1) %3)
ret void
}
int test_and_clear_bit(int nr, volatile void *addr) {
  int mask, retval;
  volatile int *a = addr;
  a += nr >> 5;
  mask = 1 << (nr & 0x1f);
  retval = (mask & *a) != 0;
  *a &= ~mask;
  return retval;
}


x86 assembly (clang, -O0):
<test_and_clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x5,%ecx
mov    -0x20(%rbp),%rax
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x20(%rbp),%rcx
mov    (%rcx),%ecx
and    %ecx,%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edx
xor    $0xffffffff,%edx
mov    -0x20(%rbp),%rax
mov    (%rax),%ecx
and    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x18(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and_clear_bit>:
mov    %edi,%ecx
mov    %edi,%eax
sar    $0x5,%eax
movslq %eax,%rdx
mov    (%rsi,%rdx,4),%eax
shr    %cl,%eax
mov    $0xfffffffe,%edi
rol    %cl,%edi
and    $0x1,%eax
and    %edi,(%rsi,%rdx,4)
ret

LLVM IR (-O0):
define i32 @test_and_clear_bit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32*
store i32 %0, i32* %3
store i8* %1, i8** %4
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i32*
store i32* %9, i32** %7
%10 = load i32, i32* %3
%11 = ashr i32 %10, 5
%12 = load i32*, i32** %7
%13 = sext i32 %11 to i64
%14 = getelementptr inbounds i32, i32* %12, i64 %13
store i32* %14, i32** %7
%15 = load i32, i32* %3
%16 = and i32 %15, 31
%17 = shl i32 1, %16
store i32 %17, i32* %5
%18 = load i32, i32* %5
%19 = load i32*, i32** %7
%20 = load volatile i32, i32* %19
%21 = and i32 %18, %20
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i32
store i32 %23, i32* %6
%24 = load i32, i32* %5
%25 = xor i32 %24, -1
%26 = load i32*, i32** %7
%27 = load volatile i32, i32* %26
%28 = and i32 %27, %25
store volatile i32 %28, i32* %26
%29 = load i32, i32* %6
ret i32 %29
}

LLVM IR (-O2):
define i32 @test_and_clear_bit(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i32*
%4 = ashr i32 %0, 5
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i32, i32* %3, i64 %5
%7 = and i32 %0, 31
%8 = shl nuw i32 1, %7
%9 = load volatile i32, i32* %6
%10 = lshr i32 %9, %7
%11 = and i32 %10, 1
%12 = xor i32 %8, -1
%13 = load volatile i32, i32* %6
%14 = and i32 %13, %12
store volatile i32 %14, i32* %6
ret i32 %11
}
/* Variables and functions */
char *malloc(size_t);
int /*<<< orphan*/ memcpy(char *, char const *, size_t);
int strlen(char const *);
char *strdup(const char *str) {
  size_t len;
  char *copy = NULL;
  if (str) {
    len = strlen(str) + 1;
    if ((copy = malloc(len)) == NULL) {
      return (NULL);
    }
    memcpy(copy, str, len);
  }
  return (copy);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1196 <strdup+0x66>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
add    $0x1,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    1185 <strdup+0x55>
movq   $0x0,-0x8(%rbp)
jmp    119e <strdup+0x6e>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <memcpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %r15
push   %r14
push   %rbx
test   %rdi,%rdi
je     1168 <strdup+0x38>
mov    %rdi,%r14
call   1030 <strlen@plt>
add    $0x1,%eax
movslq %eax,%r15
mov    %r15,%rdi
call   1050 <malloc@plt>
test   %rax,%rax
je     1168 <strdup+0x38>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
jmp    116a <strdup+0x3a>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i8* null, i8** %5
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %22
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = sext i32 %11 to i64
store i64 %12, i64* %4
%13 = load i64, i64* %4
%14 = call i8* @malloc(i64 %13)
store i8* %14, i8** %5
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %17
16: ; preds = %8
store i8* null, i8** %2
br label %24
17: ; preds = %8
%18 = load i8*, i8** %5
%19 = load i8*, i8** %3
%20 = load i64, i64* %4
%21 = call i32 @memcpy(i8* %18, i8* %19, i64 %20)
br label %22
22: ; preds = %17, %1
%23 = load i8*, i8** %5
store i8* %23, i8** %2
br label %24
24: ; preds = %22, %16
%25 = load i8*, i8** %2
ret i8* %25
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = tail call i32 @strlen(i8* %0)
%5 = add nsw i32 %4, 1
%6 = sext i32 %5 to i64
%7 = tail call i8* @malloc(i64 %6)
%8 = icmp eq i8* %7, null
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @memcpy(i8* %7, i8* %0, i64 %6)
br label %11
11: ; preds = %1, %9, %3
%12 = phi i8* [ null, %3 ], [ %7, %9 ], [ null, %1 ]
ret i8* %12
}
int main(int argc, char *argv[]) {
  int a, b;
  a = 1;
  return (a + b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
ret i32 undef
}
int C_Utils_compare_double(const double item1, const double item2) {
  if (item1 == item2)
    return 0;
  return item1 < item2 ? -1 : 1;
}


x86 assembly (clang, -O0):
<C_Utils_compare_double>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1130 <C_Utils_compare_double+0x30>
jp     1130 <C_Utils_compare_double+0x30>
movl   $0x0,-0x4(%rbp)
jmp    114e <C_Utils_compare_double+0x4e>
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
mov    $0x1,%eax
mov    $0xffffffff,%ecx
ucomisd %xmm1,%xmm0
cmova  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_Utils_compare_double>:
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
setbe  %cl
xor    %eax,%eax
ucomisd %xmm1,%xmm0
lea    -0x1(%rcx,%rcx,1),%ecx
cmovne %ecx,%eax
cmovp  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @C_Utils_compare_double(double %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca double
store double %0, double* %4
store double %1, double* %5
%6 = load double, double* %4
%7 = load double, double* %5
%8 = fcmp oeq double %6, %7
br i1 %8, label %9, label %10
9: ; preds = %2
store i32 0, i32* %3
br label %16
10: ; preds = %2
%11 = load double, double* %4
%12 = load double, double* %5
%13 = fcmp olt double %11, %12
%14 = zext i1 %13 to i64
%15 = select i1 %13, i32 -1, i32 1
store i32 %15, i32* %3
br label %16
16: ; preds = %10, %9
%17 = load i32, i32* %3
ret i32 %17
}

LLVM IR (-O2):
define i32 @C_Utils_compare_double(double %0, double %1) {
%3 = fcmp oeq double %0, %1
%4 = fcmp olt double %0, %1
%5 = select i1 %4, i32 -1, i32 1
%6 = select i1 %3, i32 0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ bar();
void foo(void) {
  bar();
  bar();
}


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

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <bar@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <bar@plt>

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

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @bar()
%2 = tail call i32 (...) @bar()
ret void
}
/* Type definitions */
struct name {
  int dummy;
};
struct generator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ write_varname(struct generator *, struct name *);
void write_varref(struct generator *g, struct name *p) { write_varname(g, p); }


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

x86 assembly (clang, -O2):
<write_varref>:
jmp    1030 <write_varname@plt>

LLVM IR (-O0):
%struct.generator = type { i32 }
%struct.name = type { i32 }
define void @write_varref(%struct.generator* %0, %struct.name* %1) {
%3 = alloca %struct.generator*
%4 = alloca %struct.name*
store %struct.generator* %0, %struct.generator** %3
store %struct.name* %1, %struct.name** %4
%5 = load %struct.generator*, %struct.generator** %3
%6 = load %struct.name*, %struct.name** %4
%7 = call i32 @write_varname(%struct.generator* %5, %struct.name* %6)
ret void
}

LLVM IR (-O2):
%struct.generator = type { i32 }
%struct.name = type { i32 }
define void @write_varref(%struct.generator* %0, %struct.name* %1) {
%3 = tail call i32 @write_varname(%struct.generator* %0, %struct.name* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rb_isalnum(int);
int rb_ispunct(int c) { return !rb_isalnum(c); }


x86 assembly (clang, -O0):
<rb_ispunct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <rb_isalnum@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @rb_ispunct(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @rb_isalnum(i32 %3)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @rb_ispunct(i32 %0) {
%2 = tail call i32 @rb_isalnum(i32 %0)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void *malloc(size_t);
void *__attribute__((weak)) __libnx_alloc(size_t size) { return malloc(size); }


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

x86 assembly (clang, -O2):
<__libnx_alloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define weak i8* @__libnx_alloc(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i8* @malloc(i64 %3)
ret i8* %4
}

LLVM IR (-O2):
define weak i8* @__libnx_alloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
ret i8* %2
}
/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ *display;
};
typedef TYPE_1__ XVisibilityEvent;
typedef int /*<<< orphan*/ Display;

/* Variables and functions */
void set_XVisibilityEvent_display(void *_p, void *_v) {
  ((XVisibilityEvent *)_p)->display = (Display *)_v;
}


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

x86 assembly (clang, -O2):
<set_XVisibilityEvent_display>:
mov    %rsi,(%rdi)
ret

LLVM IR (-O0):
%struct.TYPE_2__ = type { i32* }
define void @set_XVisibilityEvent_display(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = bitcast i8* %5 to i32*
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to %struct.TYPE_2__*
%9 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %8, i32 0, i32 0
store i32* %6, i32** %9
ret void
}

LLVM IR (-O2):
define void @set_XVisibilityEvent_display(i8* nocapture writeonly %0, i8* %1) {
%3 = bitcast i8* %0 to i8**
store i8* %1, i8** %3
ret void
}
int cardNumber(char card) {
  int number = 0;
  switch (card) {
  case 'T':
    number = 10;
    break;
  case 'J':
    number = 11;
    break;
  case 'Q':
    number = 12;
    break;
  case 'K':
    number = 13;
    break;
  case 'A':
    number = 14;
    break;
  }
  return number;
}


x86 assembly (clang, -O0):
<cardNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movl   $0x0,-0x8(%rbp)
movsbl -0x1(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x13,%eax
ja     1172 <cardNumber+0x72>
mov    -0x10(%rbp),%rax
lea    0xece(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movl   $0xa,-0x8(%rbp)
jmp    1172 <cardNumber+0x72>
movl   $0xb,-0x8(%rbp)
jmp    1172 <cardNumber+0x72>
movl   $0xc,-0x8(%rbp)
jmp    1172 <cardNumber+0x72>
movl   $0xd,-0x8(%rbp)
jmp    1172 <cardNumber+0x72>
movl   $0xe,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cardNumber>:
xor    %eax,%eax
add    $0xffffffbf,%edi
cmp    $0x13,%edi
ja     111f <cardNumber+0x1f>
lea    0xeef(%rip),%rcx
movslq (%rcx,%rdi,4),%rdx
add    %rcx,%rdx
jmp    *%rdx
mov    $0xe,%eax
ret
mov    $0xb,%eax
ret
mov    $0xd,%eax
ret
mov    $0xc,%eax
ret
mov    $0xa,%eax
ret

LLVM IR (-O0):
define i32 @cardNumber(i8 signext %0) {
%2 = alloca i8
%3 = alloca i32
store i8 %0, i8* %2
store i32 0, i32* %3
%4 = load i8, i8* %2
%5 = sext i8 %4 to i32
switch i32 %5, label %11 [
i32 84, label %6
i32 74, label %7
i32 81, label %8
i32 75, label %9
i32 65, label %10
]
6: ; preds = %1
store i32 10, i32* %3
br label %11
7: ; preds = %1
store i32 11, i32* %3
br label %11
8: ; preds = %1
store i32 12, i32* %3
br label %11
9: ; preds = %1
store i32 13, i32* %3
br label %11
10: ; preds = %1
store i32 14, i32* %3
br label %11
11: ; preds = %1, %10, %9, %8, %7, %6
%12 = load i32, i32* %3
ret i32 %12
}

LLVM IR (-O2):
define i32 @cardNumber(i8 signext %0) {
%2 = sext i8 %0 to i32
switch i32 %2, label %8 [
i32 84, label %3
i32 74, label %4
i32 81, label %5
i32 75, label %6
i32 65, label %7
]
3: ; preds = %1
br label %8
4: ; preds = %1
br label %8
5: ; preds = %1
br label %8
6: ; preds = %1
br label %8
7: ; preds = %1
br label %8
8: ; preds = %1, %7, %6, %5, %4, %3
%9 = phi i32 [ 0, %1 ], [ 14, %7 ], [ 13, %6 ], [ 12, %5 ], [ 11, %4 ], [ 10, %3 ]
ret i32 %9
}
/* Variables and functions */
float __slong2fs(char);
float __schar2fs(signed char sc) { return __slong2fs(sc); }


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

x86 assembly (clang, -O2):
<__schar2fs>:
jmp    1030 <__slong2fs@plt>

LLVM IR (-O0):
define float @__schar2fs(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call float @__slong2fs(i8 signext %3)
ret float %4
}

LLVM IR (-O2):
define float @__schar2fs(i8 signext %0) {
%2 = tail call float @__slong2fs(i8 signext %0)
ret float %2
}
void goToSleep() {}


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

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

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

LLVM IR (-O2):
define void @goToSleep() {
ret void
}
/* Variables and functions */
double log(double);
double plogp_sane(double p) {
  p = ((p) > (1e-6) ? (p) : (1e-6));
  p = ((p) < (1) ? (p) : (1));
  return p * log(p);
}


x86 assembly (clang, -O0):
<plogp_sane>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed6(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1143 <plogp_sane+0x33>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1155 <plogp_sane+0x45>
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1155 <plogp_sane+0x45>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xea1(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1181 <plogp_sane+0x71>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1193 <plogp_sane+0x83>
movsd  0xe7f(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1193 <plogp_sane+0x83>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plogp_sane>:
push   %rax
maxsd  0xee7(%rip),%xmm0
minsd  0xee7(%rip),%xmm0
movsd  %xmm0,(%rsp)
call   1030 <log@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @plogp_sane(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp ogt double %3, 0x3EB0C6F7A0B5ED8D
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = load double, double* %2
br label %8
7: ; preds = %1
br label %8
8: ; preds = %7, %5
%9 = phi double [ %6, %5 ], [ 0x3EB0C6F7A0B5ED8D, %7 ]
store double %9, double* %2
%10 = load double, double* %2
%11 = fcmp olt double %10, 1.000000e+00
br i1 %11, label %12, label %14
12: ; preds = %8
%13 = load double, double* %2
br label %15
14: ; preds = %8
br label %15
15: ; preds = %14, %12
%16 = phi double [ %13, %12 ], [ 1.000000e+00, %14 ]
store double %16, double* %2
%17 = load double, double* %2
%18 = load double, double* %2
%19 = call double @log(double %18)
%20 = fmul double %17, %19
ret double %20
}

LLVM IR (-O2):
define double @plogp_sane(double %0) {
%2 = fcmp ogt double %0, 0x3EB0C6F7A0B5ED8D
%3 = select i1 %2, double %0, double 0x3EB0C6F7A0B5ED8D
%4 = fcmp olt double %3, 1.000000e+00
%5 = select i1 %4, double %3, double 1.000000e+00
%6 = tail call double @log(double %5)
%7 = fmul double %5, %6
ret double %7
}
int nfcmp(nf, rec) const char *nf;
char *rec;
{
  char *cp, tmp;
  int ret;
  for (cp = rec; *cp != ':'; cp++)
    ;
  tmp = *(cp + 1);
  *(cp + 1) = '\0';
  ret = strcmp(nf, rec);
  *(cp + 1) = tmp;
  return (ret);
}


x86 assembly (clang, -O0):
<nfcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
je     114e <nfcmp+0x3e>
jmp    113d <nfcmp+0x2d>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1128 <nfcmp+0x18>
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
movb   $0x0,0x1(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x20(%rbp)
mov    -0x19(%rbp),%cl
mov    -0x18(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x20(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nfcmp>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
cs nopw 0x0(%rax,%rax,1)
cmpb   $0x3a,(%rbx)
lea    0x1(%rbx),%rbx
jne    1120 <nfcmp+0x10>
mov    (%rbx),%bpl
movb   $0x0,(%rbx)
call   1030 <strcmp@plt>
mov    %bpl,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @nfcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %7, %3 ]
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 58
%7 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %6, label %8, label %3
8: ; preds = %3
%9 = load i8, i8* %7
store i8 0, i8* %7
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
store i8 %9, i8* %7
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void testAlloc(void *ptr) {
  if (ptr == NULL) {
    fprintf(stderr, "Nedostatek pameti!\n");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<testAlloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    115a <testAlloc+0x3a>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
lea    0xeb9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testAlloc>:
test   %rdi,%rdi
je     1126 <testAlloc+0x6>
ret
push   %rax
mov    0x2eb2(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"Nedostatek pameti!\0A\00"
@EXIT_FAILURE = global i32 0
define void @testAlloc(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %1
%6 = load i32, i32* @stderr
%7 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"Nedostatek pameti!\0A\00"
@EXIT_FAILURE = global i32 0
define void @testAlloc(i8* readnone %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %3, label %8
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Type definitions */
struct timespec {
  scalar_t__ tv_nsec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
bool monotime_isset(struct timespec t) { return (t.tv_sec || t.tv_nsec); }


x86 assembly (clang, -O0):
<monotime_isset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x8(%rbp)
mov    $0x1,%al
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
jne    1127 <monotime_isset+0x27>
cmpq   $0x0,-0x10(%rbp)
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<monotime_isset>:
xor    %eax,%eax
or     %rsi,%rdi
setne  %al
ret

LLVM IR (-O0):
%struct.timespec = type { i64, i64 }
define i32 @monotime_isset(i64 %0, i64 %1) {
%3 = alloca %struct.timespec
%4 = bitcast %struct.timespec* %3 to { i64, i64 }*
%5 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 0
store i64 %0, i64* %5
%6 = getelementptr inbounds { i64, i64 }, { i64, i64 }* %4, i32 0, i32 1
store i64 %1, i64* %6
%7 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 1
%8 = load i64, i64* %7
%9 = icmp ne i64 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %2
%11 = getelementptr inbounds %struct.timespec, %struct.timespec* %3, i32 0, i32 0
%12 = load i64, i64* %11
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %10, %2
%15 = phi i1 [ true, %2 ], [ %13, %10 ]
%16 = zext i1 %15 to i32
ret i32 %16
}

LLVM IR (-O2):
define i32 @monotime_isset(i64 %0, i64 %1) {
%3 = icmp ne i64 %1, 0
%4 = icmp ne i64 %0, 0
%5 = select i1 %3, i1 true, i1 %4
%6 = zext i1 %5 to i32
ret i32 %6
}
fltu(x, y) unsigned long long int x;
unsigned long long int y;
{
  if (x < y)
    return 13;
  else
    return 140;
}


x86 assembly (clang, -O0):
<fltu>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    1126 <fltu+0x26>
movl   $0xd,-0x4(%rbp)
jmp    112d <fltu+0x2d>
movl   $0x8c,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fltu>:
cmp    %rsi,%rdi
mov    $0xd,%ecx
mov    $0x8c,%eax
cmovb  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @fltu(i64 %0, i64 %1) {
%3 = icmp ult i64 %0, %1
%4 = select i1 %3, i32 13, i32 140
ret i32 %4
}
void s2e_moduleexec_add_module(const char *moduleId, const char *moduleName,
                               int kernelMode) {
  __s2e_touch_string(moduleId);
  __s2e_touch_string(moduleName);
  __asm__ __volatile__(".byte 0x0f, 0x3f\n"
                       ".byte 0x00, 0xAF, 0x00, 0x00\n"
                       ".byte 0x00, 0x00, 0x00, 0x00\n"
                       :
                       : "c"(moduleId), "a"(moduleName), "d"(kernelMode));
}


x86 assembly (clang, -O0):
<s2e_moduleexec_add_module>:
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    $0x0,%al
call   1030 <__s2e_touch_string@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1030 <__s2e_touch_string@plt>
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%edx
(bad)
add    %ch,0x0(%rdi)
add    %al,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s2e_moduleexec_add_module>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
xor    %eax,%eax
call   1030 <__s2e_touch_string@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <__s2e_touch_string@plt>
mov    %rbp,%rcx
mov    %rbx,%rax
mov    %r14d,%edx
(bad)
add    %ch,0x0(%rdi)
add    %al,(%rax)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @s2e_moduleexec_add_module(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @__s2e_touch_string to i32 (i8*, ...)*)(i8* %7)
%9 = load i8*, i8** %5
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @__s2e_touch_string to i32 (i8*, ...)*)(i8* %9)
%11 = load i8*, i8** %4
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
ret void
}

LLVM IR (-O2):
define void @s2e_moduleexec_add_module(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @__s2e_touch_string to i32 (i8*, ...)*)(i8* %0)
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @__s2e_touch_string to i32 (i8*, ...)*)(i8* %1)
tail call void asm sideeffect ".byte 0x0f, 0x3f\0A.byte 0x00, 0xAF, 0x00, 0x00\0A.byte 0x00, 0x00, 0x00, 0x00\0A", "{cx},{ax},{dx},~{dirflag},~{fpsr},~{flags}"(i8* %0, i8* %1, i32 %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void governor_lve_exit_null() { printf("governor_lve_exit_null\n"); }


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

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

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

LLVM IR (-O2):
@str = [23 x i8] c"governor_lve_exit_null\00"
define void @governor_lve_exit_null() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str, i64 0, i64 0))
ret void
}