xunge/DecIR huggingface dataset:
char getipclass(unsigned long ip) {
  if ((ip & 0x80) == 0x00)
    return 'A';
  else if ((ip & 0xC0) == 0x80)
    return 'B';
  else if ((ip & 0xE0) == 0xC0)
    return 'C';
  else if ((ip & 0xF0) == 0xE0)
    return 'D';
  else if ((ip & 0xF8) == 0xF0)
    return 'E';
  else
    return 'E';
}


x86 assembly (clang, -O0):
<getipclass>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x80,%rax
cmp    $0x0,%rax
jne    1125 <getipclass+0x25>
movb   $0x41,-0x1(%rbp)
jmp    11a5 <getipclass+0xa5>
mov    -0x10(%rbp),%rax
and    $0xc0,%rax
cmp    $0x80,%rax
jne    1144 <getipclass+0x44>
movb   $0x42,-0x1(%rbp)
jmp    11a5 <getipclass+0xa5>
mov    -0x10(%rbp),%rax
and    $0xe0,%rax
cmp    $0xc0,%rax
jne    1163 <getipclass+0x63>
movb   $0x43,-0x1(%rbp)
jmp    11a5 <getipclass+0xa5>
mov    -0x10(%rbp),%rax
and    $0xf0,%rax
cmp    $0xe0,%rax
jne    1182 <getipclass+0x82>
movb   $0x44,-0x1(%rbp)
jmp    11a5 <getipclass+0xa5>
mov    -0x10(%rbp),%rax
and    $0xf8,%rax
cmp    $0xf0,%rax
jne    11a1 <getipclass+0xa1>
movb   $0x45,-0x1(%rbp)
jmp    11a5 <getipclass+0xa5>
movb   $0x45,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getipclass>:
mov    $0x41,%al
test   $0x80,%dil
je     113d <getipclass+0x3d>
mov    %edi,%ecx
and    $0xc0,%ecx
mov    $0x42,%al
cmp    $0x80,%ecx
je     113d <getipclass+0x3d>
mov    %edi,%ecx
and    $0xe0,%ecx
mov    $0x43,%al
cmp    $0xc0,%ecx
je     113d <getipclass+0x3d>
and    $0xf0,%edi
cmp    $0xe0,%edi
sete   %al
xor    $0x45,%al
ret

LLVM IR (-O0):
define signext i8 @getipclass(i64 %0) {
%2 = alloca i8
%3 = alloca i64
store i64 %0, i64* %3
%4 = load i64, i64* %3
%5 = and i64 %4, 128
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i8 65, i8* %2
br label %29
8: ; preds = %1
%9 = load i64, i64* %3
%10 = and i64 %9, 192
%11 = icmp eq i64 %10, 128
br i1 %11, label %12, label %13
12: ; preds = %8
store i8 66, i8* %2
br label %29
13: ; preds = %8
%14 = load i64, i64* %3
%15 = and i64 %14, 224
%16 = icmp eq i64 %15, 192
br i1 %16, label %17, label %18
17: ; preds = %13
store i8 67, i8* %2
br label %29
18: ; preds = %13
%19 = load i64, i64* %3
%20 = and i64 %19, 240
%21 = icmp eq i64 %20, 224
br i1 %21, label %22, label %23
22: ; preds = %18
store i8 68, i8* %2
br label %29
23: ; preds = %18
%24 = load i64, i64* %3
%25 = and i64 %24, 248
%26 = icmp eq i64 %25, 240
br i1 %26, label %27, label %28
27: ; preds = %23
store i8 69, i8* %2
br label %29
28: ; preds = %23
store i8 69, i8* %2
br label %29
29: ; preds = %28, %27, %22, %17, %12, %7
%30 = load i8, i8* %2
ret i8 %30
}

LLVM IR (-O2):
define signext i8 @getipclass(i64 %0) {
%2 = and i64 %0, 128
%3 = icmp eq i64 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = and i64 %0, 192
%6 = icmp eq i64 %5, 128
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = and i64 %0, 224
%9 = icmp eq i64 %8, 192
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = and i64 %0, 240
%12 = icmp eq i64 %11, 224
%13 = select i1 %12, i8 68, i8 69
br label %14
14: ; preds = %10, %7, %4, %1
%15 = phi i8 [ 65, %1 ], [ 66, %4 ], [ 67, %7 ], [ %13, %10 ]
ret i8 %15
}
void EVP_rc4(void) {}


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

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

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

