xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ rmdir(char *);
void test_tmpdir_free(char *path) {
  rmdir(path);
  if (path != NULL)
    free(path);
}


x86 assembly (clang, -O0):
<test_tmpdir_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <rmdir@plt>
cmpq   $0x0,-0x8(%rbp)
je     1149 <test_tmpdir_free+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_tmpdir_free>:
push   %rbx
mov    %rdi,%rbx
call   1040 <rmdir@plt>
test   %rbx,%rbx
je     1137 <test_tmpdir_free+0x17>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @test_tmpdir_free(i8* %0) {
%2 = tail call i32 @rmdir(i8* %0)
%3 = icmp eq i8* %0, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %0)
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
bool is_power_of_two(size_t x) { return ((x != 0) && !(x & (x - 1))); }


x86 assembly (clang, -O0):
<is_power_of_two>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x9(%rbp)
je     1133 <is_power_of_two+0x33>
mov    -0x8(%rbp),%rax
mov    -0x8(%rbp),%rcx
sub    $0x1,%rcx
and    %rcx,%rax
cmp    $0x0,%rax
setne  %al
xor    $0xff,%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_power_of_two>:
test   %rdi,%rdi
je     1112 <is_power_of_two+0x12>
lea    -0x1(%rdi),%rcx
xor    %eax,%eax
test   %rcx,%rdi
sete   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @is_power_of_two(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = tail call i64 @llvm.ctpop.i64(i64 %0)
%5 = icmp ult i64 %4, 2
%6 = zext i1 %5 to i32
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
void ft_bzero(void *s, size_t n) {
  char *c;
  if (s) {
    c = s;
    while (n-- > 0)
      *c++ = 0;
  }
}


x86 assembly (clang, -O0):
<ft_bzero>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1154 <ft_bzero+0x54>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
jbe    114f <ft_bzero+0x4f>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movb   $0x0,(%rax)
jmp    111f <ft_bzero+0x1f>
jmp    1154 <ft_bzero+0x54>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_bzero>:
test   %rdi,%rdi
je     1129 <ft_bzero+0x19>
mov    %rsi,%rdx
test   %rsi,%rsi
je     1129 <ft_bzero+0x19>
push   %rax
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x8,%rsp
ret

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

LLVM IR (-O2):
define void @ft_bzero(i8* writeonly %0, i64 %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i64 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %7, label %6
6: ; preds = %2
br label %7
7: ; preds = %6, %2
ret void
}
int xkcd_random(unsigned min, unsigned max) { return 4; }


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

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

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

LLVM IR (-O2):
define i32 @xkcd_random(i32 %0, i32 %1) {
ret i32 4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void x2(void) {
  printf("Called mod2-x2 "
         ""
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [16 x i8] c"Called mod2-x2 \00"
define void @x2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
uint64_t d2u(double d) {
  union {
    double f;
    uint64_t i;
  } tmp;
  tmp.f = d;
  return tmp.i;
}


x86 assembly (clang, -O0):
<d2u>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<d2u>:
movq   %xmm0,%rax
ret

LLVM IR (-O0):
%union.anon = type { double }
define i32 @d2u(double %0) {
%2 = alloca double
%3 = alloca %union.anon
store double %0, double* %2
%4 = load double, double* %2
%5 = bitcast %union.anon* %3 to double*
store double %4, double* %5
%6 = bitcast %union.anon* %3 to i32*
%7 = load i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @d2u(double %0) {
%2 = bitcast double %0 to i64
%3 = trunc i64 %2 to i32
ret i32 %3
}
/* Variables and functions */
scalar_t__ malloc(int);
int unknown_function();
int zero_to_infty();
void False_Issue_Type_l3_unknown_function_Bad() {
  int *a = (int *)malloc((zero_to_infty() + 5) * sizeof(int));
  int idx = unknown_function() * 10;
  if (10 <= idx) {
    if (idx <= 10) {
      a[idx] = 0;
    }
  }
}


x86 assembly (clang, -O0):
<False_Issue_Type_l3_unknown_function_Bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <zero_to_infty@plt>
add    $0x5,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <unknown_function@plt>
imul   $0xa,%eax,%eax
mov    %eax,-0xc(%rbp)
mov    $0xa,%eax
cmp    -0xc(%rbp),%eax
jg     118c <False_Issue_Type_l3_unknown_function_Bad+0x5c>
cmpl   $0xa,-0xc(%rbp)
jg     1187 <False_Issue_Type_l3_unknown_function_Bad+0x57>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
jmp    118c <False_Issue_Type_l3_unknown_function_Bad+0x5c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<False_Issue_Type_l3_unknown_function_Bad>:
push   %rbx
xor    %eax,%eax
call   1040 <zero_to_infty@plt>
lea    0x14(,%rax,4),%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <unknown_function@plt>
cmp    $0x1,%eax
jne    115a <False_Issue_Type_l3_unknown_function_Bad+0x2a>
movl   $0x0,0x28(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @False_Issue_Type_l3_unknown_function_Bad() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32 (...) @zero_to_infty()
%4 = add nsw i32 %3, 5
%5 = sext i32 %4 to i64
%6 = mul i64 %5, 4
%7 = trunc i64 %6 to i32
%8 = call i64 @malloc(i32 %7)
%9 = inttoptr i64 %8 to i32*
store i32* %9, i32** %1
%10 = call i32 (...) @unknown_function()
%11 = mul nsw i32 %10, 10
store i32 %11, i32* %2
%12 = load i32, i32* %2
%13 = icmp sle i32 10, %12
br i1 %13, label %14, label %23
14: ; preds = %0
%15 = load i32, i32* %2
%16 = icmp sle i32 %15, 10
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32*, i32** %1
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 0, i32* %21
br label %22
22: ; preds = %17, %14
br label %23
23: ; preds = %22, %0
ret void
}

LLVM IR (-O2):
define void @False_Issue_Type_l3_unknown_function_Bad() {
%1 = tail call i32 (...) @zero_to_infty()
%2 = shl i32 %1, 2
%3 = add i32 %2, 20
%4 = tail call i64 @malloc(i32 %3)
%5 = tail call i32 (...) @unknown_function()
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = inttoptr i64 %4 to i32*
%9 = getelementptr inbounds i32, i32* %8, i64 10
store i32 0, i32* %9
br label %10
10: ; preds = %7, %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test1();
int /*<<< orphan*/ test2();
int main(int argc, char *argv[]) {
  test1();
  test2();
  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    $0x0,%al
call   1030 <test1@plt>
mov    $0x0,%al
call   1040 <test2@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @test1()
%7 = call i32 (...) @test2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test1()
%4 = tail call i32 (...) @test2()
ret i32 0
}
unsigned char inb(int port) {
  unsigned char ret;
  __asm__ __volatile__("inb %w1, %b0" : "=a"(ret) : "Nd"(port));
  return ret;
}


x86 assembly (clang, -O0):
<inb>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
in     (%dx),%al
mov    %al,-0x5(%rbp)
movzbl -0x5(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inb>:
mov    %edi,%edx
in     (%dx),%al
ret

LLVM IR (-O0):
define zeroext i8 @inb(i32 %0) {
%2 = alloca i32
%3 = alloca i8
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i8 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %4)
store i8 %5, i8* %3
%6 = load i8, i8* %3
ret i8 %6
}

LLVM IR (-O2):
define zeroext i8 @inb(i32 %0) {
%2 = tail call i8 asm sideeffect "inb ${1:w}, ${0:b}", "={ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0)
ret i8 %2
}
void SPI_SD_RX_ISR(void) {}


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

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

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

LLVM IR (-O2):
define void @SPI_SD_RX_ISR() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void LUI_LabelSetFont(char *name, char *fontname) {
  fprintf(stderr, "LUI_LabelSetFont(): warning: function not supported\n");
}


x86 assembly (clang, -O0):
<LUI_LabelSetFont>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LUI_LabelSetFont>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"LUI_LabelSetFont(): warning: function not supported\0A\00"
define void @LUI_LabelSetFont(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"LUI_LabelSetFont(): warning: function not supported\0A\00"
define void @LUI_LabelSetFont(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0))
ret void
}
int encode_altitude(int ft) {
  int i;
  i = (ft + 1000) / 25;
  if (i < 0)
    i = 0;
  if (i > 0x7FF)
    i = 0x7FF;
  return (i & 0x000F) | 0x0010 | ((i & 0x07F0) << 1);
}


x86 assembly (clang, -O0):
<encode_altitude>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3e8,%eax
mov    $0x19,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    112b <encode_altitude+0x2b>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7ff,-0x8(%rbp)
jle    113f <encode_altitude+0x3f>
movl   $0x7ff,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xf,%eax
or     $0x10,%eax
mov    -0x8(%rbp),%ecx
and    $0x7f0,%ecx
shl    $0x1,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<encode_altitude>:
add    $0x3e8,%edi
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x23,%rax
xor    %edx,%edx
add    %ecx,%eax
cmovs  %edx,%eax
cmp    $0x7ff,%eax
mov    $0x7ff,%ecx
cmovb  %eax,%ecx
mov    %ecx,%eax
and    $0xf,%eax
and    $0x7f0,%ecx
lea    (%rax,%rcx,2),%eax
add    $0x10,%eax
ret

LLVM IR (-O0):
define i32 @encode_altitude(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1000
%6 = sdiv i32 %5, 25
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %3
br label %10
10: ; preds = %9, %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 2047
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 2047, i32* %3
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %3
%16 = and i32 %15, 15
%17 = or i32 %16, 16
%18 = load i32, i32* %3
%19 = and i32 %18, 2032
%20 = shl i32 %19, 1
%21 = or i32 %17, %20
ret i32 %21
}

LLVM IR (-O2):
define i32 @encode_altitude(i32 %0) {
%2 = add nsw i32 %0, 1000
%3 = sdiv i32 %2, 25
%4 = icmp sgt i32 %3, 0
%5 = select i1 %4, i32 %3, i32 0
%6 = icmp ult i32 %5, 2047
%7 = select i1 %6, i32 %5, i32 2047
%8 = and i32 %7, 15
%9 = shl nuw nsw i32 %7, 1
%10 = and i32 %9, 4064
%11 = or i32 %8, %10
%12 = or i32 %11, 16
ret i32 %12
}
void foo684() {}


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

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

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

LLVM IR (-O2):
define void @foo684() {
ret void
}
int GetBalance(int User) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @GetBalance(i32 %0) {
ret i32 0
}
/* Type definitions */
struct timespec {
  double tv_sec;
  int tv_nsec;
};

/* Variables and functions */
double get_time(struct timespec *start, struct timespec *end) {
  return end->tv_sec - start->tv_sec + (end->tv_nsec - start->tv_nsec) * 1e-9;
}


x86 assembly (clang, -O0):
<get_time>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x8(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%eax
mov    -0x8(%rbp),%rcx
sub    0x8(%rcx),%eax
cvtsi2sd %eax,%xmm0
movsd  0xeca(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_time>:
movsd  (%rsi),%xmm1
subsd  (%rdi),%xmm1
mov    0x8(%rsi),%eax
sub    0x8(%rdi),%eax
cvtsi2sd %eax,%xmm0
mulsd  0xee6(%rip),%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
%struct.timespec = type { double, i32 }
define double @get_time(%struct.timespec* %0, %struct.timespec* %1) {
%3 = alloca %struct.timespec*
%4 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %3
store %struct.timespec* %1, %struct.timespec** %4
%5 = load %struct.timespec*, %struct.timespec** %4
%6 = getelementptr inbounds %struct.timespec, %struct.timespec* %5, i32 0, i32 0
%7 = load double, double* %6
%8 = load %struct.timespec*, %struct.timespec** %3
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %8, i32 0, i32 0
%10 = load double, double* %9
%11 = fsub double %7, %10
%12 = load %struct.timespec*, %struct.timespec** %4
%13 = getelementptr inbounds %struct.timespec, %struct.timespec* %12, i32 0, i32 1
%14 = load i32, i32* %13
%15 = load %struct.timespec*, %struct.timespec** %3
%16 = getelementptr inbounds %struct.timespec, %struct.timespec* %15, i32 0, i32 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %14, %17
%19 = sitofp i32 %18 to double
%20 = call double @llvm.fmuladd.f64(double %19, double 1.000000e-09, double %11)
ret double %20
}

LLVM IR (-O2):
%struct.timespec = type { double, i32 }
define double @get_time(%struct.timespec* nocapture %0, %struct.timespec* nocapture %1) {
%3 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 0
%6 = load double, double* %5
%7 = fsub double %4, %6
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 1
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timespec, %struct.timespec* %0, i64 0, i32 1
%11 = load i32, i32* %10
%12 = sub nsw i32 %9, %11
%13 = sitofp i32 %12 to double
%14 = tail call double @llvm.fmuladd.f64(double %13, double 1.000000e-09, double %7)
ret double %14
}
int cmp_float_increasing(const void *a, const void *b) {
  const float *ia = (const float *)a;
  const float *ib = (const float *)b;
  if (*ia > *ib)
    return 1;
  else if (*ia < *ib)
    return -1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<cmp_float_increasing>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x28(%rbp),%rax
ucomiss (%rax),%xmm0
jbe    113d <cmp_float_increasing+0x3d>
movl   $0x1,-0x4(%rbp)
jmp    1169 <cmp_float_increasing+0x69>
mov    -0x20(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x28(%rbp),%rax
movss  (%rax),%xmm0
ucomiss %xmm1,%xmm0
jbe    1162 <cmp_float_increasing+0x62>
movl   $0xffffffff,-0x4(%rbp)
jmp    1169 <cmp_float_increasing+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_float_increasing>:
movss  (%rdi),%xmm0
movss  (%rsi),%xmm1
xor    %ecx,%ecx
ucomiss %xmm0,%xmm1
seta   %cl
neg    %ecx
ucomiss %xmm1,%xmm0
mov    $0x1,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @cmp_float_increasing(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca float*
%7 = alloca float*
store i8* %0, i8** %4
store i8* %1, i8** %5
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to float*
store float* %9, float** %6
%10 = load i8*, i8** %5
%11 = bitcast i8* %10 to float*
store float* %11, float** %7
%12 = load float*, float** %6
%13 = load float, float* %12
%14 = load float*, float** %7
%15 = load float, float* %14
%16 = fcmp ogt float %13, %15
br i1 %16, label %17, label %18
17: ; preds = %2
store i32 1, i32* %3
br label %26
18: ; preds = %2
%19 = load float*, float** %6
%20 = load float, float* %19
%21 = load float*, float** %7
%22 = load float, float* %21
%23 = fcmp olt float %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 -1, i32* %3
br label %26
25: ; preds = %18
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %17
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @cmp_float_increasing(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to float*
%4 = bitcast i8* %1 to float*
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fcmp ogt float %5, %6
%8 = fcmp olt float %5, %6
%9 = sext i1 %8 to i32
%10 = select i1 %7, i32 1, i32 %9
ret i32 %10
}
double DivOp(double a, double b) { return a / b; }


x86 assembly (clang, -O0):
<DivOp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
divsd  -0x10(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DivOp>:
divsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @DivOp(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 = fdiv double %5, %6
ret double %7
}

LLVM IR (-O2):
define double @DivOp(double %0, double %1) {
%3 = fdiv double %0, %1
ret double %3
}
/* Type definitions */
struct sock_descr {
  int dummy;
};

/* Variables and functions */
int sock_addr_inet(char const *, struct sock_descr *);
int sock_addr_unix(char const *, struct sock_descr *);
int sock_addr(const char *path, struct sock_descr *descr) {
  if (*path == '/')
    return sock_addr_unix(path, descr);
  return sock_addr_inet(path, descr);
}


x86 assembly (clang, -O0):
<sock_addr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1155 <sock_addr+0x35>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <sock_addr_unix@plt>
mov    %eax,-0x4(%rbp)
jmp    1165 <sock_addr+0x45>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <sock_addr_inet@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sock_addr>:
cmpb   $0x2f,(%rdi)
jne    112a <sock_addr+0xa>
jmp    1030 <sock_addr_unix@plt>
jmp    1040 <sock_addr_inet@plt>

LLVM IR (-O0):
%struct.sock_descr = type { i32 }
define i32 @sock_addr(i8* %0, %struct.sock_descr* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca %struct.sock_descr*
store i8* %0, i8** %4
store %struct.sock_descr* %1, %struct.sock_descr** %5
%6 = load i8*, i8** %4
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 47
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %4
%12 = load %struct.sock_descr*, %struct.sock_descr** %5
%13 = call i32 @sock_addr_unix(i8* %11, %struct.sock_descr* %12)
store i32 %13, i32* %3
br label %18
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load %struct.sock_descr*, %struct.sock_descr** %5
%17 = call i32 @sock_addr_inet(i8* %15, %struct.sock_descr* %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %10
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
%struct.sock_descr = type { i32 }
define i32 @sock_addr(i8* %0, %struct.sock_descr* %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 47
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @sock_addr_unix(i8* %0, %struct.sock_descr* %1)
br label %9
7: ; preds = %2
%8 = tail call i32 @sock_addr_inet(i8* %0, %struct.sock_descr* %1)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}
int GFX_PrepImage(int width, int height) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @GFX_PrepImage(i32 %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ ReloadPosition(int /*<<< orphan*/);
void ReloadPositionProc() { ReloadPosition(0); }


x86 assembly (clang, -O0):
<ReloadPositionProc>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <ReloadPosition@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<ReloadPositionProc>:
xor    %edi,%edi
jmp    1030 <ReloadPosition@plt>

LLVM IR (-O0):
define void @ReloadPositionProc() {
%1 = call i32 @ReloadPosition(i32 0)
ret void
}

LLVM IR (-O2):
define void @ReloadPositionProc() {
%1 = tail call i32 @ReloadPosition(i32 0)
ret void
}
long LongAbs(long x) {
  if (x >= 0)
    return (x);
  else
    return (-x);
}


x86 assembly (clang, -O0):
<LongAbs>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jl     1120 <LongAbs+0x20>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112a <LongAbs+0x2a>
xor    %eax,%eax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LongAbs>:
mov    %rdi,%rax
neg    %rax
cmovs  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @LongAbs(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
ret i64 %2
}
/* Variables and functions */
size_t _sl4_hash_func_ptr(const void *key) { return (size_t)key; }


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

x86 assembly (clang, -O2):
<_sl4_hash_func_ptr>:
mov    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @_sl4_hash_func_ptr(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = ptrtoint i8* %3 to i64
ret i64 %4
}

LLVM IR (-O2):
define i64 @_sl4_hash_func_ptr(i8* %0) {
%2 = ptrtoint i8* %0 to i64
ret i64 %2
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char const *, char const *);
void mprAssert(const char *loc, const char *msg) {
  printf("Assertion \"%s\", failed at \"%s\".\n", msg, loc);
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<mprAssert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e95(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<mprAssert>:
push   %rax
mov    %rdi,%rdx
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    0x2ea9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"Assertion \22%s\22, failed at \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
define void @mprAssert(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i8*, i8** %3
%7 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %5, i8* %6)
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"Assertion \22%s\22, failed at \22%s\22.\0A\00"
@EXIT_FAILURE = global i32 0
define void @mprAssert(i8* %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
%4 = load i32, i32* @EXIT_FAILURE
%5 = tail call i32 @exit(i32 %4)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ evaluatesurfgen_(double *, double *, double *, double *,
                                    double *);
void EvaluateSurfgen(double *geom, double *energy, double *grads,
                     double *hd_matrix, double *diab_grads) {
  evaluatesurfgen_(geom, energy, grads, hd_matrix, diab_grads);
}


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

x86 assembly (clang, -O2):
<EvaluateSurfgen>:
jmp    1030 <evaluatesurfgen_@plt>

LLVM IR (-O0):
define void @EvaluateSurfgen(double* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = alloca double*
%7 = alloca double*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
store double* %0, double** %6
store double* %1, double** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load double*, double** %6
%12 = load double*, double** %7
%13 = load double*, double** %8
%14 = load double*, double** %9
%15 = load double*, double** %10
%16 = call i32 @evaluatesurfgen_(double* %11, double* %12, double* %13, double* %14, double* %15)
ret void
}

LLVM IR (-O2):
define void @EvaluateSurfgen(double* %0, double* %1, double* %2, double* %3, double* %4) {
%6 = tail call i32 @evaluatesurfgen_(double* %0, double* %1, double* %2, double* %3, double* %4)
ret void
}
/* Variables and functions */
char *strstr(char const *, char const *);
char *lastStrStr(const char *s1, const char *s2) {
  char *p = strstr(s1, s2);
  char *q = p;
  while ((p = strstr(s1, s2)) != NULL) {
    s1++;
    q = p;
  }
  return q;
}


x86 assembly (clang, -O0):
<lastStrStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strstr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     116d <lastStrStr+0x5d>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1139 <lastStrStr+0x29>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lastStrStr>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strstr@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strstr@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1120 <lastStrStr+0x10>
mov    %r15,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @lastStrStr(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
br label %4
4: ; preds = %4, %2
%5 = phi i8* [ %0, %2 ], [ %9, %4 ]
%6 = phi i8* [ %3, %2 ], [ %7, %4 ]
%7 = tail call i8* @strstr(i8* dereferenceable(1) %5, i8* dereferenceable(1) %1)
%8 = icmp eq i8* %7, null
%9 = getelementptr inbounds i8, i8* %5, i64 1
br i1 %8, label %10, label %4
10: ; preds = %4
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void printBytes(unsigned int e) {
  int i;
  unsigned int mask;
  for (i = 32 - 1; i >= 0; i--) {
    mask = 1u << i;
    if (e & mask) {
      printf("%d", 1);
    } else {
      printf("%d", 0);
    }
  }
}


x86 assembly (clang, -O0):
<printBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x1f,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     117f <printBytes+0x6f>
mov    -0x8(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0xc(%rbp),%eax
cmp    $0x0,%eax
je     115e <printBytes+0x4e>
lea    0xeb1(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
jmp    116c <printBytes+0x5c>
lea    0xe9b(%rip),%rdi
xor    %esi,%esi
call   1030 <printf@plt>
jmp    1171 <printBytes+0x61>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <printBytes+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printBytes>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x1f,%ebp
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%esi
mov    %ebp,%ecx
shr    %cl,%esi
and    $0x1,%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jb     1130 <printBytes+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @printBytes(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 31, %1 ], [ %7, %2 ]
%4 = lshr i32 %0, %3
%5 = and i32 %4, 1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = add nsw i32 %3, -1
%8 = icmp eq i32 %3, 0
br i1 %8, label %9, label %2
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ set_bit(int, unsigned long *);
int test_bit(int, unsigned long *);
int test_and_set_bit(int nr, unsigned long *addr) {
  int oldbit = test_bit(nr, addr);
  set_bit(nr, addr);
  return oldbit;
}


x86 assembly (clang, -O0):
<test_and_set_bit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <test_bit@plt>
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1030 <set_bit@plt>
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_and_set_bit>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %edi,%ebp
call   1040 <test_bit@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    %rbx,%rsi
call   1030 <set_bit@plt>
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @test_and_set_bit(i32 %0, i64* %1) {
%3 = tail call i32 @test_bit(i32 %0, i64* %1)
%4 = tail call i32 @set_bit(i32 %0, i64* %1)
ret i32 %3
}
void mm_initialize(struct CalculationInfo *info) {}


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

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

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

LLVM IR (-O2):
%struct.CalculationInfo = type opaque
define void @mm_initialize(%struct.CalculationInfo* nocapture %0) {
ret void
}
/* Variables and functions */
scalar_t__ httpd_exit();
int httpd_run(char *, int);
int main(int argc, char **argv) {
  int ret = httpd_run("127.0.0.1", 21678);
  if (ret != 0)
    return (ret);
  if (httpd_exit() != 0)
    return (5);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x54ae,%esi
call   1030 <httpd_run@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     115f <main+0x3f>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1183 <main+0x63>
mov    $0x0,%al
call   1040 <httpd_exit@plt>
cmp    $0x0,%rax
je     117c <main+0x5c>
movl   $0x5,-0x4(%rbp)
jmp    1183 <main+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x54ae,%esi
call   1030 <httpd_run@plt>
test   %eax,%eax
je     1138 <main+0x18>
pop    %rcx
ret
xor    %eax,%eax
call   1040 <httpd_exit@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    (%rcx,%rcx,4),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"127.0.0.1\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @httpd_run(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 21678)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = tail call i64 (...) @httpd_exit()
%7 = icmp eq i64 %6, 0
%8 = select i1 %7, i32 0, i32 5
br label %9
9: ; preds = %5, %2
%10 = phi i32 [ %3, %2 ], [ %8, %5 ]
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
uint8_t isset(uint8_t val, uint8_t mask) { return (val & mask); }


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

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

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

LLVM IR (-O2):
define i32 @isset(i32 %0, i32 %1) {
%3 = and i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ error_msg(char *, char *);
int main(void) {
  error_msg("send data failed: %s\n", "open error");
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xef7(%rip),%rsi
call   1030 <error_msg@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [22 x i8] c"send data failed: %s\0A\00"
@.str.1 = [11 x i8] c"open error\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @error_msg(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"send data failed: %s\0A\00"
@.str.1 = [11 x i8] c"open error\00"
define i32 @main() {
%1 = tail call i32 @error_msg(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
int test_imm_DFint8_mem(signed char *val) {
  return ((*val) & (-0xDF << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_DFint8_mem>:
movsbl (%rdi),%eax
test   $0xffffff21,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_DFint8_mem(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = and i32 %5, -223
%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_DFint8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -223
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ ChronoReset();
void ChronoInit(void) { ChronoReset(); }


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

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

LLVM IR (-O0):
define void @ChronoInit() {
%1 = call i32 (...) @ChronoReset()
ret void
}

LLVM IR (-O2):
define void @ChronoInit() {
%1 = tail call i32 (...) @ChronoReset()
ret void
}
double da_deta(double a) { return a; }


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

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

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

LLVM IR (-O2):
define double @da_deta(double returned %0) {
ret double %0
}
/* Variables and functions */
scalar_t__ getgid();
int /*<<< orphan*/ printf(char *, long);
int main() {
  printf("gid:%ld\n", (long)getgid());
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <getgid@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [9 x i8] c"gid:%ld\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i64 (...) @getgid()
%3 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"gid:%ld\0A\00"
define i32 @main() {
%1 = tail call i64 (...) @getgid()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i64 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ mmap_bad();
int /*<<< orphan*/ mmap_no_hint();
int /*<<< orphan*/ mmap_with_hint();
int /*<<< orphan*/ munmap_good();
int test_mmap(void) {
  mmap_no_hint();
  mmap_with_hint();
  mmap_bad();
  munmap_good();
  return 0;
}


x86 assembly (clang, -O0):
<test_mmap>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <mmap_no_hint@plt>
mov    $0x0,%al
call   1060 <mmap_with_hint@plt>
mov    $0x0,%al
call   1040 <mmap_bad@plt>
mov    $0x0,%al
call   1050 <munmap_good@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mmap>:
push   %rax
xor    %eax,%eax
call   1030 <mmap_no_hint@plt>
xor    %eax,%eax
call   1060 <mmap_with_hint@plt>
xor    %eax,%eax
call   1040 <mmap_bad@plt>
xor    %eax,%eax
call   1050 <munmap_good@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @test_mmap() {
%1 = call i32 (...) @mmap_no_hint()
%2 = call i32 (...) @mmap_with_hint()
%3 = call i32 (...) @mmap_bad()
%4 = call i32 (...) @munmap_good()
ret i32 0
}

LLVM IR (-O2):
define i32 @test_mmap() {
%1 = tail call i32 (...) @mmap_no_hint()
%2 = tail call i32 (...) @mmap_with_hint()
%3 = tail call i32 (...) @mmap_bad()
%4 = tail call i32 (...) @munmap_good()
ret i32 0
}
/* Variables and functions */
int a2i(char const *);
unsigned target_a2i(int ms_bit_nr, const char *a) {
  if (ms_bit_nr)
    return (ms_bit_nr - a2i(a));
  else
    return a2i(a);
}


x86 assembly (clang, -O0):
<target_a2i>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <target_a2i+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <a2i@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1153 <target_a2i+0x43>
mov    -0x10(%rbp),%rdi
call   1030 <a2i@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<target_a2i>:
push   %rbx
mov    %edi,%ebx
mov    %rsi,%rdi
call   1030 <a2i@plt>
mov    %ebx,%ecx
sub    %eax,%ecx
test   %ebx,%ebx
cmovne %ecx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @target_a2i(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
%4 = tail call i32 @a2i(i8* %1)
%5 = sub nsw i32 %0, %4
%6 = select i1 %3, i32 %4, i32 %5
ret i32 %6
}