xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
void factor(double fx, double fy) {
  printf("&%d %d %d\n", (int)(fx * 4096 + 0.5), (int)(fy * 4096 + 0.5), 4096);
}


x86 assembly (clang, -O0):
<factor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xed1(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xecd(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%esi
movsd  -0x10(%rbp),%xmm0
movsd  0xeb0(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xeac(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edx
lea    0xea5(%rip),%rdi
mov    $0x1000,%ecx
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<factor>:
movsd  0xee8(%rip),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xee4(%rip),%xmm3
addsd  %xmm3,%xmm0
cvttsd2si %xmm0,%esi
mulsd  %xmm2,%xmm1
addsd  %xmm3,%xmm1
cvttsd2si %xmm1,%edx
lea    0xed1(%rip),%rdi
mov    $0x1000,%ecx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"&%d %d %d\0A\00"
define void @factor(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 = call double @llvm.fmuladd.f64(double %5, double 4.096000e+03, double 5.000000e-01)
%7 = fptosi double %6 to i32
%8 = load double, double* %4
%9 = call double @llvm.fmuladd.f64(double %8, double 4.096000e+03, double 5.000000e-01)
%10 = fptosi double %9 to i32
%11 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %7, i32 %10, i32 4096)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"&%d %d %d\0A\00"
define void @factor(double %0, double %1) {
%3 = tail call double @llvm.fmuladd.f64(double %0, double 4.096000e+03, double 5.000000e-01)
%4 = fptosi double %3 to i32
%5 = tail call double @llvm.fmuladd.f64(double %1, double 4.096000e+03, double 5.000000e-01)
%6 = fptosi double %5 to i32
%7 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %6, i32 4096)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ dot(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ float4(float, float, double, double);
float saturate(int /*<<< orphan*/);
float XOR(float xor_A, float xor_B) {
  return saturate(dot(float4(-xor_A, -xor_A, xor_A, xor_B),
                      float4(xor_B, xor_B, 1.0, 1.0)));
}


x86 assembly (clang, -O0):
<XOR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  -0x4(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
movss  -0x4(%rbp),%xmm2
cvtss2sd %xmm2,%xmm2
movss  -0x8(%rbp),%xmm3
cvtss2sd %xmm3,%xmm3
call   1040 <float4@plt>
mov    %eax,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movsd  0xe6e(%rip),%xmm3
movaps %xmm3,%xmm2
call   1040 <float4@plt>
mov    -0xc(%rbp),%edi
mov    %eax,%esi
call   1030 <dot@plt>
mov    %eax,%edi
call   1050 <saturate@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XOR>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm1,0xc(%rsp)
cvtss2sd %xmm0,%xmm2
xorps  0xeba(%rip),%xmm0
cvtss2sd %xmm1,%xmm3
movaps %xmm0,%xmm1
call   1040 <float4@plt>
mov    %eax,%ebx
movsd  0xeb4(%rip),%xmm2
movss  0xc(%rsp),%xmm0
movaps %xmm0,%xmm1
movaps %xmm2,%xmm3
call   1040 <float4@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <dot@plt>
mov    %eax,%edi
add    $0x10,%rsp
pop    %rbx
jmp    1050 <saturate@plt>

LLVM IR (-O0):
define float @XOR(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = fneg float %5
%7 = load float, float* %3
%8 = fneg float %7
%9 = load float, float* %3
%10 = fpext float %9 to double
%11 = load float, float* %4
%12 = fpext float %11 to double
%13 = call i32 @float4(float %6, float %8, double %10, double %12)
%14 = load float, float* %4
%15 = load float, float* %4
%16 = call i32 @float4(float %14, float %15, double 1.000000e+00, double 1.000000e+00)
%17 = call i32 @dot(i32 %13, i32 %16)
%18 = call float @saturate(i32 %17)
ret float %18
}

LLVM IR (-O2):
define float @XOR(float %0, float %1) {
%3 = fneg float %0
%4 = fpext float %0 to double
%5 = fpext float %1 to double
%6 = tail call i32 @float4(float %3, float %3, double %4, double %5)
%7 = tail call i32 @float4(float %1, float %1, double 1.000000e+00, double 1.000000e+00)
%8 = tail call i32 @dot(i32 %6, i32 %7)
%9 = tail call float @saturate(i32 %8)
ret float %9
}
/* Variables and functions */
int foo();
int compiler() { return foo(); }


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

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

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

LLVM IR (-O2):
define i32 @compiler() {
%1 = tail call i32 (...) @foo()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int nondet_int();
int main() {
  int i, n = nondet_int(), sn = 0;
  for (i = 1; i <= n - 2; i++) {
    sn = sn + (2);
  }
  assert(sn == n * (2) || sn == 0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <nondet_int@plt>
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x2,%ecx
cmp    %ecx,%eax
jg     116f <main+0x4f>
mov    -0x10(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1147 <main+0x27>
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%edx
shl    $0x1,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x11(%rbp)
je     118f <main+0x6f>
cmpl   $0x0,-0x10(%rbp)
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1030 <nondet_int@plt>
lea    (%rax,%rax,1),%ecx
cmp    $0x3,%eax
lea    -0x4(%rax,%rax,1),%eax
cmovl  %ebx,%eax
cmp    %ecx,%eax
sete   %cl
test   %eax,%eax
sete   %al
or     %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (...) @nondet_int()
store i32 %5, i32* %3
store i32 0, i32* %4
store i32 1, i32* %2
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = sub nsw i32 %8, 2
%10 = icmp sle i32 %7, %9
br i1 %10, label %11, label %17
11: ; preds = %6
%12 = load i32, i32* %4
%13 = add nsw i32 %12, 2
store i32 %13, i32* %4
br label %14
14: ; preds = %11
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %6
17: ; preds = %6
%18 = load i32, i32* %4
%19 = load i32, i32* %3
%20 = mul nsw i32 %19, 2
%21 = icmp eq i32 %18, %20
br i1 %21, label %25, label %22
22: ; preds = %17
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 0
br label %25
25: ; preds = %22, %17
%26 = phi i1 [ true, %17 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load i32, i32* %1
ret i32 %29
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @nondet_int()
%2 = icmp slt i32 %1, 3
%3 = shl i32 %1, 1
%4 = add i32 %3, -4
%5 = select i1 %2, i32 0, i32 %4
%6 = icmp eq i32 %5, %3
%7 = icmp eq i32 %5, 0
%8 = or i1 %6, %7
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
int /*<<< orphan*/ xnomem();
void *xmalloc(size_t size) {
  void *ptr;
  if (!(ptr = malloc(size)))
    xnomem();
  return (ptr);
}


x86 assembly (clang, -O0):
<xmalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    114a <xmalloc+0x2a>
mov    $0x0,%al
call   1040 <xnomem@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmalloc>:
push   %rbx
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1135 <xmalloc+0x15>
xor    %eax,%eax
call   1040 <xnomem@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @xmalloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %1
%8 = call i32 (...) @xnomem()
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %3
ret i8* %10
}

LLVM IR (-O2):
define noalias i8* @xmalloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @xnomem()
br label %6
6: ; preds = %4, %1
ret i8* %2
}
__attribute__((no, noclone)) void bar(const char *x, long long y) {
  asm volatile("" : : "r"(x), "r"(&y) : "memory");
  if (y != 0)
    __builtin_abort();
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
lea    -0x10(%rbp),%rcx
cmpq   $0x0,-0x10(%rbp)
je     1138 <bar+0x28>
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rax
mov    %rsi,(%rsp)
mov    %rsp,%rax
cmpq   $0x0,(%rsp)
jne    1121 <bar+0x11>
pop    %rax
ret
call   1030 <abort@plt>

LLVM IR (-O0):
define void @bar(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
unreachable
9: ; preds = %2
ret void
}

LLVM IR (-O2):
define void @bar(i8* %0, i64 %1) {
%3 = alloca i64
store i64 %1, i64* %3
%4 = load i64, i64* %3
%5 = icmp eq i64 %4, 0
br i1 %5, label %7, label %6
6: ; preds = %2
unreachable
7: ; preds = %2
ret void
}
/* Variables and functions */
char EOF;
char getchar();
int /*<<< orphan*/ lower(char);
int /*<<< orphan*/ putchar(int /*<<< orphan*/);
int main() {
  char c;
  while ((c = getchar()) != EOF)
    putchar(lower(c));
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e95(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     1173 <main+0x43>
movsbl -0x5(%rbp),%edi
call   1050 <lower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
jmp    113f <main+0xf>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea9(%rip),%rbx
cmp    (%rbx),%al
je     116a <main+0x3a>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1050 <lower@plt>
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%rbx),%al
jne    1150 <main+0x20>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@EOF = global i8 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
store i32 0, i32* %1
br label %3
3: ; preds = %9, %0
%4 = call signext i8 (...) @getchar()
store i8 %4, i8* %2
%5 = sext i8 %4 to i32
%6 = load i8, i8* @EOF
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %5, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i8, i8* %2
%11 = call i32 @lower(i8 signext %10)
%12 = call i32 @putchar(i32 %11)
br label %3
13: ; preds = %3
ret i32 1
}

LLVM IR (-O2):
@EOF = global i8 0
define i32 @main() {
%1 = tail call signext i8 (...) @getchar()
%2 = load i8, i8* @EOF
%3 = icmp eq i8 %1, %2
br i1 %3, label %11, label %4
4: ; preds = %0, %4
%5 = phi i8 [ %8, %4 ], [ %1, %0 ]
%6 = tail call i32 @lower(i8 signext %5)
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call signext i8 (...) @getchar()
%9 = load i8, i8* @EOF
%10 = icmp eq i8 %8, %9
br i1 %10, label %11, label %4
11: ; preds = %4, %0
ret i32 1
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void ip_set_dstaddr(uint8_t *p_ip, uint32_t addr) {
  p_ip[16] = (addr & 0xff000000) >> 24;
  p_ip[17] = (addr & 0x00ff0000) >> 16;
  p_ip[18] = (addr & 0x0000ff00) >> 8;
  p_ip[19] = (addr & 0x000000ff);
}


x86 assembly (clang, -O0):
<ip_set_dstaddr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x40(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff0000,%ecx
sar    $0x10,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x44(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x48(%rax)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4c(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ip_set_dstaddr>:
mov    %esi,%eax
mov    %esi,%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x18,%eax
mov    %eax,0x40(%rdi)
shr    $0x10,%ecx
movzbl %cl,%eax
mov    %eax,0x44(%rdi)
mov    %edx,0x48(%rdi)
mov    %esi,0x4c(%rdi)
ret

LLVM IR (-O0):
define void @ip_set_dstaddr(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = and i32 %5, -16777216
%7 = lshr i32 %6, 24
%8 = load i32*, i32** %3
%9 = getelementptr inbounds i32, i32* %8, i64 16
store i32 %7, i32* %9
%10 = load i32, i32* %4
%11 = and i32 %10, 16711680
%12 = ashr i32 %11, 16
%13 = load i32*, i32** %3
%14 = getelementptr inbounds i32, i32* %13, i64 17
store i32 %12, i32* %14
%15 = load i32, i32* %4
%16 = and i32 %15, 65280
%17 = ashr i32 %16, 8
%18 = load i32*, i32** %3
%19 = getelementptr inbounds i32, i32* %18, i64 18
store i32 %17, i32* %19
%20 = load i32, i32* %4
%21 = and i32 %20, 255
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 19
store i32 %21, i32* %23
ret void
}

LLVM IR (-O2):
define void @ip_set_dstaddr(i32* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = getelementptr inbounds i32, i32* %0, i64 16
store i32 %3, i32* %4
%5 = lshr i32 %1, 16
%6 = and i32 %5, 255
%7 = getelementptr inbounds i32, i32* %0, i64 17
store i32 %6, i32* %7
%8 = lshr i32 %1, 8
%9 = and i32 %8, 255
%10 = getelementptr inbounds i32, i32* %0, i64 18
store i32 %9, i32* %10
%11 = and i32 %1, 255
%12 = getelementptr inbounds i32, i32* %0, i64 19
store i32 %11, i32* %12
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fault_init();
int /*<<< orphan*/ pagetable_init();
int /*<<< orphan*/ physmem_init();
int /*<<< orphan*/ stats_init();
void init() {
  pagetable_init();
  physmem_init();
  stats_init();
  fault_init();
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <pagetable_init@plt>
mov    $0x0,%al
call   1040 <physmem_init@plt>
mov    $0x0,%al
call   1030 <stats_init@plt>
mov    $0x0,%al
call   1060 <fault_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rax
xor    %eax,%eax
call   1050 <pagetable_init@plt>
xor    %eax,%eax
call   1040 <physmem_init@plt>
xor    %eax,%eax
call   1030 <stats_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1060 <fault_init@plt>

LLVM IR (-O0):
define void @init() {
%1 = call i32 (...) @pagetable_init()
%2 = call i32 (...) @physmem_init()
%3 = call i32 (...) @stats_init()
%4 = call i32 (...) @fault_init()
ret void
}

LLVM IR (-O2):
define void @init() {
%1 = tail call i32 (...) @pagetable_init()
%2 = tail call i32 (...) @physmem_init()
%3 = tail call i32 (...) @stats_init()
%4 = tail call i32 (...) @fault_init()
ret void
}
void ft_get_values(int *data, int *min, int *max) {
  *min = data[0];
  *max = data[1];
}


x86 assembly (clang, -O0):
<ft_get_values>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_get_values>:
mov    (%rdi),%eax
mov    %eax,(%rsi)
mov    0x4(%rdi),%eax
mov    %eax,(%rdx)
ret

LLVM IR (-O0):
define void @ft_get_values(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 0
%9 = load i32, i32* %8
%10 = load i32*, i32** %5
store i32 %9, i32* %10
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 1
%13 = load i32, i32* %12
%14 = load i32*, i32** %6
store i32 %13, i32* %14
ret void
}

LLVM IR (-O2):
define void @ft_get_values(i32* nocapture %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %0
store i32 %4, i32* %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
store i32 %6, i32* %2
ret void
}
/* Variables and functions */
scalar_t__ f(long);
double Sum(long n, int thread_count) {
  double approx = 0.0;
  long i;
#pragma omp parallel for num_threads(thread_count) reduction(+: approx) schedule(runtime)
  for (i = 0; i <= n; i++) {
    approx += f(i);
  }
  return approx;
}


x86 assembly (clang, -O0):
<Sum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x8(%rbp),%rax
jg     1166 <Sum+0x56>
mov    -0x20(%rbp),%rdi
call   1030 <f@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    112f <Sum+0x1f>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Sum>:
push   %r14
push   %rbx
push   %rax
test   %rdi,%rdi
js     1163 <Sum+0x53>
mov    %rdi,%r14
add    $0x1,%r14
xorps  %xmm0,%xmm0
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
call   1030 <f@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  (%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  (%rsp),%xmm0
add    $0x1,%rbx
cmp    %rbx,%r14
jne    1130 <Sum+0x20>
jmp    1166 <Sum+0x56>
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @Sum(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca double
%6 = alloca i64
store i64 %0, i64* %3
store i32 %1, i32* %4
store double 0.000000e+00, double* %5
store i64 0, i64* %6
br label %7
7: ; preds = %17, %2
%8 = load i64, i64* %6
%9 = load i64, i64* %3
%10 = icmp sle i64 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i64, i64* %6
%13 = call i64 @f(i64 %12)
%14 = sitofp i64 %13 to double
%15 = load double, double* %5
%16 = fadd double %15, %14
store double %16, double* %5
br label %17
17: ; preds = %11
%18 = load i64, i64* %6
%19 = add nsw i64 %18, 1
store i64 %19, i64* %6
br label %7
20: ; preds = %7
%21 = load double, double* %5
ret double %21
}

LLVM IR (-O2):
define double @Sum(i64 %0, i32 %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 0, %2 ]
%6 = phi double [ %9, %4 ], [ 0.000000e+00, %2 ]
%7 = tail call i64 @f(i64 %5)
%8 = sitofp i64 %7 to double
%9 = fadd double %6, %8
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %5, %0
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = phi double [ 0.000000e+00, %2 ], [ %9, %4 ]
ret double %13
}
int RANGE(int Min, int Val, int Max) { return Min <= Val && Val <= Max; }


x86 assembly (clang, -O0):
<RANGE>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0xd(%rbp)
jg     112a <RANGE+0x2a>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RANGE>:
cmp    %esi,%edi
setle  %al
cmp    %edx,%esi
setle  %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @RANGE(i32 %0, i32 %1, i32 %2) {
%4 = icmp sle i32 %0, %1
%5 = icmp sle i32 %1, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
ret i32 %7
}
void Ctypes_hook_wr_sgn_s32(void) {}


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

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

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

LLVM IR (-O2):
define void @Ctypes_hook_wr_sgn_s32() {
ret void
}
int test_imm_77uint64_lowword_mem(unsigned long long *val) {
  return ((*val) & (0x77 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_77uint64_lowword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = and i64 %4, 119
%6 = icmp ne i64 %5, 0
%7 = zext i1 %6 to i64
%8 = select i1 %6, i32 -20, i32 -40
ret i32 %8
}

LLVM IR (-O2):
define i32 @test_imm_77uint64_lowword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 119
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double r17(void *x) { return *(double *)(x + 32751); }


x86 assembly (clang, -O0):
<r17>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x7fef(%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<r17>:
movsd  0x7fef(%rdi),%xmm0
ret

LLVM IR (-O0):
define double @r17(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 32751
%5 = bitcast i8* %4 to double*
%6 = load double, double* %5
ret double %6
}

LLVM IR (-O2):
define double @r17(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32751
%3 = bitcast i8* %2 to double*
%4 = load double, double* %3
ret double %4
}
/* Variables and functions */
int O_CREAT;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int open(char const *, int, int);
int /*<<< orphan*/ utime(char const *, int /*<<< orphan*/ *);
void touch_file(const char *filename) {
  int fd;
  fd = open(filename, O_WRONLY | O_CREAT, 0666);
  if (fd >= 0) {
    utime(filename, NULL);
    close(fd);
  }
}


x86 assembly (clang, -O0):
<touch_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
mov    0x2ea8(%rip),%rax
or     (%rax),%esi
mov    $0x1b6,%edx
call   1050 <open@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jl     117e <touch_file+0x4e>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <utime@plt>
mov    -0xc(%rbp),%edi
call   1040 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<touch_file>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2e93(%rip),%rax
mov    0x2eb4(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
mov    $0x1b6,%edx
call   1050 <open@plt>
test   %eax,%eax
js     116f <touch_file+0x3f>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <utime@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <close@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
define void @touch_file(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i32, i32* @O_WRONLY
%6 = load i32, i32* @O_CREAT
%7 = or i32 %5, %6
%8 = call i32 @open(i8* %4, i32 %7, i32 438)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %1
%12 = load i8*, i8** %2
%13 = call i32 @utime(i8* %12, i32* null)
%14 = load i32, i32* %3
%15 = call i32 @close(i32 %14)
br label %16
16: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
define void @touch_file(i8* nocapture %0) {
%2 = load i32, i32* @O_WRONLY
%3 = load i32, i32* @O_CREAT
%4 = or i32 %3, %2
%5 = tail call i32 @open(i8* %0, i32 %4, i32 438)
%6 = icmp sgt i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = tail call i32 @utime(i8* %0, i32* null)
%9 = tail call i32 @close(i32 %5)
br label %10
10: ; preds = %7, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void h3(char *str) { printf("<H3>%s</H3>\n", str); }


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

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

LLVM IR (-O0):
@.str = [13 x i8] c"<H3>%s</H3>\0A\00"
define void @h3(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"<H3>%s</H3>\0A\00"
define void @h3(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int _Z22jtagatlantic_get_errorPPKc(char const **);
int jtagatlantic_get_error(const char **other_info) {
  return _Z22jtagatlantic_get_errorPPKc(other_info);
}


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

x86 assembly (clang, -O2):
<jtagatlantic_get_error>:
jmp    1030 <_Z22jtagatlantic_get_errorPPKc@plt>

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

LLVM IR (-O2):
define i32 @jtagatlantic_get_error(i8** %0) {
%2 = tail call i32 @_Z22jtagatlantic_get_errorPPKc(i8** %0)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ gui_term();
int /*<<< orphan*/ stderr;
void signal_handler(int sig) {
  gui_term();
  fprintf(stderr, "Caught signal %d. Bye!\n", sig);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<signal_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <gui_term@plt>
mov    0x2e97(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xeab(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<signal_handler>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1040 <gui_term@plt>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xeb6(%rip),%rsi
mov    %ebx,%edx
call   1030 <fprintf@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"Caught signal %d. Bye!\0A\00"
@EXIT_FAILURE = global i32 0
define void @signal_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (...) @gui_term()
%4 = load i32, i32* @stderr
%5 = load i32, i32* %2
%6 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* @EXIT_FAILURE
%8 = call i32 @exit(i32 %7)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"Caught signal %d. Bye!\0A\00"
@EXIT_FAILURE = global i32 0
define void @signal_handler(i32 %0) {
%2 = tail call i32 (...) @gui_term()
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %0)
%5 = load i32, i32* @EXIT_FAILURE
%6 = tail call i32 @exit(i32 %5)
unreachable
}
char *vallocate(size)
unsigned size;
{
  char *p, buf[60];
  if ((p = (char *)malloc(size)) == (char *)0) {
    sprintf(buf, "vallocate: request for %d bytes returned NULL", size);
    verror(buf);
  }
  return (p);
}


x86 assembly (clang, -O0):
<vallocate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1173 <vallocate+0x43>
lea    -0x50(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe9f(%rip),%rsi
mov    $0x0,%al
call   1040 <sprintf@plt>
lea    -0x50(%rbp),%rdi
mov    $0x0,%al
call   1050 <verror@plt>
mov    -0x10(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vallocate>:
push   %rbp
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    %edi,%ebp
mov    %edi,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1169 <vallocate+0x39>
lea    0xeb0(%rip),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    %ebp,%edx
xor    %eax,%eax
call   1040 <sprintf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <verror@plt>
mov    %rbx,%rax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [46 x i8] c"vallocate: request for %d bytes returned NULL\00"
define i8* @vallocate(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [60 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = call i8* @malloc(i64 %6)
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %15
9: ; preds = %1
%10 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%11 = load i32, i32* %2
%12 = call i32 (i8*, i8*, ...) @sprintf(i8* %10, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [60 x i8], [60 x i8]* %4, i64 0, i64 0
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @verror to i32 (i8*, ...)*)(i8* %13)
br label %15
15: ; preds = %9, %1
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [46 x i8] c"vallocate: request for %d bytes returned NULL\00"
define i8* @vallocate(i32 %0) {
%2 = alloca [60 x i8]
%3 = getelementptr inbounds [60 x i8], [60 x i8]* %2, i64 0, i64 0
%4 = zext i32 %0 to i64
%5 = tail call i8* @malloc(i64 %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 (i8*, i8*, ...) @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0)
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @verror to i32 (i8*, ...)*)(i8* %3)
br label %10
10: ; preds = %7, %1
ret i8* %5
}
int unw_prepare(int core_fd) { return -1; }


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

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

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

LLVM IR (-O2):
define i32 @unw_prepare(i32 %0) {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ e_absx();
int /*<<< orphan*/ e_eor();
void e_eor_absx() {
  e_absx();
  e_eor();
}


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

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

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

LLVM IR (-O2):
define void @e_eor_absx() {
%1 = tail call i32 (...) @e_absx()
%2 = tail call i32 (...) @e_eor()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ F_DUPFD;
int fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int __dup(int fd) { return fcntl(fd, F_DUPFD, 0); }


x86 assembly (clang, -O0):
<__dup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1030 <fcntl@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__dup>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
jmp    1030 <fcntl@plt>

LLVM IR (-O0):
@F_DUPFD = global i32 0
define i32 @__dup(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @F_DUPFD
%5 = call i32 @fcntl(i32 %3, i32 %4, i32 0)
ret i32 %5
}

LLVM IR (-O2):
@F_DUPFD = global i32 0
define i32 @__dup(i32 %0) {
%2 = load i32, i32* @F_DUPFD
%3 = tail call i32 @fcntl(i32 %0, i32 %2, i32 0)
ret i32 %3
}
void g_ptr_array_remove_range() {}


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

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

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

LLVM IR (-O2):
define void @g_ptr_array_remove_range() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *dlopen(const char *filename, int flag) { abort(); }


x86 assembly (clang, -O0):
<dlopen>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<dlopen>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @dlopen(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define noalias i8* @dlopen(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 (...) @abort()
unreachable
}
int testLib3ImpDep(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @testLib3ImpDep() {
ret i32 0
}
char *skip_line(const char *p) {
  while ((*p != '\0') && (*p != '\n')) {
    p++;
  }
  if (*p != '\0') {
    p++;
  }
  return (char *)p;
}


x86 assembly (clang, -O0):
<skip_line>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x9(%rbp)
je     112d <skip_line+0x2d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
test   $0x1,%al
jne    113d <skip_line+0x3d>
jmp    114e <skip_line+0x4e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1108 <skip_line+0x8>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     116a <skip_line+0x6a>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_line>:
mov    %rdi,%rax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movzbl (%rax),%ecx
test   %cl,%cl
je     1122 <skip_line+0x22>
cmp    $0xa,%cl
je     1122 <skip_line+0x22>
add    $0x1,%rax
jmp    1110 <skip_line+0x10>
cmp    $0x1,%cl
sbb    $0xffffffffffffffff,%rax
ret

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

LLVM IR (-O2):
define i8* @skip_line(i8* %0) {
br label %2
2: ; preds = %5, %1
%3 = phi i8* [ %0, %1 ], [ %6, %5 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %7
i8 10, label %7
]
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
7: ; preds = %2, %2
%8 = icmp ne i8 %4, 0
%9 = zext i1 %8 to i64
%10 = getelementptr i8, i8* %3, i64 %9
ret i8* %10
}
void print_uart0(const char *s) {
  volatile unsigned int *uart_dr = (unsigned int *)(0x101f1000 + 0x00);
  volatile unsigned int *uart_fr = (unsigned int *)(0x101f1000 + 0x18);
  while (*s != '\0') {
    while ((*uart_fr) & (1 << 5))
      ;
    *uart_dr = (unsigned int)(*s);
    s++;
  }
}


x86 assembly (clang, -O0):
<print_uart0>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    $0x101f1000,%eax
mov    %rax,-0x10(%rbp)
mov    $0x101f1018,%eax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1164 <print_uart0+0x64>
jmp    112f <print_uart0+0x2f>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     1146 <print_uart0+0x46>
jmp    112f <print_uart0+0x2f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111a <print_uart0+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_uart0>:
mov    (%rdi),%al
test   %al,%al
je     1133 <print_uart0+0x33>
cs nopw 0x0(%rax,%rax,1)
testl  $0x20,0x101f1018
jne    1110 <print_uart0+0x10>
movsbl %al,%eax
mov    %eax,0x101f1000
movzbl 0x1(%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <print_uart0+0x10>
ret

LLVM IR (-O0):
define void @print_uart0(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
%4 = alloca i32*
store i8* %0, i8** %2
store i32* inttoptr (i64 270471168 to i32*), i32** %3
store i32* inttoptr (i64 270471192 to i32*), i32** %4
br label %5
5: ; preds = %17, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %24
10: ; preds = %5
br label %11
11: ; preds = %16, %10
%12 = load i32*, i32** %4
%13 = load volatile i32, i32* %12
%14 = and i32 %13, 32
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %11
br label %11
17: ; preds = %11
%18 = load i8*, i8** %2
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = load i32*, i32** %3
store volatile i32 %20, i32* %21
%22 = load i8*, i8** %2
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %2
br label %5
24: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @print_uart0(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %11
%5 = phi i8 [ %14, %11 ], [ %2, %1 ]
%6 = phi i8* [ %13, %11 ], [ %0, %1 ]
br label %7
7: ; preds = %4, %7
%8 = load volatile i32, i32* inttoptr (i64 270471192 to i32*)
%9 = and i32 %8, 32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %7
11: ; preds = %7
%12 = sext i8 %5 to i32
store volatile i32 %12, i32* inttoptr (i64 270471168 to i32*)
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %11, %1
ret void
}
unsigned int bdd_nextpower(unsigned int v) {
  v--;
  v |= v >> 1;
  v |= v >> 2;
  v |= v >> 4;
  v |= v >> 8;
  v |= v >> 16;
  return v + 1;
}


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

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

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

LLVM IR (-O2):
define i32 @bdd_nextpower(i32 %0) {
%2 = add i32 %0, -1
%3 = lshr i32 %2, 1
%4 = or i32 %3, %2
%5 = lshr i32 %4, 2
%6 = or i32 %5, %4
%7 = lshr i32 %6, 4
%8 = or i32 %7, %6
%9 = lshr i32 %8, 8
%10 = or i32 %9, %8
%11 = lshr i32 %10, 16
%12 = or i32 %11, %10
%13 = add i32 %12, 1
ret i32 %13
}
/* Variables and functions */
#define AF_INET 129
#define AF_INET6 128
const char *rd_family2str(int af) {
  switch (af) {
  case AF_INET:
    return "inet";
  case AF_INET6:
    return "inet6";
  default:
    return "af?";
  };
}


x86 assembly (clang, -O0):
<rd_family2str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x80,%eax
je     1140 <rd_family2str+0x40>
jmp    111d <rd_family2str+0x1d>
mov    -0x10(%rbp),%eax
sub    $0x81,%eax
jne    1150 <rd_family2str+0x50>
jmp    1130 <rd_family2str+0x30>
lea    0xec9(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <rd_family2str+0x5b>
lea    0xebe(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    115b <rd_family2str+0x5b>
lea    0xeb4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rd_family2str>:
cmp    $0x80,%edi
lea    0xef8(%rip),%rax
lea    0xef7(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x81,%edi
lea    0xedb(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"inet\00"
@.str.1 = [6 x i8] c"inet6\00"
@.str.2 = [4 x i8] c"af?\00"
define i8* @rd_family2str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %7 [
i32 129, label %5
i32 128, label %6
]
5: ; preds = %1
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
6: ; preds = %1
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %8
7: ; preds = %1
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %6, %5
%9 = load i8*, i8** %2
ret i8* %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"inet\00"
@.str.1 = [6 x i8] c"inet6\00"
@.str.2 = [4 x i8] c"af?\00"
define i8* @rd_family2str(i32 %0) {
%2 = icmp eq i32 %0, 128
%3 = select i1 %2, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0)
%4 = icmp eq i32 %0, 129
%5 = select i1 %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %3
ret i8* %5
}
extern void put_fs_byte(char val, char *addr) {
  __asm__("movb %0,%%fs:%1" ::"r"(val), "m"(*addr));
}


x86 assembly (clang, -O0):
<put_fs_byte>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x1(%rbp),%al
mov    -0x10(%rbp),%rcx
mov    %al,%fs:(%rcx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<put_fs_byte>:
mov    %dil,%fs:(%rsi)
ret

LLVM IR (-O0):
define void @put_fs_byte(i8 signext %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
ret void
}

LLVM IR (-O2):
define void @put_fs_byte(i8 signext %0, i8* %1) {
tail call void asm sideeffect "movb $0,%fs:$1", "r,*m,~{dirflag},~{fpsr},~{flags}"(i8 %0, i8* elementtype(i8) %1)
ret void
}
/* Variables and functions */
int atexit(void (*)());
int __mp_atexit(void (*f)(void)) {
  if (atexit(f) == -1)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<__mp_atexit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1150 <atexit>
cmp    $0xffffffff,%eax
jne    113a <__mp_atexit+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    1141 <__mp_atexit+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
nopw   0x0(%rax,%rax,1)

x86 assembly (clang, -O2):
<__mp_atexit>:
push   %rax
call   1130 <atexit>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)

LLVM IR (-O0):
define i32 @__mp_atexit(void ()* %0) {
%2 = alloca i32
%3 = alloca void ()*
store void ()* %0, void ()** %3
%4 = load void ()*, void ()** %3
%5 = bitcast void ()* %4 to void (...)*
%6 = call i32 @atexit(void (...)* %5)
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %10
9: ; preds = %1
store i32 1, i32* %2
br label %10
10: ; preds = %9, %8
%11 = load i32, i32* %2
ret i32 %11
}

LLVM IR (-O2):
define i32 @__mp_atexit(void ()* %0) {
%2 = bitcast void ()* %0 to void (...)*
%3 = tail call i32 @atexit(void (...)* %2)
%4 = icmp ne i32 %3, -1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
float acos(int /*<<< orphan*/);
int /*<<< orphan*/ f_clamp(float, int, int);
float f_acos(float x) { return acos(f_clamp(x, -1, 1)); }


x86 assembly (clang, -O0):
<f_acos>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1040 <f_clamp@plt>
mov    %eax,%edi
call   1030 <acos@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_acos>:
push   %rax
mov    $0xffffffff,%edi
mov    $0x1,%esi
call   1040 <f_clamp@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <acos@plt>

LLVM IR (-O0):
define float @f_acos(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @f_clamp(float %3, i32 -1, i32 1)
%5 = call float @acos(i32 %4)
ret float %5
}

LLVM IR (-O2):
define float @f_acos(float %0) {
%2 = tail call i32 @f_clamp(float %0, i32 -1, i32 1)
%3 = tail call float @acos(i32 %2)
ret float %3
}