xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ system(char *);
void disable_rule() {
  system("netsh advfirewall firewall set rule name=\"LoL Chat OFF\" new "
         "enable=no");
  printf("Done.\n");
}


x86 assembly (clang, -O0):
<disable_rule>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <system@plt>
lea    0xf0f(%rip),%rdi
call   1040 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<disable_rule>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <system@plt>
lea    0xf12(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"netsh advfirewall firewall set rule name=\22LoL Chat OFF\22 new enable=no\00"
@.str.1 = [7 x i8] c"Done.\0A\00"
define void @disable_rule() {
%1 = call i32 @system(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"netsh advfirewall firewall set rule name=\22LoL Chat OFF\22 new enable=no\00"
@str = [6 x i8] c"Done.\00"
define void @disable_rule() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(void *);
void *calloc(int, size_t);
void *MyMalloc(size_t bytes) {
  void *ret = calloc(1, bytes);
  assert(ret);
  return ret;
}


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

x86 assembly (clang, -O2):
<MyMalloc>:
push   %rbx
mov    %rdi,%rsi
mov    $0x1,%edi
call   1030 <calloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @MyMalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @calloc(i32 1, i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
ret i8* %8
}

LLVM IR (-O2):
define i8* @MyMalloc(i64 %0) {
%2 = tail call i8* @calloc(i32 1, i64 %0)
%3 = tail call i32 @assert(i8* %2)
ret i8* %2
}
double getTick(void) {
  double seconds_per_cycle = 1.0e-6;
  return seconds_per_cycle;
}


x86 assembly (clang, -O0):
<getTick>:
push   %rbp
mov    %rsp,%rbp
movsd  0xef4(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

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

LLVM IR (-O0):
define double @getTick() {
%1 = alloca double
store double 0x3EB0C6F7A0B5ED8D, double* %1
%2 = load double, double* %1
ret double %2
}

LLVM IR (-O2):
define double @getTick() {
ret double 0x3EB0C6F7A0B5ED8D
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void pf3() { printf("Function Test 3\n"); }


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"Function Test 3\00"
define void @pf3() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t range_sz(const char *beg, const char *end) {
  assert(beg <= end);
  return (size_t)(end - beg);
}


x86 assembly (clang, -O0):
<range_sz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    %rcx,%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<range_sz>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
sub    %rdi,%rbx
setae  %al
mov    %eax,%edi
call   1030 <assert@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @range_sz(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = icmp ule i8* %5, %6
%8 = zext i1 %7 to i32
%9 = call i32 @assert(i32 %8)
%10 = load i8*, i8** %4
%11 = load i8*, i8** %3
%12 = ptrtoint i8* %10 to i64
%13 = ptrtoint i8* %11 to i64
%14 = sub i64 %12, %13
ret i64 %14
}

LLVM IR (-O2):
define i64 @range_sz(i8* %0, i8* %1) {
%3 = icmp ule i8* %0, %1
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
%6 = ptrtoint i8* %1 to i64
%7 = ptrtoint i8* %0 to i64
%8 = sub i64 %6, %7
ret i64 %8
}
int test_imm_3Duint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0x3D << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Duint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 61
%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_3Duint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 261993005056
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
float kmLerp(float x, float y, float t) { return x + t * (y - x); }


x86 assembly (clang, -O0):
<kmLerp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  -0x4(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<kmLerp>:
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @kmLerp(float %0, float %1, float %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca float
store float %0, float* %4
store float %1, float* %5
store float %2, float* %6
%7 = load float, float* %4
%8 = load float, float* %6
%9 = load float, float* %5
%10 = load float, float* %4
%11 = fsub float %9, %10
%12 = call float @llvm.fmuladd.f32(float %8, float %11, float %7)
ret float %12
}

LLVM IR (-O2):
define float @kmLerp(float %0, float %1, float %2) {
%4 = fsub float %1, %0
%5 = tail call float @llvm.fmuladd.f32(float %2, float %4, float %0)
ret float %5
}
unsigned int setbits(unsigned int x, int p, int n, unsigned int y) {
  return ((x & ~(~(~0 << n) << (p + 1 - n))) |
          ((y & ~(~0 << n)) << (p + 1 - n)));
}


x86 assembly (clang, -O0):
<setbits>:
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
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%edx
shl    %cl,%edx
xor    $0xffffffff,%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    $0xffffffff,%esi
shl    %cl,%esi
mov    %esi,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%edx
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
sub    -0xc(%rbp),%ecx
shl    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<setbits>:
mov    %ecx,%r8d
mov    %edx,%ecx
mov    $0xffffffff,%eax
shl    %cl,%eax
not    %eax
sub    %edx,%esi
lea    0x1(%rsi),%ecx
mov    %eax,%edx
shl    %cl,%edx
not    %edx
and    %edi,%edx
and    %r8d,%eax
shl    %cl,%eax
or     %edx,%eax
ret

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

LLVM IR (-O2):
define i32 @setbits(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl nsw i32 -1, %2
%6 = xor i32 %5, -1
%7 = add nsw i32 %1, 1
%8 = sub i32 %7, %2
%9 = shl i32 %6, %8
%10 = xor i32 %9, -1
%11 = and i32 %10, %0
%12 = and i32 %6, %3
%13 = shl i32 %12, %8
%14 = or i32 %11, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ test(long);
int main(int argc, char **argv) {
  long i;
  for (i = 1; i <= 16; i++)
    test(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
cmpq   $0x10,-0x18(%rbp)
jg     1153 <main+0x43>
mov    -0x18(%rbp),%rdi
call   1030 <test@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    112e <main+0x1e>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <test@plt>
mov    $0x2,%edi
call   1030 <test@plt>
mov    $0x3,%edi
call   1030 <test@plt>
mov    $0x4,%edi
call   1030 <test@plt>
mov    $0x5,%edi
call   1030 <test@plt>
mov    $0x6,%edi
call   1030 <test@plt>
mov    $0x7,%edi
call   1030 <test@plt>
mov    $0x8,%edi
call   1030 <test@plt>
mov    $0x9,%edi
call   1030 <test@plt>
mov    $0xa,%edi
call   1030 <test@plt>
mov    $0xb,%edi
call   1030 <test@plt>
mov    $0xc,%edi
call   1030 <test@plt>
mov    $0xd,%edi
call   1030 <test@plt>
mov    $0xe,%edi
call   1030 <test@plt>
mov    $0xf,%edi
call   1030 <test@plt>
mov    $0x10,%edi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @test(i64 1)
%4 = tail call i32 @test(i64 2)
%5 = tail call i32 @test(i64 3)
%6 = tail call i32 @test(i64 4)
%7 = tail call i32 @test(i64 5)
%8 = tail call i32 @test(i64 6)
%9 = tail call i32 @test(i64 7)
%10 = tail call i32 @test(i64 8)
%11 = tail call i32 @test(i64 9)
%12 = tail call i32 @test(i64 10)
%13 = tail call i32 @test(i64 11)
%14 = tail call i32 @test(i64 12)
%15 = tail call i32 @test(i64 13)
%16 = tail call i32 @test(i64 14)
%17 = tail call i32 @test(i64 15)
%18 = tail call i32 @test(i64 16)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ io_outb(int, int);
void qemu_shutdown() { io_outb(0xf4, 0x00); }


x86 assembly (clang, -O0):
<qemu_shutdown>:
push   %rbp
mov    %rsp,%rbp
mov    $0xf4,%edi
xor    %esi,%esi
call   1030 <io_outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<qemu_shutdown>:
mov    $0xf4,%edi
xor    %esi,%esi
jmp    1030 <io_outb@plt>

LLVM IR (-O0):
define void @qemu_shutdown() {
%1 = call i32 @io_outb(i32 244, i32 0)
ret void
}

LLVM IR (-O2):
define void @qemu_shutdown() {
%1 = tail call i32 @io_outb(i32 244, i32 0)
ret void
}
char *epb2fd(epoch)
double epoch;
{
  double dj;
  dj = epb2jd(epoch);
  return (jd2fd(dj));
}


x86 assembly (clang, -O0):
<epb2fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
mov    $0x1,%al
call   1040 <epb2jd@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x1,%al
call   1030 <jd2fd@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<epb2fd>:
push   %rax
mov    $0x1,%al
call   1040 <epb2jd@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mov    $0x1,%al
call   1030 <jd2fd@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i8* @epb2fd(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %2
%4 = load double, double* %2
%5 = call i32 (double, ...) bitcast (i32 (...)* @epb2jd to i32 (double, ...)*)(double %4)
%6 = sitofp i32 %5 to double
store double %6, double* %3
%7 = load double, double* %3
%8 = call i32 (double, ...) bitcast (i32 (...)* @jd2fd to i32 (double, ...)*)(double %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
ret i8* %10
}

LLVM IR (-O2):
define i8* @epb2fd(double %0) {
%2 = tail call i32 (double, ...) bitcast (i32 (...)* @epb2jd to i32 (double, ...)*)(double %0)
%3 = sitofp i32 %2 to double
%4 = tail call i32 (double, ...) bitcast (i32 (...)* @jd2fd to i32 (double, ...)*)(double %3)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8*
ret i8* %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t read_little_endian32(const uint8_t *array, uint64_t pos) {
  return *((uint32_t *)(array + pos));
}


x86 assembly (clang, -O0):
<read_little_endian32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_little_endian32>:
movslq %esi,%rax
mov    (%rdi,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @read_little_endian32(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 = sext i32 %6 to i64
%8 = getelementptr inbounds i32, i32* %5, i64 %7
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @read_little_endian32(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int sigwait(int /*<<< orphan*/ *, int *);
int test(void) {
  sigset_t set;
  int sig;
  int result;
  result = sigwait(&set, &sig);
  return result;
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <sigwait@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <sigwait@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 @sigwait(i32* %1, i32* %2)
store i32 %4, i32* %3
%5 = load i32, i32* %3
ret i32 %5
}

LLVM IR (-O2):
define i32 @test() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @sigwait(i32* %1, i32* %2)
ret i32 %5
}
int gasnete_coll_is_power_of_two(int num) {
  while ((num & 0x1) == 0)
    num = num >> 1;
  return ((num >> 1) == 0);
}


x86 assembly (clang, -O0):
<gasnete_coll_is_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1124 <gasnete_coll_is_power_of_two+0x24>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1107 <gasnete_coll_is_power_of_two+0x7>
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gasnete_coll_is_power_of_two>:
mov    %edi,%ecx
sar    %edi
test   $0x1,%cl
je     1100 <gasnete_coll_is_power_of_two>
xor    %eax,%eax
cmp    $0x2,%ecx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @gasnete_coll_is_power_of_two(i32 %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i32 [ %0, %1 ], [ %6, %2 ]
%4 = and i32 %3, 1
%5 = icmp eq i32 %4, 0
%6 = ashr i32 %3, 1
br i1 %5, label %2, label %7
7: ; preds = %2
%8 = icmp ult i32 %3, 2
%9 = zext i1 %8 to i32
ret i32 %9
}
/* Type definitions */
typedef int GLushort;
typedef int GLubyte;
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ assert(int);
GLdouble extractUshort(int isSwap, const void *uitem) {
  GLushort ushort;
  if (isSwap) {
    ushort = (GLushort)(((GLushort)((const GLubyte *)(uitem))[1]) << 8 |
                        ((const GLubyte *)(uitem))[0]);
  } else {
    ushort = *(const GLushort *)uitem;
  }
  assert(ushort <= 65535);
  return (GLdouble)ushort;
}


x86 assembly (clang, -O0):
<extractUshort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1141 <extractUshort+0x31>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%eax
shl    $0x8,%eax
mov    -0x10(%rbp),%rcx
or     (%rcx),%eax
mov    %eax,-0x14(%rbp)
jmp    114a <extractUshort+0x3a>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xffff,-0x14(%rbp)
setle  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extractUshort>:
push   %rbx
test   %edi,%edi
je     111f <extractUshort+0xf>
mov    0x4(%rsi),%ebx
shl    $0x8,%ebx
or     (%rsi),%ebx
jmp    1121 <extractUshort+0x11>
mov    (%rsi),%ebx
xor    %edi,%edi
cmp    $0x10000,%ebx
setl   %dil
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @extractUshort(i32 %0, i8* nocapture %1) {
%3 = icmp eq i32 %0, 0
%4 = bitcast i8* %1 to i32*
br i1 %3, label %12, label %5
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = shl i32 %8, 8
%10 = load i32, i32* %4
%11 = or i32 %9, %10
br label %14
12: ; preds = %2
%13 = load i32, i32* %4
br label %14
14: ; preds = %12, %5
%15 = phi i32 [ %11, %5 ], [ %13, %12 ]
%16 = icmp slt i32 %15, 65536
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
ret i32 %15
}
/* Variables and functions */
__attribute__((visibility("default"))) void *sd_bus_message_unref(void *m) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @sd_bus_message_unref(i8* nocapture readnone %0) {
ret i8* null
}
int file_close() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @file_close() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ puts(char *);
void print_vector(int *vec, int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d", vec[i]);
  }
  puts("\n");
}


x86 assembly (clang, -O0):
<print_vector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1167 <print_vector+0x47>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeac(%rip),%rdi
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1136 <print_vector+0x16>
lea    0xe95(%rip),%rdi
call   1030 <puts@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_vector>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1155 <print_vector+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xec5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_vector+0x20>
lea    0xea7(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @print_vector(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}
int lingot_audio_pulseaudio_register(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @lingot_audio_pulseaudio_register() {
ret i32 0
}
/* Variables and functions */
int strncmp(char const *, char const *, size_t);
int os_strncmp(const char *s1, const char *s2, size_t n) {
  return strncmp(s1, s2, n);
}


x86 assembly (clang, -O0):
<os_strncmp>:
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),%rdx
call   1030 <strncmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<os_strncmp>:
jmp    1030 <strncmp@plt>

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

LLVM IR (-O2):
define i32 @os_strncmp(i8* nocapture %0, i8* nocapture %1, i64 %2) {
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i64 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ print_on_level(int, char *);
int cr_plugin_init(void) {
  print_on_level((3), "Initialized ext mount c/r\n");
  return 0;
}


x86 assembly (clang, -O0):
<cr_plugin_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
lea    0xee0(%rip),%rsi
call   1030 <print_on_level@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cr_plugin_init>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x3,%edi
call   1030 <print_on_level@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Initialized ext mount c/r\0A\00"
define i32 @cr_plugin_init() {
%1 = call i32 @print_on_level(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"Initialized ext mount c/r\0A\00"
define i32 @cr_plugin_init() {
%1 = tail call i32 @print_on_level(i32 3, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int y(int n) { return (2 * -n); }


x86 assembly (clang, -O0):
<y>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
shl    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @y(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub nsw i32 0, %3
%5 = mul nsw i32 2, %4
ret i32 %5
}

LLVM IR (-O2):
define i32 @y(i32 %0) {
%2 = mul i32 %0, -2
ret i32 %2
}
/* Forward declarations */
typedef struct TYPE_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_4__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_3__ {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};
struct itimerval {
  TYPE_2__ it_value;
  TYPE_1__ it_interval;
};

/* Variables and functions */
int /*<<< orphan*/ ITIMER_REAL;
int /*<<< orphan*/ setitimer(int /*<<< orphan*/, struct itimerval *,
                             int /*<<< orphan*/ *);
void timer_stop() {
  struct itimerval timer;
  timer.it_interval.tv_sec = 0;
  timer.it_interval.tv_usec = 0;
  timer.it_value.tv_sec = 0;
  timer.it_value.tv_usec = 0;
  setitimer(ITIMER_REAL, &timer, NULL);
}


x86 assembly (clang, -O0):
<timer_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <setitimer@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_stop>:
sub    $0x28,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
xor    %edx,%edx
call   1030 <setitimer@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@ITIMER_REAL = global i32 0
define void @timer_stop() {
%1 = alloca %struct.itimerval
%2 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 1
%3 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %2, i32 0, i32 1
store i64 0, i64* %3
%4 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 1
%5 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
store i64 0, i64* %5
%6 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 0
%7 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %6, i32 0, i32 1
store i64 0, i64* %7
%8 = getelementptr inbounds %struct.itimerval, %struct.itimerval* %1, i32 0, i32 0
%9 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %8, i32 0, i32 0
store i64 0, i64* %9
%10 = load i32, i32* @ITIMER_REAL
%11 = call i32 @setitimer(i32 %10, %struct.itimerval* %1, i32* null)
ret void
}

LLVM IR (-O2):
%struct.itimerval = type { %struct.TYPE_4__, %struct.TYPE_3__ }
%struct.TYPE_4__ = type { i64, i64 }
%struct.TYPE_3__ = type { i64, i64 }
@ITIMER_REAL = global i32 0
define void @timer_stop() {
%1 = alloca %struct.itimerval
%2 = bitcast %struct.itimerval* %1 to i8*
%3 = bitcast %struct.itimerval* %1 to i8*
%4 = load i32, i32* @ITIMER_REAL
%5 = call i32 @setitimer(i32 %4, %struct.itimerval* %1, i32* null)
ret void
}
strlen(s) char *s;
{
  register int i;
  i = 0;
  while (*s++)
    i++;
  return (i);
}


x86 assembly (clang, -O0):
<strlen>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
cmpb   $0x0,(%rax)
je     1135 <strlen+0x35>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <strlen+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @strlen(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %12
}
int test_imm_B4uint64_highword_mem(unsigned long long *val) {
  return ((*val >> 32) & (0xB4 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B4uint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 32
%6 = and i64 %5, 180
%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_B4uint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 773094113280
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double min_caml_float_of_int(void *fv, int n) { return (double)n; }


x86 assembly (clang, -O0):
<min_caml_float_of_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<min_caml_float_of_int>:
cvtsi2sd %esi,%xmm0
ret

LLVM IR (-O0):
define double @min_caml_float_of_int(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
ret double %6
}

LLVM IR (-O2):
define double @min_caml_float_of_int(i8* nocapture readnone %0, i32 %1) {
%3 = sitofp i32 %1 to double
ret double %3
}
int is_little_endian() {
  short a = 0x1;
  return *(char *)&a == 0x1;
}


x86 assembly (clang, -O0):
<is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movw   $0x1,-0x2(%rbp)
movsbl -0x2(%rbp),%eax
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @is_little_endian() {
%1 = alloca i16
store i16 1, i16* %1
%2 = bitcast i16* %1 to i8*
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ IntDisable(int);
int /*<<< orphan*/ IntUnregister(int);
void LPCIntUnregister(unsigned long ulBase) {
  ;
  IntDisable(124);
  IntUnregister(124);
}


x86 assembly (clang, -O0):
<LPCIntUnregister>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x7c,%edi
call   1030 <IntDisable@plt>
mov    $0x7c,%edi
call   1040 <IntUnregister@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCIntUnregister>:
push   %rax
mov    $0x7c,%edi
call   1030 <IntDisable@plt>
mov    $0x7c,%edi
pop    %rax
jmp    1040 <IntUnregister@plt>

LLVM IR (-O0):
define void @LPCIntUnregister(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = call i32 @IntDisable(i32 124)
%4 = call i32 @IntUnregister(i32 124)
ret void
}

LLVM IR (-O2):
define void @LPCIntUnregister(i64 %0) {
%2 = tail call i32 @IntDisable(i32 124)
%3 = tail call i32 @IntUnregister(i32 124)
ret void
}
double omp_get_wtick(void) { return 0.0; }


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

x86 assembly (clang, -O2):
<omp_get_wtick>:
xorps  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @omp_get_wtick() {
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @omp_get_wtick() {
ret double 0.000000e+00
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test(char *);
int main(void) {
  test("tests/testdata/scanner_clean.txt");
  test("tests/testdata/scanner_dirty.txt");
  test("tests/testdata/scanner_large.txt");
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [33 x i8] c"tests/testdata/scanner_clean.txt\00"
@.str.1 = [33 x i8] c"tests/testdata/scanner_dirty.txt\00"
@.str.2 = [33 x i8] c"tests/testdata/scanner_large.txt\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}

LLVM IR (-O2):
@.str = [33 x i8] c"tests/testdata/scanner_clean.txt\00"
@.str.1 = [33 x i8] c"tests/testdata/scanner_dirty.txt\00"
@.str.2 = [33 x i8] c"tests/testdata/scanner_large.txt\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @test(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ printf(char *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int sd;
  sd = socket(AF_INET, SOCK_STREAM, 0);
  if (-1 == sd) {
    return -1;
  }
  printf("Socket created\n");
  close(sd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1050 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    $0xffffffff,%eax
cmp    -0x8(%rbp),%eax
jne    1175 <main+0x45>
movl   $0xffffffff,-0x4(%rbp)
jmp    1190 <main+0x60>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%edi
call   1040 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    0x2e95(%rip),%rax
mov    (%rax),%esi
xor    %ebx,%ebx
xor    %edx,%edx
call   1050 <socket@plt>
cmp    $0xffffffff,%eax
je     116a <main+0x3a>
mov    %eax,%ebp
lea    0xea4(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1040 <close@plt>
jmp    116f <main+0x3f>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@str = [15 x i8] c"Socket created\00"
define i32 @main() {
%1 = load i32, i32* @AF_INET
%2 = load i32, i32* @SOCK_STREAM
%3 = tail call i32 @socket(i32 %1, i32 %2, i32 0)
%4 = icmp eq i32 %3, -1
br i1 %4, label %8, label %5
5: ; preds = %0
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @close(i32 %3)
br label %8
8: ; preds = %0, %5
%9 = phi i32 [ 0, %5 ], [ -1, %0 ]
ret i32 %9
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ show_file_info(char *, struct stat *);
int stat(char *, struct stat *);
void dostat(char *filename) {
  struct stat info;
  if (stat(filename, &info) == -1)
    perror(filename);
  else
    show_file_info(filename, &info);
}


x86 assembly (clang, -O0):
<dostat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
jne    1160 <dostat+0x30>
mov    -0x8(%rbp),%rdi
call   1050 <perror@plt>
jmp    116d <dostat+0x3d>
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <show_file_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dostat>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
call   1040 <stat@plt>
cmp    $0xffffffff,%eax
je     115a <dostat+0x2a>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1030 <show_file_info@plt>
add    $0x10,%rsp
pop    %rbx
ret
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <perror@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
define void @dostat(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.stat
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @stat(i8* %4, %struct.stat* %3)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = call i32 @perror(i8* %8)
br label %13
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @show_file_info(i8* %11, %struct.stat* %3)
br label %13
13: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
define void @dostat(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i32 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @perror(i8* %0)
br label %10
8: ; preds = %1
%9 = call i32 @show_file_info(i8* %0, %struct.stat* %2)
br label %10
10: ; preds = %8, %6
ret void
}
int f(int *const p) { return *p; }


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

x86 assembly (clang, -O2):
<f>:
mov    (%rdi),%eax
ret

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

LLVM IR (-O2):
define i32 @f(i32* nocapture %0) {
%2 = load i32, i32* %0
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ verify_v3_kdf(char *, char *, char *, char *, char *);
void test_v3_kdf_Short_password(void) {
  verify_v3_kdf("Short password", "3", "thepassword", "0203040506070801",
                "0ea84f52 52310dc3 e3a7607c 33bfd1eb 580805fb 68293005 "
                "da21037c cf499626");
}


x86 assembly (clang, -O0):
<test_v3_kdf_Short_password>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
lea    0xeed(%rip),%rsi
lea    0xee8(%rip),%rdx
lea    0xeed(%rip),%rcx
lea    0xef7(%rip),%r8
call   1030 <verify_v3_kdf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_v3_kdf_Short_password>:
lea    0xee9(%rip),%rdi
lea    0xef1(%rip),%rsi
lea    0xeec(%rip),%rdx
lea    0xef1(%rip),%rcx
lea    0xefb(%rip),%r8
jmp    1030 <verify_v3_kdf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Short password\00"
@.str.1 = [2 x i8] c"3\00"
@.str.2 = [12 x i8] c"thepassword\00"
@.str.3 = [17 x i8] c"0203040506070801\00"
@.str.4 = [72 x i8] c"0ea84f52 52310dc3 e3a7607c 33bfd1eb 580805fb 68293005 da21037c cf499626\00"
define void @test_v3_kdf_Short_password() {
%1 = call i32 @verify_v3_kdf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Short password\00"
@.str.1 = [2 x i8] c"3\00"
@.str.2 = [12 x i8] c"thepassword\00"
@.str.3 = [17 x i8] c"0203040506070801\00"
@.str.4 = [72 x i8] c"0ea84f52 52310dc3 e3a7607c 33bfd1eb 580805fb 68293005 da21037c cf499626\00"
define void @test_v3_kdf_Short_password() {
%1 = tail call i32 @verify_v3_kdf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ srandom(int);
void initrand(int seed) { srandom(seed); }


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

x86 assembly (clang, -O2):
<initrand>:
jmp    1030 <srandom@plt>

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

LLVM IR (-O2):
define void @initrand(i32 %0) {
%2 = tail call i32 @srandom(i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cpuASLt();
int /*<<< orphan*/ cpuORA();
void cpuSLO() {
  cpuASLt();
  cpuORA();
}


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

x86 assembly (clang, -O2):
<cpuSLO>:
push   %rax
xor    %eax,%eax
call   1040 <cpuASLt@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <cpuORA@plt>

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

LLVM IR (-O2):
define void @cpuSLO() {
%1 = tail call i32 (...) @cpuASLt()
%2 = tail call i32 (...) @cpuORA()
ret void
}
unsigned short wimaxll_le16_to_cpu(unsigned short le16) {
  unsigned short cpu;
  cpu = le16;
  return cpu;
}


x86 assembly (clang, -O0):
<wimaxll_le16_to_cpu>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define zeroext i16 @wimaxll_le16_to_cpu(i16 returned zeroext %0) {
ret i16 %0
}
/* Variables and functions */
int /*<<< orphan*/ hook(char *);
void shutdown(void) { hook("shutdown() called inside weak-import."); }


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

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

LLVM IR (-O0):
@.str = [38 x i8] c"shutdown() called inside weak-import.\00"
define void @shutdown() {
%1 = call i32 @hook(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [38 x i8] c"shutdown() called inside weak-import.\00"
define void @shutdown() {
%1 = tail call i32 @hook(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ testequal(int, int);
int main() {
  {
    testequal(37, 10);
    testequal(45, 13);
    testequal(99, 28);
    testequal(85, 24);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x25,%edi
mov    $0xa,%esi
call   1030 <testequal@plt>
mov    $0x2d,%edi
mov    $0xd,%esi
call   1030 <testequal@plt>
mov    $0x63,%edi
mov    $0x1c,%esi
call   1030 <testequal@plt>
mov    $0x55,%edi
mov    $0x18,%esi
call   1030 <testequal@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x25,%edi
mov    $0xa,%esi
call   1030 <testequal@plt>
mov    $0x2d,%edi
mov    $0xd,%esi
call   1030 <testequal@plt>
mov    $0x63,%edi
mov    $0x1c,%esi
call   1030 <testequal@plt>
mov    $0x55,%edi
mov    $0x18,%esi
call   1030 <testequal@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @testequal(i32 37, i32 10)
%2 = call i32 @testequal(i32 45, i32 13)
%3 = call i32 @testequal(i32 99, i32 28)
%4 = call i32 @testequal(i32 85, i32 24)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @testequal(i32 37, i32 10)
%2 = tail call i32 @testequal(i32 45, i32 13)
%3 = tail call i32 @testequal(i32 99, i32 28)
%4 = tail call i32 @testequal(i32 85, i32 24)
ret i32 0
}
int f() {
  const int v;
  int w;
  w = v;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @f() {
ret i32 0
}