xunge/DecIR huggingface dataset:
/* Type definitions */
typedef scalar_t__ ssize_t;

/* Variables and functions */
ssize_t anna_idx_wrap(ssize_t idx, size_t count) {
  if (idx < 0) {
    idx = count + idx;
  }
  return idx;
}


x86 assembly (clang, -O0):
<anna_idx_wrap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1123 <anna_idx_wrap+0x23>
mov    -0x10(%rbp),%rax
add    -0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<anna_idx_wrap>:
mov    %rdi,%rax
sar    $0x3f,%rax
and    %rsi,%rax
add    %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @anna_idx_wrap(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, 0
%4 = select i1 %3, i64 %1, i64 0
%5 = add i64 %4, %0
ret i64 %5
}
void g(int count) {
  int(*a[5])[count];
  int(*b)[][count];
}


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

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

LLVM IR (-O0):
define void @g(i32 %0) {
%2 = alloca i32
%3 = alloca [5 x i32*]
%4 = alloca [0 x i32]*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = zext i32 %5 to i64
%7 = load i32, i32* %2
%8 = zext i32 %7 to i64
ret void
}

LLVM IR (-O2):
define void @g(i32 %0) {
ret void
}
int strcmp(const char *s1, const char *s2) {
  while (*s1++ == *s2) {
    if (*s2++ == '\0') {
      return (0);
    }
  }
  return ((int)s1[-1] - (int)s2[0]);
  return (1);
}


x86 assembly (clang, -O0):
<strcmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
jne    1159 <strcmp+0x59>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1154 <strcmp+0x54>
movl   $0x0,-0x4(%rbp)
jmp    116d <strcmp+0x6d>
jmp    110c <strcmp+0xc>
mov    -0x10(%rbp),%rax
movsbl -0x1(%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcmp>:
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rdi,%rcx,1),%eax
movsbl (%rsi,%rcx,1),%edx
cmp    %dl,%al
jne    1127 <strcmp+0x27>
add    $0x1,%rcx
test   %al,%al
jne    1110 <strcmp+0x10>
xor    %eax,%eax
ret
sub    %edx,%eax
ret

