xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ Window;

/* Variables and functions */
int /*<<< orphan*/ display_tree_info_1(int /*<<< orphan*/, int,
                                       int /*<<< orphan*/);
void Display_Tree_Info(Window window, int recurse) {
  display_tree_info_1(window, recurse, 0);
}


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

x86 assembly (clang, -O2):
<Display_Tree_Info>:
xor    %edx,%edx
jmp    1030 <display_tree_info_1@plt>

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

LLVM IR (-O2):
define void @Display_Tree_Info(i32 %0, i32 %1) {
%3 = tail call i32 @display_tree_info_1(i32 %0, i32 %1, i32 0)
ret void
}
/* Variables and functions */
int atoi(char *);
int pread(int, char *, int, int /*<<< orphan*/);
int get_temp_by_fd(int fd) {
  char buf_file[256];
  int ret;
  if (pread(fd, buf_file, 256, 0) == -1) {
    return -1;
  }
  return atoi(buf_file) / 1000;
}


x86 assembly (clang, -O0):
<get_temp_by_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x110(%rbp),%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1040 <pread@plt>
cmp    $0xffffffff,%eax
jne    1159 <get_temp_by_fd+0x39>
movl   $0xffffffff,-0x4(%rbp)
jmp    1170 <get_temp_by_fd+0x50>
lea    -0x110(%rbp),%rdi
call   1030 <atoi@plt>
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_temp_by_fd>:
sub    $0x108,%rsp
mov    %rsp,%rsi
mov    $0x100,%edx
xor    %ecx,%ecx
call   1040 <pread@plt>
cmp    $0xffffffff,%eax
je     1161 <get_temp_by_fd+0x41>
mov    %rsp,%rdi
call   1030 <atoi@plt>
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
add    $0x108,%rsp
ret
mov    $0xffffffff,%eax
add    $0x108,%rsp
ret

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

LLVM IR (-O2):
define i32 @get_temp_by_fd(i32 %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%4 = call i32 @pread(i32 %0, i8* %3, i32 256, i32 0)
%5 = icmp eq i32 %4, -1
br i1 %5, label %9, label %6
6: ; preds = %1
%7 = call i32 @atoi(i8* %3)
%8 = sdiv i32 %7, 1000
br label %9
9: ; preds = %1, %6
%10 = phi i32 [ %8, %6 ], [ -1, %1 ]
ret i32 %10
}
void __attribute__((weak)) usbcb_wake_from_suspend() {}


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

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

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