LLVM IR (-O2):
define void @EVP_rc4() {
ret void
}
void wifi_evt_dfu_boot(const struct wifi_msg_dfu_boot_evt_t *msg) {}


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

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

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

LLVM IR (-O2):
%struct.wifi_msg_dfu_boot_evt_t = type opaque
define void @wifi_evt_dfu_boot(%struct.wifi_msg_dfu_boot_evt_t* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fd_timer_callback_triggered();
int /*<<< orphan*/ fd_timer_schedule_countdown();
void fd_timer_update(void) {
  fd_timer_schedule_countdown();
  fd_timer_callback_triggered();
}


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

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

LLVM IR (-O0):
define void @fd_timer_update() {
%1 = call i32 (...) @fd_timer_schedule_countdown()
%2 = call i32 (...) @fd_timer_callback_triggered()
ret void
}

LLVM IR (-O2):
define void @fd_timer_update() {
%1 = tail call i32 (...) @fd_timer_schedule_countdown()
%2 = tail call i32 (...) @fd_timer_callback_triggered()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int string_length(char *s1) {
  char *s1_ptr;
  s1_ptr = &s1[0];
  int count_of_characters = 0;
  while (*s1_ptr != '\0') {
    s1_ptr++;
    count_of_characters++;
  }
  printf("length = %d\n", count_of_characters);
}


x86 assembly (clang, -O0):
<string_length>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1155 <string_length+0x45>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112b <string_length+0x1b>
mov    -0x1c(%rbp),%esi
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<string_length>:
cmpb   $0x0,(%rdi)
je     1137 <string_length+0x27>
xor    %esi,%esi
nopw   0x0(%rax,%rax,1)
cmpb   $0x0,0x1(%rdi,%rsi,1)
lea    0x1(%rsi),%rsi
jne    1120 <string_length+0x10>
lea    0xece(%rip),%rdi
jmp    1030 <printf@plt>
xor    %esi,%esi
lea    0xec0(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [13 x i8] c"length = %d\0A\00"
define i32 @string_length(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %11, label %4
4: ; preds = %1, %4
%5 = phi i32 [ %8, %4 ], [ 0, %1 ]
%6 = phi i8* [ %7, %4 ], [ %0, %1 ]
%7 = getelementptr inbounds i8, i8* %6, i64 1
%8 = add nuw nsw i32 %5, 1
%9 = load i8, i8* %7
%10 = icmp eq i8 %9, 0
br i1 %10, label %11, label %4
11: ; preds = %4, %1
%12 = phi i32 [ 0, %1 ], [ %8, %4 ]
%13 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 %12)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
void dummy(void *arg) {
  sleep(1);
  printf("Executing\n");
}


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

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

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

LLVM IR (-O2):
@str = [10 x i8] c"Executing\00"
define void @dummy(i8* nocapture readnone %0) {
%2 = tail call i32 @sleep(i32 1)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0))
ret void
}
int search(int ar[], int va, int si[]) {
  if (si[0] == 0)
    return 0;
  int i;
  for (i = 0; i < si[0]; i++) {
    if (va == ar[i])
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<search>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpl   $0x0,(%rax)
jne    1128 <search+0x28>
movl   $0x0,-0x4(%rbp)
jmp    1178 <search+0x78>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    1171 <search+0x71>
mov    -0x14(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x24(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    115e <search+0x5e>
movl   $0x1,-0x4(%rbp)
jmp    1178 <search+0x78>
jmp    1163 <search+0x63>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    112f <search+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<search>:
mov    (%rdx),%eax
test   %eax,%eax
jle    111e <search+0x1e>
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
cmp    %esi,(%rdi,%rcx,4)
je     1121 <search+0x21>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <search+0x10>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

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

LLVM IR (-O2):
define i32 @search(i32* nocapture %0, i32 %1, i32* nocapture %2) {
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %15, %7
br i1 %9, label %16, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %15, %8 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp eq i32 %13, %1
%15 = add nuw nsw i64 %11, 1
br i1 %14, label %16, label %8
16: ; preds = %8, %10, %3
%17 = phi i32 [ 0, %3 ], [ 0, %8 ], [ 1, %10 ]
ret i32 %17
}
/* Variables and functions */
int rl_crlf();
int crlf() { return rl_crlf(); }


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

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

LLVM IR (-O0):
define i32 @crlf() {
%1 = call i32 (...) @rl_crlf()
ret i32 %1
}

LLVM IR (-O2):
define i32 @crlf() {
%1 = tail call i32 (...) @rl_crlf()
ret i32 %1
}
int main() {
  unsigned long t1 = 15;
  return t1 % 4;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movq   $0xf,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x3,%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
store i32 0, i32* %1
store i64 15, i64* %2
%3 = load i64, i64* %2
%4 = urem i64 %3, 4
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Type definitions */
typedef int /*<<< orphan*/ GLuint;
typedef int /*<<< orphan*/ GLsizei;

/* Variables and functions */
int /*<<< orphan*/ glDeleteLists(int /*<<< orphan*/, int /*<<< orphan*/);
void DeleteLists(GLuint list, GLsizei range) { glDeleteLists(list, range); }


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

x86 assembly (clang, -O2):
<DeleteLists>:
jmp    1030 <glDeleteLists@plt>

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

LLVM IR (-O2):
define void @DeleteLists(i32 %0, i32 %1) {
%3 = tail call i32 @glDeleteLists(i32 %0, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __init__();
int main() {
  __init__();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @__init__()
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void print_path(int pre[], int source, int destination) {
  if (pre[destination] != source)
    print_path(pre, source, pre[destination]);
  printf("%-4c->", pre[destination] + 65);
}


x86 assembly (clang, -O0):
<print_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0xc(%rbp),%eax
je     115d <print_path+0x3d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
call   1040 <print_path@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
add    $0x41,%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_path>:
push   %r14
push   %rbx
push   %rax
movslq %edx,%r14
mov    (%rdi,%r14,4),%edx
cmp    %esi,%edx
je     113b <print_path+0x1b>
mov    %rdi,%rbx
call   1040 <print_path@plt>
mov    (%rbx,%r14,4),%esi
add    $0x41,%esi
lea    0xebb(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"%-4c->\00"
define void @print_path(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sext i32 %2 to i64
%5 = getelementptr inbounds i32, i32* %0, i64 %4
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, %1
br i1 %7, label %10, label %8
8: ; preds = %3
tail call void @print_path(i32* %0, i32 %1, i32 %6)
%9 = load i32, i32* %5
br label %10
10: ; preds = %8, %3
%11 = phi i32 [ %9, %8 ], [ %1, %3 ]
%12 = add nsw i32 %11, 65
%13 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %12)
ret void
}
/* Type definitions */
struct esb_s {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ esb_appendn_internal(struct esb_s *, char const *, size_t);
size_t strlen(char const *);
void esb_append(struct esb_s *data, const char *in_string) {
  size_t len = strlen(in_string);
  esb_appendn_internal(data, in_string, len);
}


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

x86 assembly (clang, -O2):
<esb_append>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <esb_appendn_internal@plt>

LLVM IR (-O0):
%struct.esb_s = type { i32 }
define void @esb_append(%struct.esb_s* %0, i8* %1) {
%3 = alloca %struct.esb_s*
%4 = alloca i8*
%5 = alloca i64
store %struct.esb_s* %0, %struct.esb_s** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load %struct.esb_s*, %struct.esb_s** %3
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i32 @esb_appendn_internal(%struct.esb_s* %8, i8* %9, i64 %10)
ret void
}

LLVM IR (-O2):
%struct.esb_s = type { i32 }
define void @esb_append(%struct.esb_s* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i32 @esb_appendn_internal(%struct.esb_s* %0, i8* %1, i64 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ rst(int);
void op0xF7(void) { rst(0x30); }


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

x86 assembly (clang, -O2):
<op0xF7>:
mov    $0x30,%edi
jmp    1030 <rst@plt>

LLVM IR (-O0):
define void @op0xF7() {
%1 = call i32 @rst(i32 48)
ret void
}

LLVM IR (-O2):
define void @op0xF7() {
%1 = tail call i32 @rst(i32 48)
ret void
}
/* Variables and functions */
float clamp(int, int /*<<< orphan*/, int);
float SchlickFresnel(float u) {
  float m = clamp(1 - u, 0, 1);
  float m2 = m * m;
  return m2 * m2 * m;
}


x86 assembly (clang, -O0):
<SchlickFresnel>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  0xedb(%rip),%xmm0
subss  -0x4(%rbp),%xmm0
cvttss2si %xmm0,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <clamp@plt>
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
mulss  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SchlickFresnel>:
push   %rax
movss  0xee7(%rip),%xmm1
subss  %xmm0,%xmm1
cvttss2si %xmm1,%edi
xor    %esi,%esi
mov    $0x1,%edx
call   1030 <clamp@plt>
movaps %xmm0,%xmm1
mulss  %xmm0,%xmm1
mulss  %xmm1,%xmm1
mulss  %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @SchlickFresnel(float %0) {
%2 = alloca float
%3 = alloca float
%4 = alloca float
store float %0, float* %2
%5 = load float, float* %2
%6 = fsub float 1.000000e+00, %5
%7 = fptosi float %6 to i32
%8 = call float @clamp(i32 %7, i32 0, i32 1)
store float %8, float* %3
%9 = load float, float* %3
%10 = load float, float* %3
%11 = fmul float %9, %10
store float %11, float* %4
%12 = load float, float* %4
%13 = load float, float* %4
%14 = fmul float %12, %13
%15 = load float, float* %3
%16 = fmul float %14, %15
ret float %16
}

LLVM IR (-O2):
define float @SchlickFresnel(float %0) {
%2 = fsub float 1.000000e+00, %0
%3 = fptosi float %2 to i32
%4 = tail call float @clamp(i32 %3, i32 0, i32 1)
%5 = fmul float %4, %4
%6 = fmul float %5, %5
%7 = fmul float %4, %6
ret float %7
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sleep(int);
int main() {
  pid_t pid;
  switch (pid = fork()) {
  case 0:
    sleep(1000000);
    exit(0);
  default:
    printf("OK: foo bar baz\n");
    exit(0);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
call   1060 <fork@plt>
mov    %eax,-0x8(%rbp)
test   %eax,%eax
jne    1177 <main+0x37>
jmp    1166 <main+0x26>
mov    $0xf4240,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <fork@plt>
test   %eax,%eax
jne    115d <main+0x1d>
mov    $0xf4240,%edi
call   1050 <sleep@plt>
xor    %edi,%edi
call   1040 <exit@plt>
lea    0xe9c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"OK: foo bar baz\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (...) @fork()
store i32 %3, i32* %2
switch i32 %3, label %7 [
i32 0, label %4
]
4: ; preds = %0
%5 = call i32 @sleep(i32 1000000)
%6 = call i32 @exit(i32 0)
unreachable
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [16 x i8] c"OK: foo bar baz\00"
define i32 @main() {
%1 = tail call i32 (...) @fork()
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @sleep(i32 1000000)
%5 = tail call i32 @exit(i32 0)
unreachable
6: ; preds = %0
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 0)
unreachable
}
float *subtract(float v[3], float a[3], float b[3]) {
  v[0] = a[0] - b[0];
  v[1] = a[1] - b[1];
  v[2] = a[2] - b[2];
  return v;
}


x86 assembly (clang, -O0):
<subtract>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  0x4(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
subss  0x8(%rax),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<subtract>:
mov    %rdi,%rax
movss  (%rsi),%xmm0
subss  (%rdx),%xmm0
movss  %xmm0,(%rdi)
movss  0x4(%rsi),%xmm0
subss  0x4(%rdx),%xmm0
movss  %xmm0,0x4(%rdi)
movss  0x8(%rsi),%xmm0
subss  0x8(%rdx),%xmm0
movss  %xmm0,0x8(%rdi)
ret

LLVM IR (-O0):
define float* @subtract(float* %0, float* %1, float* %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca float*
store float* %0, float** %4
store float* %1, float** %5
store float* %2, float** %6
%7 = load float*, float** %5
%8 = getelementptr inbounds float, float* %7, i64 0
%9 = load float, float* %8
%10 = load float*, float** %6
%11 = getelementptr inbounds float, float* %10, i64 0
%12 = load float, float* %11
%13 = fsub float %9, %12
%14 = load float*, float** %4
%15 = getelementptr inbounds float, float* %14, i64 0
store float %13, float* %15
%16 = load float*, float** %5
%17 = getelementptr inbounds float, float* %16, i64 1
%18 = load float, float* %17
%19 = load float*, float** %6
%20 = getelementptr inbounds float, float* %19, i64 1
%21 = load float, float* %20
%22 = fsub float %18, %21
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 1
store float %22, float* %24
%25 = load float*, float** %5
%26 = getelementptr inbounds float, float* %25, i64 2
%27 = load float, float* %26
%28 = load float*, float** %6
%29 = getelementptr inbounds float, float* %28, i64 2
%30 = load float, float* %29
%31 = fsub float %27, %30
%32 = load float*, float** %4
%33 = getelementptr inbounds float, float* %32, i64 2
store float %31, float* %33
%34 = load float*, float** %4
ret float* %34
}

LLVM IR (-O2):
define float* @subtract(float* returned writeonly %0, float* nocapture %1, float* nocapture %2) {
%4 = load float, float* %1
%5 = load float, float* %2
%6 = fsub float %4, %5
store float %6, float* %0
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = getelementptr inbounds float, float* %2, i64 1
%10 = load float, float* %9
%11 = fsub float %8, %10
%12 = getelementptr inbounds float, float* %0, i64 1
store float %11, float* %12
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = getelementptr inbounds float, float* %2, i64 2
%16 = load float, float* %15
%17 = fsub float %14, %16
%18 = getelementptr inbounds float, float* %0, i64 2
store float %17, float* %18
ret float* %0
}
double pair(double x, double y, double z, double x0, double y0, double z0) {
  double dx, dy, dz;
  dx = x - x0;
  dy = y - y0;
  dz = z - z0;
  return dx * dx + dy * dy + dz * dz;
}


x86 assembly (clang, -O0):
<pair>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm1
movsd  -0x38(%rbp),%xmm2
movsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<pair>:
subsd  %xmm3,%xmm0
subsd  %xmm4,%xmm1
subsd  %xmm5,%xmm2
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  %xmm2,%xmm2
addsd  %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @pair(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%16 = load double, double* %7
%17 = load double, double* %10
%18 = fsub double %16, %17
store double %18, double* %13
%19 = load double, double* %8
%20 = load double, double* %11
%21 = fsub double %19, %20
store double %21, double* %14
%22 = load double, double* %9
%23 = load double, double* %12
%24 = fsub double %22, %23
store double %24, double* %15
%25 = load double, double* %13
%26 = load double, double* %13
%27 = load double, double* %14
%28 = load double, double* %14
%29 = fmul double %27, %28
%30 = call double @llvm.fmuladd.f64(double %25, double %26, double %29)
%31 = load double, double* %15
%32 = load double, double* %15
%33 = call double @llvm.fmuladd.f64(double %31, double %32, double %30)
ret double %33
}

LLVM IR (-O2):
define double @pair(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = fsub double %0, %3
%8 = fsub double %1, %4
%9 = fsub double %2, %5
%10 = fmul double %8, %8
%11 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %10)
%12 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %11)
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ printsysinfo();
int main(void) {
  printsysinfo();
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @printsysinfo()
ret i32 0
}
int sep_iscomma(char c) { return (c == ',' ? 1 : 0); }


x86 assembly (clang, -O0):
<sep_iscomma>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x2c,%edx
cmove  %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sep_iscomma>:
xor    %eax,%eax
cmp    $0x2c,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @sep_iscomma(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 44
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 1, i32 0
ret i32 %7
}

LLVM IR (-O2):
define i32 @sep_iscomma(i8 signext %0) {
%2 = icmp eq i8 %0, 44
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned divu1000(unsigned n) {
  unsigned q, r, t;
  t = (n >> 7) + (n >> 8) + (n >> 12);
  q = (n >> 1) + t + (n >> 15) + (t >> 11) + (t >> 14);
  q = q >> 9;
  r = n - q * 1000;
  return q + ((r + 24) >> 10);
}


x86 assembly (clang, -O0):
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x7,%eax
mov    -0x4(%rbp),%ecx
shr    $0x8,%ecx
add    %ecx,%eax
mov    -0x4(%rbp),%ecx
shr    $0xc,%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
shr    $0x1,%eax
add    -0x10(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    $0xf,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
shr    $0xb,%ecx
add    %ecx,%eax
mov    -0x10(%rbp),%ecx
shr    $0xe,%ecx
add    %ecx,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
shr    $0x9,%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   $0x3e8,-0x8(%rbp),%ecx
sub    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    -0xc(%rbp),%ecx
add    $0x18,%ecx
shr    $0xa,%ecx
add    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
mov    %edi,%eax
shr    $0x7,%eax
mov    %edi,%ecx
shr    $0x8,%ecx
add    %eax,%ecx
mov    %edi,%eax
shr    $0xc,%eax
add    %ecx,%eax
mov    %edi,%ecx
shr    %ecx
mov    %edi,%edx
shr    $0xf,%edx
add    %edx,%ecx
mov    %eax,%edx
shr    $0xb,%edx
add    %eax,%ecx
shr    $0xe,%eax
add    %edx,%ecx
add    %eax,%ecx
shr    $0x9,%ecx
imul   $0xfffffc18,%ecx,%eax
add    %edi,%eax
add    $0x18,%eax
shr    $0xa,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @divu1000(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = lshr i32 %6, 7
%8 = load i32, i32* %2
%9 = lshr i32 %8, 8
%10 = add i32 %7, %9
%11 = load i32, i32* %2
%12 = lshr i32 %11, 12
%13 = add i32 %10, %12
store i32 %13, i32* %5
%14 = load i32, i32* %2
%15 = lshr i32 %14, 1
%16 = load i32, i32* %5
%17 = add i32 %15, %16
%18 = load i32, i32* %2
%19 = lshr i32 %18, 15
%20 = add i32 %17, %19
%21 = load i32, i32* %5
%22 = lshr i32 %21, 11
%23 = add i32 %20, %22
%24 = load i32, i32* %5
%25 = lshr i32 %24, 14
%26 = add i32 %23, %25
store i32 %26, i32* %3
%27 = load i32, i32* %3
%28 = lshr i32 %27, 9
store i32 %28, i32* %3
%29 = load i32, i32* %2
%30 = load i32, i32* %3
%31 = mul i32 %30, 1000
%32 = sub i32 %29, %31
store i32 %32, i32* %4
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = add i32 %34, 24
%36 = lshr i32 %35, 10
%37 = add i32 %33, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @divu1000(i32 %0) {
%2 = lshr i32 %0, 7
%3 = lshr i32 %0, 8
%4 = add nuw nsw i32 %2, %3
%5 = lshr i32 %0, 12
%6 = add nuw nsw i32 %4, %5
%7 = lshr i32 %0, 1
%8 = lshr i32 %0, 15
%9 = lshr i32 %6, 11
%10 = lshr i32 %6, 14
%11 = add nuw i32 %8, %7
%12 = add nuw i32 %11, %6
%13 = add nuw i32 %12, %9
%14 = add nuw i32 %13, %10
%15 = lshr i32 %14, 9
%16 = mul i32 %15, -1000
%17 = add i32 %0, 24
%18 = add i32 %17, %16
%19 = lshr i32 %18, 10
%20 = add nuw nsw i32 %19, %15
ret i32 %20
}
int isspace(int c) {
  if (c == ' ')
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<isspace>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jne    111d <isspace+0x1d>
movl   $0x1,-0x4(%rbp)
jmp    1124 <isspace+0x24>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isspace>:
xor    %eax,%eax
cmp    $0x20,%edi
sete   %al
ret

LLVM IR (-O0):
define i32 @isspace(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 32
br i1 %5, label %6, label %7
6: ; preds = %1
store i32 1, i32* %2
br label %8
7: ; preds = %1
store i32 0, i32* %2
br label %8
8: ; preds = %7, %6
%9 = load i32, i32* %2
ret i32 %9
}

LLVM IR (-O2):
define i32 @isspace(i32 %0) {
%2 = icmp eq i32 %0, 32
%3 = zext i1 %2 to i32
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
void init_pit() {
  outb(0x0043, 0x34);
  outb(0x0040, 0x9c);
  outb(0x0040, 0x2e);
}


x86 assembly (clang, -O0):
<init_pit>:
push   %rbp
mov    %rsp,%rbp
mov    $0x43,%edi
mov    $0x34,%esi
call   1030 <outb@plt>
mov    $0x40,%edi
mov    $0x9c,%esi
call   1030 <outb@plt>
mov    $0x40,%edi
mov    $0x2e,%esi
call   1030 <outb@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_pit>:
push   %rax
mov    $0x43,%edi
mov    $0x34,%esi
call   1030 <outb@plt>
mov    $0x40,%edi
mov    $0x9c,%esi
call   1030 <outb@plt>
mov    $0x40,%edi
mov    $0x2e,%esi
pop    %rax
jmp    1030 <outb@plt>

LLVM IR (-O0):
define void @init_pit() {
%1 = call i32 @outb(i32 67, i32 52)
%2 = call i32 @outb(i32 64, i32 156)
%3 = call i32 @outb(i32 64, i32 46)
ret void
}

LLVM IR (-O2):
define void @init_pit() {
%1 = tail call i32 @outb(i32 67, i32 52)
%2 = tail call i32 @outb(i32 64, i32 156)
%3 = tail call i32 @outb(i32 64, i32 46)
ret void
}
double get_mflops(double t, int n) {
  return (n * (double)1000 * (double)600000 / t * 1000. / 1000. / 1000.);
}


x86 assembly (clang, -O0):
<get_mflops>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
movsd  0xee7(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xee3(%rip),%xmm1
mulsd  %xmm1,%xmm0
divsd  -0x8(%rbp),%xmm0
movsd  0xeca(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xebe(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xeb2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_mflops>:
cvtsi2sd %edi,%xmm1
movsd  0xef4(%rip),%xmm2
mulsd  %xmm2,%xmm1
mulsd  0xef0(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
divsd  %xmm2,%xmm1
divsd  %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @get_mflops(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = sitofp i32 %5 to double
%7 = fmul double %6, 1.000000e+03
%8 = fmul double %7, 6.000000e+05
%9 = load double, double* %3
%10 = fdiv double %8, %9
%11 = fmul double %10, 1.000000e+03
%12 = fdiv double %11, 1.000000e+03
%13 = fdiv double %12, 1.000000e+03
ret double %13
}

LLVM IR (-O2):
define double @get_mflops(double %0, i32 %1) {
%3 = sitofp i32 %1 to double
%4 = fmul double %3, 1.000000e+03
%5 = fmul double %4, 6.000000e+05
%6 = fdiv double %5, %0
%7 = fmul double %6, 1.000000e+03
%8 = fdiv double %7, 1.000000e+03
%9 = fdiv double %8, 1.000000e+03
ret double %9
}
void g_DUMMY_menu_destroy_popup(int win_id) { win_id = win_id; }


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

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

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

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


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_bi_epel_v48_8_avx2() {
ret void
}
int qsort_cmp__SVEC_VAL(const void *x, const void *y) {
  if (*((double *)x) > *((double *)y))
    return (-1);
  else
    return (*((double *)x) < *((double *)y));
}


x86 assembly (clang, -O0):
<qsort_cmp__SVEC_VAL>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x18(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    112e <qsort_cmp__SVEC_VAL+0x2e>
movl   $0xffffffff,-0x4(%rbp)
jmp    114d <qsort_cmp__SVEC_VAL+0x4d>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<qsort_cmp__SVEC_VAL>:
movsd  (%rdi),%xmm0
movsd  (%rsi),%xmm1
xor    %ecx,%ecx
ucomisd %xmm0,%xmm1
seta   %cl
ucomisd %xmm1,%xmm0
mov    $0xffffffff,%eax
cmovbe %ecx,%eax
ret

LLVM IR (-O0):
define i32 @qsort_cmp__SVEC_VAL(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
%6 = load i8*, i8** %4
%7 = bitcast i8* %6 to double*
%8 = load double, double* %7
%9 = load i8*, i8** %5
%10 = bitcast i8* %9 to double*
%11 = load double, double* %10
%12 = fcmp ogt double %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 -1, i32* %3
br label %23
14: ; preds = %2
%15 = load i8*, i8** %4
%16 = bitcast i8* %15 to double*
%17 = load double, double* %16
%18 = load i8*, i8** %5
%19 = bitcast i8* %18 to double*
%20 = load double, double* %19
%21 = fcmp olt double %17, %20
%22 = zext i1 %21 to i32
store i32 %22, i32* %3
br label %23
23: ; preds = %14, %13
%24 = load i32, i32* %3
ret i32 %24
}

LLVM IR (-O2):
define i32 @qsort_cmp__SVEC_VAL(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = bitcast i8* %1 to double*
%6 = load double, double* %5
%7 = fcmp ogt double %4, %6
%8 = fcmp olt double %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
int test_imm_C7int16_mem(short *val) {
  return ((*val) & (0xC7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_C7int16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movswl (%rax),%edx
and    $0xc7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_C7int16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 199
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
unsigned char pgm_read_byte(const char *c) { return *c; }


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

x86 assembly (clang, -O2):
<pgm_read_byte>:
mov    (%rdi),%al
ret

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

LLVM IR (-O2):
define zeroext i8 @pgm_read_byte(i8* nocapture %0) {
%2 = load i8, i8* %0
ret i8 %2
}
int test_imm_77uint64_midword_reg(unsigned long long val) {
  return ((val >> 16) & (0x77 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_77uint64_midword_reg>:
test   $0x770000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_77uint64_midword_reg(i64 %0) {
%2 = and i64 %0, 7798784
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ __free_cf(void *);
void CGColorSpaceRelease(void *item) { __free_cf(item); }


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

x86 assembly (clang, -O2):
<CGColorSpaceRelease>:
jmp    1030 <__free_cf@plt>

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

LLVM IR (-O2):
define void @CGColorSpaceRelease(i8* %0) {
%2 = tail call i32 @__free_cf(i8* %0)
ret void
}
void RTNetIPv4IsDHCPValid(void) {}


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

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

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

LLVM IR (-O2):
define void @RTNetIPv4IsDHCPValid() {
ret void
}
/* Variables and functions */
int noecho();
int wrap_noecho(void) { return noecho(); }


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

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

LLVM IR (-O0):
define i32 @wrap_noecho() {
%1 = call i32 (...) @noecho()
ret i32 %1
}

LLVM IR (-O2):
define i32 @wrap_noecho() {
%1 = tail call i32 (...) @noecho()
ret i32 %1
}
/* Variables and functions */
int /*<<< orphan*/ ft_putchar(char const);
void ft_putstr(char const *s) {
  if (s) {
    while (*s) {
      ft_putchar(*s);
      s++;
    }
  }
}


x86 assembly (clang, -O0):
<ft_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115b <ft_putstr+0x4b>
jmp    112c <ft_putstr+0x1c>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1156 <ft_putstr+0x46>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <ft_putchar@plt>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    112c <ft_putstr+0x1c>
jmp    115b <ft_putstr+0x4b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putstr>:
push   %rbx
test   %rdi,%rdi
je     1143 <ft_putstr+0x33>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     1143 <ft_putstr+0x33>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <ft_putchar@plt>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <ft_putstr+0x20>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @ft_putstr(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %13, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %11, %6 ], [ %4, %3 ]
%8 = phi i8* [ %10, %6 ], [ %0, %3 ]
%9 = tail call i32 @ft_putchar(i8 signext %7)
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  void test(int *int_pointer);
  int i = 50, *p = &i;
  printf("Before the call to test i = % i\n", i);
  test(p);
  printf("After the call to test i = %i\n", i);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x32,0x4(%rsp)
lea    0xed0(%rip),%rdi
mov    $0x32,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdi
call   1040 <test@plt>
mov    0x4(%rsp),%esi
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Before the call to test i = % i\0A\00"
@.str.1 = [31 x i8] c"After the call to test i = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
store i32 0, i32* %1
store i32 50, i32* %2
store i32* %2, i32** %3
%4 = load i32, i32* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = load i32*, i32** %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [33 x i8] c"Before the call to test i = % i\0A\00"
@.str.1 = [31 x i8] c"After the call to test i = %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 50, i32* %1
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i32 50)
%4 = load i32, i32* %1
%5 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __u64;
typedef int /*<<< orphan*/ __le64;

/* Variables and functions */
int /*<<< orphan*/ __swab64p(int /*<<< orphan*/ *);
__u64 __le64_to_cpup(const __le64 *p) { return __swab64p((__u64 *)p); }


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

x86 assembly (clang, -O2):
<__le64_to_cpup>:
jmp    1030 <__swab64p@plt>

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

LLVM IR (-O2):
define i32 @__le64_to_cpup(i32* %0) {
%2 = tail call i32 @__swab64p(i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t ape_finishcrc(uint32_t crc) {
  crc ^= 0xffffffff;
  crc >>= 1;
  return crc;
}


x86 assembly (clang, -O0):
<ape_finishcrc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sar    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @ape_finishcrc(i32 %0) {
%2 = ashr i32 %0, 1
%3 = xor i32 %2, -1
ret i32 %3
}