xunge/DecIR huggingface dataset:
/* Variables and functions */
int fremovexattr(int, char const *);
int ceph_os_fremovexattr(int fd, const char *name) {
  int error = -1;
  error = fremovexattr(fd, name);
  return (error);
}


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

x86 assembly (clang, -O2):
<ceph_os_fremovexattr>:
jmp    1030 <fremovexattr@plt>

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

LLVM IR (-O2):
define i32 @ceph_os_fremovexattr(i32 %0, i8* %1) {
%3 = tail call i32 @fremovexattr(i32 %0, i8* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ int8_t;

/* Variables and functions */
int8_t readBit(int8_t *buf, int x) { return buf[x]; }


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

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

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

LLVM IR (-O2):
define i32 @readBit(i32* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i32, i32* %0, i64 %3
%5 = load i32, i32* %4
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fail(char *, char const *, int, char const *);
void atf_sanity_post(const char *file, int line, const char *cond) {
  fail("Postcondition check failed at %s:%d: %s", file, line, cond);
}


x86 assembly (clang, -O0):
<atf_sanity_post>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xecb(%rip),%rdi
call   1030 <fail@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<atf_sanity_post>:
mov    %rdx,%rcx
mov    %esi,%edx
mov    %rdi,%rsi
lea    0xee1(%rip),%rdi
jmp    1030 <fail@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Postcondition check failed at %s:%d: %s\00"
define void @atf_sanity_post(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @fail(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %8, i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Postcondition check failed at %s:%d: %s\00"
define void @atf_sanity_post(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32 @fail(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
ret void
}
/* Variables and functions */
int O_NDELAY;
int O_NOCTTY;
int O_WRONLY;
int /*<<< orphan*/ close(int);
int console_open(int);
int /*<<< orphan*/ safe_write(int, char *, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
void print(char *s) {
  int fd;
  if ((fd = console_open(O_WRONLY | O_NOCTTY | O_NDELAY)) >= 0) {
    safe_write(fd, s, strlen(s));
    close(fd);
  }
}


x86 assembly (clang, -O0):
<print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e75(%rip),%rax
mov    (%rax),%edi
mov    0x2e84(%rip),%rax
or     (%rax),%edi
mov    0x2e73(%rip),%rax
or     (%rax),%edi
call   1030 <console_open@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jl     11a5 <print+0x65>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1060 <safe_write@plt>
mov    -0xc(%rbp),%edi
call   1050 <close@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print>:
push   %rbp
push   %rbx
push   %rax
mov    0x2e7e(%rip),%rcx
mov    0x2e8f(%rip),%rax
mov    (%rax),%eax
or     (%rcx),%eax
mov    %rdi,%rbx
mov    0x2e79(%rip),%rcx
or     (%rcx),%eax
mov    %eax,%edi
call   1030 <console_open@plt>
test   %eax,%eax
js     118f <print+0x4f>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <safe_write@plt>
mov    %ebp,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <close@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define void @print(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i32, i32* @O_WRONLY
%5 = load i32, i32* @O_NOCTTY
%6 = or i32 %4, %5
%7 = load i32, i32* @O_NDELAY
%8 = or i32 %6, %7
%9 = call i32 @console_open(i32 %8)
store i32 %9, i32* %3
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %19
11: ; preds = %1
%12 = load i32, i32* %3
%13 = load i8*, i8** %2
%14 = load i8*, i8** %2
%15 = call i32 @strlen(i8* %14)
%16 = call i32 @safe_write(i32 %12, i8* %13, i32 %15)
%17 = load i32, i32* %3
%18 = call i32 @close(i32 %17)
br label %19
19: ; preds = %11, %1
ret void
}

LLVM IR (-O2):
@O_WRONLY = global i32 0
@O_NOCTTY = global i32 0
@O_NDELAY = global i32 0
define void @print(i8* %0) {
%2 = load i32, i32* @O_WRONLY
%3 = load i32, i32* @O_NOCTTY
%4 = or i32 %3, %2
%5 = load i32, i32* @O_NDELAY
%6 = or i32 %4, %5
%7 = tail call i32 @console_open(i32 %6)
%8 = icmp sgt i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %1
%10 = tail call i32 @strlen(i8* %0)
%11 = tail call i32 @safe_write(i32 %7, i8* %0, i32 %10)
%12 = tail call i32 @close(i32 %7)
br label %13
13: ; preds = %9, %1
ret void
}
/* Variables and functions */
int query(int);
int ranqy(int l, int r) { return query(r) - query(l - 1); }


x86 assembly (clang, -O0):
<ranqy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <query@plt>
mov    %eax,-0xc(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1030 <query@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
sub    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ranqy(i32 %0, i32 %1) {
%3 = tail call i32 @query(i32 %1)
%4 = add nsw i32 %0, -1
%5 = tail call i32 @query(i32 %4)
%6 = sub nsw i32 %3, %5
ret i32 %6
}
adrx0adrreg1_set(r0, r1, x0, x1, p0, p1) float r0, r1;
float *p0, *p1;
{ (((float *)10000000)[x0]) = (p1[1111111 / 4]); }


x86 assembly (clang, -O0):
<adrx0adrreg1_set>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm1,-0x30(%rbp)
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm0
movss  %xmm1,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movss  0x10f444(%rax),%xmm0
movslq -0x10(%rbp),%rcx
mov    $0x989680,%eax
movss  %xmm0,(%rax,%rcx,4)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrx0adrreg1_set>:
movss  0x10f444(%rcx),%xmm0
movslq %edi,%rax
movss  %xmm0,0x989680(,%rax,4)
ret

LLVM IR (-O0):
define i32 @adrx0adrreg1_set(double %0, double %1, i32 %2, i32 %3, float* %4, float* %5) {
%7 = alloca i32
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = fptrunc double %0 to float
%15 = fptrunc double %1 to float
store float %14, float* %8
store float %15, float* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store float* %4, float** %12
store float* %5, float** %13
%16 = load float*, float** %13
%17 = getelementptr inbounds float, float* %16, i64 277777
%18 = load float, float* %17
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %20
store float %18, float* %21
%22 = load i32, i32* %7
ret i32 %22
}

LLVM IR (-O2):
define i32 @adrx0adrreg1_set(double %0, double %1, i32 %2, i32 %3, float* nocapture readnone %4, float* nocapture %5) {
%7 = getelementptr inbounds float, float* %5, i64 277777
%8 = load float, float* %7
%9 = sext i32 %2 to i64
%10 = getelementptr inbounds float, float* inttoptr (i64 10000000 to float*), i64 %9
store float %8, float* %10
ret i32 undef
}
/* Type definitions */
struct fs_file {
  int dummy;
};
typedef int ssize_t;

/* Variables and functions */
ssize_t fs_http_write_to(struct fs_file *f, const void *buf, size_t count,
                         long timeout) {
  return -1;
}


x86 assembly (clang, -O0):
<fs_http_write_to>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xffffffff,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.fs_file = type { i32 }
define i32 @fs_http_write_to(%struct.fs_file* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca %struct.fs_file*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
store %struct.fs_file* %0, %struct.fs_file** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
ret i32 -1
}

LLVM IR (-O2):
%struct.fs_file = type { i32 }
define i32 @fs_http_write_to(%struct.fs_file* nocapture readnone %0, i8* nocapture readnone %1, i64 %2, i64 %3) {
ret i32 -1
}
void create_start() {}


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @inclass2inclass_ext_unit() {
ret void
}
/* Variables and functions */
int **foo();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int(*arr)[] = foo();
  printf("array[0] = %d\n", (*arr)[0]);
  printf("array[1] = %d\n", (*arr)[1]);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1040 <foo@plt>
mov    %rax,%rbx
mov    (%rax),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
lea    0xecc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [15 x i8] c"array[0] = %d\0A\00"
@.str.1 = [15 x i8] c"array[1] = %d\0A\00"
define i32 @main() {
%1 = tail call i32** (...) @foo()
%2 = bitcast i32** %1 to [0 x i32]*
%3 = bitcast i32** %1 to i32*
%4 = load i32, i32* %3
%5 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = getelementptr inbounds [0 x i32], [0 x i32]* %2, i64 0, i64 1
%7 = load i32, i32* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void hello2() { printf("test/include hello2()!\n"); }


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ base64_encode_padded(char *, int, unsigned long);
const char *cnum2str(unsigned long snum, unsigned long cnum) {
  static char buf[5 + 1];
  base64_encode_padded(buf, sizeof(buf), snum * 64 * 64 * 64 + cnum);
  return buf;
}


x86 assembly (clang, -O0):
<cnum2str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdx
shl    $0x6,%rdx
shl    $0x6,%rdx
shl    $0x6,%rdx
add    -0x10(%rbp),%rdx
lea    0x2eee(%rip),%rdi
mov    $0x6,%esi
call   1030 <base64_encode_padded@plt>
lea    0x2edd(%rip),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cnum2str>:
push   %rbx
shl    $0x12,%rdi
lea    (%rdi,%rsi,1),%rdx
lea    0x2f09(%rip),%rbx
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <base64_encode_padded@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@cnum2str.buf = internal global [6 x i8] zeroinitializer
define i8* @cnum2str(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = mul i64 %5, 64
%7 = mul i64 %6, 64
%8 = mul i64 %7, 64
%9 = load i64, i64* %4
%10 = add i64 %8, %9
%11 = call i32 @base64_encode_padded(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @cnum2str.buf, i64 0, i64 0), i32 6, i64 %10)
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @cnum2str.buf, i64 0, i64 0)
}

LLVM IR (-O2):
@cnum2str.buf = internal global [6 x i8] zeroinitializer
define i8* @cnum2str(i64 %0, i64 %1) {
%3 = shl i64 %0, 18
%4 = add i64 %3, %1
%5 = tail call i32 @base64_encode_padded(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @cnum2str.buf, i64 0, i64 0), i32 6, i64 %4)
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @cnum2str.buf, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ MOTOR_DIR_RestoreConfig();
void MOTOR_DIR_Wakeup(void) { MOTOR_DIR_RestoreConfig(); }


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

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

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

LLVM IR (-O2):
define void @MOTOR_DIR_Wakeup() {
%1 = tail call i32 (...) @MOTOR_DIR_RestoreConfig()
ret void
}
int stress_get_load_avg(double *min1, double *min5, double *min15) {
  *min1 = *min5 = *min15 = 0.0;
  return -1;
}


x86 assembly (clang, -O0):
<stress_get_load_avg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x8(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<stress_get_load_avg>:
movq   $0x0,(%rdx)
movq   $0x0,(%rsi)
movq   $0x0,(%rdi)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @stress_get_load_avg(double* %0, double* %1, double* %2) {
%4 = alloca double*
%5 = alloca double*
%6 = alloca double*
store double* %0, double** %4
store double* %1, double** %5
store double* %2, double** %6
%7 = load double*, double** %6
store double 0.000000e+00, double* %7
%8 = load double*, double** %5
store double 0.000000e+00, double* %8
%9 = load double*, double** %4
store double 0.000000e+00, double* %9
ret i32 -1
}

LLVM IR (-O2):
define i32 @stress_get_load_avg(double* nocapture writeonly %0, double* nocapture writeonly %1, double* nocapture writeonly %2) {
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %1
store double 0.000000e+00, double* %0
ret i32 -1
}
void gtk_text_buffer_insert() {}


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

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

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

LLVM IR (-O2):
define void @gtk_text_buffer_insert() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
int main() {
  char a;
  a = 'g';
  printf("%c", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x67,-0x5(%rbp)
lea    0xed6(%rip),%rdi
movsbl -0x5(%rbp),%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x67,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext 103)
ret i32 0
}
int test_imm_B3uint16_mem(unsigned short *val) {
  return ((*val) & (-0xB3 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B3uint16_mem(i16* %0) {
%2 = alloca i16*
store i16* %0, i16** %2
%3 = load i16*, i16** %2
%4 = load i16, i16* %3
%5 = zext i16 %4 to i32
%6 = and i32 %5, -179
%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_B3uint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, -179
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
double sin(double x __attribute__((unused))) { return 0.0; }


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

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

LLVM IR (-O0):
define double @sin(double %0) {
%2 = alloca double
store double %0, double* %2
ret double 0.000000e+00
}

LLVM IR (-O2):
define double @sin(double %0) {
ret double 0.000000e+00
}
void *get_elem(const void *ptr, int n, int elem_size) {
  return ((char *)ptr) + n * elem_size;
}


x86 assembly (clang, -O0):
<get_elem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_elem>:
imul   %edx,%esi
movslq %esi,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i8* @get_elem(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = mul nsw i32 %8, %9
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %7, i64 %11
ret i8* %12
}

LLVM IR (-O2):
define i8* @get_elem(i8* readnone %0, i32 %1, i32 %2) {
%4 = mul nsw i32 %2, %1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
ret i8* %6
}
/* Variables and functions */
int recv(int, void *, size_t, int);
int plat_recv(int s, void *buf, size_t len, int flags) {
  return (recv(s, buf, len, flags));
}


x86 assembly (clang, -O0):
<plat_recv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <recv@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plat_recv>:
jmp    1030 <recv@plt>

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

LLVM IR (-O2):
define i32 @plat_recv(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @recv(i32 %0, i8* %1, i64 %2, i32 %3)
ret i32 %5
}
/* Type definitions */
struct u_tsd {
  int dummy;
};

/* Variables and functions */
void *u_tsd_get(struct u_tsd *tsd) {
  (void)tsd;
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.u_tsd = type { i32 }
define i8* @u_tsd_get(%struct.u_tsd* %0) {
%2 = alloca %struct.u_tsd*
store %struct.u_tsd* %0, %struct.u_tsd** %2
%3 = load %struct.u_tsd*, %struct.u_tsd** %2
ret i8* null
}

LLVM IR (-O2):
%struct.u_tsd = type { i32 }
define noalias i8* @u_tsd_get(%struct.u_tsd* nocapture readnone %0) {
ret i8* null
}
int cmpfn(void *a, void *b) { return *(double *)a == *(double *)b; }


x86 assembly (clang, -O0):
<cmpfn>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
sete   %al
setnp  %cl
and    %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmpfn>:
movsd  (%rsi),%xmm0
cmpeqsd (%rdi),%xmm0
movq   %xmm0,%rax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @cmpfn(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 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to double*
%10 = load double, double* %9
%11 = fcmp oeq double %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @cmpfn(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp oeq double %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
void view_hotel_av(void) {}


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

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

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

LLVM IR (-O2):
define void @view_hotel_av() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ functionA();
int functionB();
int functionC(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  functionA();
  int valAux = functionB();
  printf("\nA Funcao B, retornou: %d\n", valAux);
  int soma = functionC(5, 4);
  printf("\nA Funcao C, retornou: %d\n", soma);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <functionA@plt>
mov    $0x0,%al
call   1060 <functionB@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x4,%esi
call   1050 <functionC@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe90(%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 <functionA@plt>
xor    %eax,%eax
call   1060 <functionB@plt>
lea    0xeaa(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    $0x4,%esi
call   1050 <functionC@plt>
lea    0xea8(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0AA Funcao B, retornou: %d\0A\00"
@.str.1 = [27 x i8] c"\0AA Funcao C, retornou: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @functionA()
%5 = call i32 (...) @functionB()
store i32 %5, i32* %2
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @functionC(i32 5, i32 4)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0AA Funcao B, retornou: %d\0A\00"
@.str.1 = [27 x i8] c"\0AA Funcao C, retornou: %d\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @functionA()
%2 = tail call i32 (...) @functionB()
%3 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @functionC(i32 5, i32 4)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
char *strcpy(char *, char const *);
int strlen(char const *);
char *strdup(const char *s) {
  int len = strlen(s);
  char *new_string = (char *)malloc((len + 1) * sizeof(char));
  return strcpy(new_string, s);
}


x86 assembly (clang, -O0):
<strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strdup>:
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <malloc@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <strcpy@plt>

LLVM IR (-O0):
define i8* @strdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = sext i32 %8 to i64
%10 = mul i64 %9, 1
%11 = trunc i64 %10 to i32
%12 = call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %4
%14 = load i8*, i8** %4
%15 = load i8*, i8** %2
%16 = call i8* @strcpy(i8* %14, i8* %15)
ret i8* %16
}

LLVM IR (-O2):
define i8* @strdup(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = tail call i8* @strcpy(i8* dereferenceable(1) %5, i8* dereferenceable(1) %0)
ret i8* %5
}
/* Variables and functions */
int ackermanRecur(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  printf("%3d", ackermanRecur(4, 0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x4,%edi
xor    %esi,%esi
call   1040 <ackermanRecur@plt>
mov    %eax,%esi
lea    0xebc(%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
xor    %esi,%esi
call   1040 <ackermanRecur@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%3d\00"
define i32 @main() {
%1 = tail call i32 @ackermanRecur(i32 4, i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int cmp(void *d1, void *d2) { return (strcmp((char *)d1, (char *)d2)); }


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

x86 assembly (clang, -O2):
<cmp>:
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @cmp(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 i32 @strcmp(i8* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i32 %3
}
void pr21668_2(__attribute__((nonnull)) const char *p) {
  p = 0;
  if (p)
    ;
}


x86 assembly (clang, -O0):
<pr21668_2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1120 <pr21668_2+0x20>
jmp    1120 <pr21668_2+0x20>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @pr21668_2(i8* nocapture %0) {
ret void
}
int test_fn(int i) {
  int j = i;
  return j;
}


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

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

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

LLVM IR (-O2):
define i32 @test_fn(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int *);
void bar() {
  int a;
  int *p;
  printf("%d %p\n", a, p);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [7 x i8] c"%d %p\0A\00"
define void @bar() {
%1 = alloca i32
%2 = alloca i32*
%3 = load i32, i32* %1
%4 = load i32*, i32** %2
%5 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %3, i32* %4)
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"%d %p\0A\00"
define void @bar() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 undef, i32* undef)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_add_digits();
int /*<<< orphan*/ test_itoc();
int /*<<< orphan*/ test_reverse_string();
int main(int argc, char *argv[]) {
  test_reverse_string();
  test_itoc();
  test_add_digits();
  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   1050 <test_reverse_string@plt>
mov    $0x0,%al
call   1040 <test_itoc@plt>
mov    $0x0,%al
call   1030 <test_add_digits@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1050 <test_reverse_string@plt>
xor    %eax,%eax
call   1040 <test_itoc@plt>
xor    %eax,%eax
call   1030 <test_add_digits@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 (...) @test_reverse_string()
%7 = call i32 (...) @test_itoc()
%8 = call i32 (...) @test_add_digits()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_reverse_string()
%4 = tail call i32 (...) @test_itoc()
%5 = tail call i32 (...) @test_add_digits()
ret i32 0
}
/* Variables and functions */
unsigned short RAND_MAX;
unsigned short rand();
unsigned short rand_num(unsigned short min, unsigned short max) {
  return (min + rand() / (RAND_MAX / (max - min) + 1));
}


x86 assembly (clang, -O0):
<rand_num>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movzwl -0x2(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
movzwl %ax,%eax
mov    %eax,-0xc(%rbp)
mov    0x2ea7(%rip),%rax
movzwl (%rax),%eax
movzwl -0x4(%rbp),%ecx
movzwl -0x2(%rbp),%edx
sub    %edx,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_num>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
movzwl %ax,%ecx
mov    0x2ec0(%rip),%rax
movzwl (%rax),%eax
sub    %ebp,%ebx
xor    %edx,%edx
idiv   %ebx
mov    %eax,%esi
add    $0x1,%esi
mov    %ecx,%eax
xor    %edx,%edx
idiv   %esi
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i16 0
define zeroext i16 @rand_num(i16 zeroext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = call zeroext i16 (...) @rand()
%8 = zext i16 %7 to i32
%9 = load i16, i16* @RAND_MAX
%10 = zext i16 %9 to i32
%11 = load i16, i16* %4
%12 = zext i16 %11 to i32
%13 = load i16, i16* %3
%14 = zext i16 %13 to i32
%15 = sub nsw i32 %12, %14
%16 = sdiv i32 %10, %15
%17 = add nsw i32 %16, 1
%18 = sdiv i32 %8, %17
%19 = add nsw i32 %6, %18
%20 = trunc i32 %19 to i16
ret i16 %20
}

LLVM IR (-O2):
@RAND_MAX = global i16 0
define zeroext i16 @rand_num(i16 zeroext %0, i16 zeroext %1) {
%3 = zext i16 %0 to i32
%4 = tail call zeroext i16 (...) @rand()
%5 = zext i16 %4 to i32
%6 = load i16, i16* @RAND_MAX
%7 = zext i16 %6 to i32
%8 = zext i16 %1 to i32
%9 = sub nsw i32 %8, %3
%10 = sdiv i32 %7, %9
%11 = add nsw i32 %10, 1
%12 = sdiv i32 %5, %11
%13 = trunc i32 %12 to i16
%14 = add i16 %13, %0
ret i16 %14
}
double fabs(double x) {
  if (x < 0)
    return (-x);
  return x;
}


x86 assembly (clang, -O0):
<fabs>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    113d <fabs+0x3d>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1147 <fabs+0x47>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabs>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @fabs(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = fneg double %7
store double %8, double* %2
br label %11
9: ; preds = %1
%10 = load double, double* %3
store double %10, double* %2
br label %11
11: ; preds = %9, %6
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
define double @fabs(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ledHoriz(int on, int decimalPt) {
  if (on)
    printf("#########");
  else
    printf("         ");
  if (decimalPt)
    printf(" #   ");
  else
    printf("     ");
}


x86 assembly (clang, -O0):
<ledHoriz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1139 <ledHoriz+0x29>
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
jmp    1145 <ledHoriz+0x35>
lea    0xeca(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x0,-0x8(%rbp)
je     1160 <ledHoriz+0x50>
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
jmp    116c <ledHoriz+0x5c>
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ledHoriz>:
push   %rbx
mov    %esi,%ebx
test   %edi,%edi
lea    0xeee(%rip),%rax
lea    0xedd(%rip),%rdi
cmove  %rax,%rdi
call   1030 <printf@plt>
test   %ebx,%ebx
lea    0xed9(%rip),%rax
lea    0xed8(%rip),%rdi
cmove  %rax,%rdi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"#########\00"
@.str.1 = [10 x i8] c" \00"
@.str.2 = [6 x i8] c" # \00"
@.str.3 = [6 x i8] c" \00"
define void @ledHoriz(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 = icmp ne i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
br label %11
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %7
%12 = load i32, i32* %4
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %11
%15 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %18
16: ; preds = %11
%17 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %18
18: ; preds = %16, %14
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"#########\00"
@.str.1 = [10 x i8] c" \00"
@.str.2 = [6 x i8] c" # \00"
@.str.3 = [6 x i8] c" \00"
define void @ledHoriz(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = select i1 %3, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0)
%5 = tail call i32 @printf(i8* dereferenceable(1) %4)
%6 = icmp eq i32 %1, 0
%7 = select i1 %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0)
%8 = tail call i32 @printf(i8* dereferenceable(1) %7)
ret void
}
int NumberOfWaves() { return 1000; }


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

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

LLVM IR (-O0):
define i32 @NumberOfWaves() {
ret i32 1000
}

LLVM IR (-O2):
define i32 @NumberOfWaves() {
ret i32 1000
}
int test_imm_FFint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0xFF << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_FFint64_highword_mem>:
cmpb   $0x0,0x4(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_FFint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 1095216660480
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
void quantifier2ZEROMORE() {}


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

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

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

LLVM IR (-O2):
define void @quantifier2ZEROMORE() {
ret void
}
double __extendsfdf2(float a) {
  long lc[2];
  if (!((*(const long *)&a) & 0x7fffffff))
    lc[1] = (*(const long *)&a), lc[0] = 0;
  else
    ((lc)[1] = (((*(const long *)&a)) & 0x80000000) +
               ((((*(const long *)&a)) & 0x7fffffff) >> 3) + 0x38000000,
     (lc)[0] = ((*(const long *)&a)) << 29);
  return (*(const double *)lc);
}


x86 assembly (clang, -O0):
<__extendsfdf2>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
mov    -0x4(%rbp),%rax
and    $0x7fffffff,%rax
cmp    $0x0,%rax
jne    1132 <__extendsfdf2+0x32>
mov    -0x4(%rbp),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
jmp    1168 <__extendsfdf2+0x68>
movabs $0x80000000,%rax
and    -0x4(%rbp),%rax
mov    -0x4(%rbp),%rcx
and    $0x7fffffff,%rcx
sar    $0x3,%rcx
add    %rcx,%rax
add    $0x38000000,%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%rax
shl    $0x1d,%rax
mov    %rax,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<__extendsfdf2>:
movd   %xmm0,-0x8(%rsp)
mov    -0x8(%rsp),%rax
pxor   %xmm0,%xmm0
test   $0x7fffffff,%eax
je     111f <__extendsfdf2+0x1f>
shl    $0x1d,%rax
movq   %rax,%xmm0
ret

LLVM IR (-O0):
define double @__extendsfdf2(float %0) {
%2 = alloca float
%3 = alloca [2 x i64]
store float %0, float* %2
%4 = bitcast float* %2 to i64*
%5 = load i64, i64* %4
%6 = and i64 %5, 2147483647
%7 = icmp ne i64 %6, 0
br i1 %7, label %13, label %8
8: ; preds = %1
%9 = bitcast float* %2 to i64*
%10 = load i64, i64* %9
%11 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 1
store i64 %10, i64* %11
%12 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
store i64 0, i64* %12
br label %28
13: ; preds = %1
%14 = bitcast float* %2 to i64*
%15 = load i64, i64* %14
%16 = and i64 %15, 2147483648
%17 = bitcast float* %2 to i64*
%18 = load i64, i64* %17
%19 = and i64 %18, 2147483647
%20 = ashr i64 %19, 3
%21 = add nsw i64 %16, %20
%22 = add nsw i64 %21, 939524096
%23 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 1
store i64 %22, i64* %23
%24 = bitcast float* %2 to i64*
%25 = load i64, i64* %24
%26 = shl i64 %25, 29
%27 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
store i64 %26, i64* %27
br label %28
28: ; preds = %13, %8
%29 = getelementptr inbounds [2 x i64], [2 x i64]* %3, i64 0, i64 0
%30 = bitcast i64* %29 to double*
%31 = load double, double* %30
ret double %31
}

LLVM IR (-O2):
define double @__extendsfdf2(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = bitcast float* %2 to i64*
%4 = load i64, i64* %3
%5 = and i64 %4, 2147483647
%6 = icmp eq i64 %5, 0
%7 = shl i64 %4, 29
%8 = bitcast i64 %7 to double
%9 = select i1 %6, double 0.000000e+00, double %8
ret double %9
}
void asd_dump_scb_list(struct asd_ascb *ascb, int num) {}


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

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

LLVM IR (-O0):
%struct.asd_ascb = type opaque
define void @asd_dump_scb_list(%struct.asd_ascb* %0, i32 %1) {
%3 = alloca %struct.asd_ascb*
%4 = alloca i32
store %struct.asd_ascb* %0, %struct.asd_ascb** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.asd_ascb = type opaque
define void @asd_dump_scb_list(%struct.asd_ascb* nocapture %0, i32 %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sys_free(long long *);
void free(void *ptr) {
  if (ptr)
    sys_free((long long *)ptr - 1);
}


x86 assembly (clang, -O0):
<free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1134 <free+0x24>
mov    -0x8(%rbp),%rdi
add    $0xfffffffffffffff8,%rdi
call   1030 <sys_free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free>:
test   %rdi,%rdi
je     111e <free+0xe>
add    $0xfffffffffffffff8,%rdi
jmp    1030 <sys_free@plt>
ret

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

LLVM IR (-O2):
define void @free(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %7, label %3
3: ; preds = %1
%4 = getelementptr inbounds i8, i8* %0, i64 -8
%5 = bitcast i8* %4 to i64*
%6 = tail call i32 @sys_free(i64* %5)
br label %7
7: ; preds = %3, %1
ret void
}
void nullprint(char *s, ...) { return; }


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

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

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

LLVM IR (-O2):
define void @nullprint(i8* nocapture %0, ...) {
ret void
}
double max_dble(double x, double y) {
  if (x > y) {
    return x;
  } else {
    return y;
  }
}


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

x86 assembly (clang, -O2):
<max_dble>:
maxsd  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define double @max_dble(double %0, double %1) {
%3 = fcmp ogt double %0, %1
%4 = select i1 %3, double %0, double %1
ret double %4
}
int cmp_lt(long arg1, long arg2) { return arg1 >= arg2; }


x86 assembly (clang, -O0):
<cmp_lt>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
setge  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_lt>:
xor    %eax,%eax
cmp    %rsi,%rdi
setge  %al
ret

LLVM IR (-O0):
define i32 @cmp_lt(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = icmp sge i64 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @cmp_lt(i64 %0, i64 %1) {
%3 = icmp sge i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}