LLVM IR (-O0):
define i32 @strcmp(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %6
6: ; preds = %22, %2
%7 = load i8*, i8** %4
%8 = getelementptr inbounds i8, i8* %7, i32 1
store i8* %8, i8** %4
%9 = load i8, i8* %7
%10 = sext i8 %9 to i32
%11 = load i8*, i8** %5
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %10, %13
br i1 %14, label %15, label %23
15: ; preds = %6
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i32 1
store i8* %17, i8** %5
%18 = load i8, i8* %16
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 0, i32* %3
br label %33
22: ; preds = %15
br label %6
23: ; preds = %6
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 -1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = load i8*, i8** %5
%29 = getelementptr inbounds i8, i8* %28, i64 0
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %27, %31
store i32 %32, i32* %3
br label %33
33: ; preds = %23, %21
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
define i32 @strcmp(i8* nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %9, %2
%4 = phi i8* [ %0, %2 ], [ %10, %9 ]
%5 = phi i8* [ %1, %2 ], [ %11, %9 ]
%6 = load i8, i8* %4
%7 = load i8, i8* %5
%8 = icmp eq i8 %6, %7
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = getelementptr inbounds i8, i8* %4, i64 1
%11 = getelementptr inbounds i8, i8* %5, i64 1
%12 = icmp eq i8 %6, 0
br i1 %12, label %17, label %3
13: ; preds = %3
%14 = sext i8 %7 to i32
%15 = sext i8 %6 to i32
%16 = sub nsw i32 %15, %14
br label %17
17: ; preds = %9, %13
%18 = phi i32 [ %16, %13 ], [ 0, %9 ]
ret i32 %18
}
extern double double_to_double(double x) { return x + 1; }


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

x86 assembly (clang, -O2):
<double_to_double>:
addsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @double_to_double(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 1.000000e+00
ret double %4
}

LLVM IR (-O2):
define double @double_to_double(double %0) {
%2 = fadd double %0, 1.000000e+00
ret double %2
}
void novm(msg) char *msg;
{ fatal("Virtual memory exhausted allocating %s\n", msg); }


x86 assembly (clang, -O0):
<novm>:
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 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<novm>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
xor    %eax,%eax
jmp    1030 <fatal@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"Virtual memory exhausted allocating %s\0A\00"
define void @novm(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [40 x i8] c"Virtual memory exhausted allocating %s\0A\00"
define void @novm(i8* %0) {
%2 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @fatal to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() {
  printf("%lu %lu\n", sizeof(size_t), sizeof(long long));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"%lu %lu\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 8, i32 8)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *strdup(char const *);
int strfcpy(const char *source_str, char **dest_str) {
  if (*dest_str) {
    free(*dest_str);
    *dest_str = NULL;
  }
  *dest_str = strdup(source_str);
  if (*dest_str == NULL)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<strfcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1155 <strfcpy+0x35>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <strdup@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1182 <strfcpy+0x62>
movl   $0x1,-0x4(%rbp)
jmp    1189 <strfcpy+0x69>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strfcpy>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
test   %rdi,%rdi
je     113e <strfcpy+0x1e>
call   1030 <free@plt>
movq   $0x0,(%rbx)
mov    %r14,%rdi
call   1040 <strdup@plt>
mov    %rax,(%rbx)
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @strfcpy(i8* nocapture %0, i8** nocapture %1) {
%3 = load i8*, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @free(i8* %3)
store i8* null, i8** %1
br label %7
7: ; preds = %5, %2
%8 = tail call i8* @strdup(i8* %0)
store i8* %8, i8** %1
%9 = icmp eq i8* %8, null
%10 = zext i1 %9 to i32
ret i32 %10
}
void beganTest(void *ctx_) {}


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

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

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

LLVM IR (-O2):
define void @beganTest(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f() { printf("Called C-function!\n"); }


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"Called C-function!\00"
define void @f() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ kernelpanic(char *);
void secure_undef() { kernelpanic("secure world undef\n"); }


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

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

LLVM IR (-O0):
@.str = [20 x i8] c"secure world undef\0A\00"
define void @secure_undef() {
%1 = call i32 @kernelpanic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"secure world undef\0A\00"
define void @secure_undef() {
%1 = tail call i32 @kernelpanic(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ sneeze(char const *);
void barf(const char *msg) {
  sneeze(msg);
  exit(1);
}


x86 assembly (clang, -O0):
<barf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <sneeze@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<barf>:
push   %rax
call   1040 <sneeze@plt>
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @barf(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sneeze(i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @barf(i8* %0) {
%2 = tail call i32 @sneeze(i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int gid_t;

/* Variables and functions */
gid_t getgid(void) {
  ;
  return 1;
}


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

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

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

LLVM IR (-O2):
define i32 @getgid() {
ret i32 1
}
int hash(char *key) {
  int n = 0;
  char *ch = key;
  while (*ch) {
    n <<= 1;
    n += (*ch);
    ++ch;
  }
  return (n % 1999);
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <hash+0x4b>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1117 <hash+0x17>
mov    -0xc(%rbp),%eax
mov    $0x7cf,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%al
test   %al,%al
je     1141 <hash+0x41>
add    $0x1,%rdi
xor    %ecx,%ecx
nopl   0x0(%rax)
movsbl %al,%eax
lea    (%rax,%rcx,2),%ecx
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <hash+0x10>
movslq %ecx,%rax
imul   $0x41919bdb,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x29,%rcx
add    %edx,%ecx
imul   $0x7cf,%ecx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i8* [ %11, %4 ], [ %0, %1 ]
%7 = phi i32 [ %10, %4 ], [ 0, %1 ]
%8 = shl i32 %7, 1
%9 = sext i8 %5 to i32
%10 = add nsw i32 %8, %9
%11 = getelementptr inbounds i8, i8* %6, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = srem i32 %10, 1999
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ ctest_test_assert_add(int, char *);
int ctest_assert_zero(int avalue, char *message) {
  if (avalue == 0) {
    ctest_test_assert_add(0, message);
    return 0;
  }
  ctest_test_assert_add(1, message);
  return -1;
}


x86 assembly (clang, -O0):
<ctest_assert_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1140 <ctest_assert_zero+0x30>
mov    -0x10(%rbp),%rsi
xor    %edi,%edi
call   1030 <ctest_test_assert_add@plt>
movl   $0x0,-0x4(%rbp)
jmp    1155 <ctest_assert_zero+0x45>
mov    -0x10(%rbp),%rsi
mov    $0x1,%edi
call   1030 <ctest_test_assert_add@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ctest_assert_zero>:
push   %rbx
xor    %eax,%eax
test   %edi,%edi
setne  %al
mov    %eax,%ebx
neg    %ebx
mov    %eax,%edi
call   1030 <ctest_test_assert_add@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @ctest_assert_zero(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 0
%4 = xor i1 %3, true
%5 = zext i1 %4 to i32
%6 = xor i1 %3, true
%7 = sext i1 %6 to i32
%8 = tail call i32 @ctest_test_assert_add(i32 %5, i8* %1)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ clear_screen_clr(int);
void clear_screen(void) { clear_screen_clr((0x0 << 4) | ((0x7 | 0x08) & 0xF)); }


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

x86 assembly (clang, -O2):
<clear_screen>:
mov    $0xf,%edi
jmp    1030 <clear_screen_clr@plt>

LLVM IR (-O0):
define void @clear_screen() {
%1 = call i32 @clear_screen_clr(i32 15)
ret void
}

LLVM IR (-O2):
define void @clear_screen() {
%1 = tail call i32 @clear_screen_clr(i32 15)
ret void
}
void foo439() {}


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

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

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

LLVM IR (-O2):
define void @foo439() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ api5(int, int, int, int, int, int);
void draw_text(int sid, int x, int y, unsigned int color, const char *s) {
  api5(1010, sid, x, y, (int)color, (int)s);
}


x86 assembly (clang, -O0):
<draw_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x18(%rbp),%rax
mov    %eax,%r9d
mov    $0x3f2,%edi
call   1030 <api5@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_text>:
mov    %r8,%r9
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%edx
mov    %edi,%esi
mov    $0x3f2,%edi
jmp    1030 <api5@plt>

LLVM IR (-O0):
define void @draw_text(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i8* %4, i8** %10
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i8*, i8** %10
%16 = ptrtoint i8* %15 to i32
%17 = call i32 @api5(i32 1010, i32 %11, i32 %12, i32 %13, i32 %14, i32 %16)
ret void
}

LLVM IR (-O2):
define void @draw_text(i32 %0, i32 %1, i32 %2, i32 %3, i8* %4) {
%6 = ptrtoint i8* %4 to i64
%7 = trunc i64 %6 to i32
%8 = tail call i32 @api5(i32 1010, i32 %0, i32 %1, i32 %2, i32 %3, i32 %7)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void freakout(char *why) {
  fprintf(stderr, "Error: %s\n", why);
  exit(1);
}


x86 assembly (clang, -O0):
<freakout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<freakout>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @freakout(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"Error: %s\0A\00"
define void @freakout(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int test_imm_3Fuint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0x3F << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_3Fuint64_midword_mem>:
testb  $0x3f,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_3Fuint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 4128768
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
struct fb_info {
  int dummy;
};
struct fb_fillrect {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ sys_fillrect(struct fb_info *, struct fb_fillrect const *);
void wmt_ge_fillrect(struct fb_info *p, const struct fb_fillrect *rect) {
  sys_fillrect(p, rect);
}


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

x86 assembly (clang, -O2):
<wmt_ge_fillrect>:
jmp    1030 <sys_fillrect@plt>

LLVM IR (-O0):
%struct.fb_info = type { i32 }
%struct.fb_fillrect = type { i32 }
define void @wmt_ge_fillrect(%struct.fb_info* %0, %struct.fb_fillrect* %1) {
%3 = alloca %struct.fb_info*
%4 = alloca %struct.fb_fillrect*
store %struct.fb_info* %0, %struct.fb_info** %3
store %struct.fb_fillrect* %1, %struct.fb_fillrect** %4
%5 = load %struct.fb_info*, %struct.fb_info** %3
%6 = load %struct.fb_fillrect*, %struct.fb_fillrect** %4
%7 = call i32 @sys_fillrect(%struct.fb_info* %5, %struct.fb_fillrect* %6)
ret void
}

LLVM IR (-O2):
%struct.fb_info = type { i32 }
%struct.fb_fillrect = type { i32 }
define void @wmt_ge_fillrect(%struct.fb_info* %0, %struct.fb_fillrect* %1) {
%3 = tail call i32 @sys_fillrect(%struct.fb_info* %0, %struct.fb_fillrect* %1)
ret void
}
void PatchIOC(int x) {}


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

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

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

LLVM IR (-O2):
define void @PatchIOC(i32 %0) {
ret void
}
float fact(n) {
  if ((n == 1) || (n == 0))
    return 1.0;
  return n * fact(n - 1);
}


x86 assembly (clang, -O0):
<fact>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     112f <fact+0x1f>
cmpl   $0x0,-0x8(%rbp)
jne    1141 <fact+0x31>
movss  0xec9(%rip),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1167 <fact+0x57>
cvtsi2ssl -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1030 <fact@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fact>:
push   %rax
cmp    $0x1,%edi
ja     1120 <fact+0x10>
movss  0xee2(%rip),%xmm0
pop    %rax
ret
cvtsi2ss %edi,%xmm0
movss  %xmm0,0x4(%rsp)
add    $0xffffffff,%edi
call   1030 <fact@plt>
mulss  0x4(%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @fact(i32 %0) {
%2 = alloca float
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 1
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %1
store float 1.000000e+00, float* %2
br label %17
10: ; preds = %6
%11 = load i32, i32* %3
%12 = sitofp i32 %11 to float
%13 = load i32, i32* %3
%14 = sub nsw i32 %13, 1
%15 = call float @fact(i32 %14)
%16 = fmul float %12, %15
store float %16, float* %2
br label %17
17: ; preds = %10, %9
%18 = load float, float* %2
ret float %18
}

LLVM IR (-O2):
define float @fact(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1, %5
%4 = phi float [ %9, %5 ], [ 1.000000e+00, %1 ]
ret float %4
5: ; preds = %1
%6 = sitofp i32 %0 to float
%7 = add nsw i32 %0, -1
%8 = tail call float @fact(i32 %7)
%9 = fmul float %8, %6
br label %3
}
int execute_timerfd_create() { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @execute_timerfd_create() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
void sys_exit(int status) { _exit(status); }


x86 assembly (clang, -O0):
<sys_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<sys_exit>:
push   %rax
call   1030 <_exit@plt>

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

LLVM IR (-O2):
define void @sys_exit(i32 %0) {
%2 = tail call i32 @_exit(i32 %0)
unreachable
}
unsigned f6(unsigned x, unsigned short y) {
  y &= 8 * 4 - 1;
  return (x << y) | (x >> (-y & (8 * 4 - 1)));
}


x86 assembly (clang, -O0):
<f6>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
movzwl -0x6(%rbp),%eax
and    $0x1f,%eax
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
movzwl -0x6(%rbp),%ecx
shl    %cl,%eax
mov    -0x4(%rbp),%edx
movzwl -0x6(%rbp),%esi
xor    %ecx,%ecx
sub    %esi,%ecx
and    $0x1f,%ecx
shr    %cl,%edx
mov    %edx,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f6>:
mov    %esi,%ecx
mov    %edi,%eax
rol    %cl,%eax
ret

LLVM IR (-O0):
define i32 @f6(i32 %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i16, i16* %4
%6 = zext i16 %5 to i32
%7 = and i32 %6, 31
%8 = trunc i32 %7 to i16
store i16 %8, i16* %4
%9 = load i32, i32* %3
%10 = load i16, i16* %4
%11 = zext i16 %10 to i32
%12 = shl i32 %9, %11
%13 = load i32, i32* %3
%14 = load i16, i16* %4
%15 = zext i16 %14 to i32
%16 = sub nsw i32 0, %15
%17 = and i32 %16, 31
%18 = lshr i32 %13, %17
%19 = or i32 %12, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @f6(i32 %0, i16 zeroext %1) {
%3 = zext i16 %1 to i32
%4 = tail call i32 @llvm.fshl.i32(i32 %0, i32 %0, i32 %3)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ PRINTF(char *, char *);
int /*<<< orphan*/ exit(int);
void fisError(char *msg) {
  PRINTF("%s\n", msg);
  exit(1);
}


x86 assembly (clang, -O0):
<fisError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <PRINTF@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fisError>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <PRINTF@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%s\0A\00"
define void @fisError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @PRINTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define void @fisError(i8* %0) {
%2 = tail call i32 @PRINTF(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
float pow(float const, float);
float LinearToGamma(const float f1linear) { return pow(f1linear, 1.0f / 2.2f); }


x86 assembly (clang, -O0):
<LinearToGamma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xed6(%rip),%xmm1
call   1030 <pow@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LinearToGamma>:
movss  0xee8(%rip),%xmm1
jmp    1030 <pow@plt>

LLVM IR (-O0):
define float @LinearToGamma(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call float @pow(float %3, float 0x3FDD1745C0000000)
ret float %4
}

LLVM IR (-O2):
define float @LinearToGamma(float %0) {
%2 = tail call float @pow(float %0, float 0x3FDD1745C0000000)
ret float %2
}
int jumpSpace(char *line, int iter) {
  while (*(line + iter) == ' ') {
    ++iter;
  }
  return iter;
}


x86 assembly (clang, -O0):
<jumpSpace>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jne    112e <jumpSpace+0x2e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110b <jumpSpace+0xb>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<jumpSpace>:
movslq %esi,%rcx
lea    -0x1(%rcx),%eax
add    %rcx,%rdi
nopl   0x0(%rax)
add    $0x1,%eax
cmpb   $0x20,(%rdi)
lea    0x1(%rdi),%rdi
je     1110 <jumpSpace+0x10>
ret

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

LLVM IR (-O2):
define i32 @jumpSpace(i8* nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
br label %4
4: ; preds = %4, %2
%5 = phi i64 [ %9, %4 ], [ %3, %2 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 32
%9 = add i64 %5, 1
br i1 %8, label %4, label %10
10: ; preds = %4
%11 = trunc i64 %5 to i32
ret i32 %11
}
/* Type definitions */
typedef int uint8_t;
typedef int uint32_t;

/* Variables and functions */
void write16(uint8_t *base, uint32_t value) {
  base[0] = value & 0xff;
  base[1] = (value >> 8) & 0xff;
}


x86 assembly (clang, -O0):
<write16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write16>:
mov    %esi,%eax
movzbl %al,%ecx
mov    %ecx,(%rdi)
movzbl %ah,%eax
mov    %eax,0x4(%rdi)
ret

LLVM IR (-O0):
define void @write16(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 = and i32 %5, 255
%7 = load i32*, i32** %3
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %6, i32* %8
%9 = load i32, i32* %4
%10 = ashr i32 %9, 8
%11 = and i32 %10, 255
%12 = load i32*, i32** %3
%13 = getelementptr inbounds i32, i32* %12, i64 1
store i32 %11, i32* %13
ret void
}

LLVM IR (-O2):
define void @write16(i32* nocapture writeonly %0, i32 %1) {
%3 = and i32 %1, 255
store i32 %3, i32* %0
%4 = lshr i32 %1, 8
%5 = and i32 %4, 255
%6 = getelementptr inbounds i32, i32* %0, i64 1
store i32 %5, i32* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ROR_();
int /*<<< orphan*/ c64_memAbsoluteAddrX();
void ROR_absx(void) {
  c64_memAbsoluteAddrX();
  ROR_();
}


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

x86 assembly (clang, -O2):
<ROR_absx>:
push   %rax
xor    %eax,%eax
call   1040 <c64_memAbsoluteAddrX@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <ROR_@plt>

LLVM IR (-O0):
define void @ROR_absx() {
%1 = call i32 (...) @c64_memAbsoluteAddrX()
%2 = call i32 (...) @ROR_()
ret void
}

LLVM IR (-O2):
define void @ROR_absx() {
%1 = tail call i32 (...) @c64_memAbsoluteAddrX()
%2 = tail call i32 (...) @ROR_()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pop();
long wcstol(int /*<<< orphan*/, int /*<<< orphan*/ *, int);
long pop_to_long() { return wcstol(pop(), NULL, 10); }


x86 assembly (clang, -O0):
<pop_to_long>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <pop@plt>
mov    %eax,%edi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1030 <wcstol@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<pop_to_long>:
push   %rax
xor    %eax,%eax
call   1040 <pop@plt>
mov    %eax,%edi
xor    %esi,%esi
mov    $0xa,%edx
pop    %rax
jmp    1030 <wcstol@plt>

LLVM IR (-O0):
define i64 @pop_to_long() {
%1 = call i32 (...) @pop()
%2 = call i64 @wcstol(i32 %1, i32* null, i32 10)
ret i64 %2
}

LLVM IR (-O2):
define i64 @pop_to_long() {
%1 = tail call i32 (...) @pop()
%2 = tail call i64 @wcstol(i32 %1, i32* null, i32 10)
ret i64 %2
}
long _biggest(long EV_num1, long EV_num2) {
  if ((EV_num1 > EV_num2)) {
    return EV_num1;
  } else {
    return EV_num2;
  }
}


x86 assembly (clang, -O0):
<_biggest>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jle    1127 <_biggest+0x27>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    112f <_biggest+0x2f>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_biggest>:
mov    %rsi,%rax
cmp    %rsi,%rdi
cmovg  %rdi,%rax
ret

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

LLVM IR (-O2):
define i64 @_biggest(i64 %0, i64 %1) {
%3 = icmp sgt i64 %0, %1
%4 = select i1 %3, i64 %0, i64 %1
ret i64 %4
}
/* Variables and functions */
int /*<<< orphan*/ addbyte(int);
void NEG_HOST_REG_B(int reg) {
  addbyte(0xf6);
  addbyte(0xd8 | reg);
}


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

x86 assembly (clang, -O2):
<NEG_HOST_REG_B>:
push   %rbx
mov    %edi,%ebx
mov    $0xf6,%edi
call   1030 <addbyte@plt>
or     $0xd8,%ebx
mov    %ebx,%edi
pop    %rbx
jmp    1030 <addbyte@plt>

LLVM IR (-O0):
define void @NEG_HOST_REG_B(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @addbyte(i32 246)
%4 = load i32, i32* %2
%5 = or i32 216, %4
%6 = call i32 @addbyte(i32 %5)
ret void
}

LLVM IR (-O2):
define void @NEG_HOST_REG_B(i32 %0) {
%2 = tail call i32 @addbyte(i32 246)
%3 = or i32 %0, 216
%4 = tail call i32 @addbyte(i32 %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ value;

/* Variables and functions */
int /*<<< orphan*/ knapsack_complete(int *, int *, int, int);
int main() {
  int value[] = {6, 5, 10, 2, 16, 8};
  int weight[] = {3, 2, 5, 1, 6, 4};
  int total = 10;
  int length = sizeof(value) / sizeof(value[0]);
  knapsack_complete(value, weight, length, total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed9(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xed6(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
movl   $0xa,-0x44(%rbp)
movl   $0x6,-0x48(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%edx
mov    -0x44(%rbp),%ecx
call   1030 <knapsack_complete@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0xef5(%rip),%rax
mov    %rax,0x30(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xefd(%rip),%rax
mov    %rax,0x10(%rsp)
movaps 0xee1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x6,%edx
mov    $0xa,%ecx
call   1030 <knapsack_complete@plt>
xor    %eax,%eax
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.value = [6 x i32] [i32 6, i32 5, i32 10, i32 2, i32 16, i32 8]
@__const.main.weight = [6 x i32] [i32 3, i32 2, i32 5, i32 1, i32 6, i32 4]
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i32]
%3 = alloca [6 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [6 x i32]* %2 to i8*
%7 = bitcast [6 x i32]* %3 to i8*
store i32 10, i32* %4
store i32 6, i32* %5
%8 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = call i32 @knapsack_complete(i32* %8, i32* %9, i32 %10, i32 %11)
ret i32 0
}

LLVM IR (-O2):
@__const.main.value = [6 x i32] [i32 6, i32 5, i32 10, i32 2, i32 16, i32 8]
@__const.main.weight = [6 x i32] [i32 3, i32 2, i32 5, i32 1, i32 6, i32 4]
define i32 @main() {
%1 = alloca [6 x i32]
%2 = alloca [6 x i32]
%3 = bitcast [6 x i32]* %1 to i8*
%4 = bitcast [6 x i32]* %2 to i8*
%5 = getelementptr inbounds [6 x i32], [6 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [6 x i32], [6 x i32]* %2, i64 0, i64 0
%7 = call i32 @knapsack_complete(i32* %5, i32* %6, i32 6, i32 10)
ret i32 0
}
/* Type definitions */
struct node {
  int dummy;
};

/* Variables and functions */
struct node *create_node(int /*<<< orphan*/);
struct node *create_tree() {
  struct node *n = create_node(0);
  return n;
}


x86 assembly (clang, -O0):
<create_tree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <create_node@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.node = type { i32 }
define %struct.node* @create_tree() {
%1 = alloca %struct.node*
%2 = call %struct.node* @create_node(i32 0)
store %struct.node* %2, %struct.node** %1
%3 = load %struct.node*, %struct.node** %1
ret %struct.node* %3
}

LLVM IR (-O2):
%struct.node = type { i32 }
define %struct.node* @create_tree() {
%1 = tail call %struct.node* @create_node(i32 0)
ret %struct.node* %1
}
int hpgl_palettesize(int size) {
  size = size;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @hpgl_palettesize(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
void idt_int10(void) { print("!! Invalid TSS "); }


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

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

LLVM IR (-O0):
@.str = [16 x i8] c"!! Invalid TSS \00"
define void @idt_int10() {
%1 = call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"!! Invalid TSS \00"
define void @idt_int10() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
void cleanExit(int status, char *msg) {
  char *exitStatus;
  switch (status) {
  case 1:
    exitStatus = "SUCCESS";
    break;
  case 0:
    exitStatus = "FAILURE";
    break;
  default:
    "DEBUG, wrong param passed into cleanExit";
    break;
  }
  printf("[EXIT] [%s] %s \n ", exitStatus, msg);
  exit(status);
}


x86 assembly (clang, -O0):
<cleanExit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x1c(%rbp)
test   %eax,%eax
je     1163 <cleanExit+0x43>
jmp    1142 <cleanExit+0x22>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
jne    1173 <cleanExit+0x53>
jmp    1153 <cleanExit+0x33>
lea    0xea6(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1178 <cleanExit+0x58>
lea    0xe9e(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1178 <cleanExit+0x58>
jmp    1178 <cleanExit+0x58>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
lea    0xeb2(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<cleanExit>:
push   %rbx
mov    %rsi,%rdx
mov    %edi,%ebx
cmp    $0x1,%edi
lea    0xed0(%rip),%rax
lea    0xed1(%rip),%rsi
cmove  %rax,%rsi
lea    0xece(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"SUCCESS\00"
@.str.1 = [8 x i8] c"FAILURE\00"
@.str.2 = [41 x i8] c"DEBUG, wrong param passed into cleanExit\00"
@.str.3 = [18 x i8] c"[EXIT] [%s] %s \0A \00"
define void @cleanExit(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%6 = load i32, i32* %3
switch i32 %6, label %9 [
i32 1, label %7
i32 0, label %8
]
7: ; preds = %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8** %5
br label %10
8: ; preds = %2
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %5
br label %10
9: ; preds = %2
br label %10
10: ; preds = %9, %8, %7
%11 = load i8*, i8** %5
%12 = load i8*, i8** %4
%13 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %11, i8* %12)
%14 = load i32, i32* %3
%15 = call i32 @exit(i32 %14)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"SUCCESS\00"
@.str.1 = [8 x i8] c"FAILURE\00"
@.str.3 = [18 x i8] c"[EXIT] [%s] %s \0A \00"
define void @cleanExit(i32 %0, i8* %1) {
%3 = icmp eq i32 %0, 1
%4 = select i1 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %4, i8* %1)
%6 = tail call i32 @exit(i32 %0)
unreachable
}
int tegra_cpu_speedo_value(void) { return 1777; }


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

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

LLVM IR (-O0):
define i32 @tegra_cpu_speedo_value() {
ret i32 1777
}

LLVM IR (-O2):
define i32 @tegra_cpu_speedo_value() {
ret i32 1777
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned long);
int /*<<< orphan*/ sleep(int);
void eat(unsigned long i) {
  printf("C   %ld comendo...\n", i);
  sleep(1);
}


x86 assembly (clang, -O0):
<eat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <sleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<eat>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <sleep@plt>

LLVM IR (-O0):
@.str = [20 x i8] c"C %ld comendo...\0A\00"
define void @eat(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %3)
%5 = call i32 @sleep(i32 1)
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"C %ld comendo...\0A\00"
define void @eat(i64 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = tail call i32 @sleep(i32 1)
ret void
}
int ds(int n) {
  while (n > 9)
    n = n % 10 + ds(n / 10);
  return n;
}


x86 assembly (clang, -O0):
<ds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jle    1152 <ds+0x42>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%edi
call   1030 <ds@plt>
mov    -0x8(%rbp),%edx
add    %eax,%edx
mov    %edx,-0x4(%rbp)
jmp    111b <ds+0xb>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ds>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
cmp    $0xa,%edi
jl     114e <ds+0x3e>
mov    $0xcccccccd,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
imul   %r14,%rdi
shr    $0x23,%rdi
lea    (%rdi,%rdi,1),%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
call   1030 <ds@plt>
add    %eax,%ebx
cmp    $0x9,%ebx
jg     1130 <ds+0x20>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @ds(i32 %0) {
%2 = icmp sgt i32 %0, 9
br i1 %2, label %3, label %10
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = urem i32 %4, 10
%6 = udiv i32 %4, 10
%7 = tail call i32 @ds(i32 %6)
%8 = add nsw i32 %7, %5
%9 = icmp sgt i32 %8, 9
br i1 %9, label %3, label %10
10: ; preds = %3, %1
%11 = phi i32 [ %0, %1 ], [ %8, %3 ]
ret i32 %11
}
/* Variables and functions */
unsigned char at_hex_get_byte(char const *, int);
unsigned char at_hex_get_data(const char *line, int i) {
  return at_hex_get_byte(line, i + 4);
}


x86 assembly (clang, -O0):
<at_hex_get_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x4,%esi
call   1030 <at_hex_get_byte@plt>
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<at_hex_get_data>:
add    $0x4,%esi
jmp    1030 <at_hex_get_byte@plt>

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

LLVM IR (-O2):
define zeroext i8 @at_hex_get_data(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 4
%4 = tail call zeroext i8 @at_hex_get_byte(i8* %0, i32 %3)
ret i8 %4
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void safe_free(void *in_memory) { free(in_memory); }


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

x86 assembly (clang, -O2):
<safe_free>:
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @safe_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}