xunge/DecIR huggingface dataset:
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, long long, long long);
void print_timestamp(void) {
  struct timeval t;
  gettimeofday(&t, NULL);
  printf("%lld:%lld seconds\n", (long long)t.tv_sec, (long long)t.tv_usec);
}


x86 assembly (clang, -O0):
<print_timestamp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_timestamp>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
mov    0x8(%rsp),%rdx
mov    0x10(%rsp),%rsi
lea    0xebf(%rip),%rdi
add    $0x18,%rsp
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
@.str = [19 x i8] c"%lld:%lld seconds\0A\00"
define void @print_timestamp() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%4 = load i64, i64* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%6 = load i64, i64* %5
%7 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %4, i64 %6)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
@.str = [19 x i8] c"%lld:%lld seconds\0A\00"
define void @print_timestamp() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i64, i64* %6
%8 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i64 %5, i64 %7)
ret void
}
void ram_console_pl_save(unsigned int val, int index) {}


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

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

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

LLVM IR (-O2):
define void @ram_console_pl_save(i32 %0, i32 %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ unlink(char const *);
void dmn_pidfile_unlock(FILE *f, const char *name) {
  if (name)
    unlink(name);
  if (f)
    fclose(f);
}


x86 assembly (clang, -O0):
<dmn_pidfile_unlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1144 <dmn_pidfile_unlock+0x24>
mov    -0x10(%rbp),%rdi
call   1030 <unlink@plt>
cmpq   $0x0,-0x8(%rbp)
je     1158 <dmn_pidfile_unlock+0x38>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dmn_pidfile_unlock>:
push   %rbx
mov    %rdi,%rbx
test   %rsi,%rsi
je     1131 <dmn_pidfile_unlock+0x11>
mov    %rsi,%rdi
call   1030 <unlink@plt>
test   %rbx,%rbx
je     113f <dmn_pidfile_unlock+0x1f>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <fclose@plt>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @dmn_pidfile_unlock(i32* %0, i8* %1) {
%3 = icmp eq i8* %1, null
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 @unlink(i8* %1)
br label %6
6: ; preds = %4, %2
%7 = icmp eq i32* %0, null
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = tail call i32 @fclose(i32* %0)
br label %10
10: ; preds = %8, %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void italy() { printf("I am in italy\n"); }


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

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

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

LLVM IR (-O2):
@str = [14 x i8] c"I am in italy\00"
define void @italy() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
ret void
}
int tcp_cork_sock(int fd __attribute__((unused)),
                  int corked __attribute__((unused))) {
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @tcp_cork_sock(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 @tcp_cork_sock(i32 %0, i32 %1) {
ret i32 0
}
void i2d_X509_EXTENSIONS(void) {}


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

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

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

LLVM IR (-O2):
define void @i2d_X509_EXTENSIONS() {
ret void
}
/* Variables and functions */
int javaparse();
main() { return (javaparse()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <javaparse@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @javaparse()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ SIGABRT;
int /*<<< orphan*/ raise(int /*<<< orphan*/);
void abort() { raise(SIGABRT); }


x86 assembly (clang, -O0):
<abort>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>

x86 assembly (clang, -O2):
<abort>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
call   1030 <raise@plt>

LLVM IR (-O0):
@SIGABRT = global i32 0
define void @abort() {
%1 = load i32, i32* @SIGABRT
%2 = call i32 @raise(i32 %1)
unreachable
}

LLVM IR (-O2):
@SIGABRT = global i32 0
define void @abort() {
%1 = load i32, i32* @SIGABRT
%2 = tail call i32 @raise(i32 %1)
unreachable
}
/* Variables and functions */
void *malloc(int);
void *aligned_malloc(int size) {
  void *mem = malloc(size + 16 + sizeof(void *));
  void **ptr = (void **)((long)(mem + 16 + sizeof(void *)) & ~(16 - 1));
  ptr[-1] = mem;
  return ptr;
}


x86 assembly (clang, -O0):
<aligned_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%eax
cltq
add    $0x8,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rax
add    $0x8,%rax
and    $0xfffffffffffffff0,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,-0x8(%rax)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aligned_malloc>:
push   %rax
add    $0x18,%edi
call   1030 <malloc@plt>
lea    0x18(%rax),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rax,-0x8(%rcx)
mov    %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @aligned_malloc(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8**
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = add nsw i32 %5, 16
%7 = sext i32 %6 to i64
%8 = add i64 %7, 8
%9 = trunc i64 %8 to i32
%10 = call i8* @malloc(i32 %9)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = getelementptr i8, i8* %11, i64 16
%13 = getelementptr i8, i8* %12, i64 8
%14 = ptrtoint i8* %13 to i64
%15 = and i64 %14, -16
%16 = inttoptr i64 %15 to i8**
store i8** %16, i8*** %4
%17 = load i8*, i8** %3
%18 = load i8**, i8*** %4
%19 = getelementptr inbounds i8*, i8** %18, i64 -1
store i8* %17, i8** %19
%20 = load i8**, i8*** %4
%21 = bitcast i8** %20 to i8*
ret i8* %21
}

LLVM IR (-O2):
define i8* @aligned_malloc(i32 %0) {
%2 = add i32 %0, 24
%3 = tail call i8* @malloc(i32 %2)
%4 = getelementptr i8, i8* %3, i64 24
%5 = ptrtoint i8* %4 to i64
%6 = and i64 %5, -16
%7 = inttoptr i64 %6 to i8**
%8 = getelementptr inbounds i8*, i8** %7, i64 -1
store i8* %3, i8** %8
%9 = inttoptr i64 %6 to i8*
ret i8* %9
}
int myishexdigit(int chr) {
  if ((chr >= 'A') && (chr <= 'F'))
    return (1);
  if ((chr >= 'a') && (chr <= 'f'))
    return (1);
  if ((chr >= '0') && (chr <= '9'))
    return (1);
  if (chr == '-')
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<myishexdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x41,-0x8(%rbp)
jl     1127 <myishexdigit+0x27>
cmpl   $0x46,-0x8(%rbp)
jg     1127 <myishexdigit+0x27>
movl   $0x1,-0x4(%rbp)
jmp    1184 <myishexdigit+0x84>
cmpl   $0x61,-0x8(%rbp)
jl     1147 <myishexdigit+0x47>
cmpl   $0x66,-0x8(%rbp)
jg     1147 <myishexdigit+0x47>
movl   $0x1,-0x4(%rbp)
jmp    1184 <myishexdigit+0x84>
cmpl   $0x30,-0x8(%rbp)
jl     1167 <myishexdigit+0x67>
cmpl   $0x39,-0x8(%rbp)
jg     1167 <myishexdigit+0x67>
movl   $0x1,-0x4(%rbp)
jmp    1184 <myishexdigit+0x84>
cmpl   $0x2d,-0x8(%rbp)
jne    117d <myishexdigit+0x7d>
movl   $0x1,-0x4(%rbp)
jmp    1184 <myishexdigit+0x84>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<myishexdigit>:
mov    %edi,%eax
and    $0xffffffdf,%eax
add    $0xffffffbf,%eax
cmp    $0x6,%eax
setb   %al
lea    -0x30(%rdi),%ecx
cmp    $0xa,%ecx
setb   %cl
cmp    $0x2d,%edi
sete   %dl
or     %cl,%dl
or     %al,%dl
movzbl %dl,%eax
ret

LLVM IR (-O0):
define i32 @myishexdigit(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 65
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 70
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 1, i32* %2
br label %29
10: ; preds = %6, %1
%11 = load i32, i32* %3
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = load i32, i32* %3
%15 = icmp sle i32 %14, 102
br i1 %15, label %16, label %17
16: ; preds = %13
store i32 1, i32* %2
br label %29
17: ; preds = %13, %10
%18 = load i32, i32* %3
%19 = icmp sge i32 %18, 48
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %3
%22 = icmp sle i32 %21, 57
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 1, i32* %2
br label %29
24: ; preds = %20, %17
%25 = load i32, i32* %3
%26 = icmp eq i32 %25, 45
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 1, i32* %2
br label %29
28: ; preds = %24
store i32 0, i32* %2
br label %29
29: ; preds = %28, %27, %23, %16, %9
%30 = load i32, i32* %2
ret i32 %30
}

LLVM IR (-O2):
define i32 @myishexdigit(i32 %0) {
%2 = and i32 %0, -33
%3 = add i32 %2, -65
%4 = icmp ult i32 %3, 6
%5 = add i32 %0, -48
%6 = icmp ult i32 %5, 10
%7 = or i1 %6, %4
%8 = icmp eq i32 %0, 45
%9 = or i1 %8, %7
%10 = zext i1 %9 to i32
ret i32 %10
}
int Veq(v1, v2)
int v1, v2;
{ return (v1 == v2); }


x86 assembly (clang, -O0):
<Veq>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Veq>:
xor    %eax,%eax
cmp    %esi,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @Veq(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 = icmp eq i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}

LLVM IR (-O2):
define i32 @Veq(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ i2c_acquire_bus(int, unsigned int);
int i2c_setup(char const *);
int /*<<< orphan*/ wakeup(int);
int hashlet_setup(const char *bus, unsigned int addr) {
  int fd = i2c_setup(bus);
  i2c_acquire_bus(fd, addr);
  wakeup(fd);
  return fd;
}


x86 assembly (clang, -O0):
<hashlet_setup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <i2c_setup@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <i2c_acquire_bus@plt>
mov    -0x10(%rbp),%edi
call   1030 <wakeup@plt>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hashlet_setup>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
call   1050 <i2c_setup@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %ebx,%esi
call   1040 <i2c_acquire_bus@plt>
mov    %ebp,%edi
call   1030 <wakeup@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @hashlet_setup(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = call i32 @i2c_setup(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = call i32 @i2c_acquire_bus(i32 %8, i32 %9)
%11 = load i32, i32* %5
%12 = call i32 @wakeup(i32 %11)
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
define i32 @hashlet_setup(i8* %0, i32 %1) {
%3 = tail call i32 @i2c_setup(i8* %0)
%4 = tail call i32 @i2c_acquire_bus(i32 %3, i32 %1)
%5 = tail call i32 @wakeup(i32 %3)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef long int32_t;

/* Variables and functions */
long __read_png_int_raw(int /*<<< orphan*/ const *);
bool read_png_int(const uint8_t *buf, int32_t *out) {
  int32_t val;
  val = __read_png_int_raw(buf);
  *out = val;
  return (-((1L << 31) - 1)) <= val;
}


x86 assembly (clang, -O0):
<read_png_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <__read_png_int_raw@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    $0xffffffff80000001,%rax
cmp    -0x18(%rbp),%rax
setle  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_png_int>:
push   %rbx
mov    %rsi,%rbx
call   1030 <__read_png_int_raw@plt>
mov    %rax,(%rbx)
xor    %ecx,%ecx
cmp    $0xffffffff80000001,%rax
setge  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @read_png_int(i32* %0, i64* %1) {
%3 = alloca i32*
%4 = alloca i64*
%5 = alloca i64
store i32* %0, i32** %3
store i64* %1, i64** %4
%6 = load i32*, i32** %3
%7 = call i64 @__read_png_int_raw(i32* %6)
store i64 %7, i64* %5
%8 = load i64, i64* %5
%9 = load i64*, i64** %4
store i64 %8, i64* %9
%10 = load i64, i64* %5
%11 = icmp sle i64 -2147483647, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @read_png_int(i32* %0, i64* nocapture writeonly %1) {
%3 = tail call i64 @__read_png_int_raw(i32* %0)
store i64 %3, i64* %1
%4 = icmp sgt i64 %3, -2147483648
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int exact_square(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int number;
  scanf("%d", &number);
  printf("%d\n", exact_square(number));
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%edi
call   1040 <exact_square@plt>
lea    0xeb1(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @exact_square(i32 %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
int test_imm_4Cuint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x4C << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_4Cuint64_midword_reg>:
test   $0x4c0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_4Cuint64_midword_reg(i64 %0) {
%2 = and i64 %0, 4980736
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void INT_Excep_TPU5_TGI5A(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_TPU5_TGI5A() {
ret void
}
/* Type definitions */
struct client {
  int dummy;
};

/* Variables and functions */
struct client *get_client(int);
struct client *protocol_textline_newclient(int fd) {
  return get_client(fd);
}


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

x86 assembly (clang, -O2):
<protocol_textline_newclient>:
jmp    1030 <get_client@plt>

LLVM IR (-O0):
%struct.client = type { i32 }
define %struct.client* @protocol_textline_newclient(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call %struct.client* @get_client(i32 %3)
ret %struct.client* %4
}

LLVM IR (-O2):
%struct.client = type { i32 }
define %struct.client* @protocol_textline_newclient(i32 %0) {
%2 = tail call %struct.client* @get_client(i32 %0)
ret %struct.client* %2
}
int mysum(int arg1, int arg2) { return arg1 + arg2; }


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

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

LLVM IR (-O0):
define i32 @mysum(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @mysum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
void _testbench_fixture_teardown(void *udata, void *fixtures) {}


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

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

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

LLVM IR (-O2):
define void @_testbench_fixture_teardown(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ GLdouble;

/* Variables and functions */
int /*<<< orphan*/ glScaled(int /*<<< orphan*/, int /*<<< orphan*/,
                            int /*<<< orphan*/);
void Scaled(GLdouble x, GLdouble y, GLdouble z) { glScaled(x, y, z); }


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

x86 assembly (clang, -O2):
<Scaled>:
jmp    1030 <glScaled@plt>

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

LLVM IR (-O2):
define void @Scaled(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @glScaled(i32 %0, i32 %1, i32 %2)
ret void
}
int __config_type_is_scalar(int type) { return ((type >= 2) && (type <= 6)); }


x86 assembly (clang, -O0):
<__config_type_is_scalar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x2,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <__config_type_is_scalar+0x20>
cmpl   $0x6,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__config_type_is_scalar>:
add    $0xfffffffe,%edi
xor    %eax,%eax
cmp    $0x5,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @__config_type_is_scalar(i32 %0) {
%2 = add i32 %0, -2
%3 = icmp ult i32 %2, 5
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t TimerMatchGet(uint32_t ui32Base, uint32_t ui32Timer) {
  ;
  ;
  return ((ui32Timer == 0x000000ff)
              ? (*((volatile uint32_t *)(ui32Base + 0x00000030)))
              : (*((volatile uint32_t *)(ui32Base + 0x00000034))));
}


x86 assembly (clang, -O0):
<TimerMatchGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0xff,-0x8(%rbp)
jne    1129 <TimerMatchGet+0x29>
mov    -0x4(%rbp),%eax
add    $0x30,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
jmp    1136 <TimerMatchGet+0x36>
mov    -0x4(%rbp),%eax
add    $0x34,%eax
cltq
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerMatchGet>:
xor    %eax,%eax
cmp    $0xff,%esi
setne  %al
lea    0x30(,%rax,4),%eax
movslq %edi,%rcx
mov    (%rax,%rcx,1),%eax
ret

LLVM IR (-O0):
define i32 @TimerMatchGet(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 = icmp eq i32 %5, 255
br i1 %6, label %7, label %13
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add nsw i32 %8, 48
%10 = sext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
br label %19
13: ; preds = %2
%14 = load i32, i32* %3
%15 = add nsw i32 %14, 52
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to i32*
%18 = load volatile i32, i32* %17
br label %19
19: ; preds = %13, %7
%20 = phi i32 [ %12, %7 ], [ %18, %13 ]
ret i32 %20
}

LLVM IR (-O2):
define i32 @TimerMatchGet(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 255
%4 = select i1 %3, i32 48, i32 52
%5 = add nsw i32 %4, %0
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i32*
%8 = load volatile i32, i32* %7
ret i32 %8
}
int sendip(fd, pkt, len)
int fd, len;
char *pkt;
{
  if (send(fd, pkt, len, 0) == -1) {
    perror("send");
    return -1;
  }
  return len;
}


x86 assembly (clang, -O0):
<sendip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1030 <send@plt>
cmp    $0xffffffff,%eax
jne    1168 <sendip+0x48>
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    116e <sendip+0x4e>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sendip>:
push   %rbx
mov    %edx,%ebx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <send@plt>
cmp    $0xffffffff,%eax
jne    1144 <sendip+0x24>
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1040 <perror@plt>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"send\00"
define i32 @sendip(i32 %0, i8* %1, i32 %2) {
%4 = tail call i32 (i32, i8*, i32, i32, ...) bitcast (i32 (...)* @send to i32 (i32, i8*, i32, i32, ...)*)(i32 %0, i8* %1, i32 %2, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %3, %6
%9 = phi i32 [ -1, %6 ], [ %2, %3 ]
ret i32 %9
}
void foo640(int p) {}


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

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

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

LLVM IR (-O2):
define void @foo640(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void app_main(void) { printf("Application started!\n"); }


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

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

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

LLVM IR (-O2):
@str = [21 x i8] c"Application started!\00"
define void @app_main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
ret void
}
int abs2(int n) {
  if (n < 0) {
    return -n;
  }
  return n;
}


x86 assembly (clang, -O0):
<abs2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111e <abs2+0x1e>
xor    %eax,%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1124 <abs2+0x24>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @abs2(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ f();
void testTortureExecute(void) {
  f();
  return;
}


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

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

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

LLVM IR (-O2):
define void @testTortureExecute() {
%1 = tail call i32 (...) @f()
ret void
}
unsigned int AT91F_WDTGetPeriod(unsigned int ms) {
  if ((ms < 4) || (ms > 16000))
    return 0;
  return ((ms << 8) / 1000);
}


x86 assembly (clang, -O0):
<AT91F_WDTGetPeriod>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x4,-0x8(%rbp)
jb     111e <AT91F_WDTGetPeriod+0x1e>
cmpl   $0x3e80,-0x8(%rbp)
jbe    112a <AT91F_WDTGetPeriod+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    113c <AT91F_WDTGetPeriod+0x3c>
mov    -0x8(%rbp),%eax
shl    $0x8,%eax
mov    $0x3e8,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<AT91F_WDTGetPeriod>:
lea    -0x3e81(%rdi),%ecx
xor    %eax,%eax
cmp    $0xffffc183,%ecx
jb     111e <AT91F_WDTGetPeriod+0x1e>
shl    $0x8,%edi
imul   $0x10624dd3,%rdi,%rax
shr    $0x26,%rax
ret

LLVM IR (-O0):
define i32 @AT91F_WDTGetPeriod(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp ult i32 %4, 4
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp ugt i32 %7, 16000
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store i32 0, i32* %2
br label %14
10: ; preds = %6
%11 = load i32, i32* %3
%12 = shl i32 %11, 8
%13 = udiv i32 %12, 1000
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %9
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @AT91F_WDTGetPeriod(i32 %0) {
%2 = add i32 %0, -16001
%3 = icmp ult i32 %2, -15997
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = shl nuw nsw i32 %0, 8
%6 = udiv i32 %5, 1000
br label %7
7: ; preds = %1, %4
%8 = phi i32 [ %6, %4 ], [ 0, %1 ]
ret i32 %8
}
void set_uvwp_surface(double ***U, double ***V, double ***W, double ***P,
                      int ***Flag, double dx, double dy, double dz, int imax,
                      int jmax, int kmax, double GX, double GY, double GZ,
                      double Re) {}


x86 assembly (clang, -O0):
<set_uvwp_surface>:
push   %rbp
mov    %rsp,%rbp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
movsd  %xmm1,-0x38(%rbp)
movsd  %xmm2,-0x40(%rbp)
mov    %r9d,-0x44(%rbp)
movsd  %xmm3,-0x50(%rbp)
movsd  %xmm4,-0x58(%rbp)
movsd  %xmm5,-0x60(%rbp)
movsd  %xmm6,-0x68(%rbp)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @set_uvwp_surface(double*** %0, double*** %1, double*** %2, double*** %3, i32*** %4, double %5, double %6, double %7, i32 %8, i32 %9, i32 %10, double %11, double %12, double %13, double %14) {
%16 = alloca double***
%17 = alloca double***
%18 = alloca double***
%19 = alloca double***
%20 = alloca i32***
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
store double*** %0, double**** %16
store double*** %1, double**** %17
store double*** %2, double**** %18
store double*** %3, double**** %19
store i32*** %4, i32**** %20
store double %5, double* %21
store double %6, double* %22
store double %7, double* %23
store i32 %8, i32* %24
store i32 %9, i32* %25
store i32 %10, i32* %26
store double %11, double* %27
store double %12, double* %28
store double %13, double* %29
store double %14, double* %30
ret void
}

LLVM IR (-O2):
define void @set_uvwp_surface(double*** nocapture %0, double*** nocapture %1, double*** nocapture %2, double*** nocapture %3, i32*** nocapture %4, double %5, double %6, double %7, i32 %8, i32 %9, i32 %10, double %11, double %12, double %13, double %14) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, float);
int main(void) {
  float volume, radius = 10.0f;
  volume = 4.0f / 3.0f * 3.1415 * radius * radius * radius;
  printf("Volume of sphere: %.2f\n", volume);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xee1(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xec3(%rip),%xmm0
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0xc(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeec(%rip),%rdi
movss  0xee0(%rip),%xmm0
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Volume of sphere: %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
store i32 0, i32* %1
store float 1.000000e+01, float* %3
%4 = load float, float* %3
%5 = fpext float %4 to double
%6 = fmul double 0x4010C131DE0D4FE0, %5
%7 = load float, float* %3
%8 = fpext float %7 to double
%9 = fmul double %6, %8
%10 = load float, float* %3
%11 = fpext float %10 to double
%12 = fmul double %9, %11
%13 = fptrunc double %12 to float
store float %13, float* %2
%14 = load float, float* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Volume of sphere: %.2f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), float 0x40B05CAAC0000000)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: imagetool [-0] <type> <source> <output>\n"
         "<type> can be:\n"
         "\tconfont : Monospaced console font\n"
         "\tfont    : Normal font\n"
         "\timage   : Raw image\n"
         "\txhair   : Crosshair\n"
         "\tpcx     : Convert <source> to a PCX file\n"
         "\tbmp     : Convert <source> to a BMP file\n"
         "\tilbm    : Convert <source> to an ILBM file\n"
         "<source> can be an ILBM, BMP, PCX, IMGZ, FON1, FON2, or Doom patch.\n"
         "Specify -0 to swap colors 0 and 247 in <source>.\n\n"
         "Alternatively, to process a script file, in place of <type>, use:\n"
         "\timagetool script <file>\n");
  exit(10);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xa,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xa,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [500 x i8] c"Usage: imagetool [-0] <type> <source> <output>\0A<type> can be:\0A\09confont : Monospaced console font\0A\09font : Normal font\0A\09image : Raw image\0A\09xhair : Crosshair\0A\09pcx : Convert <source> to a PCX file\0A\09bmp : Convert <source> to a BMP file\0A\09ilbm : Convert <source> to an ILBM file\0A<source> can be an ILBM, BMP, PCX, IMGZ, FON1, FON2, or Doom patch.\0ASpecify -0 to swap colors 0 and 247 in <source>.\0A\0AAlternatively, to process a script file, in place of <type>, use:\0A\09imagetool script <file>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([500 x i8], [500 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 10)
unreachable
}

LLVM IR (-O2):
@str = [499 x i8] c"Usage: imagetool [-0] <type> <source> <output>\0A<type> can be:\0A\09confont : Monospaced console font\0A\09font : Normal font\0A\09image : Raw image\0A\09xhair : Crosshair\0A\09pcx : Convert <source> to a PCX file\0A\09bmp : Convert <source> to a BMP file\0A\09ilbm : Convert <source> to an ILBM file\0A<source> can be an ILBM, BMP, PCX, IMGZ, FON1, FON2, or Doom patch.\0ASpecify -0 to swap colors 0 and 247 in <source>.\0A\0AAlternatively, to process a script file, in place of <type>, use:\0A\09imagetool script <file>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([499 x i8], [499 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 10)
unreachable
}
/* Type definitions */
struct _reent {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ SEGGER_RTT_Write(int /*<<< orphan*/, char *, int);
int _write_r(struct _reent *r, int file, char *ptr, int len) {
  (void)file;
  (void)r;
  SEGGER_RTT_Write(0, ptr, len);
  return len;
}


x86 assembly (clang, -O0):
<_write_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
xor    %edi,%edi
call   1030 <SEGGER_RTT_Write@plt>
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_write_r>:
push   %rbx
mov    %ecx,%ebx
xor    %edi,%edi
mov    %rdx,%rsi
mov    %ecx,%edx
call   1030 <SEGGER_RTT_Write@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct._reent = type { i32 }
define i32 @_write_r(%struct._reent* %0, i32 %1, i8* %2, i32 %3) {
%5 = alloca %struct._reent*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
store %struct._reent* %0, %struct._reent** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i32, i32* %6
%10 = load %struct._reent*, %struct._reent** %5
%11 = load i8*, i8** %7
%12 = load i32, i32* %8
%13 = call i32 @SEGGER_RTT_Write(i32 0, i8* %11, i32 %12)
%14 = load i32, i32* %8
ret i32 %14
}

LLVM IR (-O2):
%struct._reent = type { i32 }
define i32 @_write_r(%struct._reent* nocapture readnone %0, i32 %1, i8* %2, i32 returned %3) {
%5 = tail call i32 @SEGGER_RTT_Write(i32 0, i8* %2, i32 %3)
ret i32 %3
}
void crypto_cleanup(void) {}


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

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

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

LLVM IR (-O2):
define void @crypto_cleanup() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ readFileAt(int, size_t, unsigned char *, int);
unsigned short readFileWORD(int fileIndex, size_t offset) {
  unsigned char buf[2];
  readFileAt(fileIndex, offset, buf, 2);
  return buf[0] | (buf[1] << 8);
}


x86 assembly (clang, -O0):
<readFileWORD>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    -0x12(%rbp),%rdx
mov    $0x2,%ecx
call   1030 <readFileAt@plt>
movzbl -0x12(%rbp),%eax
movzbl -0x11(%rbp),%ecx
shl    $0x8,%ecx
or     %ecx,%eax
movzwl %ax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readFileWORD>:
push   %rax
lea    0x6(%rsp),%rdx
mov    $0x2,%ecx
call   1030 <readFileAt@plt>
movzwl 0x6(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i16 @readFileWORD(i32 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca [2 x i8]
store i32 %0, i32* %3
store i64 %1, i64* %4
%6 = load i32, i32* %3
%7 = load i64, i64* %4
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%9 = call i32 @readFileAt(i32 %6, i64 %7, i8* %8, i32 2)
%10 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 1
%14 = load i8, i8* %13
%15 = zext i8 %14 to i32
%16 = shl i32 %15, 8
%17 = or i32 %12, %16
%18 = trunc i32 %17 to i16
ret i16 %18
}

LLVM IR (-O2):
define zeroext i16 @readFileWORD(i32 %0, i64 %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = call i32 @readFileAt(i32 %0, i64 %1, i8* %4, i32 2)
%6 = load i8, i8* %4
%7 = zext i8 %6 to i16
%8 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = zext i8 %9 to i16
%11 = shl nuw i16 %10, 8
%12 = or i16 %11, %7
ret i16 %12
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, double);
int /*<<< orphan*/ sscanf(char *, char *, int *);
char *strstr(char *, char *);
int EpdGetExponentDecimal(double value) {
  char *pos, str[24];
  int exponent;
  sprintf(str, "%E", value);
  pos = strstr(str, "E");
  sscanf(pos, "E%d", &exponent);
  return (exponent);
}


x86 assembly (clang, -O0):
<EpdGetExponentDecimal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
lea    -0x30(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
lea    0xeb3(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x30(%rbp),%rdi
lea    0xea4(%rip),%rsi
call   1050 <strstr@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe92(%rip),%rsi
lea    -0x34(%rbp),%rdx
call   1030 <sscanf@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<EpdGetExponentDecimal>:
push   %rbx
sub    $0x30,%rsp
lea    0xec4(%rip),%rsi
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <sprintf@plt>
mov    %rbx,%rdi
mov    $0x45,%esi
call   1030 <strchr@plt>
lea    0xea6(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
mov    0xc(%rsp),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%E\00"
@.str.1 = [2 x i8] c"E\00"
@.str.2 = [4 x i8] c"E%d\00"
define i32 @EpdGetExponentDecimal(double %0) {
%2 = alloca double
%3 = alloca i8*
%4 = alloca [24 x i8]
%5 = alloca i32
store double %0, double* %2
%6 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 0
%7 = load double, double* %2
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %7)
%9 = getelementptr inbounds [24 x i8], [24 x i8]* %4, i64 0, i64 0
%10 = call i8* @strstr(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%13 = load i32, i32* %5
ret i32 %13
}

LLVM IR (-O2):
@.str = [3 x i8] c"%E\00"
@.str.2 = [4 x i8] c"E%d\00"
define i32 @EpdGetExponentDecimal(double %0) {
%2 = alloca [24 x i8]
%3 = alloca i32
%4 = getelementptr inbounds [24 x i8], [24 x i8]* %2, i64 0, i64 0
%5 = bitcast i32* %3 to i8*
%6 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %0)
%7 = call i8* @strchr(i8* %4, i32 69)
%8 = call i32 @sscanf(i8* %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %3
ret i32 %9
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
void sr_dump_close(FILE *fp) { fclose(fp); }


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

x86 assembly (clang, -O2):
<sr_dump_close>:
jmp    1030 <fclose@plt>

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

LLVM IR (-O2):
define void @sr_dump_close(i32* nocapture %0) {
%2 = tail call i32 @fclose(i32* %0)
ret void
}
/* Variables and functions */
int random();
int get_random() { return random() % 5; }


x86 assembly (clang, -O0):
<get_random>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <random@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_random>:
push   %rax
xor    %eax,%eax
call   1030 <random@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @get_random() {
%1 = call i32 (...) @random()
%2 = srem i32 %1, 5
ret i32 %2
}

LLVM IR (-O2):
define i32 @get_random() {
%1 = tail call i32 (...) @random()
%2 = srem i32 %1, 5
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stdout;
int endCanvas(int status) {
  printf("\nQuitting canvas.\n\n");
  fflush(stdout);
  exit(status);
}


x86 assembly (clang, -O0):
<endCanvas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x4(%rbp),%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<endCanvas>:
push   %rbx
mov    %edi,%ebx
lea    0xec6(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e9a(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"\0AQuitting canvas.\0A\0A\00"
@stdout = global i32 0
define i32 @endCanvas(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @stdout
%5 = call i32 @fflush(i32 %4)
%6 = load i32, i32* %2
%7 = call i32 @exit(i32 %6)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@str = [19 x i8] c"\0AQuitting canvas.\0A\00"
define i32 @endCanvas(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%3 = load i32, i32* @stdout
%4 = tail call i32 @fflush(i32 %3)
%5 = tail call i32 @exit(i32 %0)
unreachable
}
/* Type definitions */
struct expr {
  int dummy;
};

/* Variables and functions */
int isdigit(char const);
int find_uint(const char *remain, struct expr *e) { return isdigit(*remain); }


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

x86 assembly (clang, -O2):
<find_uint>:
movsbl (%rdi),%edi
jmp    1030 <isdigit@plt>

LLVM IR (-O0):
%struct.expr = type { i32 }
define i32 @find_uint(i8* %0, %struct.expr* %1) {
%3 = alloca i8*
%4 = alloca %struct.expr*
store i8* %0, i8** %3
store %struct.expr* %1, %struct.expr** %4
%5 = load i8*, i8** %3
%6 = load i8, i8* %5
%7 = call i32 @isdigit(i8 signext %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.expr = type { i32 }
define i32 @find_uint(i8* nocapture %0, %struct.expr* nocapture readnone %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @isdigit(i8 signext %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ sleep(int);
void spin_wait_sleeper_callback() { sleep(1); }


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

x86 assembly (clang, -O2):
<spin_wait_sleeper_callback>:
mov    $0x1,%edi
jmp    1030 <sleep@plt>

LLVM IR (-O0):
define void @spin_wait_sleeper_callback() {
%1 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
define void @spin_wait_sleeper_callback() {
%1 = tail call i32 @sleep(i32 1)
ret void
}