xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint64_t;

/* Variables and functions */
int popcount_32(int);
int popcount_64(uint64_t v) { return popcount_32(v >> 32) + popcount_32(v); }


x86 assembly (clang, -O0):
<popcount_64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x20,%ecx
sar    %cl,%edi
call   1030 <popcount_32@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <popcount_32@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<popcount_64>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
call   1030 <popcount_32@plt>
mov    %eax,%ebp
mov    %ebx,%edi
call   1030 <popcount_32@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @popcount_64(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = ashr i32 %3, 32
%5 = call i32 @popcount_32(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @popcount_32(i32 %6)
%8 = add nsw i32 %5, %7
ret i32 %8
}

LLVM IR (-O2):
define i32 @popcount_64(i32 %0) {
%2 = tail call i32 @popcount_32(i32 poison)
%3 = tail call i32 @popcount_32(i32 %0)
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
int bar_getfrob(int);
int getfrob() { return bar_getfrob(2); }


x86 assembly (clang, -O0):
<getfrob>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1030 <bar_getfrob@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getfrob>:
mov    $0x2,%edi
jmp    1030 <bar_getfrob@plt>

LLVM IR (-O0):
define i32 @getfrob() {
%1 = call i32 @bar_getfrob(i32 2)
ret i32 %1
}

LLVM IR (-O2):
define i32 @getfrob() {
%1 = tail call i32 @bar_getfrob(i32 2)
ret i32 %1
}
int fun883() { return 883; }


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

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

LLVM IR (-O0):
define i32 @fun883() {
ret i32 883
}

LLVM IR (-O2):
define i32 @fun883() {
ret i32 883
}
char *strcpy(char *dst, const char *src) {
  char *odst = dst;
  while ((*(dst++) = *(src++)))
    ;
  return odst;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

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

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
int ge(int x) { return x >= 0; }


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

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

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

LLVM IR (-O2):
define i32 @ge(i32 %0) {
%2 = xor i32 %0, -1
%3 = lshr i32 %2, 31
ret i32 %3
}
int test_imm_10uint64_highword_reg(unsigned long long val) {
  return ((val >> 32) & (0x10 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_10uint64_highword_reg>:
bt     $0x24,%rdi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmovae %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_10uint64_highword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = lshr i64 %3, 32
%5 = and i64 %4, 16
%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_10uint64_highword_reg(i64 %0) {
%2 = and i64 %0, 68719476736
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
int main() {
  fprintf(stdout, "Olá mundo\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
lea    0xed1(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [12 x i8] c"Ol\C3\A1 mundo\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = load i32, i32* @stdout
%3 = call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [12 x i8] c"Ol\C3\A1 mundo\0A\00"
define i32 @main() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
double foo(double x, double y) { return !__builtin_isunordered(x, y) ? x : y; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jp     112d <foo+0x2d>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1137 <foo+0x37>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
movapd %xmm0,%xmm2
cmpordsd %xmm1,%xmm2
andpd  %xmm2,%xmm0
andnpd %xmm1,%xmm2
orpd   %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @foo(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fcmp uno double %5, %6
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = load double, double* %3
br label %12
10: ; preds = %2
%11 = load double, double* %4
br label %12
12: ; preds = %10, %8
%13 = phi double [ %9, %8 ], [ %11, %10 ]
ret double %13
}

LLVM IR (-O2):
define double @foo(double %0, double %1) {
%3 = fcmp ord double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void next_2n(int v) {
  int r;
  if (v > 1) {
    float f = (float)v;
    unsigned int const t = 1U << ((*(unsigned int *)&f >> 23) - 0x7f);
    r = t << (t < v);
  } else {
    r = 1;
  }
  printf("%d -> %d\n", v, r);
}


x86 assembly (clang, -O0):
<next_2n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    115e <next_2n+0x4e>
cvtsi2ssl -0x4(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
shr    $0x17,%ecx
sub    $0x7f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x10(%rbp),%ecx
cmp    -0x4(%rbp),%ecx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
shl    %cl,%eax
mov    %eax,-0x8(%rbp)
jmp    1165 <next_2n+0x55>
movl   $0x1,-0x8(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<next_2n>:
mov    %edi,%esi
mov    $0x1,%edx
cmp    $0x2,%edi
jl     1138 <next_2n+0x28>
cvtsi2ss %esi,%xmm0
movd   %xmm0,%ecx
shr    $0x17,%ecx
add    $0x81,%cl
mov    $0x1,%edx
shl    %cl,%edx
cmp    %esi,%edx
setb   %cl
shl    %cl,%edx
lea    0xec1(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"%d -> %d\0A\00"
define void @next_2n(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = icmp sgt i32 %6, 1
br i1 %7, label %8, label %22
8: ; preds = %1
%9 = load i32, i32* %2
%10 = sitofp i32 %9 to float
store float %10, float* %4
%11 = bitcast float* %4 to i32*
%12 = load i32, i32* %11
%13 = lshr i32 %12, 23
%14 = sub i32 %13, 127
%15 = shl i32 1, %14
store i32 %15, i32* %5
%16 = load i32, i32* %5
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = icmp ult i32 %17, %18
%20 = zext i1 %19 to i32
%21 = shl i32 %16, %20
store i32 %21, i32* %3
br label %23
22: ; preds = %1
store i32 1, i32* %3
br label %23
23: ; preds = %22, %8
%24 = load i32, i32* %2
%25 = load i32, i32* %3
%26 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d -> %d\0A\00"
define void @next_2n(i32 %0) {
%2 = icmp sgt i32 %0, 1
br i1 %2, label %3, label %12
3: ; preds = %1
%4 = sitofp i32 %0 to float
%5 = bitcast float %4 to i32
%6 = lshr i32 %5, 23
%7 = add nsw i32 %6, -127
%8 = shl nuw i32 1, %7
%9 = icmp ult i32 %8, %0
%10 = zext i1 %9 to i32
%11 = shl i32 %8, %10
br label %12
12: ; preds = %1, %3
%13 = phi i32 [ %11, %3 ], [ 1, %1 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %13)
ret void
}
void l2x0_pmu_resume(void) {}


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

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

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

LLVM IR (-O2):
define void @l2x0_pmu_resume() {
ret void
}
/* Variables and functions */
double log(int);
double log10(double x) { return log(x) / log(10); }


x86 assembly (clang, -O0):
<log10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
cvttsd2si -0x8(%rbp),%edi
call   1030 <log@plt>
movsd  %xmm0,-0x10(%rbp)
mov    $0xa,%edi
call   1030 <log@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log10>:
push   %rax
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  %xmm0,(%rsp)
mov    $0xa,%edi
call   1030 <log@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @log10(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fptosi double %3 to i32
%5 = call double @log(i32 %4)
%6 = call double @log(i32 10)
%7 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @log10(double %0) {
%2 = fptosi double %0 to i32
%3 = tail call double @log(i32 %2)
%4 = tail call double @log(i32 10)
%5 = fdiv double %3, %4
ret double %5
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void BadMalloc() {
  fprintf(stderr, "\nError: Unable to allocate memory.");
  fprintf(stderr, "\nTerminating program.");
  exit(0);
}


x86 assembly (clang, -O0):
<BadMalloc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<BadMalloc>:
push   %rbx
mov    0x2eb8(%rip),%rbx
mov    (%rbx),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    (%rbx),%edi
lea    0xee4(%rip),%rsi
call   1030 <fprintf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError: Unable to allocate memory.\00"
@.str.1 = [22 x i8] c"\0ATerminating program.\00"
define void @BadMalloc() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"\0AError: Unable to allocate memory.\00"
@.str.1 = [22 x i8] c"\0ATerminating program.\00"
define void @BadMalloc() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ ZLIBH_decompress(char *, char const *);
size_t BMK_ZLIBH_decompress(void *dest, size_t originalSize,
                            const void *compressed, size_t cSize) {
  (void)cSize;
  ZLIBH_decompress((char *)dest, (const char *)compressed);
  return originalSize;
}


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

x86 assembly (clang, -O2):
<BMK_ZLIBH_decompress>:
push   %rbx
mov    %rsi,%rbx
mov    %rdx,%rsi
call   1030 <ZLIBH_decompress@plt>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @BMK_ZLIBH_decompress(i8* %0, i64 returned %1, i8* %2, i64 %3) {
%5 = tail call i32 @ZLIBH_decompress(i8* %0, i8* %2)
ret i64 %1
}
double *sub2(double *x, unsigned n) { return x - n; }


x86 assembly (clang, -O0):
<sub2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
xor    %ecx,%ecx
sub    %rdx,%rcx
shl    $0x3,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sub2>:
mov    %rdi,%rax
mov    %esi,%ecx
shl    $0x3,%rcx
sub    %rcx,%rax
ret

LLVM IR (-O0):
define double* @sub2(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%5 = load double*, double** %3
%6 = load i32, i32* %4
%7 = zext i32 %6 to i64
%8 = sub i64 0, %7
%9 = getelementptr inbounds double, double* %5, i64 %8
ret double* %9
}

LLVM IR (-O2):
define double* @sub2(double* readnone %0, i32 %1) {
%3 = zext i32 %1 to i64
%4 = sub nsw i64 0, %3
%5 = getelementptr inbounds double, double* %0, i64 %4
ret double* %5
}
/* Type definitions */
struct geometry_struct {
  int dummy;
};

/* Variables and functions */
int box_overlaps_sphere(struct geometry_struct *, struct geometry_struct *);
int sphere_overlaps_box(struct geometry_struct *geometry_sph,
                        struct geometry_struct *geometry_box) {
  return box_overlaps_sphere(geometry_box, geometry_sph);
}


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

x86 assembly (clang, -O2):
<sphere_overlaps_box>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %rax,%rsi
jmp    1030 <box_overlaps_sphere@plt>

LLVM IR (-O0):
%struct.geometry_struct = type { i32 }
define i32 @sphere_overlaps_box(%struct.geometry_struct* %0, %struct.geometry_struct* %1) {
%3 = alloca %struct.geometry_struct*
%4 = alloca %struct.geometry_struct*
store %struct.geometry_struct* %0, %struct.geometry_struct** %3
store %struct.geometry_struct* %1, %struct.geometry_struct** %4
%5 = load %struct.geometry_struct*, %struct.geometry_struct** %4
%6 = load %struct.geometry_struct*, %struct.geometry_struct** %3
%7 = call i32 @box_overlaps_sphere(%struct.geometry_struct* %5, %struct.geometry_struct* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.geometry_struct = type { i32 }
define i32 @sphere_overlaps_box(%struct.geometry_struct* %0, %struct.geometry_struct* %1) {
%3 = tail call i32 @box_overlaps_sphere(%struct.geometry_struct* %1, %struct.geometry_struct* %0)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ MYSQL;

/* Variables and functions */
int mysql_errno(int /*<<< orphan*/ *);
char *mysql_error(int /*<<< orphan*/ *);
scalar_t__ mysql_query(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, int, char *);
void createDb(MYSQL *connection) {
  if (mysql_query(connection, "CREATE DATABASE benchmark")) {
    printf("createDb::Error %u: %s\n", mysql_errno(connection),
           mysql_error(connection));
  }
}


x86 assembly (clang, -O0):
<createDb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xea9(%rip),%rsi
call   1030 <mysql_query@plt>
cmp    $0x0,%rax
je     118d <createDb+0x4d>
mov    -0x8(%rbp),%rdi
call   1050 <mysql_errno@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <mysql_error@plt>
mov    -0xc(%rbp),%esi
mov    %rax,%rdx
lea    0xe92(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createDb>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xeb3(%rip),%rsi
call   1030 <mysql_query@plt>
test   %rax,%rax
je     1180 <createDb+0x40>
mov    %rbx,%rdi
call   1050 <mysql_errno@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1060 <mysql_error@plt>
lea    0xeaa(%rip),%rdi
mov    %ebp,%esi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <printf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [26 x i8] c"CREATE DATABASE benchmark\00"
@.str.1 = [24 x i8] c"createDb::Error %u: %s\0A\00"
define void @createDb(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = call i64 @mysql_query(i32* %3, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32*, i32** %2
%8 = call i32 @mysql_errno(i32* %7)
%9 = load i32*, i32** %2
%10 = call i8* @mysql_error(i32* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %8, i8* %10)
br label %12
12: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"CREATE DATABASE benchmark\00"
@.str.1 = [24 x i8] c"createDb::Error %u: %s\0A\00"
define void @createDb(i32* %0) {
%2 = tail call i64 @mysql_query(i32* %0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @mysql_errno(i32* %0)
%6 = tail call i8* @mysql_error(i32* %0)
%7 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32 %5, i8* %6)
br label %8
8: ; preds = %4, %1
ret void
}
/* Variables and functions */
double doSomething(int);
int /*<<< orphan*/ printf(char *, double);
int main(int argc, char *argv[]) {
  printf("result is %f\n", doSomething(4));
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [14 x i8] c"result is %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call double @doSomething(i32 4)
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"result is %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call double @doSomething(i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}
/* Variables and functions */
int strcmp(char const *, char const *);
int compare_str(const void *key1, const void *key2) {
  int retval;
  if ((retval = strcmp((const char *)key1, (const char *)key2)) > 0)
    return 1;
  if (retval < 0)
    return -1;
  return 0;
}


x86 assembly (clang, -O0):
<compare_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0x0,%eax
jle    1145 <compare_str+0x35>
movl   $0x1,-0x4(%rbp)
jmp    1162 <compare_str+0x52>
cmpl   $0x0,-0x1c(%rbp)
jge    115b <compare_str+0x4b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1162 <compare_str+0x52>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_str>:
push   %rax
call   1030 <strcmp@plt>
mov    %eax,%ecx
sar    $0x1f,%ecx
test   %eax,%eax
mov    $0x1,%eax
cmovle %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @compare_str(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
%4 = ashr i32 %3, 31
%5 = icmp slt i32 %3, 1
%6 = select i1 %5, i32 %4, i32 1
ret i32 %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
uint8_t ld_u8_be(const void *x) { return ((uint8_t *)x)[0]; }


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

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

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

LLVM IR (-O2):
define i32 @ld_u8_be(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
ret i32 %3
}
void picosat_enable_trace_generation(void) {}


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

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

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

LLVM IR (-O2):
define void @picosat_enable_trace_generation() {
ret void
}
/* Variables and functions */
int a();
int /*<<< orphan*/ b();
int /*<<< orphan*/ c();
void testRemoveDeadBindings() {
  int i = a();
  if (i)
    a();
  else
    b();
  c();
}


x86 assembly (clang, -O0):
<testRemoveDeadBindings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <a@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1158 <testRemoveDeadBindings+0x28>
mov    $0x0,%al
call   1050 <a@plt>
jmp    115f <testRemoveDeadBindings+0x2f>
mov    $0x0,%al
call   1030 <b@plt>
mov    $0x0,%al
call   1040 <c@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testRemoveDeadBindings>:
push   %rax
xor    %eax,%eax
call   1050 <a@plt>
test   %eax,%eax
je     1145 <testRemoveDeadBindings+0x15>
xor    %eax,%eax
call   1050 <a@plt>
jmp    114c <testRemoveDeadBindings+0x1c>
xor    %eax,%eax
call   1030 <b@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <c@plt>

LLVM IR (-O0):
define void @testRemoveDeadBindings() {
%1 = alloca i32
%2 = call i32 (...) @a()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @a()
br label %9
7: ; preds = %0
%8 = call i32 (...) @b()
br label %9
9: ; preds = %7, %5
%10 = call i32 (...) @c()
ret void
}

LLVM IR (-O2):
define void @testRemoveDeadBindings() {
%1 = tail call i32 (...) @a()
%2 = icmp eq i32 %1, 0
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @a()
br label %7
5: ; preds = %0
%6 = tail call i32 (...) @b()
br label %7
7: ; preds = %5, %3
%8 = tail call i32 (...) @c()
ret void
}
int fd2tsi(string)
char *string;
{
  double date, time;
  fd2dt(string, &date, &time);
  return (dt2tsi(date, time));
}


x86 assembly (clang, -O0):
<fd2tsi>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1040 <fd2dt@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mov    $0x2,%al
call   1030 <dt2tsi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fd2tsi>:
sub    $0x18,%rsp
lea    0x10(%rsp),%rsi
lea    0x8(%rsp),%rdx
xor    %eax,%eax
call   1040 <fd2dt@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
mov    $0x2,%al
call   1030 <dt2tsi@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
define i32 @fd2tsi(i8* %0) {
%2 = alloca i8*
%3 = alloca double
%4 = alloca double
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 (i8*, double*, double*, ...) bitcast (i32 (...)* @fd2dt to i32 (i8*, double*, double*, ...)*)(i8* %5, double* %3, double* %4)
%7 = load double, double* %3
%8 = load double, double* %4
%9 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2tsi to i32 (double, double, ...)*)(double %7, double %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @fd2tsi(i8* %0) {
%2 = alloca double
%3 = alloca double
%4 = bitcast double* %2 to i8*
%5 = bitcast double* %3 to i8*
%6 = call i32 (i8*, double*, double*, ...) bitcast (i32 (...)* @fd2dt to i32 (i8*, double*, double*, ...)*)(i8* %0, double* %2, double* %3)
%7 = load double, double* %2
%8 = load double, double* %3
%9 = call i32 (double, double, ...) bitcast (i32 (...)* @dt2tsi to i32 (double, double, ...)*)(double %7, double %8)
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void portuguese(const char *name) {
  printf("Ola mundo! Bem-vindo, %s\n", name);
}


x86 assembly (clang, -O0):
<portuguese>:
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):
<portuguese>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"Ola mundo! Bem-vindo, %s\0A\00"
define void @portuguese(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Ola mundo! Bem-vindo, %s\0A\00"
define void @portuguese(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int test_imm_95int16_mem(short *val) {
  return ((*val) & (-0x95 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_95int16_mem>:
movzwl (%rdi),%eax
test   $0xff6b,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_95int16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = sext i16 %4 to i32
%6 = and i32 %5, -149
%7 = icmp ne i32 %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_95int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -149
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
scalar_t__ errno;
int /*<<< orphan*/ perror(char *);
void sigpipe_handler(int signal) {
  (void)signal;
  if (0 != errno)
    perror("sigpipe_handler");
}


x86 assembly (clang, -O0):
<sigpipe_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    0x2ebc(%rip),%rcx
cmp    (%rcx),%rax
je     1139 <sigpipe_handler+0x29>
lea    0xecc(%rip),%rdi
call   1030 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigpipe_handler>:
mov    0x2ec9(%rip),%rax
cmpq   $0x0,(%rax)
jne    111e <sigpipe_handler+0xe>
ret
lea    0xedb(%rip),%rdi
jmp    1030 <perror@plt>

LLVM IR (-O0):
@errno = global i64 0
@.str = [16 x i8] c"sigpipe_handler\00"
define void @sigpipe_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i64, i64* @errno
%5 = icmp ne i64 0, %4
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@errno = global i64 0
@.str = [16 x i8] c"sigpipe_handler\00"
define void @sigpipe_handler(i32 %0) {
%2 = load i64, i64* @errno
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
int bar_helper(int j, int g) { return j + g; }


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

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

LLVM IR (-O0):
define i32 @bar_helper(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @bar_helper(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
void main() {
  int32_t a;
  a = 1;
  a *= 3;
}


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

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

LLVM IR (-O0):
define void @main() {
%1 = alloca i32
store i32 1, i32* %1
%2 = load i32, i32* %1
%3 = mul nsw i32 %2, 3
store i32 %3, i32* %1
ret void
}

LLVM IR (-O2):
define void @main() {
ret void
}
int baz() { return 42; }


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

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

LLVM IR (-O0):
define i32 @baz() {
ret i32 42
}

LLVM IR (-O2):
define i32 @baz() {
ret i32 42
}
int fun324() { return 324; }


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

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

LLVM IR (-O0):
define i32 @fun324() {
ret i32 324
}

LLVM IR (-O2):
define i32 @fun324() {
ret i32 324
}
int sf_strlen(char *str) {
  int out;
  out = 0;
  while (str[out] != '\0')
    ++out;
  return (out);
}


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

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

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

LLVM IR (-O2):
define i32 @sf_strlen(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
scalar_t__ RAND_MAX;
scalar_t__ rand();
double rand_real() { return (double)rand() / (double)RAND_MAX; }


x86 assembly (clang, -O0):
<rand_real>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec1(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_real>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2ec4(%rip),%rax
cvtsi2sdq (%rax),%xmm1
divsd  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define double @rand_real() {
%1 = call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define double @rand_real() {
%1 = tail call i64 (...) @rand()
%2 = sitofp i64 %1 to double
%3 = load i64, i64* @RAND_MAX
%4 = sitofp i64 %3 to double
%5 = fdiv double %2, %4
ret double %5
}
int is_digit(char ch) { return ch >= '0' && ch <= '9'; }


x86 assembly (clang, -O0):
<is_digit>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0x30,%ecx
mov    %al,-0x2(%rbp)
jl     1129 <is_digit+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x39,%eax
setle  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_digit>:
add    $0xd0,%dil
xor    %eax,%eax
cmp    $0xa,%dil
setb   %al
ret

LLVM IR (-O0):
define i32 @is_digit(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp sge i32 %4, 48
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp sle i32 %8, 57
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ false, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @is_digit(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int unresolvedExternalFunction();
int bar() { return unresolvedExternalFunction(); }


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

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

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

LLVM IR (-O2):
define i32 @bar() {
%1 = tail call i32 (...) @unresolvedExternalFunction()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void term_clear() { printf("\e[H\e[J"); }


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"\1B[H\1B[J\00"
define void @term_clear() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
void gtk_drag_dest_unset() {}


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

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

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

LLVM IR (-O2):
define void @gtk_drag_dest_unset() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ gpio_write_and_close(int, int);
void alfa_set_enable(bool enable) { gpio_write_and_close(20, enable ? 1 : 0); }


x86 assembly (clang, -O0):
<alfa_set_enable>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
xor    %esi,%esi
mov    $0x1,%eax
cmp    $0x0,%ecx
cmovne %eax,%esi
mov    $0x14,%edi
call   1030 <gpio_write_and_close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<alfa_set_enable>:
xor    %esi,%esi
test   %edi,%edi
setne  %sil
mov    $0x14,%edi
jmp    1030 <gpio_write_and_close@plt>

LLVM IR (-O0):
define void @alfa_set_enable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
%5 = zext i1 %4 to i64
%6 = select i1 %4, i32 1, i32 0
%7 = call i32 @gpio_write_and_close(i32 20, i32 %6)
ret void
}

LLVM IR (-O2):
define void @alfa_set_enable(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = tail call i32 @gpio_write_and_close(i32 20, i32 %3)
ret void
}
/* Variables and functions */
int sqrtf(float);
float test_func_00(float x) { return 1 / sqrtf(x); }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <sqrtf@plt>
mov    %eax,%ecx
mov    $0x1,%eax
cltd
idiv   %ecx
cvtsi2ss %eax,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
push   %rax
call   1030 <sqrtf@plt>
lea    0x1(%rax),%ecx
xor    %edx,%edx
cmp    $0x3,%ecx
cmovb  %eax,%edx
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @test_func_00(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @sqrtf(float %3)
%5 = sdiv i32 1, %4
%6 = sitofp i32 %5 to float
ret float %6
}

LLVM IR (-O2):
define float @test_func_00(float %0) {
%2 = tail call i32 @sqrtf(float %0)
%3 = add i32 %2, 1
%4 = icmp ult i32 %3, 3
%5 = select i1 %4, i32 %2, i32 0
%6 = sitofp i32 %5 to float
ret float %6
}
/* Variables and functions */
int /*<<< orphan*/ gdb1253();
int /*<<< orphan*/ gdb1338();
int /*<<< orphan*/ gdb1718();
int /*<<< orphan*/ jump_at_beginning();
int /*<<< orphan*/ stack_align_eax();
int /*<<< orphan*/ stack_align_ecx();
int /*<<< orphan*/ stack_align_edx();
int /*<<< orphan*/ standard();
int main(void) {
  standard();
  stack_align_ecx();
  stack_align_edx();
  stack_align_eax();
  gdb1253();
  gdb1718();
  gdb1338();
  jump_at_beginning();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1070 <standard@plt>
mov    $0x0,%al
call   1030 <stack_align_ecx@plt>
mov    $0x0,%al
call   1060 <stack_align_edx@plt>
mov    $0x0,%al
call   1090 <stack_align_eax@plt>
mov    $0x0,%al
call   1080 <gdb1253@plt>
mov    $0x0,%al
call   10a0 <gdb1718@plt>
mov    $0x0,%al
call   1040 <gdb1338@plt>
mov    $0x0,%al
call   1050 <jump_at_beginning@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1070 <standard@plt>
xor    %eax,%eax
call   1030 <stack_align_ecx@plt>
xor    %eax,%eax
call   1060 <stack_align_edx@plt>
xor    %eax,%eax
call   1090 <stack_align_eax@plt>
xor    %eax,%eax
call   1080 <gdb1253@plt>
xor    %eax,%eax
call   10a0 <gdb1718@plt>
xor    %eax,%eax
call   1040 <gdb1338@plt>
xor    %eax,%eax
call   1050 <jump_at_beginning@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @standard()
%3 = call i32 (...) @stack_align_ecx()
%4 = call i32 (...) @stack_align_edx()
%5 = call i32 (...) @stack_align_eax()
%6 = call i32 (...) @gdb1253()
%7 = call i32 (...) @gdb1718()
%8 = call i32 (...) @gdb1338()
%9 = call i32 (...) @jump_at_beginning()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @standard()
%2 = tail call i32 (...) @stack_align_ecx()
%3 = tail call i32 (...) @stack_align_edx()
%4 = tail call i32 (...) @stack_align_eax()
%5 = tail call i32 (...) @gdb1253()
%6 = tail call i32 (...) @gdb1718()
%7 = tail call i32 (...) @gdb1338()
%8 = tail call i32 (...) @jump_at_beginning()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test_b() { printf("this is in test_b...\n"); }


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

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

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

LLVM IR (-O2):
@str = [21 x i8] c"this is in test_b...\00"
define void @test_b() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
char *strchr(char *, char);
void delete_newline(char *str) {
  char *p;
  if ((p = strchr(str, '\n')) != NULL) {
    *p = '\0';
  }
}


x86 assembly (clang, -O0):
<delete_newline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     113f <delete_newline+0x2f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<delete_newline>:
push   %rax
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1123 <delete_newline+0x13>
movb   $0x0,(%rax)
pop    %rax
ret

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

LLVM IR (-O2):
define void @delete_newline(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
ret void
}
int execute_init_module() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_init_module() {
ret i32 0
}
/* Variables and functions */
void *calloc(int, int);
void *csf_malloc(int sz) {
  void *buf;
  buf = calloc(sz, 1);
  if (buf == NULL) {
    ;
  }
  return buf;
}


x86 assembly (clang, -O0):
<csf_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1,%esi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    113c <csf_malloc+0x2c>
jmp    113c <csf_malloc+0x2c>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csf_malloc>:
mov    $0x1,%esi
jmp    1030 <calloc@plt>

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

LLVM IR (-O2):
define noalias i8* @csf_malloc(i32 %0) {
%2 = tail call i8* @calloc(i32 %0, i32 1)
ret i8* %2
}
/* Variables and functions */
char *strmcat(char *, char const *, int);
char *pathcat(char *dst, char const *src) { return strmcat(dst, src, 1024); }


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

x86 assembly (clang, -O2):
<pathcat>:
mov    $0x400,%edx
jmp    1030 <strmcat@plt>

LLVM IR (-O0):
define i8* @pathcat(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i8* @strmcat(i8* %5, i8* %6, i32 1024)
ret i8* %7
}

LLVM IR (-O2):
define i8* @pathcat(i8* %0, i8* %1) {
%3 = tail call i8* @strmcat(i8* %0, i8* %1, i32 1024)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ endwin();
int /*<<< orphan*/ exit(int);
int getch();
int /*<<< orphan*/ timeout(long);
void wait_a_while(long msec) {
  int c;
  if (msec != 1)
    timeout(msec);
  c = getch();
  if (c == 'q') {
    endwin();
    exit(1);
  }
}


x86 assembly (clang, -O0):
<wait_a_while>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x1,-0x8(%rbp)
je     1160 <wait_a_while+0x20>
mov    -0x8(%rbp),%rdi
call   1030 <timeout@plt>
mov    $0x0,%al
call   1040 <getch@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x71,-0xc(%rbp)
jne    1185 <wait_a_while+0x45>
mov    $0x0,%al
call   1050 <endwin@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait_a_while>:
push   %rax
cmp    $0x1,%rdi
je     114c <wait_a_while+0xc>
call   1030 <timeout@plt>
xor    %eax,%eax
call   1040 <getch@plt>
cmp    $0x71,%eax
je     115a <wait_a_while+0x1a>
pop    %rax
ret
xor    %eax,%eax
call   1050 <endwin@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
define void @wait_a_while(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = icmp ne i64 %4, 1
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i64, i64* %2
%8 = call i32 @timeout(i64 %7)
br label %9
9: ; preds = %6, %1
%10 = call i32 (...) @getch()
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = icmp eq i32 %11, 113
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 (...) @endwin()
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @wait_a_while(i64 %0) {
%2 = icmp eq i64 %0, 1
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @timeout(i64 %0)
br label %5
5: ; preds = %3, %1
%6 = tail call i32 (...) @getch()
%7 = icmp eq i32 %6, 113
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = tail call i32 (...) @endwin()
%10 = tail call i32 @exit(i32 1)
unreachable
11: ; preds = %5
ret void
}
void dummyGlobal() {}


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

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

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

LLVM IR (-O2):
define void @dummyGlobal() {
ret void
}