xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ link_error();
void do_thing(char *s, int *p, char *q) {
  if (s == 0 || q == 0)
    link_error();
  if (p)
    *p = 3;
}


x86 assembly (clang, -O0):
<do_thing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     113a <do_thing+0x2a>
cmpq   $0x0,-0x18(%rbp)
jne    1141 <do_thing+0x31>
mov    $0x0,%al
call   1030 <link_error@plt>
cmpq   $0x0,-0x10(%rbp)
je     1156 <do_thing+0x46>
mov    -0x10(%rbp),%rax
movl   $0x3,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_thing>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
je     111e <do_thing+0xe>
test   %rdx,%rdx
jne    1125 <do_thing+0x15>
xor    %eax,%eax
call   1030 <link_error@plt>
test   %rbx,%rbx
je     1130 <do_thing+0x20>
movl   $0x3,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @do_thing(i8* readnone %0, i32* writeonly %1, i8* readnone %2) {
%4 = icmp eq i8* %0, null
%5 = icmp eq i8* %2, null
%6 = or i1 %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 (...) @link_error()
br label %9
9: ; preds = %3, %7
%10 = icmp eq i32* %1, null
br i1 %10, label %12, label %11
11: ; preds = %9
store i32 3, i32* %1
br label %12
12: ; preds = %11, %9
ret void
}
/* Type definitions */
struct range {
  int dummy;
};
struct genomeRangeTree {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ genomeRangeTreeFindOrAddRangeTree(struct genomeRangeTree *,
                                                     char *);
struct range *rangeTreeAddValCount(int /*<<< orphan*/, int, int);
struct range *genomeRangeTreeAddValCount(struct genomeRangeTree *tree,
                                         char *chrom, int start, int end) {
  return rangeTreeAddValCount(genomeRangeTreeFindOrAddRangeTree(tree, chrom),
                              start, end);
}


x86 assembly (clang, -O0):
<genomeRangeTreeAddValCount>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <genomeRangeTreeFindOrAddRangeTree@plt>
mov    %eax,%edi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1040 <rangeTreeAddValCount@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<genomeRangeTreeAddValCount>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%ebx
mov    %edx,%ebp
call   1030 <genomeRangeTreeFindOrAddRangeTree@plt>
mov    %eax,%edi
mov    %ebp,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <rangeTreeAddValCount@plt>

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

LLVM IR (-O2):
%struct.range = type { i32 }
%struct.genomeRangeTree = type { i32 }
define %struct.range* @genomeRangeTreeAddValCount(%struct.genomeRangeTree* %0, i8* %1, i32 %2, i32 %3) {
%5 = tail call i32 @genomeRangeTreeFindOrAddRangeTree(%struct.genomeRangeTree* %0, i8* %1)
%6 = tail call %struct.range* @rangeTreeAddValCount(i32 %5, i32 %2, i32 %3)
ret %struct.range* %6
}
/* Type definitions */
struct timex {
  long freq;
};

/* Variables and functions */
long getter_freq(const struct timex *txc) { return txc->freq; }


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

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

LLVM IR (-O0):
%struct.timex = type { i64 }
define i64 @getter_freq(%struct.timex* %0) {
%2 = alloca %struct.timex*
store %struct.timex* %0, %struct.timex** %2
%3 = load %struct.timex*, %struct.timex** %2
%4 = getelementptr inbounds %struct.timex, %struct.timex* %3, i32 0, i32 0
%5 = load i64, i64* %4
ret i64 %5
}

LLVM IR (-O2):
%struct.timex = type { i64 }
define i64 @getter_freq(%struct.timex* nocapture %0) {
%2 = getelementptr inbounds %struct.timex, %struct.timex* %0, i64 0, i32 0
%3 = load i64, i64* %2
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ test_sun_sendMessage();
void test_stun() { test_sun_sendMessage(); }


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

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

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

LLVM IR (-O2):
define void @test_stun() {
%1 = tail call i32 (...) @test_sun_sendMessage()
ret void
}
/* Variables and functions */
double pnorm5(double, double, double, int, int);
double log_pnorm(double x) { return pnorm5(x, 0.0, 1.0, 1, 1); }


x86 assembly (clang, -O0):
<log_pnorm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
movsd  0xed3(%rip),%xmm2
mov    $0x1,%esi
mov    %esi,%edi
call   1030 <pnorm5@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_pnorm>:
movsd  0xee8(%rip),%xmm2
xorps  %xmm1,%xmm1
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <pnorm5@plt>

LLVM IR (-O0):
define double @log_pnorm(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @pnorm5(double %3, double 0.000000e+00, double 1.000000e+00, i32 1, i32 1)
ret double %4
}

LLVM IR (-O2):
define double @log_pnorm(double %0) {
%2 = tail call double @pnorm5(double %0, double 0.000000e+00, double 1.000000e+00, i32 1, i32 1)
ret double %2
}
/* Variables and functions */
char tolower(char);
const char *strlwr(char *s) {
  const char *p = s;
  while (*s) {
    *s = tolower(*s);
    s++;
  }
  return p;
}


x86 assembly (clang, -O0):
<strlwr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <strlwr+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <tolower@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1124 <strlwr+0x14>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strlwr>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%al
test   %al,%al
je     1146 <strlwr+0x36>
lea    0x1(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strlwr+0x20>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @strlwr(i8* returned %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %9, %4 ], [ %2, %1 ]
%6 = phi i8* [ %8, %4 ], [ %0, %1 ]
%7 = tail call signext i8 @tolower(i8 signext %5)
store i8 %7, i8* %6
%8 = getelementptr inbounds i8, i8* %6, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
ret i8* %0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int, int);
int main() {
  int i = 2147483647;
  printf("%d %d %d\n", i, i + 1, i + 2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x7fffffff,-0x8(%rbp)
mov    -0x8(%rbp),%esi
mov    -0x8(%rbp),%edx
add    $0x1,%edx
mov    -0x8(%rbp),%ecx
add    $0x2,%ecx
lea    0xec4(%rip),%rdi
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    $0x7fffffff,%esi
mov    $0x80000000,%edx
mov    $0x80000001,%ecx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 2147483647, i32 -2147483648, i32 -2147483647)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ DymosimMessage(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, int, int, double);
void DymosimMessageMatrixElement(char *name, int i, int j, double d) {
  char textline[200];
  sprintf(textline, "  %.160s[%i, %i] = %G", name, i, j, d);
  DymosimMessage(textline);
}


x86 assembly (clang, -O0):
<DymosimMessageMatrixElement>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movsd  %xmm0,-0x18(%rbp)
lea    -0xe0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
movsd  -0x18(%rbp),%xmm0
lea    0xea8(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0xe0(%rbp),%rdi
call   1030 <DymosimMessage@plt>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DymosimMessageMatrixElement>:
push   %rbx
sub    $0xd0,%rsp
mov    %edx,%r8d
mov    %esi,%ecx
mov    %rdi,%rdx
lea    0xec9(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <DymosimMessage@plt>
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [22 x i8] c" %.160s[%i, %i] = %G\00"
define void @DymosimMessageMatrixElement(i8* %0, i32 %1, i32 %2, double %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca double
%9 = alloca [200 x i8]
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store double %3, double* %8
%10 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%11 = load i8*, i8** %5
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = load double, double* %8
%15 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %11, i32 %12, i32 %13, double %14)
%16 = getelementptr inbounds [200 x i8], [200 x i8]* %9, i64 0, i64 0
%17 = call i32 @DymosimMessage(i8* %16)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c" %.160s[%i, %i] = %G\00"
define void @DymosimMessageMatrixElement(i8* %0, i32 %1, i32 %2, double %3) {
%5 = alloca [200 x i8]
%6 = getelementptr inbounds [200 x i8], [200 x i8]* %5, i64 0, i64 0
%7 = call i32 @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i32 %2, double %3)
%8 = call i32 @DymosimMessage(i8* %6)
ret void
}
int another_way(int a, int b, int c) { return a * b + a * c; }


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

x86 assembly (clang, -O2):
<another_way>:
lea    (%rsi,%rdx,1),%eax
imul   %edi,%eax
ret

LLVM IR (-O0):
define i32 @another_way(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = mul nsw i32 %7, %8
%10 = load i32, i32* %4
%11 = load i32, i32* %6
%12 = mul nsw i32 %10, %11
%13 = add nsw i32 %9, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @another_way(i32 %0, i32 %1, i32 %2) {
%4 = add i32 %2, %1
%5 = mul i32 %4, %0
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ tell_me_a_bad_translated_joke();
int main() {
  tell_me_a_bad_translated_joke();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @tell_me_a_bad_translated_joke()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ logDebug(char);
int max(int, int);
int __doComputation(int a, float b) {
  int c = max(3, 4);
  logDebug('d');
  return c;
}


x86 assembly (clang, -O0):
<__doComputation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movss  %xmm0,-0x8(%rbp)
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <max@plt>
mov    %eax,-0xc(%rbp)
mov    $0x64,%edi
call   1040 <logDebug@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__doComputation>:
push   %rbx
mov    $0x3,%edi
mov    $0x4,%esi
call   1030 <max@plt>
mov    %eax,%ebx
mov    $0x64,%edi
call   1040 <logDebug@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @__doComputation(i32 %0, float %1) {
%3 = alloca i32
%4 = alloca float
%5 = alloca i32
store i32 %0, i32* %3
store float %1, float* %4
%6 = call i32 @max(i32 3, i32 4)
store i32 %6, i32* %5
%7 = call i32 @logDebug(i8 signext 100)
%8 = load i32, i32* %5
ret i32 %8
}

LLVM IR (-O2):
define i32 @__doComputation(i32 %0, float %1) {
%3 = tail call i32 @max(i32 3, i32 4)
%4 = tail call i32 @logDebug(i8 signext 100)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ printf(char *);
void test_while() {
  printf("\n===== test_while\n");
  int result = 1;
  while (result < 10) {
    ++result;
  }
  assert(result == 10);
}


x86 assembly (clang, -O0):
<test_while>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
cmpl   $0xa,-0x4(%rbp)
jge    1153 <test_while+0x33>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    113b <test_while+0x1b>
cmpl   $0xa,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_while>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
pop    %rax
jmp    1040 <assert@plt>

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

LLVM IR (-O2):
@str = [18 x i8] c"\0A===== test_while\00"
define void @test_while() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @assert(i32 1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void clear_screen() { memset((void *)0xB8000, 0, 80 * 2 * 25); }


x86 assembly (clang, -O0):
<clear_screen>:
push   %rbp
mov    %rsp,%rbp
mov    $0xb8000,%edi
xor    %esi,%esi
mov    $0xfa0,%edx
call   1030 <memset@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_screen>:
mov    $0xb8000,%edi
xor    %esi,%esi
mov    $0xfa0,%edx
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @clear_screen() {
%1 = call i32 @memset(i8* inttoptr (i64 753664 to i8*), i32 0, i32 4000)
ret void
}

LLVM IR (-O2):
define void @clear_screen() {
%1 = tail call i32 @memset(i8* inttoptr (i64 753664 to i8*), i32 0, i32 4000)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ PrintErrorCode();
int dxl_read_byte(int, int);
void getI(int ID) {
  int iVal;
  iVal = dxl_read_byte(ID, 27);
  PrintErrorCode();
}


x86 assembly (clang, -O0):
<getI>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x1b,%esi
call   1040 <dxl_read_byte@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1030 <PrintErrorCode@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getI>:
push   %rax
mov    $0x1b,%esi
call   1040 <dxl_read_byte@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <PrintErrorCode@plt>

LLVM IR (-O0):
define void @getI(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 @dxl_read_byte(i32 %4, i32 27)
store i32 %5, i32* %3
%6 = call i32 (...) @PrintErrorCode()
ret void
}

LLVM IR (-O2):
define void @getI(i32 %0) {
%2 = tail call i32 @dxl_read_byte(i32 %0, i32 27)
%3 = tail call i32 (...) @PrintErrorCode()
ret void
}
norettype(int x) { return x; }


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

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

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

LLVM IR (-O2):
define i32 @norettype(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
void *tommy_list_head(void *);
void *get_first_node_list(void *ll) { return tommy_list_head(ll); }


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

x86 assembly (clang, -O2):
<get_first_node_list>:
jmp    1030 <tommy_list_head@plt>

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

LLVM IR (-O2):
define i8* @get_first_node_list(i8* %0) {
%2 = tail call i8* @tommy_list_head(i8* %0)
ret i8* %2
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;

/* Variables and functions */
char *ctime(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  time_t t;
  t = time(NULL);
  printf("%s", ctime(&t));
  return (0);
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @time(i32* null)
store i32 %3, i32* %1
%4 = call i8* @ctime(i32* %1)
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, int);
void testPrint(int line, const char *func) {
  printf("%s is at line %d\n", func, line);
}


x86 assembly (clang, -O0):
<testPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%edx
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testPrint>:
mov    %edi,%edx
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"%s is at line %d\0A\00"
define void @testPrint(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i32, i32* %3
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %5, i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"%s is at line %d\0A\00"
define void @testPrint(i32 %0, i8* %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %0)
ret void
}
/* Variables and functions */
int __set_memory(unsigned long, int, unsigned long);
int set_memory_nx(unsigned long addr, int numpages) {
  return __set_memory(addr, numpages, 4UL);
}


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

x86 assembly (clang, -O2):
<set_memory_nx>:
mov    $0x4,%edx
jmp    1030 <__set_memory@plt>

LLVM IR (-O0):
define i32 @set_memory_nx(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = load i32, i32* %4
%7 = call i32 @__set_memory(i64 %5, i32 %6, i64 4)
ret i32 %7
}

LLVM IR (-O2):
define i32 @set_memory_nx(i64 %0, i32 %1) {
%3 = tail call i32 @__set_memory(i64 %0, i32 %1, i64 4)
ret i32 %3
}
unsigned short ld2(char *p) { return (p[0] << 8) | p[1]; }


x86 assembly (clang, -O0):
<ld2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
shl    $0x8,%eax
mov    -0x8(%rbp),%rcx
movsbl 0x1(%rcx),%ecx
or     %ecx,%eax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld2>:
movzbl (%rdi),%ecx
shl    $0x8,%ecx
movsbl 0x1(%rdi),%eax
or     %ecx,%eax
ret

LLVM IR (-O0):
define zeroext i16 @ld2(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = shl i32 %6, 8
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = or i32 %7, %11
%13 = trunc i32 %12 to i16
ret i16 %13
}

LLVM IR (-O2):
define zeroext i16 @ld2(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = zext i8 %2 to i16
%4 = shl nuw i16 %3, 8
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i16
%8 = or i16 %4, %7
ret i16 %8
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ *wcsncpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, size_t);
wchar_t *ISandBox_wcsncpy(wchar_t *dest, wchar_t *src, size_t n) {
  return wcsncpy(dest, src, n);
}


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

x86 assembly (clang, -O2):
<ISandBox_wcsncpy>:
jmp    1030 <wcsncpy@plt>

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

LLVM IR (-O2):
define i32* @ISandBox_wcsncpy(i32* %0, i32* %1, i64 %2) {
%4 = tail call i32* @wcsncpy(i32* %0, i32* %1, i64 %2)
ret i32* %4
}
void option_free_bool(void *p) {}


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

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

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

LLVM IR (-O2):
define void @option_free_bool(i8* nocapture %0) {
ret void
}
_Bool scmp(char *a, char *b) {
  while (*a != 0) {
    if (*a != *b) {
      return 0;
    }
    a++;
    b++;
  }
  return *a == *b;
}


x86 assembly (clang, -O0):
<scmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1158 <scmp+0x58>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     113b <scmp+0x3b>
movb   $0x0,-0x1(%rbp)
jmp    1170 <scmp+0x70>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    110c <scmp+0xc>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<scmp>:
mov    (%rdi),%al
test   %al,%al
je     1123 <scmp+0x23>
add    $0x1,%rdi
nopw   0x0(%rax,%rax,1)
cmp    (%rsi),%al
jne    112a <scmp+0x2a>
add    $0x1,%rsi
movzbl (%rdi),%eax
add    $0x1,%rdi
test   %al,%al
jne    1110 <scmp+0x10>
cmpb   $0x0,(%rsi)
sete   %al
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define zeroext i1 @scmp(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %16, label %5
5: ; preds = %2, %11
%6 = phi i8 [ %14, %11 ], [ %3, %2 ]
%7 = phi i8* [ %13, %11 ], [ %1, %2 ]
%8 = phi i8* [ %12, %11 ], [ %0, %2 ]
%9 = load i8, i8* %7
%10 = icmp eq i8 %6, %9
br i1 %10, label %11, label %20
11: ; preds = %5
%12 = getelementptr inbounds i8, i8* %8, i64 1
%13 = getelementptr inbounds i8, i8* %7, i64 1
%14 = load i8, i8* %12
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %5
16: ; preds = %11, %2
%17 = phi i8* [ %1, %2 ], [ %13, %11 ]
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br label %20
20: ; preds = %5, %16
%21 = phi i1 [ %19, %16 ], [ false, %5 ]
ret i1 %21
}
void gtk_style_set_background() {}


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

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

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

LLVM IR (-O2):
define void @gtk_style_set_background() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_array_off_2_2_5();
int /*<<< orphan*/ test_array_off_2_3();
int /*<<< orphan*/ test_array_ref_2_2_5();
int /*<<< orphan*/ test_array_ref_2_3();
int main() {
  test_array_ref_2_3();
  test_array_off_2_3();
  test_array_ref_2_2_5();
  test_array_off_2_2_5();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <test_array_ref_2_3@plt>
mov    $0x0,%al
call   1040 <test_array_off_2_3@plt>
mov    $0x0,%al
call   1060 <test_array_ref_2_2_5@plt>
mov    $0x0,%al
call   1050 <test_array_off_2_2_5@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_array_ref_2_3@plt>
xor    %eax,%eax
call   1040 <test_array_off_2_3@plt>
xor    %eax,%eax
call   1060 <test_array_ref_2_2_5@plt>
xor    %eax,%eax
call   1050 <test_array_off_2_2_5@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 (...) @test_array_ref_2_3()
%2 = call i32 (...) @test_array_off_2_3()
%3 = call i32 (...) @test_array_ref_2_2_5()
%4 = call i32 (...) @test_array_off_2_2_5()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test_array_ref_2_3()
%2 = tail call i32 (...) @test_array_off_2_3()
%3 = tail call i32 (...) @test_array_ref_2_2_5()
%4 = tail call i32 (...) @test_array_off_2_2_5()
ret i32 0
}
void gtk_file_filter_get_needed() {}


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

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

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

LLVM IR (-O2):
define void @gtk_file_filter_get_needed() {
ret void
}
void XMinCmapsOfScreen() {}


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

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

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

LLVM IR (-O2):
define void @XMinCmapsOfScreen() {
ret void
}
/* Variables and functions */
double average(int, int, int, int, int, ...);
int /*<<< orphan*/ printf(char *, double);
int main() {
  printf("%f\n", average(5, 1, 2, 3, 4, 5));
  printf("%f\n", average(4, 1, 2, 3, 4));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%r9d
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    %r9d,%edi
mov    $0x0,%al
call   1040 <average@plt>
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x4,%r8d
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    %r8d,%edi
mov    $0x0,%al
call   1040 <average@plt>
lea    0xe7a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x5,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
mov    $0x5,%r9d
xor    %eax,%eax
call   1040 <average@plt>
lea    0xeb1(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
mov    $0x4,%edi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0x3,%ecx
mov    $0x4,%r8d
xor    %eax,%eax
call   1040 <average@plt>
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call double (i32, i32, i32, i32, i32, ...) @average(i32 5, i32 1, i32 2, i32 3, i32 4, i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %1)
%3 = tail call double (i32, i32, i32, i32, i32, ...) @average(i32 4, i32 1, i32 2, i32 3, i32 4)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ print_int_nl(char *, int);
void test_print() {
  print_int_nl("0: ", 0);
  print_int_nl("1: ", 1);
  print_int_nl("7F..FF: ", 0x7FFFFFFFFFFFFFFFLL);
  print_int_nl("FF..FF: ", 0xFFFFFFFFFFFFFFFFLL);
  print_int_nl("-1: ", -1);
}


x86 assembly (clang, -O0):
<test_print>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
xor    %esi,%esi
call   1030 <print_int_nl@plt>
lea    0xeee(%rip),%rdi
mov    $0x1,%esi
call   1030 <print_int_nl@plt>
lea    0xeca(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <print_int_nl@plt>
lea    0xec2(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <print_int_nl@plt>
lea    0xeba(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <print_int_nl@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_print>:
push   %rax
lea    0xee8(%rip),%rdi
xor    %esi,%esi
call   1030 <print_int_nl@plt>
lea    0xef1(%rip),%rdi
mov    $0x1,%esi
call   1030 <print_int_nl@plt>
lea    0xecd(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <print_int_nl@plt>
lea    0xec5(%rip),%rdi
mov    $0xffffffff,%esi
call   1030 <print_int_nl@plt>
lea    0xebd(%rip),%rdi
mov    $0xffffffff,%esi
pop    %rax
jmp    1030 <print_int_nl@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"0: \00"
@.str.1 = [4 x i8] c"1: \00"
@.str.2 = [9 x i8] c"7F..FF: \00"
@.str.3 = [9 x i8] c"FF..FF: \00"
@.str.4 = [5 x i8] c"-1: \00"
define void @test_print() {
%1 = call i32 @print_int_nl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = call i32 @print_int_nl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = call i32 @print_int_nl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%4 = call i32 @print_int_nl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 -1)
%5 = call i32 @print_int_nl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"0: \00"
@.str.1 = [4 x i8] c"1: \00"
@.str.2 = [9 x i8] c"7F..FF: \00"
@.str.3 = [9 x i8] c"FF..FF: \00"
@.str.4 = [5 x i8] c"-1: \00"
define void @test_print() {
%1 = tail call i32 @print_int_nl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @print_int_nl(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 @print_int_nl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32 -1)
%4 = tail call i32 @print_int_nl(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i32 -1)
%5 = tail call i32 @print_int_nl(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0), i32 -1)
ret void
}
int main(void) {
  char *s;
  s = &"hello";
  s[0];
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
mov    %rax,-0x8(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
void memzero_aligned(void *dst, int n) { memset(dst, 0, n); }


x86 assembly (clang, -O0):
<memzero_aligned>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
xor    %esi,%esi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memzero_aligned>:
mov    %esi,%edx
xor    %esi,%esi
jmp    1030 <memset@plt>

LLVM IR (-O0):
define void @memzero_aligned(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 = call i32 @memset(i8* %5, i32 0, i32 %6)
ret void
}

LLVM IR (-O2):
define void @memzero_aligned(i8* %0, i32 %1) {
%3 = tail call i32 @memset(i8* %0, i32 0, i32 %1)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ test_CSSOM();
int /*<<< orphan*/ test_Deque();
int /*<<< orphan*/ test_FSM();
int /*<<< orphan*/ test_List();
int /*<<< orphan*/ test_Stack();
int /*<<< orphan*/ test_Vector();
int main(void) {
  test_Vector();
  test_List();
  test_Deque();
  test_FSM();
  test_Stack();
  test_CSSOM();
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <test_Vector@plt>
mov    $0x0,%al
call   1080 <test_List@plt>
mov    $0x0,%al
call   1040 <test_Deque@plt>
mov    $0x0,%al
call   1050 <test_FSM@plt>
mov    $0x0,%al
call   1060 <test_Stack@plt>
mov    $0x0,%al
call   1070 <test_CSSOM@plt>
mov    0x2e40(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <test_Vector@plt>
xor    %eax,%eax
call   1080 <test_List@plt>
xor    %eax,%eax
call   1040 <test_Deque@plt>
xor    %eax,%eax
call   1050 <test_FSM@plt>
xor    %eax,%eax
call   1060 <test_Stack@plt>
xor    %eax,%eax
call   1070 <test_CSSOM@plt>
mov    0x2e4e(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_Vector()
%3 = call i32 (...) @test_List()
%4 = call i32 (...) @test_Deque()
%5 = call i32 (...) @test_FSM()
%6 = call i32 (...) @test_Stack()
%7 = call i32 (...) @test_CSSOM()
%8 = load i32, i32* @EXIT_SUCCESS
ret i32 %8
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @test_Vector()
%2 = tail call i32 (...) @test_List()
%3 = tail call i32 (...) @test_Deque()
%4 = tail call i32 (...) @test_FSM()
%5 = tail call i32 (...) @test_Stack()
%6 = tail call i32 (...) @test_CSSOM()
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ say_hello();
int /*<<< orphan*/ say_hi();
int main() {
  say_hello();
  say_hi();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @say_hello()
%2 = tail call i32 (...) @say_hi()
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int compareString(const void *a, const void *b) {
  return strcmp(*(char **)a, *(char **)b);
}


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

x86 assembly (clang, -O2):
<compareString>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

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

LLVM IR (-O2):
define i32 @compareString(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
void GPMCWriteProtectPinLevelCtrl(unsigned int baseAddr,
                                  unsigned int pinLevel) {
  if (pinLevel == (1)) {
    (*((volatile unsigned int *)(baseAddr + (0x50)))) |= ((0x00000010u));
  } else if (pinLevel == (0)) {
    (*((volatile unsigned int *)(baseAddr + (0x50)))) &= (~(0x00000010u));
  }
}


x86 assembly (clang, -O0):
<GPMCWriteProtectPinLevelCtrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1128 <GPMCWriteProtectPinLevelCtrl+0x28>
mov    -0x4(%rbp),%eax
add    $0x50,%eax
mov    %eax,%eax
mov    (%rax),%ecx
or     $0x10,%ecx
mov    %ecx,(%rax)
jmp    1146 <GPMCWriteProtectPinLevelCtrl+0x46>
cmpl   $0x0,-0x8(%rbp)
jne    1141 <GPMCWriteProtectPinLevelCtrl+0x41>
mov    -0x4(%rbp),%eax
add    $0x50,%eax
mov    %eax,%eax
mov    (%rax),%ecx
and    $0xffffffef,%ecx
mov    %ecx,(%rax)
jmp    1146 <GPMCWriteProtectPinLevelCtrl+0x46>
pop    %rbp
ret

x86 assembly (clang, -O2):
<GPMCWriteProtectPinLevelCtrl>:
test   %esi,%esi
je     1110 <GPMCWriteProtectPinLevelCtrl+0x10>
cmp    $0x1,%esi
jne    1116 <GPMCWriteProtectPinLevelCtrl+0x16>
add    $0x50,%edi
orl    $0x10,(%rdi)
ret
add    $0x50,%edi
andl   $0xffffffef,(%rdi)
ret

LLVM IR (-O0):
define void @GPMCWriteProtectPinLevelCtrl(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = load i32, i32* %3
%9 = add i32 %8, 80
%10 = zext i32 %9 to i64
%11 = inttoptr i64 %10 to i32*
%12 = load volatile i32, i32* %11
%13 = or i32 %12, 16
store volatile i32 %13, i32* %11
br label %25
14: ; preds = %2
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load i32, i32* %3
%19 = add i32 %18, 80
%20 = zext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load volatile i32, i32* %21
%23 = and i32 %22, -17
store volatile i32 %23, i32* %21
br label %24
24: ; preds = %17, %14
br label %25
25: ; preds = %24, %7
ret void
}

LLVM IR (-O2):
define void @GPMCWriteProtectPinLevelCtrl(i32 %0, i32 %1) {
switch i32 %1, label %15 [
i32 1, label %3
i32 0, label %9
]
3: ; preds = %2
%4 = add i32 %0, 80
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
%8 = or i32 %7, 16
store volatile i32 %8, i32* %6
br label %15
9: ; preds = %2
%10 = add i32 %0, 80
%11 = zext i32 %10 to i64
%12 = inttoptr i64 %11 to i32*
%13 = load volatile i32, i32* %12
%14 = and i32 %13, -17
store volatile i32 %14, i32* %12
br label %15
15: ; preds = %2, %9, %3
ret void
}
/* Type definitions */
struct tty_struct {
  int dummy;
};
struct inode {
  int dummy;
};

/* Variables and functions */
int EINVAL;
int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<devpts_pty_new>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
mov    0x2ecb(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<devpts_pty_new>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
%struct.inode = type { i32 }
%struct.tty_struct = type { i32 }
@EINVAL = global i32 0
define i32 @devpts_pty_new(%struct.inode* %0, %struct.tty_struct* %1) {
%3 = alloca %struct.inode*
%4 = alloca %struct.tty_struct*
store %struct.inode* %0, %struct.inode** %3
store %struct.tty_struct* %1, %struct.tty_struct** %4
%5 = load i32, i32* @EINVAL
%6 = sub nsw i32 0, %5
ret i32 %6
}

LLVM IR (-O2):
%struct.inode = type { i32 }
%struct.tty_struct = type { i32 }
@EINVAL = global i32 0
define i32 @devpts_pty_new(%struct.inode* nocapture readnone %0, %struct.tty_struct* nocapture readnone %1) {
%3 = load i32, i32* @EINVAL
%4 = sub nsw i32 0, %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void amp_stderr_logger(char *message) { fprintf(stderr, "%s\n", message); }


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

x86 assembly (clang, -O2):
<amp_stderr_logger>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @amp_stderr_logger(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 ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
define void @amp_stderr_logger(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reverse_recursive(char *);
int main(void) {
  char str[6] = "hello";
  reverse_recursive(str);
  printf("reverse string is \'%s\'\n", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xa(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x6(%rbp)
lea    -0xa(%rbp),%rdi
call   1040 <reverse_recursive@plt>
lea    -0xa(%rbp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reverse_recursive@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.str = [6 x i8] c"hello\00"
@.str = [24 x i8] c"reverse string is '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [6 x i8]
store i32 0, i32* %1
%3 = bitcast [6 x i8]* %2 to i8*
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = call i32 @reverse_recursive(i8* %4)
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str = [6 x i8] c"hello\00"
@.str = [24 x i8] c"reverse string is '%s'\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%3 = call i32 @reverse_recursive(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}