LLVM IR (-O2):
define weak void @usbcb_wake_from_suspend() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ scanf(char *, char *);
int main(void) {
  char buffer[20];
  while (1) {
    scanf("%s", buffer);
    printf("WORD: [ %s ]\n", buffer);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xec6(%rip),%rdi
call   1040 <scanf@plt>
lea    -0x20(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xed0(%rip),%r14
mov    %rsp,%rbx
lea    0xec9(%rip),%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1140 <main+0x20>

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"WORD: [ %s ]\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %0, %3
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %3
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [14 x i8] c"WORD: [ %s ]\0A\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ ptr;

/* Variables and functions */
int /*<<< orphan*/ hash_int(int /*<<< orphan*/ *, intptr_t);
int /*<<< orphan*/ hash_int64(int /*<<< orphan*/ *, intptr_t);
void hash_ptr(uint32_t *hash, void *ptr) {
  if (sizeof(ptr) > 4) {
    hash_int64(hash, (intptr_t)ptr);
  } else {
    hash_int(hash, (intptr_t)ptr);
  }
}


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

x86 assembly (clang, -O2):
<hash_ptr>:
jmp    1030 <hash_int64@plt>

LLVM IR (-O0):
define void @hash_ptr(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 = load i8*, i8** %4
%7 = ptrtoint i8* %6 to i64
%8 = call i32 @hash_int64(i32* %5, i64 %7)
ret void
}

LLVM IR (-O2):
define void @hash_ptr(i32* %0, i8* %1) {
%3 = ptrtoint i8* %1 to i64
%4 = tail call i32 @hash_int64(i32* %0, i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ popNarray(char *, unsigned int);
void popinteger8array_(void *x, unsigned int *n) {
  popNarray((char *)x, (*n * 8));
}


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

x86 assembly (clang, -O2):
<popinteger8array_>:
mov    (%rsi),%esi
shl    $0x3,%esi
jmp    1030 <popNarray@plt>

LLVM IR (-O0):
define void @popinteger8array_(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 = load i32, i32* %6
%8 = mul i32 %7, 8
%9 = call i32 @popNarray(i8* %5, i32 %8)
ret void
}

LLVM IR (-O2):
define void @popinteger8array_(i8* %0, i32* nocapture %1) {
%3 = load i32, i32* %1
%4 = shl i32 %3, 3
%5 = tail call i32 @popNarray(i8* %0, i32 %4)
ret void
}
/* Variables and functions */
scalar_t__ FileGetCurrentFileName();
int /*<<< orphan*/ put_string(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(scalar_t__);
void insert_current_filename(void) {
  if (FileGetCurrentFileName())
    put_string(FileGetCurrentFileName(), strlen(FileGetCurrentFileName()));
}


x86 assembly (clang, -O0):
<insert_current_filename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <FileGetCurrentFileName@plt>
cmp    $0x0,%rax
je     116e <insert_current_filename+0x3e>
mov    $0x0,%al
call   1050 <FileGetCurrentFileName@plt>
mov    %rax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <FileGetCurrentFileName@plt>
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    -0x8(%rbp),%rdi
mov    %eax,%esi
call   1040 <put_string@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_current_filename>:
push   %rbx
xor    %eax,%eax
call   1050 <FileGetCurrentFileName@plt>
test   %rax,%rax
je     1161 <insert_current_filename+0x31>
xor    %eax,%eax
call   1050 <FileGetCurrentFileName@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1050 <FileGetCurrentFileName@plt>
mov    %rax,%rdi
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
pop    %rbx
jmp    1040 <put_string@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @insert_current_filename() {
%1 = call i64 (...) @FileGetCurrentFileName()
%2 = icmp ne i64 %1, 0
br i1 %2, label %3, label %8
3: ; preds = %0
%4 = call i64 (...) @FileGetCurrentFileName()
%5 = call i64 (...) @FileGetCurrentFileName()
%6 = call i32 @strlen(i64 %5)
%7 = call i32 @put_string(i64 %4, i32 %6)
br label %8
8: ; preds = %3, %0
ret void
}

LLVM IR (-O2):
define void @insert_current_filename() {
%1 = tail call i64 (...) @FileGetCurrentFileName()
%2 = icmp eq i64 %1, 0
br i1 %2, label %8, label %3
3: ; preds = %0
%4 = tail call i64 (...) @FileGetCurrentFileName()
%5 = tail call i64 (...) @FileGetCurrentFileName()
%6 = tail call i32 @strlen(i64 %5)
%7 = tail call i32 @put_string(i64 %4, i32 %6)
br label %8
8: ; preds = %3, %0
ret void
}
/* Variables and functions */
scalar_t__ is_same(int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int i;
  for (i = 1; i < 10000000; ++i) {
    if (is_same(i)) {
      printf("%d\n", i);
      break;
    }
  }
  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)
movl   $0x1,-0x14(%rbp)
cmpl   $0x989680,-0x14(%rbp)
jge    1183 <main+0x63>
mov    -0x14(%rbp),%edi
call   1040 <is_same@plt>
cmp    $0x0,%rax
je     1170 <main+0x50>
mov    -0x14(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
jmp    1183 <main+0x63>
jmp    1175 <main+0x55>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113d <main+0x1d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <is_same@plt>
test   %rax,%rax
jne    1149 <main+0x29>
add    $0x1,%ebx
cmp    $0x989680,%ebx
jne    1130 <main+0x10>
jmp    1157 <main+0x37>
lea    0xeb0(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %2, %9
%4 = phi i32 [ 1, %2 ], [ %10, %9 ]
%5 = tail call i64 @is_same(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %4)
br label %12
9: ; preds = %3
%10 = add nuw nsw i32 %4, 1
%11 = icmp eq i32 %10, 10000000
br i1 %11, label %12, label %3
12: ; preds = %9, %7
ret i32 0
}
/* Variables and functions */
scalar_t__ is_prime(int);
int problem_3(void) {
  unsigned long long n = 600851475143;
  int i = 0, largest_factor;
  while (i * i <= n) {
    i++;
    if (is_prime(i) && n % i == 0) {
      largest_factor = i;
    }
  }
  return largest_factor;
}


x86 assembly (clang, -O0):
<problem_3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movabs $0x8be589eac7,%rax
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
imul   -0xc(%rbp),%eax
cltq
cmp    -0x8(%rbp),%rax
ja     117d <problem_3+0x6d>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <is_prime@plt>
cmp    $0x0,%rax
je     1178 <problem_3+0x68>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
xor    %edx,%edx
div    %rcx
cmp    $0x0,%rdx
jne    1178 <problem_3+0x68>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    112d <problem_3+0x1d>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<problem_3>:
push   %rbx
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <is_prime@plt>
add    $0x1,%ebx
jmp    1120 <problem_3+0x10>

LLVM IR (-O0):
define i32 @problem_3() {
%1 = alloca i64
%2 = alloca i32
%3 = alloca i32
store i64 600851475143, i64* %1
store i32 0, i32* %2
br label %4
4: ; preds = %25, %0
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = mul nsw i32 %5, %6
%8 = sext i32 %7 to i64
%9 = load i64, i64* %1
%10 = icmp ule i64 %8, %9
br i1 %10, label %11, label %26
11: ; preds = %4
%12 = load i32, i32* %2
%13 = add nsw i32 %12, 1
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = call i64 @is_prime(i32 %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = load i64, i64* %1
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = urem i64 %18, %20
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = load i32, i32* %2
store i32 %24, i32* %3
br label %25
25: ; preds = %23, %17, %11
br label %4
26: ; preds = %4
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @problem_3() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ %3, %1 ], [ 0, %0 ]
%3 = add nuw nsw i64 %2, 1
%4 = trunc i64 %3 to i32
%5 = tail call i64 @is_prime(i32 %4)
br label %1
}
int apply(int (*f)(int), int a) { return (*f)(a); }


x86 assembly (clang, -O0):
<apply>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apply>:
mov    %rdi,%rax
mov    %esi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define i32 @apply(i32 (i32)* nocapture %0, i32 %1) {
%3 = tail call i32 %0(i32 %1)
ret i32 %3
}
/* Type definitions */
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/);
double time_time(void) {
  struct timeval tv;
  double t;
  gettimeofday(&tv, 0);
  t = (double)tv.tv_sec + ((double)tv.tv_usec / 1E6);
  return t;
}


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

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

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
define double @time_time() {
%1 = alloca %struct.timeval
%2 = alloca double
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %6, %10
store double %11, double* %2
%12 = load double, double* %2
ret double %12
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
define double @time_time() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32 0)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = fdiv double %9, 1.000000e+06
%11 = fadd double %10, %6
ret double %11
}
int rr_is_dmabuf_bar(unsigned long address) {
  int bar = ((address) >> 28);
  return bar == 0x0c;
}


x86 assembly (clang, -O0):
<rr_is_dmabuf_bar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
shr    $0x1c,%rax
mov    %eax,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rr_is_dmabuf_bar>:
shr    $0x1c,%rdi
xor    %eax,%eax
cmp    $0xc,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @rr_is_dmabuf_bar(i64 %0) {
%2 = alloca i64
%3 = alloca i32
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = lshr i64 %4, 28
%6 = trunc i64 %5 to i32
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 12
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @rr_is_dmabuf_bar(i64 %0) {
%2 = lshr i64 %0, 28
%3 = trunc i64 %2 to i32
%4 = icmp eq i32 %3, 12
%5 = zext i1 %4 to i32
ret i32 %5
}
void tachyon_display_draw(struct anon$3 *dh) { ; }


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

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

LLVM IR (-O0):
%"struct.anon$3" = type opaque
define void @tachyon_display_draw(%"struct.anon$3"* %0) {
%2 = alloca %"struct.anon$3"*
store %"struct.anon$3"* %0, %"struct.anon$3"** %2
ret void
}

LLVM IR (-O2):
%"struct.anon$3" = type opaque
define void @tachyon_display_draw(%"struct.anon$3"* nocapture %0) {
ret void
}
/* Variables and functions */
int random();
int capacity() {
  int min = 10;
  int max = 50;
  int r = random() % (max - min) + min;
  return r;
}


x86 assembly (clang, -O0):
<capacity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xa,-0x4(%rbp)
movl   $0x32,-0x8(%rbp)
mov    $0x0,%al
call   1030 <random@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
cltd
idiv   %ecx
add    -0x4(%rbp),%edx
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @capacity() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 10, i32* %1
store i32 50, i32* %2
%4 = call i32 (...) @random()
%5 = load i32, i32* %2
%6 = load i32, i32* %1
%7 = sub nsw i32 %5, %6
%8 = srem i32 %4, %7
%9 = load i32, i32* %1
%10 = add nsw i32 %8, %9
store i32 %10, i32* %3
%11 = load i32, i32* %3
ret i32 %11
}

LLVM IR (-O2):
define i32 @capacity() {
%1 = tail call i32 (...) @random()
%2 = srem i32 %1, 40
%3 = add nsw i32 %2, 10
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ done(int /*<<< orphan*/);
int /*<<< orphan*/ getargs(int, char **);
int /*<<< orphan*/ lalr();
int /*<<< orphan*/ lr0();
int /*<<< orphan*/ make_parser();
int /*<<< orphan*/ open_files();
int /*<<< orphan*/ output();
int /*<<< orphan*/ reader();
int /*<<< orphan*/ set_signals();
int /*<<< orphan*/ verbose();
int main(int argc, char *argv[]) {
  set_signals();
  getargs(argc, argv);
  open_files();
  reader();
  lr0();
  lalr();
  make_parser();
  verbose();
  output();
  done(0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   10c0 <set_signals@plt>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   10b0 <getargs@plt>
mov    $0x0,%al
call   1070 <open_files@plt>
mov    $0x0,%al
call   1060 <reader@plt>
mov    $0x0,%al
call   1030 <lr0@plt>
mov    $0x0,%al
call   1090 <lalr@plt>
mov    $0x0,%al
call   1080 <make_parser@plt>
mov    $0x0,%al
call   10a0 <verbose@plt>
mov    $0x0,%al
call   1040 <output@plt>
xor    %edi,%edi
call   1050 <done@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   10c0 <set_signals@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   10b0 <getargs@plt>
xor    %eax,%eax
call   1070 <open_files@plt>
xor    %eax,%eax
call   1060 <reader@plt>
xor    %eax,%eax
call   1030 <lr0@plt>
xor    %eax,%eax
call   1090 <lalr@plt>
xor    %eax,%eax
call   1080 <make_parser@plt>
xor    %eax,%eax
call   10a0 <verbose@plt>
xor    %eax,%eax
call   1040 <output@plt>
xor    %edi,%edi
call   1050 <done@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @set_signals()
%7 = load i32, i32* %4
%8 = load i8**, i8*** %5
%9 = call i32 @getargs(i32 %7, i8** %8)
%10 = call i32 (...) @open_files()
%11 = call i32 (...) @reader()
%12 = call i32 (...) @lr0()
%13 = call i32 (...) @lalr()
%14 = call i32 (...) @make_parser()
%15 = call i32 (...) @verbose()
%16 = call i32 (...) @output()
%17 = call i32 @done(i32 0)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 (...) @set_signals()
%4 = tail call i32 @getargs(i32 %0, i8** %1)
%5 = tail call i32 (...) @open_files()
%6 = tail call i32 (...) @reader()
%7 = tail call i32 (...) @lr0()
%8 = tail call i32 (...) @lalr()
%9 = tail call i32 (...) @make_parser()
%10 = tail call i32 (...) @verbose()
%11 = tail call i32 (...) @output()
%12 = tail call i32 @done(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
char *strrchr(char *, char);
void usage(char *argv0) {
  char *c;
  c = strrchr(argv0, '/');
  if (!c)
    c = argv0;
  else
    c++;
  fprintf(stderr,
          "Usage: %s [-c COUNT] [-v]\n"
          "    Valid options are:\n"
          "  -c COUNT    Run just COUNT cycles (otherwise: forever).\n"
          "  -v          More verbose output.\n"
          "  -h          This help text.\n",
          c);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1156 <usage+0x36>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1162 <usage+0x42>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe8a(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
lea    0x1(%rax),%rdx
test   %rax,%rax
cmove  %rbx,%rdx
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
lea    0xeb7(%rip),%rsi
pop    %rbx
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [173 x i8] c"Usage: %s [-c COUNT] [-v]\0A Valid options are:\0A -c COUNT Run just COUNT cycles (otherwise: forever).\0A -v More verbose output.\0A -h This help text.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strrchr(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %10, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
store i8* %9, i8** %3
br label %13
10: ; preds = %1
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* @stderr
%15 = load i8*, i8** %3
%16 = call i32 @fprintf(i32 %14, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str, i64 0, i64 0), i8* %15)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [173 x i8] c"Usage: %s [-c COUNT] [-v]\0A Valid options are:\0A -c COUNT Run just COUNT cycles (otherwise: forever).\0A -v More verbose output.\0A -h This help text.\0A\00"
define void @usage(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([173 x i8], [173 x i8]* @.str, i64 0, i64 0), i8* %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void itos(int i, char *buf) { sprintf(buf, "%d", i); }


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

x86 assembly (clang, -O2):
<itos>:
mov    %rsi,%rax
mov    %edi,%edx
lea    0xee4(%rip),%rsi
mov    %rax,%rdi
jmp    1030 <sprintf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @itos(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 @sprintf(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %6)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @itos(i32 %0, i8* nocapture writeonly %1) {
%3 = tail call i32 @sprintf(i8* dereferenceable(1) %1, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ one;
typedef int /*<<< orphan*/ int8_t;
typedef int int32_t;

/* Variables and functions */
int /*<<< orphan*/ navdata_write(int /*<<< orphan*/ *, int);
void navdata_open_server(void) {
  int32_t one = 1;
  navdata_write((int8_t *)&one, sizeof(one));
}


x86 assembly (clang, -O0):
<navdata_open_server>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
mov    $0x4,%esi
call   1030 <navdata_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<navdata_open_server>:
push   %rax
movl   $0x1,0x4(%rsp)
lea    0x4(%rsp),%rdi
mov    $0x4,%esi
call   1030 <navdata_write@plt>
pop    %rax
ret

LLVM IR (-O0):
define void @navdata_open_server() {
%1 = alloca i32
store i32 1, i32* %1
%2 = call i32 @navdata_write(i32* %1, i32 4)
ret void
}

LLVM IR (-O2):
define void @navdata_open_server() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 1, i32* %1
%3 = call i32 @navdata_write(i32* %1, i32 4)
ret void
}
int msm_dts_eagle_deinit_post(int port_id, int topology) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @msm_dts_eagle_deinit_post(i32 %0, i32 %1) {
ret i32 0
}
void strcopy(char chaine1[], char chaine2[]) {
  int i;
  char c;
  i = 0;
  chaine2[0] = 'a';
  while (chaine1[i] != 0) {
    chaine2[i] = chaine1[i];
    i++;
  }
}


x86 assembly (clang, -O0):
<strcopy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x61,(%rax)
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1153 <strcopy+0x53>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    111a <strcopy+0x1a>
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcopy>:
movb   $0x61,(%rsi)
mov    (%rdi),%al
test   %al,%al
je     1120 <strcopy+0x20>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    %al,(%rsi,%rcx,1)
movzbl 0x1(%rdi,%rcx,1),%eax
add    $0x1,%rcx
test   %al,%al
jne    1110 <strcopy+0x10>
ret

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

LLVM IR (-O2):
define void @strcopy(i8* nocapture %0, i8* nocapture writeonly %1) {
store i8 97, i8* %1
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %9, %5 ], [ 0, %2 ]
%7 = phi i8 [ %11, %5 ], [ %3, %2 ]
%8 = getelementptr inbounds i8, i8* %1, i64 %6
store i8 %7, i8* %8
%9 = add nuw nsw i64 %6, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
ret void
}
float rsqrt(float x) {
  float xhalf = 0.5f * x;
  int i = *(int *)&x;
  i = 0x5f375a82 - (i >> 1);
  x = *(float *)&i;
  x = x * (1.5f - xhalf * x * x);
  return x;
}


x86 assembly (clang, -O0):
<rsqrt>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  0xef3(%rip),%xmm0
mulss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
sar    $0x1,%ecx
mov    $0x5f375a82,%eax
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x4(%rbp),%xmm1
movss  -0x4(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
movss  0xe98(%rip),%xmm2
addss  %xmm2,%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsqrt>:
movd   %xmm0,%eax
sar    %eax
mov    $0x5f375a82,%ecx
sub    %eax,%ecx
movd   %ecx,%xmm1
mulss  0xee7(%rip),%xmm0
mulss  %xmm1,%xmm0
mulss  %xmm1,%xmm0
addss  0xedb(%rip),%xmm0
mulss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @rsqrt(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store float %0, float* %2
%5 = load float, float* %2
%6 = fmul float 5.000000e-01, %5
store float %6, float* %3
%7 = bitcast float* %2 to i32*
%8 = load i32, i32* %7
store i32 %8, i32* %4
%9 = load i32, i32* %4
%10 = ashr i32 %9, 1
%11 = sub nsw i32 1597463170, %10
store i32 %11, i32* %4
%12 = bitcast i32* %4 to float*
%13 = load float, float* %12
store float %13, float* %2
%14 = load float, float* %2
%15 = load float, float* %3
%16 = load float, float* %2
%17 = fmul float %15, %16
%18 = load float, float* %2
%19 = fneg float %17
%20 = call float @llvm.fmuladd.f32(float %19, float %18, float 1.500000e+00)
%21 = fmul float %14, %20
store float %21, float* %2
%22 = load float, float* %2
ret float %22
}

LLVM IR (-O2):
define float @rsqrt(float %0) {
%2 = bitcast float %0 to i32
%3 = ashr i32 %2, 1
%4 = sub nsw i32 1597463170, %3
%5 = bitcast i32 %4 to float
%6 = fmul float %0, -5.000000e-01
%7 = fmul float %6, %5
%8 = tail call float @llvm.fmuladd.f32(float %7, float %5, float 1.500000e+00)
%9 = fmul float %8, %5
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(void *, void const *, size_t);
void *xmalloc(size_t);
void *xmemdup(const void *str, size_t n) {
  void *ret = xmalloc(n);
  memcpy(ret, str, n);
  return ret;
}


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

x86 assembly (clang, -O2):
<xmemdup>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <xmalloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <memcpy@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @xmemdup(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 i64, i64* %4
%7 = call i8* @xmalloc(i64 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i8*, i8** %3
%10 = load i64, i64* %4
%11 = call i32 @memcpy(i8* %8, i8* %9, i64 %10)
%12 = load i8*, i8** %5
ret i8* %12
}

LLVM IR (-O2):
define i8* @xmemdup(i8* %0, i64 %1) {
%3 = tail call i8* @xmalloc(i64 %1)
%4 = tail call i32 @memcpy(i8* %3, i8* %0, i64 %1)
ret i8* %3
}
void newlinespec_unit2OPT_CRLF() {}


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

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

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

LLVM IR (-O2):
define void @newlinespec_unit2OPT_CRLF() {
ret void
}
const char *basename(const char *path) {
  const char *base;
  for (base = path; *path; path++) {
    if (((*path) == '/'))
      base = path + 1;
  }
  return base;
}


x86 assembly (clang, -O0):
<basename>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114f <basename+0x4f>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
jne    1139 <basename+0x39>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113e <basename+0x3e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1110 <basename+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<basename>:
mov    %rdi,%rax
lea    0x1(%rdi),%rcx
jmp    1117 <basename+0x17>
nopl   0x0(%rax)
mov    %rcx,%rax
add    $0x1,%rcx
movzbl -0x1(%rcx),%edx
cmp    $0x2f,%dl
je     1110 <basename+0x10>
test   %dl,%dl
jne    1113 <basename+0x13>
ret

LLVM IR (-O0):
define i8* @basename(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 = %18, %1
%6 = load i8*, i8** %2
%7 = load i8, i8* %6
%8 = icmp ne i8 %7, 0
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 47
br i1 %13, label %14, label %17
14: ; preds = %9
%15 = load i8*, i8** %2
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8* %16, i8** %3
br label %17
17: ; preds = %14, %9
br label %18
18: ; preds = %17
%19 = load i8*, i8** %2
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %2
br label %5
21: ; preds = %5
%22 = load i8*, i8** %3
ret i8* %22
}

LLVM IR (-O2):
define i8* @basename(i8* %0) {
br label %2
2: ; preds = %8, %1
%3 = phi i8* [ %0, %1 ], [ %10, %8 ]
%4 = phi i8* [ %0, %1 ], [ %9, %8 ]
%5 = load i8, i8* %3
switch i8 %5, label %8 [
i8 0, label %11
i8 47, label %6
]
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %3, i64 1
br label %8
8: ; preds = %2, %6
%9 = phi i8* [ %7, %6 ], [ %4, %2 ]
%10 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
11: ; preds = %2
ret i8* %4
}
void b_print_char(char chr) { asm volatile("call 0x00100018" : : "a"(chr)); }


x86 assembly (clang, -O0):
<b_print_char>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%al
call   100018 <completed.0+0xfbff8>
pop    %rbp
ret

x86 assembly (clang, -O2):
<b_print_char>:
mov    %edi,%eax
call   100018 <completed.0+0xfbff8>
ret

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

LLVM IR (-O2):
define void @b_print_char(i8 signext %0) {
tail call void asm sideeffect "call 0x00100018", "{ax},~{dirflag},~{fpsr},~{flags}"(i8 %0)
ret void
}
/* Type definitions */
typedef int uint8_t;
typedef unsigned long long uint64_t;

/* Variables and functions */
void set_block_number_in_tweak(uint8_t *tweak, const uint64_t block_no) {
  tweak[3] = (tweak[3] & 0xf0) ^ ((block_no >> 16ULL) & 0x0f);
  tweak[4] = ((block_no >> 8ULL) & 0xff);
  tweak[5] = ((block_no >> 0ULL) & 0xff);
}


x86 assembly (clang, -O0):
<set_block_number_in_tweak>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%eax
and    $0xf0,%eax
cltq
mov    -0x10(%rbp),%rcx
shr    $0x10,%rcx
and    $0xf,%rcx
xor    %rcx,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0xc(%rax)
mov    -0x10(%rbp),%rax
shr    $0x8,%rax
and    $0xff,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    -0x10(%rbp),%rax
shr    $0x0,%rax
and    $0xff,%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,0x14(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_block_number_in_tweak>:
mov    %rsi,%rax
mov    $0xf0,%ecx
and    0xc(%rdi),%ecx
movzbl %ah,%edx
movzbl %al,%esi
shr    $0x10,%eax
and    $0xf,%eax
or     %ecx,%eax
mov    %eax,0xc(%rdi)
mov    %edx,0x10(%rdi)
mov    %esi,0x14(%rdi)
ret

LLVM IR (-O0):
define void @set_block_number_in_tweak(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 = getelementptr inbounds i32, i32* %5, i64 3
%7 = load i32, i32* %6
%8 = and i32 %7, 240
%9 = sext i32 %8 to i64
%10 = load i64, i64* %4
%11 = lshr i64 %10, 16
%12 = and i64 %11, 15
%13 = xor i64 %9, %12
%14 = trunc i64 %13 to i32
%15 = load i32*, i32** %3
%16 = getelementptr inbounds i32, i32* %15, i64 3
store i32 %14, i32* %16
%17 = load i64, i64* %4
%18 = lshr i64 %17, 8
%19 = and i64 %18, 255
%20 = trunc i64 %19 to i32
%21 = load i32*, i32** %3
%22 = getelementptr inbounds i32, i32* %21, i64 4
store i32 %20, i32* %22
%23 = load i64, i64* %4
%24 = lshr i64 %23, 0
%25 = and i64 %24, 255
%26 = trunc i64 %25 to i32
%27 = load i32*, i32** %3
%28 = getelementptr inbounds i32, i32* %27, i64 5
store i32 %26, i32* %28
ret void
}

LLVM IR (-O2):
define void @set_block_number_in_tweak(i32* nocapture %0, i64 %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 3
%4 = load i32, i32* %3
%5 = and i32 %4, 240
%6 = trunc i64 %1 to i32
%7 = lshr i32 %6, 16
%8 = and i32 %7, 15
%9 = or i32 %5, %8
store i32 %9, i32* %3
%10 = lshr i32 %6, 8
%11 = and i32 %10, 255
%12 = getelementptr inbounds i32, i32* %0, i64 4
store i32 %11, i32* %12
%13 = and i32 %6, 255
%14 = getelementptr inbounds i32, i32* %0, i64 5
store i32 %13, i32* %14
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int v;
  scanf("%i", &v);
  printf("%X\n", v);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@.str.1 = [4 x i8] c"%X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
void gdk_region_shrink() {}


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

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

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

LLVM IR (-O2):
define void @gdk_region_shrink() {
ret void
}
/* Variables and functions */
unsigned long callback(int, char **);
int gen_argv(void *, unsigned long, char **);
unsigned long callback_entry(void *base, unsigned long len) {
  char *argv[10];
  int argc;
  argc = gen_argv(base, len, argv);
  return (callback(argc, argv));
}


x86 assembly (clang, -O0):
<callback_entry>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x60(%rbp),%rdx
call   1030 <gen_argv@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%edi
lea    -0x60(%rbp),%rsi
call   1040 <callback@plt>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<callback_entry>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdx
call   1030 <gen_argv@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <callback@plt>
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i64 @callback_entry(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [10 x i8*]
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
%10 = call i32 @gen_argv(i8* %7, i64 %8, i8** %9)
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = getelementptr inbounds [10 x i8*], [10 x i8*]* %5, i64 0, i64 0
%13 = call i64 @callback(i32 %11, i8** %12)
ret i64 %13
}

LLVM IR (-O2):
define i64 @callback_entry(i8* %0, i64 %1) {
%3 = alloca [10 x i8*]
%4 = bitcast [10 x i8*]* %3 to i8*
%5 = getelementptr inbounds [10 x i8*], [10 x i8*]* %3, i64 0, i64 0
%6 = call i32 @gen_argv(i8* %0, i64 %1, i8** %5)
%7 = call i64 @callback(i32 %6, i8** %5)
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ guessNumber(int);
int main() {
  guessNumber(500);
  guessNumber(600);
  guessNumber(555);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1f4,%edi
call   1030 <guessNumber@plt>
mov    $0x258,%edi
call   1030 <guessNumber@plt>
mov    $0x22b,%edi
call   1030 <guessNumber@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1f4,%edi
call   1030 <guessNumber@plt>
mov    $0x258,%edi
call   1030 <guessNumber@plt>
mov    $0x22b,%edi
call   1030 <guessNumber@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @guessNumber(i32 500)
%2 = call i32 @guessNumber(i32 600)
%3 = call i32 @guessNumber(i32 555)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @guessNumber(i32 500)
%2 = tail call i32 @guessNumber(i32 600)
%3 = tail call i32 @guessNumber(i32 555)
ret i32 0
}
/* Variables and functions */
int getLine(char *, int);
int /*<<< orphan*/ printf(char *, char *);
int main(void) {
  int len;
  int moreThan;
  char line[10];
  moreThan = 5;
  while ((len = getLine(line, 10)) > 0) {
    if (len > moreThan) {
      printf("%s\n", line);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x5,-0xc(%rbp)
lea    -0x16(%rbp),%rdi
mov    $0xa,%esi
call   1040 <getLine@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jle    1171 <main+0x51>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    116c <main+0x4c>
lea    -0x16(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xe(%rsp),%rdi
mov    $0xa,%esi
call   1040 <getLine@plt>
test   %eax,%eax
jle    1173 <main+0x53>
lea    0xebf(%rip),%r14
lea    0xe(%rsp),%rbx
jmp    1161 <main+0x41>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0xa,%esi
call   1040 <getLine@plt>
test   %eax,%eax
jle    1173 <main+0x53>
cmp    $0x6,%eax
jb     1150 <main+0x30>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
jmp    1150 <main+0x30>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @getLine(i8* %2, i32 10)
%4 = icmp sgt i32 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %0, %10
%6 = phi i32 [ %11, %10 ], [ %3, %0 ]
%7 = icmp ugt i32 %6, 5
br i1 %7, label %8, label %10
8: ; preds = %5
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %10
10: ; preds = %8, %5
%11 = call i32 @getLine(i8* %2, i32 10)
%12 = icmp sgt i32 %11, 0
br i1 %12, label %5, label %13
13: ; preds = %10, %0
ret i32 0
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct list *);
int /*<<< orphan*/ list_clear(struct list *);
void list_destroy(struct list *this) {
  list_clear(this);
  free(this);
}


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

x86 assembly (clang, -O2):
<list_destroy>:
push   %rbx
mov    %rdi,%rbx
call   1040 <list_clear@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define void @list_destroy(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
%3 = load %struct.list*, %struct.list** %2
%4 = call i32 @list_clear(%struct.list* %3)
%5 = load %struct.list*, %struct.list** %2
%6 = call i32 @free(%struct.list* %5)
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
define void @list_destroy(%struct.list* %0) {
%2 = tail call i32 @list_clear(%struct.list* %0)
%3 = tail call i32 @free(%struct.list* %0)
ret void
}
void address_mapped() {}


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

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

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

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