xunge/DecIR huggingface dataset:
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ state_save(int);
int cmd_savestate(int argc, char **argv) {
  state_save(argc > 1 ? atoi(argv[1]) : -1);
  return 0;
}


x86 assembly (clang, -O0):
<cmd_savestate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    114e <cmd_savestate+0x2e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    115b <cmd_savestate+0x3b>
mov    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    115b <cmd_savestate+0x3b>
mov    -0x14(%rbp),%edi
call   1030 <state_save@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmd_savestate>:
push   %rax
mov    %edi,%eax
mov    $0xffffffff,%edi
cmp    $0x2,%eax
jl     1138 <cmd_savestate+0x18>
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
mov    %eax,%edi
call   1030 <state_save@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @cmd_savestate(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = load i8**, i8*** %4
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
br label %13
12: ; preds = %2
br label %13
13: ; preds = %12, %7
%14 = phi i32 [ %11, %7 ], [ -1, %12 ]
%15 = call i32 @state_save(i32 %14)
ret i32 0
}

LLVM IR (-O2):
define i32 @cmd_savestate(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @atoi(i8* %6)
br label %8
8: ; preds = %2, %4
%9 = phi i32 [ %7, %4 ], [ -1, %2 ]
%10 = tail call i32 @state_save(i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ reset_histofull();
void Reset_Histogram() { reset_histofull(); }


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

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

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

LLVM IR (-O2):
define void @Reset_Histogram() {
%1 = tail call i32 (...) @reset_histofull()
ret void
}
void inNbrUnit2ASCII(char c) {}


x86 assembly (clang, -O0):
<inNbrUnit2ASCII>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @inNbrUnit2ASCII(i8 signext %0) {
ret void
}
/* Variables and functions */
int _cmp_int_to_size(long i, size_t s) {
  if (i < 0) {
    return -1;
  } else {
    return (((((size_t)i) > (s)) - (((size_t)i) < (s))));
  }
}


x86 assembly (clang, -O0):
<_cmp_int_to_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    1123 <_cmp_int_to_size+0x23>
movl   $0xffffffff,-0x4(%rbp)
jmp    1149 <_cmp_int_to_size+0x49>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    -0x10(%rbp),%rcx
cmp    -0x18(%rbp),%rcx
setb   %cl
and    $0x1,%cl
movzbl %cl,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_cmp_int_to_size>:
test   %rdi,%rdi
js     1111 <_cmp_int_to_size+0x11>
xor    %eax,%eax
cmp    %rsi,%rdi
seta   %al
sbb    $0x0,%eax
ret
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @_cmp_int_to_size(i64 %0, i64 %1) {
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
%6 = load i64, i64* %4
%7 = icmp slt i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %2
store i32 -1, i32* %3
br label %19
9: ; preds = %2
%10 = load i64, i64* %4
%11 = load i64, i64* %5
%12 = icmp ugt i64 %10, %11
%13 = zext i1 %12 to i32
%14 = load i64, i64* %4
%15 = load i64, i64* %5
%16 = icmp ult i64 %14, %15
%17 = zext i1 %16 to i32
%18 = sub nsw i32 %13, %17
store i32 %18, i32* %3
br label %19
19: ; preds = %9, %8
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
define i32 @_cmp_int_to_size(i64 %0, i64 %1) {
%3 = icmp slt i64 %0, 0
br i1 %3, label %10, label %4
4: ; preds = %2
%5 = icmp ugt i64 %0, %1
%6 = zext i1 %5 to i32
%7 = icmp ult i64 %0, %1
%8 = sext i1 %7 to i32
%9 = add nsw i32 %8, %6
br label %10
10: ; preds = %2, %4
%11 = phi i32 [ %9, %4 ], [ -1, %2 ]
ret i32 %11
}
/* Variables and functions */
int get4();
float get_float() {
  int i = get4();
  return *((float *)&i);
}


x86 assembly (clang, -O0):
<get_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <get4@plt>
mov    %eax,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_float>:
push   %rax
xor    %eax,%eax
call   1030 <get4@plt>
movd   %eax,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @get_float() {
%1 = alloca i32
%2 = call i32 (...) @get4()
store i32 %2, i32* %1
%3 = bitcast i32* %1 to float*
%4 = load float, float* %3
ret float %4
}

LLVM IR (-O2):
define float @get_float() {
%1 = tail call i32 (...) @get4()
%2 = bitcast i32 %1 to float
ret float %2
}
/* Variables and functions */
int cio_read(int);
int /*<<< orphan*/ cio_skip(int);
void j2k_read_com() {
  int len;

  len = cio_read(2);
  cio_skip(len - 2);
}


x86 assembly (clang, -O0):
<j2k_read_com>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x2,%edi
call   1040 <cio_read@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
sub    $0x2,%edi
call   1030 <cio_skip@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j2k_read_com>:
push   %rax
mov    $0x2,%edi
call   1040 <cio_read@plt>
lea    -0x2(%rax),%edi
pop    %rax
jmp    1030 <cio_skip@plt>

LLVM IR (-O0):
define void @j2k_read_com() {
%1 = alloca i32
%2 = call i32 @cio_read(i32 2)
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = sub nsw i32 %3, 2
%5 = call i32 @cio_skip(i32 %4)
ret void
}

LLVM IR (-O2):
define void @j2k_read_com() {
%1 = tail call i32 @cio_read(i32 2)
%2 = add nsw i32 %1, -2
%3 = tail call i32 @cio_skip(i32 %2)
ret void
}
/* Variables and functions */
char *malloc(int);
void adjustedLT(unsigned a) {
  char *b = ((void *)0);
  if (a + 1 < 1)
    b = malloc(1);
  return;
}


x86 assembly (clang, -O0):
<adjustedLT>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
cmp    $0x1,%eax
jae    1140 <adjustedLT+0x30>
mov    $0x1,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @adjustedLT(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
store i8* null, i8** %3
%4 = load i32, i32* %2
%5 = add i32 %4, 1
%6 = icmp ult i32 %5, 1
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i8* @malloc(i32 1)
store i8* %8, i8** %3
br label %9
9: ; preds = %7, %1
ret void
}

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

/* Variables and functions */
int /*<<< orphan*/ fwrite(unsigned long *, int, int, int /*<<< orphan*/ *);
void tiffWriteLong(FILE *fp, unsigned long l) { fwrite(&l, 1, 4, fp); }


x86 assembly (clang, -O0):
<tiffWriteLong>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rcx
lea    -0x10(%rbp),%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fwrite@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tiffWriteLong>:
push   %rax
mov    %rdi,%rcx
mov    %rsi,(%rsp)
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x4,%edx
call   1030 <fwrite@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @tiffWriteLong(i32* nocapture %0, i64 %1) {
%3 = alloca i64
store i64 %1, i64* %3
%4 = call i32 @fwrite(i64* %3, i32 1, i32 4, i32* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void print_signed_char(char *ptr, int n_len) {
  int n_loop = 0;
  if (n_len > 0) {
    for (n_loop = 0; n_loop < n_len; n_loop++) {
      printf("%c", (char)*(ptr + n_loop));
    }
  }
}


x86 assembly (clang, -O0):
<print_signed_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0xc(%rbp)
jle    116e <print_signed_char+0x5e>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1169 <print_signed_char+0x59>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
lea    0xeae(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1137 <print_signed_char+0x27>
jmp    116e <print_signed_char+0x5e>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_signed_char>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1146 <print_signed_char+0x36>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <print_signed_char+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%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
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@str = [13 x i8] c"hello, world\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int write_block(int, int /*<<< orphan*/, int /*<<< orphan*/,
                int /*<<< orphan*/);
int decrease_speed(void) { return write_block(103, 0, 0, 0); }


x86 assembly (clang, -O0):
<decrease_speed>:
push   %rbp
mov    %rsp,%rbp
mov    $0x67,%edi
xor    %ecx,%ecx
mov    %ecx,%esi
mov    %ecx,%edx
call   1030 <write_block@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<decrease_speed>:
mov    $0x67,%edi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <write_block@plt>

LLVM IR (-O0):
define i32 @decrease_speed() {
%1 = call i32 @write_block(i32 103, i32 0, i32 0, i32 0)
ret i32 %1
}

LLVM IR (-O2):
define i32 @decrease_speed() {
%1 = tail call i32 @write_block(i32 103, i32 0, i32 0, i32 0)
ret i32 %1
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, int, int);
char *output_filename(int q, int n) {
  char *filename = malloc(sizeof(char *) * 20);
  sprintf(filename, "%s_q%d_n%d", "solution", q, n);
  return filename;
}


x86 assembly (clang, -O0):
<output_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0xa0,%edi
call   1030 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xeb2(%rip),%rsi
lea    0xeb6(%rip),%rdx
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<output_filename>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %edi,%ebp
mov    $0xa0,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
lea    0xec3(%rip),%rsi
lea    0xec7(%rip),%rdx
mov    %rax,%rdi
mov    %ebp,%ecx
mov    %r14d,%r8d
call   1040 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%s_q%d_n%d\00"
@.str.1 = [9 x i8] c"solution\00"
define i8* @output_filename(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = call i8* @malloc(i32 160)
store i8* %6, i8** %5
%7 = load i8*, i8** %5
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i8*, i8** %5
ret i8* %11
}

LLVM IR (-O2):
@.str = [11 x i8] c"%s_q%d_n%d\00"
@.str.1 = [9 x i8] c"solution\00"
define noalias i8* @output_filename(i32 %0, i32 %1) {
%3 = tail call dereferenceable_or_null(160) i8* @malloc(i32 160)
%4 = tail call i32 @sprintf(i8* dereferenceable(1) %3, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1)
ret i8* %3
}
/* Variables and functions */
int f65(int *);
int f66(int *p) { return f65(p); }


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

x86 assembly (clang, -O2):
<f66>:
jmp    1030 <f65@plt>

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

LLVM IR (-O2):
define i32 @f66(i32* %0) {
%2 = tail call i32 @f65(i32* %0)
ret i32 %2
}
int config_CARDREADER_SC8IN1(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @config_CARDREADER_SC8IN1() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcpy1(char *, char *);
int main() {
  char str1[] = "hello";
  char str2[40];
  strcpy1(str2, str1);
  printf("%s\n", str2);
  return 0;
}


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

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

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

LLVM IR (-O2):
@__const.main.str1 = [6 x i8] c"hello\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [40 x i8]
%3 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [40 x i8], [40 x i8]* %2, i64 0, i64 0
%5 = call i32 @strcpy1(i8* %4, i8* %3)
%6 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
void testClosureLLILLrV(void (*closure)(long long, int, long long),
                        long long a1, int a2, long long a3) {
  (*closure)(a1, a2, a3);
}


x86 assembly (clang, -O0):
<testClosureLLILLrV>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
call   *%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testClosureLLILLrV>:
mov    %rdi,%rax
mov    %rsi,%rdi
mov    %edx,%esi
mov    %rcx,%rdx
jmp    *%rax

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

LLVM IR (-O2):
define void @testClosureLLILLrV(void (i64, i32, i64)* nocapture %0, i64 %1, i32 %2, i64 %3) {
tail call void %0(i64 %1, i32 %2, i64 %3)
ret void
}
/* Variables and functions */
int mulmod(int, int, int);
int main() {
  if (mulmod(123, 456, 7) != 4)
    goto error;
  if (mulmod(987654, 54321, 43650352937) != 9999999997)
    goto error;
  if (mulmod(0xffffffffffffffff, 0xffffffffffffffff, 1152921504606847009) !=
      279841)
    goto error;
  return 0;
error:
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7b,%edi
mov    $0x1c8,%esi
mov    $0x7,%edx
call   1030 <mulmod@plt>
cmp    $0x4,%eax
je     1141 <main+0x31>
jmp    119c <main+0x8c>
mov    $0xf1206,%edi
mov    $0xd431,%esi
mov    $0x29c38729,%edx
call   1030 <mulmod@plt>
cltq
movabs $0x2540be3fd,%rcx
cmp    %rcx,%rax
je     116f <main+0x5f>
jmp    119c <main+0x8c>
mov    $0xffffffff,%esi
mov    $0x21,%edx
mov    %esi,%edi
call   1030 <mulmod@plt>
cmp    $0x44521,%eax
je     1190 <main+0x80>
jmp    119c <main+0x8c>
movl   $0x0,-0x4(%rbp)
jmp    11a3 <main+0x93>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7b,%edi
mov    $0x1c8,%esi
mov    $0x7,%edx
call   1030 <mulmod@plt>
cmp    $0x4,%eax
jne    113e <main+0x2e>
mov    $0xf1206,%edi
mov    $0xd431,%esi
mov    $0x29c38729,%edx
call   1030 <mulmod@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @mulmod(i32 123, i32 456, i32 7)
%3 = icmp ne i32 %2, 4
br i1 %3, label %4, label %5
4: ; preds = %0
br label %15
5: ; preds = %0
%6 = call i32 @mulmod(i32 987654, i32 54321, i32 700679977)
%7 = sext i32 %6 to i64
%8 = icmp ne i64 %7, 9999999997
br i1 %8, label %9, label %10
9: ; preds = %5
br label %15
10: ; preds = %5
%11 = call i32 @mulmod(i32 -1, i32 -1, i32 33)
%12 = icmp ne i32 %11, 279841
br i1 %12, label %13, label %14
13: ; preds = %10
br label %15
14: ; preds = %10
store i32 0, i32* %1
br label %16
15: ; preds = %13, %9, %4
store i32 1, i32* %1
br label %16
16: ; preds = %15, %14
%17 = load i32, i32* %1
ret i32 %17
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @mulmod(i32 123, i32 456, i32 7)
%2 = icmp eq i32 %1, 4
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @mulmod(i32 987654, i32 54321, i32 700679977)
br label %5
5: ; preds = %0, %3
ret i32 1
}
/* Variables and functions */
void *calloc(size_t, size_t);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, unsigned int);
int /*<<< orphan*/ stderr;
void *xcalloc(size_t num, size_t size) {
  void *allocated = calloc(num, size);
  if (allocated == NULL) {
    fprintf(stderr,
            "Error:  Insufficient memory "
            "(attempt to calloc %zu bytes)\n",
            (unsigned int)size);
    exit(1);
  }
  return allocated;
}


x86 assembly (clang, -O0):
<xcalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <calloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1181 <xcalloc+0x51>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    %eax,%edx
lea    0xe8e(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xcalloc>:
push   %rbx
mov    %rsi,%rbx
call   1030 <calloc@plt>
test   %rax,%rax
je     1140 <xcalloc+0x10>
pop    %rbx
ret
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xeb0(%rip),%rsi
mov    %ebx,%edx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [59 x i8] c"Error: Insufficient memory (attempt to calloc %zu bytes)\0A\00"
define i8* @xcalloc(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
store i64 %0, i64* %3
store i64 %1, i64* %4
%6 = load i64, i64* %3
%7 = load i64, i64* %4
%8 = call i8* @calloc(i64 %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i64, i64* %4
%14 = trunc i64 %13 to i32
%15 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 @exit(i32 1)
unreachable
17: ; preds = %2
%18 = load i8*, i8** %5
ret i8* %18
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [59 x i8] c"Error: Insufficient memory (attempt to calloc %zu bytes)\0A\00"
define noalias i8* @xcalloc(i64 %0, i64 %1) {
%3 = tail call i8* @calloc(i64 %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = trunc i64 %1 to i32
%8 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %2
ret i8* %3
}
/* Type definitions */
struct a {
  int dummy;
};

/* Variables and functions */
struct a *malloc(int);
struct a *f(void) {
  struct a *b = malloc(100);
  return b;
}


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

x86 assembly (clang, -O2):
<f>:
mov    $0x64,%edi
jmp    1030 <malloc@plt>

LLVM IR (-O0):
%struct.a = type { i32 }
define %struct.a* @f() {
%1 = alloca %struct.a*
%2 = call %struct.a* @malloc(i32 100)
store %struct.a* %2, %struct.a** %1
%3 = load %struct.a*, %struct.a** %1
ret %struct.a* %3
}

LLVM IR (-O2):
%struct.a = type { i32 }
define noalias %struct.a* @f() {
%1 = tail call %struct.a* @malloc(i32 100)
ret %struct.a* %1
}
/* Variables and functions */
int /*<<< orphan*/ check_palindrome(char *, int, int, char *);
int /*<<< orphan*/ scanf(char *, char *);
int strlen(char *);
int main() {
  char s[100];
  scanf("%s", s);
  int x = strlen(s);
  char *y;
  y = s;
  check_palindrome(s, x, x, y);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x70(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x74(%rbp)
lea    -0x70(%rbp),%rax
mov    %rax,-0x80(%rbp)
lea    -0x70(%rbp),%rdi
mov    -0x74(%rbp),%esi
mov    -0x74(%rbp),%edx
mov    -0x80(%rbp),%rcx
call   1050 <check_palindrome@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
lea    0xec4(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %eax,%edx
mov    %rbx,%rcx
call   1050 <check_palindrome@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
%4 = alloca i8*
store i32 0, i32* %1
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @strlen(i8* %7)
store i32 %8, i32* %3
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
store i8* %9, i8** %4
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%11 = load i32, i32* %3
%12 = load i32, i32* %3
%13 = load i8*, i8** %4
%14 = call i32 @check_palindrome(i8* %10, i32 %11, i32 %12, i8* %13)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @strlen(i8* %2)
%5 = call i32 @check_palindrome(i8* %2, i32 %4, i32 %4, i8* %2)
ret i32 0
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void uDMAChannelEnable(uint32_t ui32ChannelNum) {
  ;
  (*((volatile unsigned long *)(0x400FF028))) = 1 << (ui32ChannelNum & 0x1f);
}


x86 assembly (clang, -O0):
<uDMAChannelEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
and    $0x1f,%ecx
mov    $0x1,%eax
shl    %cl,%eax
movslq %eax,%rcx
mov    $0x400ff028,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uDMAChannelEnable>:
mov    %edi,%ecx
mov    $0x1,%eax
shl    %cl,%eax
cltq
mov    %rax,0x400ff028
40
ret

LLVM IR (-O0):
define void @uDMAChannelEnable(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 31
%5 = shl i32 1, %4
%6 = sext i32 %5 to i64
store volatile i64 %6, i64* inttoptr (i64 1074786344 to i64*)
ret void
}

LLVM IR (-O2):
define void @uDMAChannelEnable(i32 %0) {
%2 = and i32 %0, 31
%3 = shl nuw i32 1, %2
%4 = sext i32 %3 to i64
store volatile i64 %4, i64* inttoptr (i64 1074786344 to i64*)
ret void
}
/* Type definitions */
struct t_hdata {
  int dummy;
};

/* Variables and functions */
void *hdata_get_var_at_offset(struct t_hdata *hdata, void *pointer,
                              int offset) {
  if (!hdata || !pointer)
    return NULL;
  return pointer + offset;
}


x86 assembly (clang, -O0):
<hdata_get_var_at_offset>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1125 <hdata_get_var_at_offset+0x25>
cmpq   $0x0,-0x18(%rbp)
jne    1132 <hdata_get_var_at_offset+0x32>
movq   $0x0,-0x8(%rbp)
jmp    1141 <hdata_get_var_at_offset+0x41>
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hdata_get_var_at_offset>:
movslq %edx,%rax
add    %rsi,%rax
test   %rsi,%rsi
cmove  %rsi,%rax
test   %rdi,%rdi
cmove  %rdi,%rax
ret

LLVM IR (-O0):
%struct.t_hdata = type { i32 }
define i8* @hdata_get_var_at_offset(%struct.t_hdata* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.t_hdata*
%6 = alloca i8*
%7 = alloca i32
store %struct.t_hdata* %0, %struct.t_hdata** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
%8 = load %struct.t_hdata*, %struct.t_hdata** %5
%9 = icmp ne %struct.t_hdata* %8, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = icmp ne i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %10, %3
store i8* null, i8** %4
br label %19
14: ; preds = %10
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = sext i32 %16 to i64
%18 = getelementptr i8, i8* %15, i64 %17
store i8* %18, i8** %4
br label %19
19: ; preds = %14, %13
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
%struct.t_hdata = type { i32 }
define i8* @hdata_get_var_at_offset(%struct.t_hdata* readnone %0, i8* readnone %1, i32 %2) {
%4 = icmp ne %struct.t_hdata* %0, null
%5 = icmp ne i8* %1, null
%6 = and i1 %4, %5
%7 = sext i32 %2 to i64
%8 = getelementptr i8, i8* %1, i64 %7
%9 = select i1 %6, i8* %8, i8* null
ret i8* %9
}
/* Variables and functions */
int /*<<< orphan*/ rct_set_usb_ana_on();
int /*<<< orphan*/ udelay(int);
void _init_usb_pll(void) {
  rct_set_usb_ana_on();
  udelay(150);
}


x86 assembly (clang, -O0):
<_init_usb_pll>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rct_set_usb_ana_on@plt>
mov    $0x96,%edi
call   1040 <udelay@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_init_usb_pll>:
push   %rax
xor    %eax,%eax
call   1030 <rct_set_usb_ana_on@plt>
mov    $0x96,%edi
pop    %rax
jmp    1040 <udelay@plt>

LLVM IR (-O0):
define void @_init_usb_pll() {
%1 = call i32 (...) @rct_set_usb_ana_on()
%2 = call i32 @udelay(i32 150)
ret void
}

LLVM IR (-O2):
define void @_init_usb_pll() {
%1 = tail call i32 (...) @rct_set_usb_ana_on()
%2 = tail call i32 @udelay(i32 150)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
header(FILE *fp, char *content_type) {
  fprintf(fp, "HTTP/1.0 200 OK\r\n");
  if (content_type)
    fprintf(fp, "Content-type: %s\r\n", content_type);
}


x86 assembly (clang, -O0):
<header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed5(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1153 <header+0x43>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xec6(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<header>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xecf(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <fwrite@plt>
test   %r14,%r14
je     115c <header+0x3c>
lea    0xec3(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [18 x i8] c"HTTP/1.0 200 OK\0D\0A\00"
@.str.1 = [19 x i8] c"Content-type: %s\0D\0A\00"
define i32 @header(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 = call i32 (i32*, i8*, ...) @fprintf(i32* %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i32*, i32** %4
%12 = load i8*, i8** %5
%13 = call i32 (i32*, i8*, ...) @fprintf(i32* %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %12)
br label %14
14: ; preds = %10, %2
%15 = load i32, i32* %3
ret i32 %15
}

LLVM IR (-O2):
@.str = [18 x i8] c"HTTP/1.0 200 OK\0D\0A\00"
@.str.1 = [19 x i8] c"Content-type: %s\0D\0A\00"
define i32 @header(i32* nocapture %0, i8* %1) {
%3 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i64 17, i64 1, i32* %0)
%4 = icmp eq i8* %1, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %7
7: ; preds = %5, %2
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ print(char *, int, int);
int read_(unsigned char *data, int address, int size) {
  (void)data;
  print("\t(template driver) read(to_data, address=0x%x, size=0x%x)\n", address,
        size);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [59 x i8] c"\09(template driver) read(to_data, address=0x%x, size=0x%x)\0A\00"
define i32 @read_(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 @print(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [59 x i8] c"\09(template driver) read(to_data, address=0x%x, size=0x%x)\0A\00"
define i32 @read_(i8* nocapture readnone %0, i32 %1, i32 %2) {
%4 = tail call i32 @print(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
ret i32 0
}
void av_freep() {}


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

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

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

LLVM IR (-O2):
define void @av_freep() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ write(int, char *, int);
void ft_error(void) {
  write(1, "Error\n", 6);
  exit(1);
}


x86 assembly (clang, -O0):
<ft_error>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
lea    0xed0(%rip),%rsi
mov    $0x6,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<ft_error>:
push   %rax
lea    0xed8(%rip),%rsi
mov    $0x1,%edi
mov    $0x6,%edx
call   1030 <write@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Error\0A\00"
define void @ft_error() {
%1 = call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [7 x i8] c"Error\0A\00"
define void @ft_error() {
%1 = tail call i32 @write(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 6)
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Type definitions */
typedef int int32_t;

/* Variables and functions */
int fonctionAvant(int);
int32_t main() {
  int32_t a;
  a = 3;
  return fonctionAvant(a);
}


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

x86 assembly (clang, -O2):
<main>:
mov    $0x3,%edi
jmp    1030 <fonctionAvant@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @fonctionAvant(i32 3)
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ bar(int);
void foo(int n) {
  int i;
#pragma omp for schedule(runtime) ordered
  for (i = 0; i < n; ++i)
    bar(i);
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1144 <foo+0x34>
mov    -0x8(%rbp),%edi
call   1030 <bar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <foo+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rbp
push   %rbx
push   %rax
test   %edi,%edi
jle    112e <foo+0x1e>
mov    %edi,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    %ebp,%edi
call   1030 <bar@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1120 <foo+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @foo(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @bar(i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                           int /*<<< orphan*/);
int /*<<< orphan*/ rdmsr(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  uint32_t n;
  uint64_t ra;
  uint64_t rd;
  n = strtol(argv[1], NULL, 16);
  ra = rdmsr(n, &rd);
  fprintf(stderr, "ra: %016lX rd: %016lX\n", ra, rd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x1c(%rbp),%rsi
call   1030 <rdmsr@plt>
mov    %eax,-0x18(%rbp)
mov    0x2e6b(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe7c(%rip),%rsi
call   1040 <fprintf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1050 <strtol@plt>
lea    0x4(%rsp),%rsi
mov    %eax,%edi
call   1030 <rdmsr@plt>
mov    0x2e8c(%rip),%rcx
mov    (%rcx),%edi
mov    0x4(%rsp),%ecx
lea    0xe9f(%rip),%rsi
mov    %eax,%edx
call   1040 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"ra: %016lX rd: %016lX\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 1
%11 = load i8*, i8** %10
%12 = call i32 @strtol(i8* %11, i32* null, i32 16)
store i32 %12, i32* %6
%13 = load i32, i32* %6
%14 = call i32 @rdmsr(i32 %13, i32* %8)
store i32 %14, i32* %7
%15 = load i32, i32* @stderr
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %16, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"ra: %016lX rd: %016lX\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strtol(i8* nocapture %6, i32* null, i32 16)
%8 = call i32 @rdmsr(i32 %7, i32* %3)
%9 = load i32, i32* @stderr
%10 = load i32, i32* %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ emsSyser(char const *, int);
void errSyser(const char *token, int systat) { emsSyser(token, systat); }


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

x86 assembly (clang, -O2):
<errSyser>:
jmp    1030 <emsSyser@plt>

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

LLVM IR (-O2):
define void @errSyser(i8* %0, i32 %1) {
%3 = tail call i32 @emsSyser(i8* %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ r1(int /*<<< orphan*/);
int /*<<< orphan*/ w1(int /*<<< orphan*/);
int main() {
__CPROVER_ASYNC_0:
  w1(0);
__CPROVER_ASYNC_1:
  r1(0);
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0
%3 = call i32 @w1(i32 0)
br label %4
4: ; preds = %2
%5 = call i32 @r1(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @w1(i32 0)
%2 = tail call i32 @r1(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *realloc(void *, size_t);
int /*<<< orphan*/ stderr;
void *xrealloc(void *ptr, size_t size) {
  void *p;
  p = realloc(ptr, size);
  if (!p) {
    fprintf(stderr, "Memory is too low\n");
    exit(EXIT_FAILURE);
  }
  return p;
}


x86 assembly (clang, -O0):
<xrealloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <realloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    117f <xrealloc+0x4f>
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e60(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrealloc>:
push   %rax
call   1040 <realloc@plt>
test   %rax,%rax
je     113d <xrealloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Memory is too low\0A\00"
@EXIT_FAILURE = global i32 0
define i8* @xrealloc(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%6 = load i8*, i8** %3
%7 = load i64, i64* %4
%8 = call i8* @realloc(i8* %6, i64 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %16, label %11
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = call i32 @exit(i32 %14)
unreachable
16: ; preds = %2
%17 = load i8*, i8** %5
ret i8* %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Memory is too low\0A\00"
@EXIT_FAILURE = global i32 0
define noalias i8* @xrealloc(i8* nocapture %0, i64 %1) {
%3 = tail call i8* @realloc(i8* %0, i64 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %5, label %10
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
ret i8* %3
}
unsigned int sleep(unsigned int delay) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @sleep(i32 %0) {
ret i32 0
}
void ff_hevc_put_hevc_bi_epel_hv16_8_sse4() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_hv16_8_sse4() {
ret void
}
void rop3_63_0_0(unsigned char *D, unsigned char S, unsigned char T) {
  unsigned char stk1;
  stk1 = T & S;
  stk1 = ~stk1;
  *D = stk1;
}


x86 assembly (clang, -O0):
<rop3_63_0_0>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %sil,%cl
mov    %rdi,-0x8(%rbp)
mov    %cl,-0x9(%rbp)
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
movzbl -0x9(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xb(%rbp)
movzbl -0xb(%rbp),%eax
xor    $0xffffffff,%eax
mov    %al,-0xb(%rbp)
mov    -0xb(%rbp),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rop3_63_0_0>:
and    %edx,%esi
not    %sil
mov    %sil,(%rdi)
ret

LLVM IR (-O0):
define void @rop3_63_0_0(i8* %0, i8 zeroext %1, i8 zeroext %2) {
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %4
store i8 %1, i8* %5
store i8 %2, i8* %6
%8 = load i8, i8* %6
%9 = zext i8 %8 to i32
%10 = load i8, i8* %5
%11 = zext i8 %10 to i32
%12 = and i32 %9, %11
%13 = trunc i32 %12 to i8
store i8 %13, i8* %7
%14 = load i8, i8* %7
%15 = zext i8 %14 to i32
%16 = xor i32 %15, -1
%17 = trunc i32 %16 to i8
store i8 %17, i8* %7
%18 = load i8, i8* %7
%19 = load i8*, i8** %4
store i8 %18, i8* %19
ret void
}

LLVM IR (-O2):
define void @rop3_63_0_0(i8* nocapture writeonly %0, i8 zeroext %1, i8 zeroext %2) {
%4 = and i8 %2, %1
%5 = xor i8 %4, -1
store i8 %5, i8* %0
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  double pi = 3.1415;
  printf("%f\n", pi);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  0xee0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    0xed7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.141500e+00)
ret i32 0
}