xunge/DecIR huggingface dataset:
/* Variables and functions */
int receiveByte(int);
int /*<<< orphan*/ sendByte(int, unsigned int);
int /*<<< orphan*/ updateCarry(int, unsigned int *);
void tube_BGet(unsigned int *reg) {
  sendByte(2, 0x0E);
  sendByte(2, reg[1]);
  updateCarry(receiveByte(2) & 0x80, reg);
  reg[0] = receiveByte(2);
}


x86 assembly (clang, -O0):
<tube_BGet>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x2,%edi
mov    $0xe,%esi
call   1050 <sendByte@plt>
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
mov    $0x2,%edi
call   1050 <sendByte@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,%edi
and    $0x80,%edi
mov    -0x8(%rbp),%rsi
call   1040 <updateCarry@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tube_BGet>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2,%edi
mov    $0xe,%esi
call   1050 <sendByte@plt>
mov    0x4(%rbx),%esi
mov    $0x2,%edi
call   1050 <sendByte@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
and    $0x80,%eax
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <updateCarry@plt>
mov    $0x2,%edi
call   1030 <receiveByte@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @tube_BGet(i32* %0) {
%2 = tail call i32 @sendByte(i32 2, i32 14)
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = tail call i32 @sendByte(i32 2, i32 %4)
%6 = tail call i32 @receiveByte(i32 2)
%7 = and i32 %6, 128
%8 = tail call i32 @updateCarry(i32 %7, i32* %0)
%9 = tail call i32 @receiveByte(i32 2)
store i32 %9, i32* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() { printf("Hello, beautiful!\e"); }


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

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

LLVM IR (-O0):
@.str = [19 x i8] c"Hello, beautiful!\1B\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [19 x i8] c"Hello, beautiful!\1B\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(size_t *);
void stash(size_t *new, size_t **destination) {
  if (!destination) {
    free(new);
    return;
  }
  if (*destination) {
    free(*destination);
  }
  *destination = new;
}


x86 assembly (clang, -O0):
<stash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1139 <stash+0x29>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
jmp    115e <stash+0x4e>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1153 <stash+0x43>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stash>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
test   %rsi,%rsi
je     1137 <stash+0x27>
mov    %rsi,%rbx
mov    (%rsi),%rdi
test   %rdi,%rdi
je     112c <stash+0x1c>
call   1030 <free@plt>
mov    %r14,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @stash(i64* %0, i64** %1) {
%3 = icmp eq i64** %1, null
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @free(i64* %0)
br label %12
6: ; preds = %2
%7 = load i64*, i64** %1
%8 = icmp eq i64* %7, null
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @free(i64* %7)
br label %11
11: ; preds = %9, %6
store i64* %0, i64** %1
br label %12
12: ; preds = %11, %4
ret void
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
size_t utf16len(char *string) {
  uint16_t *utf16char;
  size_t i = 0;
  if (string == NULL)
    i = 0;
  else
    for (utf16char = (uint16_t *)string; *utf16char; utf16char++)
      i++;
  return i;
}


x86 assembly (clang, -O0):
<utf16len>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    1128 <utf16len+0x28>
movq   $0x0,-0x18(%rbp)
jmp    1160 <utf16len+0x60>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     115b <utf16len+0x5b>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <utf16len+0x30>
jmp    1160 <utf16len+0x60>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf16len>:
test   %rdi,%rdi
je     1120 <utf16len+0x20>
cmpq   $0x0,(%rdi)
je     1120 <utf16len+0x20>
xor    %ecx,%ecx
nopl   (%rax)
lea    0x1(%rcx),%rax
cmpq   $0x0,0x8(%rdi,%rcx,8)
mov    %rax,%rcx
jne    1110 <utf16len+0x10>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i64 @utf16len(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = bitcast i8* %0 to i64*
%5 = load i64, i64* %4
%6 = icmp eq i64 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %3, %7
%8 = phi i64 [ %10, %7 ], [ 0, %3 ]
%9 = phi i64* [ %11, %7 ], [ %4, %3 ]
%10 = add i64 %8, 1
%11 = getelementptr inbounds i64, i64* %9, i64 1
%12 = load i64, i64* %11
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %7
14: ; preds = %7, %3, %1
%15 = phi i64 [ 0, %1 ], [ 0, %3 ], [ %10, %7 ]
ret i64 %15
}
/* Variables and functions */
int posix_memalign(void **, size_t, size_t);
void *nmx_memalign(size_t alignment, size_t size) {
  void *p;
  int err;
  err = posix_memalign(&p, alignment, size);
  return p;
}


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

x86 assembly (clang, -O2):
<nmx_memalign>:
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    %rsp,%rdi
call   1030 <posix_memalign@plt>
mov    (%rsp),%rax
pop    %rcx
ret

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

LLVM IR (-O2):
define i8* @nmx_memalign(i64 %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = call i32 @posix_memalign(i8** %3, i64 %0, i64 %1)
%6 = load i8*, i8** %3
ret i8* %6
}
/* Variables and functions */
int /*<<< orphan*/ mylib_function();
int /*<<< orphan*/ printf(char *);
int main() {
  printf("myexe calling mylib_function:\n");
  mylib_function();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <mylib_function@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <mylib_function@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [31 x i8] c"myexe calling mylib_function:\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @mylib_function()
ret i32 0
}

LLVM IR (-O2):
@str = [30 x i8] c"myexe calling mylib_function:\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @mylib_function()
ret i32 0
}
/* Variables and functions */
int O_NONBLOCK;
int O_RDONLY;
int open(char *, int);
int ljoy_Open(char *dev, int nonblocking) {
  if (nonblocking)
    return (open(dev, O_RDONLY | O_NONBLOCK));
  else
    return (open(dev, O_RDONLY));
}


x86 assembly (clang, -O0):
<ljoy_Open>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     114c <ljoy_Open+0x3c>
mov    -0x10(%rbp),%rdi
mov    0x2eac(%rip),%rax
mov    (%rax),%esi
mov    0x2eab(%rip),%rax
or     (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x4(%rbp)
jmp    1161 <ljoy_Open+0x51>
mov    -0x10(%rbp),%rdi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
call   1030 <open@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ljoy_Open>:
mov    0x2ec9(%rip),%rax
test   %esi,%esi
je     1124 <ljoy_Open+0x14>
mov    0x2ec6(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
jmp    1030 <open@plt>

LLVM IR (-O0):
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
define i32 @ljoy_Open(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8*, i8** %4
%10 = load i32, i32* @O_RDONLY
%11 = load i32, i32* @O_NONBLOCK
%12 = or i32 %10, %11
%13 = call i32 @open(i8* %9, i32 %12)
store i32 %13, i32* %3
br label %18
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = load i32, i32* @O_RDONLY
%17 = call i32 @open(i8* %15, i32 %16)
store i32 %17, i32* %3
br label %18
18: ; preds = %14, %8
%19 = load i32, i32* %3
ret i32 %19
}

LLVM IR (-O2):
@O_RDONLY = global i32 0
@O_NONBLOCK = global i32 0
define i32 @ljoy_Open(i8* nocapture %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = load i32, i32* @O_RDONLY
%5 = load i32, i32* @O_NONBLOCK
%6 = select i1 %3, i32 0, i32 %5
%7 = or i32 %4, %6
%8 = tail call i32 @open(i8* %0, i32 %7)
ret i32 %8
}
/* Variables and functions */
double sqrt(double);
double ECsqrt(double x) { return (sqrt(x)); }


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

x86 assembly (clang, -O2):
<ECsqrt>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     111f <ECsqrt+0xf>
sqrtsd %xmm0,%xmm0
ret
jmp    1030 <sqrt@plt>

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

LLVM IR (-O2):
define double @ECsqrt(double %0) {
%2 = tail call double @sqrt(double %0)
ret double %2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage() {
  fprintf(stderr, "USAGE:\n decrypt <encrypted_file> <xor_cypher_file> "
                  "[<optional_offset>]\n");
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [72 x i8] c"USAGE:\0A decrypt <encrypted_file> <xor_cypher_file> [<optional_offset>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [72 x i8] c"USAGE:\0A decrypt <encrypted_file> <xor_cypher_file> [<optional_offset>]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
ret void
}
void delay(int time) {
  int i = 0;
  for (i = time * 1000; i != 0; i--) {
  }
}


x86 assembly (clang, -O0):
<delay>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
imul   $0x3e8,-0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1135 <delay+0x35>
jmp    1127 <delay+0x27>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1118 <delay+0x18>
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @delay(i32 %0) {
ret void
}
int compute_pixblt_cycles(int left_partials, int right_partials, int full_words,
                          int op_timing) {
  int srcwords, dstwords;
  if (left_partials)
    full_words += 1;
  if (right_partials)
    full_words += 1;
  srcwords = full_words;
  dstwords = full_words;
  return (dstwords * op_timing + srcwords * 2) + 2;
}


x86 assembly (clang, -O0):
<compute_pixblt_cycles>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1123 <compute_pixblt_cycles+0x23>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1136 <compute_pixblt_cycles+0x36>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    -0x14(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_pixblt_cycles>:
cmp    $0x1,%edi
sbb    $0xffffffff,%edx
cmp    $0x1,%esi
sbb    $0xffffffff,%edx
lea    0x2(%rcx),%eax
imul   %edx,%eax
add    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @compute_pixblt_cycles(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%11 = load i32, i32* %5
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %4
%14 = load i32, i32* %7
%15 = add nsw i32 %14, 1
store i32 %15, i32* %7
br label %16
16: ; preds = %13, %4
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %16
%20 = load i32, i32* %7
%21 = add nsw i32 %20, 1
store i32 %21, i32* %7
br label %22
22: ; preds = %19, %16
%23 = load i32, i32* %7
store i32 %23, i32* %9
%24 = load i32, i32* %7
store i32 %24, i32* %10
%25 = load i32, i32* %10
%26 = load i32, i32* %8
%27 = mul nsw i32 %25, %26
%28 = load i32, i32* %9
%29 = mul nsw i32 %28, 2
%30 = add nsw i32 %27, %29
%31 = add nsw i32 %30, 2
ret i32 %31
}

LLVM IR (-O2):
define i32 @compute_pixblt_cycles(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = icmp ne i32 %0, 0
%6 = zext i1 %5 to i32
%7 = add nsw i32 %6, %2
%8 = icmp ne i32 %1, 0
%9 = zext i1 %8 to i32
%10 = add nsw i32 %7, %9
%11 = add i32 %3, 2
%12 = mul i32 %10, %11
%13 = add nsw i32 %12, 2
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ validaDados();
int main() { validaDados(); }


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @validaDados()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @validaDados()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void safer_free(void **pp) {
  if (*pp != NULL && pp != NULL) {
    free(*pp);
    *pp = NULL;
  }
}


x86 assembly (clang, -O0):
<safer_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpq   $0x0,(%rax)
je     114c <safer_free+0x3c>
cmpq   $0x0,-0x8(%rbp)
je     114c <safer_free+0x3c>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rax
movq   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safer_free>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1128 <safer_free+0x18>
call   1030 <free@plt>
movq   $0x0,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @safer_free(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @free(i8* %2)
store i8* null, i8** %0
br label %6
6: ; preds = %4, %1
ret void
}
/* Type definitions */
typedef int __u16;

/* Variables and functions */
__u16 __sw16(__u16 x) {
  __u16 v = x;
  return (v & (__u16)0x00ffU) << 8 | (v & (__u16)0xff00U) >> 8;
}


x86 assembly (clang, -O0):
<__sw16>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%ecx
and    $0xff00,%ecx
sar    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__sw16>:
rol    $0x8,%di
movzwl %di,%eax
ret

LLVM IR (-O0):
define i32 @__sw16(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
%6 = and i32 %5, 255
%7 = shl i32 %6, 8
%8 = load i32, i32* %3
%9 = and i32 %8, 65280
%10 = ashr i32 %9, 8
%11 = or i32 %7, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @__sw16(i32 %0) {
%2 = trunc i32 %0 to i16
%3 = tail call i16 @llvm.bswap.i16(i16 %2)
%4 = zext i16 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ ExceptionGroup1(int);
void Line_F(void) { ExceptionGroup1(11); }


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

x86 assembly (clang, -O2):
<Line_F>:
mov    $0xb,%edi
jmp    1030 <ExceptionGroup1@plt>

LLVM IR (-O0):
define void @Line_F() {
%1 = call i32 @ExceptionGroup1(i32 11)
ret void
}

LLVM IR (-O2):
define void @Line_F() {
%1 = tail call i32 @ExceptionGroup1(i32 11)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *, int *, double *);
int main(void) {
  int number, hours;
  double salaryPerHour;
  scanf("%d %d %lf", &number, &hours, &salaryPerHour);
  printf("NUMBER = %d\n", number);
  printf("SALARY = U$ %.2f\n", hours * salaryPerHour);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl -0xc(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
cvtsi2sdl 0x8(%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
cvttsd2si %xmm0,%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d %d %lf\00"
@.str.1 = [13 x i8] c"NUMBER = %d\0A\00"
@.str.2 = [18 x i8] c"SALARY = U$ %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
%5 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %2, i32* %3, double* %4)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = load i32, i32* %3
%9 = sitofp i32 %8 to double
%10 = load double, double* %4
%11 = fmul double %9, %10
%12 = fptosi double %11 to i32
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %lf\00"
@.str.1 = [13 x i8] c"NUMBER = %d\0A\00"
@.str.2 = [18 x i8] c"SALARY = U$ %.2f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast double* %3 to i8*
%7 = call i32 @scanf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %1, i32* %2, double* %3)
%8 = load i32, i32* %1
%9 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = load i32, i32* %2
%11 = sitofp i32 %10 to double
%12 = load double, double* %3
%13 = fmul double %12, %11
%14 = fptosi double %13 to i32
%15 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %14)
ret i32 0
}
void delete_packet_data(struct packet_data *data) {}


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

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

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

LLVM IR (-O2):
%struct.packet_data = type opaque
define void @delete_packet_data(%struct.packet_data* nocapture %0) {
ret void
}
void SystemInit(void) { return; }


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

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

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

LLVM IR (-O2):
define void @SystemInit() {
ret void
}
int test_imm_30uint16_reg(unsigned short val) {
  return ((val) & (0x30 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_30uint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x30,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_30uint16_reg>:
test   $0x30,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_30uint16_reg(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = and i32 %4, 48
%6 = icmp ne i32 %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_30uint16_reg(i16 zeroext %0) {
%2 = and i16 %0, 48
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ simulation(char **);
int main(int argc, char *argv[]) {
  simulation(argv);
  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    -0x10(%rbp),%rdi
call   1030 <simulation@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    %rsi,%rdi
call   1030 <simulation@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 = load i8**, i8*** %5
%7 = call i32 @simulation(i8** %6)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @simulation(i8** %1)
ret i32 0
}
/* Variables and functions */
float atan2f(float, float);
float math_angle(float ax, float ay, float bx, float by) {
  return atan2f(bx - ax, by - ay);
}


x86 assembly (clang, -O0):
<math_angle>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
subss  -0x8(%rbp),%xmm1
call   1030 <atan2f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_angle>:
subss  %xmm0,%xmm2
subss  %xmm1,%xmm3
movaps %xmm2,%xmm0
movaps %xmm3,%xmm1
jmp    1030 <atan2f@plt>

LLVM IR (-O0):
define float @math_angle(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %7
%10 = load float, float* %5
%11 = fsub float %9, %10
%12 = load float, float* %8
%13 = load float, float* %6
%14 = fsub float %12, %13
%15 = call float @atan2f(float %11, float %14)
ret float %15
}

LLVM IR (-O2):
define float @math_angle(float %0, float %1, float %2, float %3) {
%5 = fsub float %2, %0
%6 = fsub float %3, %1
%7 = tail call float @atan2f(float %5, float %6)
ret float %7
}
/* Variables and functions */
int josephus(int, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n = 5;
  int k = 2;
  printf("The chosen place is %d", josephus(n, k));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"The chosen place is %d\00"
define i32 @main() {
%1 = tail call i32 @josephus(i32 5, i32 2)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ body(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ preamble(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char **argv) {
  preamble(stdout);
  body(stdin, stdout);
  exit(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    0x2e8b(%rip),%rax
mov    (%rax),%edi
call   1040 <preamble@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
mov    0x2e74(%rip),%rax
mov    (%rax),%esi
call   1030 <body@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ea0(%rip),%rbx
mov    (%rbx),%edi
call   1040 <preamble@plt>
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%esi
call   1030 <body@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stdout = global i32 0
@stdin = global i32 0
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 = load i32, i32* @stdout
%7 = call i32 @preamble(i32 %6)
%8 = load i32, i32* @stdin
%9 = load i32, i32* @stdout
%10 = call i32 @body(i32 %8, i32 %9)
%11 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stdout = global i32 0
@stdin = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = load i32, i32* @stdout
%4 = tail call i32 @preamble(i32 %3)
%5 = load i32, i32* @stdin
%6 = load i32, i32* @stdout
%7 = tail call i32 @body(i32 %5, i32 %6)
%8 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
double exp(double);
int pow(double, int);
double rho(double r) {
  return ((1.554485 * exp(-4.090619 * (r / 2.556162 - 1.))) /
          (1. + pow(r / 2.556162 - 0.86214, 20.)));
}


x86 assembly (clang, -O0):
<rho>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xed6(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  0xeba(%rip),%xmm0
subsd  %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  0xeb2(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xe80(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    $0x14,%edi
call   1040 <pow@plt>
movsd  -0x10(%rbp),%xmm0
cvtsi2sd %eax,%xmm2
movsd  0xe59(%rip),%xmm1
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rho>:
sub    $0x18,%rsp
movapd %xmm0,%xmm1
divsd  0xed0(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xeca(%rip),%xmm0
addsd  %xmm1,%xmm0
mulsd  0xec6(%rip),%xmm0
call   1030 <exp@plt>
mulsd  0xec1(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
addsd  0xeb5(%rip),%xmm0
mov    $0x14,%edi
call   1040 <pow@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
addsd  0xea4(%rip),%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @rho(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fdiv double %3, 0x40047305100A393F
%5 = fsub double %4, 1.000000e+00
%6 = fmul double 0xC0105CCB3A2595BC, %5
%7 = call double @exp(double %6)
%8 = fmul double 0x3FF8DF2BA9D1F601, %7
%9 = load double, double* %2
%10 = fdiv double %9, 0x40047305100A393F
%11 = fsub double %10, 8.621400e-01
%12 = call i32 @pow(double %11, i32 20)
%13 = sitofp i32 %12 to double
%14 = fadd double 1.000000e+00, %13
%15 = fdiv double %8, %14
ret double %15
}

LLVM IR (-O2):
define double @rho(double %0) {
%2 = fdiv double %0, 0x40047305100A393F
%3 = fadd double %2, -1.000000e+00
%4 = fmul double %3, 0xC0105CCB3A2595BC
%5 = tail call double @exp(double %4)
%6 = fmul double %5, 0x3FF8DF2BA9D1F601
%7 = fadd double %2, -8.621400e-01
%8 = tail call i32 @pow(double %7, i32 20)
%9 = sitofp i32 %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %6, %10
ret double %11
}
int do_100() { return 100; }


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    $0x64,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    $0x64,%eax
ret

LLVM IR (-O0):
define i32 @do_100() {
ret i32 100
}

LLVM IR (-O2):
define i32 @do_100() {
ret i32 100
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
main() {
  printf("Hello, World,\n");
  printf("#!Crunchbang 11 Waldorf\n");
  printf("Powered by Debian,\n");
  printf("harataiki");
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xee4(%rip),%rdi
call   1030 <puts@plt>
lea    0xef0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb4(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World,\0A\00"
@.str.1 = [25 x i8] c"#!Crunchbang 11 Waldorf\0A\00"
@.str.2 = [20 x i8] c"Powered by Debian,\0A\00"
@.str.3 = [10 x i8] c"harataiki\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.3 = [10 x i8] c"harataiki\00"
@str = [14 x i8] c"Hello, World,\00"
@str.4 = [24 x i8] c"#!Crunchbang 11 Waldorf\00"
@str.5 = [19 x i8] c"Powered by Debian,\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str.5, i64 0, i64 0))
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int next_big(int);
int /*<<< orphan*/ printf(char *, int);
void main() { printf("Next big is %d", next_big(1)); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1040 <next_big@plt>
mov    %eax,%esi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1040 <next_big@plt>
lea    0xece(%rip),%rdi
mov    %eax,%esi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Next big is %d\00"
define void @main() {
%1 = call i32 @next_big(i32 1)
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"Next big is %d\00"
define void @main() {
%1 = tail call i32 @next_big(i32 1)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_int_array(int a[], int length) {
  for (int i = 0; i < length; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_int_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_int_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_int_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_int_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_int_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_int_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_int_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8, %2
%7 = tail call i32 @putchar(i32 10)
ret void
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %13, %8 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %5
br i1 %14, label %6, label %8
}
/* Variables and functions */
int /*<<< orphan*/ synchronize_sched();
void foo(void) { synchronize_sched(); }


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

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

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

LLVM IR (-O2):
define void @foo() {
%1 = tail call i32 (...) @synchronize_sched()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void usage(char *app) {
  printf(
      "Usage:\t%s <image> <rootfs> <kernel> <security_code> <output_tag>\n\n",
      app);
  printf("Beware: it's not recommended to use this app directly, use the "
         "script instead.\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0a(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [67 x i8] c"Usage:\09%s <image> <rootfs> <kernel> <security_code> <output_tag>\0A\0A\00"
@.str.1 = [80 x i8] c"Beware: it's not recommended to use this app directly, use the script instead.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([80 x i8], [80 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [67 x i8] c"Usage:\09%s <image> <rootfs> <kernel> <security_code> <output_tag>\0A\0A\00"
@str = [79 x i8] c"Beware: it's not recommended to use this app directly, use the script instead.\00"
define void @usage(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([79 x i8], [79 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct timeval {
  double tv_sec;
  double tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
double get_now() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return tv.tv_sec + tv.tv_usec / 1000000.0;
}


x86 assembly (clang, -O0):
<get_now>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movsd  0xec9(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_now>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movsd  0x10(%rsp),%xmm0
divsd  0xed2(%rip),%xmm0
addsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { double, double }
define double @get_now() {
%1 = alloca %struct.timeval
%2 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%3 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%4 = load double, double* %3
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%6 = load double, double* %5
%7 = fdiv double %6, 1.000000e+06
%8 = fadd double %4, %7
ret double %8
}

LLVM IR (-O2):
%struct.timeval = type { double, double }
define double @get_now() {
%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 0
%5 = load double, double* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load double, double* %6
%8 = fdiv double %7, 1.000000e+06
%9 = fadd double %5, %8
ret double %9
}
void test_caret_on_leading_whitespace(void) {}


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

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

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

LLVM IR (-O2):
define void @test_caret_on_leading_whitespace() {
ret void
}
int hugetlbfs_unlinked_fd(void) { return -1; }


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

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

LLVM IR (-O0):
define i32 @hugetlbfs_unlinked_fd() {
ret i32 -1
}

LLVM IR (-O2):
define i32 @hugetlbfs_unlinked_fd() {
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void app_help(const char *app) {
  printf("  usage: %s [-D] [-b bandwidth] [-i ifname]\n", app);
  printf("         %s [-d] [-v] [-h]\n\n", app);
  printf("     eg. %s -b8 -iwlan0 -D\n", app);
}


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

x86 assembly (clang, -O2):
<app_help>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xf03(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
lea    0xf11(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [45 x i8] c" usage: %s [-D] [-b bandwidth] [-i ifname]\0A\00"
@.str.1 = [29 x i8] c" %s [-d] [-v] [-h]\0A\0A\00"
@.str.2 = [28 x i8] c" eg. %s -b8 -iwlan0 -D\0A\00"
define void @app_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = load i8*, i8** %2
%6 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = load i8*, i8** %2
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@.str = [45 x i8] c" usage: %s [-D] [-b bandwidth] [-i ifname]\0A\00"
@.str.1 = [29 x i8] c" %s [-d] [-v] [-h]\0A\0A\00"
@.str.2 = [28 x i8] c" eg. %s -b8 -iwlan0 -D\0A\00"
define void @app_help(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int nudgeHealth(int);
int powerNudgeHealth(int);
int rand();
int modHealth(int hp) {
  if ((rand() % 20) > 17)
    return powerNudgeHealth(hp);
  else
    return nudgeHealth(hp);
}


x86 assembly (clang, -O0):
<modHealth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x14,%ecx
cltd
idiv   %ecx
cmp    $0x11,%edx
jle    1163 <modHealth+0x33>
mov    -0x8(%rbp),%edi
call   1030 <powerNudgeHealth@plt>
mov    %eax,-0x4(%rbp)
jmp    116e <modHealth+0x3e>
mov    -0x8(%rbp),%edi
call   1040 <nudgeHealth@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<modHealth>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x23,%rcx
add    %edx,%ecx
shl    $0x2,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
mov    %ebx,%edi
cmp    $0x12,%eax
jl     1165 <modHealth+0x35>
pop    %rbx
jmp    1030 <powerNudgeHealth@plt>
pop    %rbx
jmp    1040 <nudgeHealth@plt>

LLVM IR (-O0):
define i32 @modHealth(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = call i32 (...) @rand()
%5 = srem i32 %4, 20
%6 = icmp sgt i32 %5, 17
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = load i32, i32* %3
%9 = call i32 @powerNudgeHealth(i32 %8)
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call i32 @nudgeHealth(i32 %11)
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %7
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @modHealth(i32 %0) {
%2 = tail call i32 (...) @rand()
%3 = srem i32 %2, 20
%4 = icmp sgt i32 %3, 17
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = tail call i32 @powerNudgeHealth(i32 %0)
br label %9
7: ; preds = %1
%8 = tail call i32 @nudgeHealth(i32 %0)
br label %9
9: ; preds = %7, %5
%10 = phi i32 [ %6, %5 ], [ %8, %7 ]
ret i32 %10
}