xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int a[], int num_elements) {
  int i;
  for (i = 0; i < num_elements; i++) {
    printf("%d ", a[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @print_array(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
%14 = tail call i32 @putchar(i32 10)
ret void
}
int UpdateWindow(HWND) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @UpdateWindow(i32 %0) {
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
void *readstat_malloc(size_t len) {
  if (len > 0xFFF000 || len == 0) {
    return NULL;
  }
  return malloc(len);
}


x86 assembly (clang, -O0):
<readstat_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0xfff000,-0x10(%rbp)
ja     1135 <readstat_malloc+0x25>
cmpq   $0x0,-0x10(%rbp)
jne    1142 <readstat_malloc+0x32>
movq   $0x0,-0x8(%rbp)
jmp    114f <readstat_malloc+0x3f>
mov    -0x10(%rbp),%rdi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readstat_malloc>:
lea    -0xfff001(%rdi),%rax
cmp    $0xffffffffff001000,%rax
jae    1122 <readstat_malloc+0x12>
xor    %eax,%eax
ret
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i8* @readstat_malloc(i64 %0) {
%2 = add i64 %0, -16773121
%3 = icmp ult i64 %2, -16773120
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i8* @malloc(i64 %0)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ prompt_error_msg_internal(char const *, char const *,
                                             int /*<<< orphan*/);
void show_error_msg(const char title[], const char message[]) {
  (void)prompt_error_msg_internal(title, message, 0);
}


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

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

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

LLVM IR (-O2):
define void @show_error_msg(i8* %0, i8* %1) {
%3 = tail call i32 @prompt_error_msg_internal(i8* %0, i8* %1, i32 0)
ret void
}
/* Variables and functions */
int func(int, double);
int /*<<< orphan*/ output(int);
int main() {
  int joel;
  int x;
  int c;
  joel = x + c;
  int y;
  int z;
  int j;
  if ((x + y) < 3 && z < 4) {
    x = func(j, x);
    func(j, 3.4);
    int character;
    while (!(character == 1)) {
      output(j);
      char bluh;
    }
  }
  return joel;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    -0x14(%rbp),%eax
cmp    $0x3,%eax
jge    1199 <main+0x79>
cmpl   $0x4,-0x18(%rbp)
jge    1199 <main+0x79>
mov    -0x1c(%rbp),%edi
cvtsi2sdl -0xc(%rbp),%xmm0
call   1040 <func@plt>
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%edi
movsd  0xe94(%rip),%xmm0
call   1040 <func@plt>
cmpl   $0x1,-0x20(%rbp)
sete   %al
xor    $0xff,%al
test   $0x1,%al
jne    1187 <main+0x67>
jmp    1194 <main+0x74>
mov    -0x1c(%rbp),%edi
call   1030 <output@plt>
jmp    1171 <main+0x51>
jmp    1199 <main+0x79>
mov    -0x8(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 0, i32* %1
%10 = load i32, i32* %3
%11 = load i32, i32* %4
%12 = add nsw i32 %10, %11
store i32 %12, i32* %2
%13 = load i32, i32* %3
%14 = load i32, i32* %5
%15 = add nsw i32 %13, %14
%16 = icmp slt i32 %15, 3
br i1 %16, label %17, label %35
17: ; preds = %0
%18 = load i32, i32* %6
%19 = icmp slt i32 %18, 4
br i1 %19, label %20, label %35
20: ; preds = %17
%21 = load i32, i32* %7
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to double
%24 = call i32 @func(i32 %21, double %23)
store i32 %24, i32* %3
%25 = load i32, i32* %7
%26 = call i32 @func(i32 %25, double 3.400000e+00)
br label %27
27: ; preds = %31, %20
%28 = load i32, i32* %8
%29 = icmp eq i32 %28, 1
%30 = xor i1 %29, true
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = load i32, i32* %7
%33 = call i32 @output(i32 %32)
br label %27
34: ; preds = %27
br label %35
35: ; preds = %34, %17, %0
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
define i32 @main() {
ret i32 undef
}
/* Variables and functions */
int atoi(char *);
long strtol(char *, char **, int);
int convert_from_hex_string(char *strhex) {
  long val;
  char *endptr;
  val = strtol(strhex, &endptr, 16);
  if (endptr == strhex) {
    return atoi(strhex);
  } else {
    return (int)val;
  }
}


x86 assembly (clang, -O0):
<convert_from_hex_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    1161 <convert_from_hex_string+0x41>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x4(%rbp)
jmp    1168 <convert_from_hex_string+0x48>
mov    -0x18(%rbp),%rax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<convert_from_hex_string>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rsi
mov    $0x10,%edx
call   1030 <strtol@plt>
cmp    %rbx,0x8(%rsp)
je     1144 <convert_from_hex_string+0x24>
add    $0x10,%rsp
pop    %rbx
ret
mov    %rbx,%rdi
add    $0x10,%rsp
pop    %rbx
jmp    1040 <atoi@plt>

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

LLVM IR (-O2):
define i32 @convert_from_hex_string(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
%4 = call i64 @strtol(i8* %0, i8** %2, i32 16)
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, %0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = tail call i32 @atoi(i8* %0)
br label %11
9: ; preds = %1
%10 = trunc i64 %4 to i32
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ mergeSort(int *, int);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main() {
  int numbers[100000], i;
  srand(time(NULL));
  for (i = 0; i < 100000; i++)
    numbers[i] = rand();
  mergeSort(numbers, 100000);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61aa0,%rsp
movl   $0x0,-0x4(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
movl   $0x0,-0x61a94(%rbp)
cmpl   $0x186a0,-0x61a94(%rbp)
jge    11a7 <main+0x67>
mov    $0x0,%al
call   1060 <rand@plt>
mov    %eax,%ecx
movslq -0x61a94(%rbp),%rax
mov    %ecx,-0x61a90(%rbp,%rax,4)
mov    -0x61a94(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x61a94(%rbp)
jmp    116c <main+0x2c>
lea    -0x61a90(%rbp),%rdi
mov    $0x186a0,%esi
call   1040 <mergeSort@plt>
xor    %eax,%eax
add    $0x61aa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x61a80,%rsp
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1060 <rand@plt>
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%rbx
cmp    $0x186a0,%rbx
jne    1160 <main+0x20>
mov    %rsp,%rdi
mov    $0x186a0,%esi
call   1040 <mergeSort@plt>
xor    %eax,%eax
add    $0x61a80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca [100000 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
store i32 0, i32* %3
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 100000
br i1 %8, label %9, label %17
9: ; preds = %6
%10 = call i32 (...) @rand()
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 %12
store i32 %10, i32* %13
br label %14
14: ; preds = %9
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %6
17: ; preds = %6
%18 = getelementptr inbounds [100000 x i32], [100000 x i32]* %2, i64 0, i64 0
%19 = call i32 @mergeSort(i32* %18, i32 100000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [100000 x i32]
%2 = bitcast [100000 x i32]* %1 to i8*
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
br label %5
5: ; preds = %0, %5
%6 = phi i64 [ 0, %0 ], [ %9, %5 ]
%7 = tail call i32 (...) @rand()
%8 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 %6
store i32 %7, i32* %8
%9 = add nuw nsw i64 %6, 1
%10 = icmp eq i64 %9, 100000
br i1 %10, label %11, label %5
11: ; preds = %5
%12 = getelementptr inbounds [100000 x i32], [100000 x i32]* %1, i64 0, i64 0
%13 = call i32 @mergeSort(i32* %12, i32 100000)
ret i32 0
}
__attribute__((always_)) int pm_request_resume(struct device *dev) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.device = type opaque
define i32 @pm_request_resume(%struct.device* nocapture readnone %0) {
ret i32 0
}
/* Type definitions */
struct font {
  int dummy;
};

/* Variables and functions */
int fttextwidth(struct font *, char const *);
int fttextwidth_utf8(struct font *f, const char *s) {
  return fttextwidth(f, s);
}


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

x86 assembly (clang, -O2):
<fttextwidth_utf8>:
jmp    1030 <fttextwidth@plt>

LLVM IR (-O0):
%struct.font = type { i32 }
define i32 @fttextwidth_utf8(%struct.font* %0, i8* %1) {
%3 = alloca %struct.font*
%4 = alloca i8*
store %struct.font* %0, %struct.font** %3
store i8* %1, i8** %4
%5 = load %struct.font*, %struct.font** %3
%6 = load i8*, i8** %4
%7 = call i32 @fttextwidth(%struct.font* %5, i8* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.font = type { i32 }
define i32 @fttextwidth_utf8(%struct.font* %0, i8* %1) {
%3 = tail call i32 @fttextwidth(%struct.font* %0, i8* %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int const, int const, int const);
void output_color(const int r, const int g, const int b) {
  printf("%d %d %d ", r, g, b);
}


x86 assembly (clang, -O0):
<output_color>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xecf(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [10 x i8] c"%d %d %d \00"
define void @output_color(i32 %0, i32 %1, i32 %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2)
ret void
}
unsigned test8(unsigned x) {
  return ((x & 0x0000FF00) << 8) | ((x & 0xFF000000) >> 24);
}


x86 assembly (clang, -O0):
<test8>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0xff00,%eax
shl    $0x8,%eax
mov    -0x4(%rbp),%ecx
and    $0xff000000,%ecx
shr    $0x18,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test8>:
mov    %edi,%eax
rol    $0x8,%eax
and    $0xff00ff,%eax
ret

LLVM IR (-O0):
define i32 @test8(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 65280
%5 = shl i32 %4, 8
%6 = load i32, i32* %2
%7 = and i32 %6, -16777216
%8 = lshr i32 %7, 24
%9 = or i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test8(i32 %0) {
%2 = shl i32 %0, 8
%3 = and i32 %2, 16711680
%4 = lshr i32 %0, 24
%5 = or i32 %3, %4
ret i32 %5
}
double SqrDiff(double x, double y) { return (x - y) * (x - y); }


x86 assembly (clang, -O0):
<SqrDiff>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<SqrDiff>:
subsd  %xmm1,%xmm0
mulsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @SqrDiff(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = load double, double* %4
%7 = fsub double %5, %6
%8 = load double, double* %3
%9 = load double, double* %4
%10 = fsub double %8, %9
%11 = fmul double %7, %10
ret double %11
}

LLVM IR (-O2):
define double @SqrDiff(double %0, double %1) {
%3 = fsub double %0, %1
%4 = fmul double %3, %3
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ val;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ murmur3_final(int /*<<< orphan*/, int);
int /*<<< orphan*/ murmur3_update(int /*<<< orphan*/, int /*<<< orphan*/);
uint32_t murmur3_u32(uint32_t hash, uint32_t val) {
  hash = murmur3_update(hash, val);
  return murmur3_final(hash, sizeof(val));
}


x86 assembly (clang, -O0):
<murmur3_u32>:
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 <murmur3_update@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x4,%esi
call   1040 <murmur3_final@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<murmur3_u32>:
push   %rax
call   1030 <murmur3_update@plt>
mov    %eax,%edi
mov    $0x4,%esi
pop    %rax
jmp    1040 <murmur3_final@plt>

LLVM IR (-O0):
define i32 @murmur3_u32(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 @murmur3_update(i32 %5, i32 %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = call i32 @murmur3_final(i32 %8, i32 4)
ret i32 %9
}

LLVM IR (-O2):
define i32 @murmur3_u32(i32 %0, i32 %1) {
%3 = tail call i32 @murmur3_update(i32 %0, i32 %1)
%4 = tail call i32 @murmur3_final(i32 %3, i32 4)
ret i32 %4
}
_Bool __evil_rand_bool(void) { return __evil_rand_range(0, 2) == 1; }


x86 assembly (clang, -O0):
<__evil_rand_bool>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
mov    $0x2,%esi
mov    $0x0,%al
call   1030 <__evil_rand_range@plt>
cmp    $0x1,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<__evil_rand_bool>:
push   %rax
xor    %edi,%edi
mov    $0x2,%esi
xor    %eax,%eax
call   1030 <__evil_rand_range@plt>
cmp    $0x1,%eax
sete   %al
pop    %rcx
ret

LLVM IR (-O0):
define zeroext i1 @__evil_rand_bool() {
%1 = call i32 (i32, i32, ...) bitcast (i32 (...)* @__evil_rand_range to i32 (i32, i32, ...)*)(i32 0, i32 2)
%2 = icmp eq i32 %1, 1
ret i1 %2
}

LLVM IR (-O2):
define zeroext i1 @__evil_rand_bool() {
%1 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @__evil_rand_range to i32 (i32, i32, ...)*)(i32 0, i32 2)
%2 = icmp eq i32 %1, 1
ret i1 %2
}
/* Variables and functions */
int /*<<< orphan*/ clear_io_bit(int, int);
void TOSH_CLR_UART_TXD0_PIN() { clear_io_bit(0x70, 1); }


x86 assembly (clang, -O0):
<TOSH_CLR_UART_TXD0_PIN>:
push   %rbp
mov    %rsp,%rbp
mov    $0x70,%edi
mov    $0x1,%esi
call   1030 <clear_io_bit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<TOSH_CLR_UART_TXD0_PIN>:
mov    $0x70,%edi
mov    $0x1,%esi
jmp    1030 <clear_io_bit@plt>

LLVM IR (-O0):
define void @TOSH_CLR_UART_TXD0_PIN() {
%1 = call i32 @clear_io_bit(i32 112, i32 1)
ret void
}

LLVM IR (-O2):
define void @TOSH_CLR_UART_TXD0_PIN() {
%1 = tail call i32 @clear_io_bit(i32 112, i32 1)
ret void
}
unsigned host_to_le32(unsigned n) { return n; }


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

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

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

LLVM IR (-O2):
define i32 @host_to_le32(i32 returned %0) {
ret i32 %0
}
/* Type definitions */
typedef int int64_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ stderr;
void error_not_tuple(int64_t val) {
  fprintf(stderr, "expected a tuple: %#010x\n", val);
  exit(1);
}


x86 assembly (clang, -O0):
<error_not_tuple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
lea    0xec2(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_not_tuple>:
push   %rax
mov    %edi,%edx
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [26 x i8] c"expected a tuple: %x\0A\00"
define void @error_not_tuple(i32 %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i32 %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ outb(int, int);
int /*<<< orphan*/ vbe_outw(int, int);
void vga_prep_init(void) {
  outb(0x3c0, 0x00);
  vbe_outw(0x4, 0x00);
}


x86 assembly (clang, -O0):
<vga_prep_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3c0,%edi
xor    %esi,%esi
call   1040 <outb@plt>
mov    $0x4,%edi
xor    %esi,%esi
call   1030 <vbe_outw@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<vga_prep_init>:
push   %rax
mov    $0x3c0,%edi
xor    %esi,%esi
call   1040 <outb@plt>
mov    $0x4,%edi
xor    %esi,%esi
pop    %rax
jmp    1030 <vbe_outw@plt>

LLVM IR (-O0):
define void @vga_prep_init() {
%1 = call i32 @outb(i32 960, i32 0)
%2 = call i32 @vbe_outw(i32 4, i32 0)
ret void
}

LLVM IR (-O2):
define void @vga_prep_init() {
%1 = tail call i32 @outb(i32 960, i32 0)
%2 = tail call i32 @vbe_outw(i32 4, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void hm_u64_int_entry_destroy(void *entry) { free(entry); }


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

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

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

LLVM IR (-O2):
define void @hm_u64_int_entry_destroy(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void printDoubleArray(double *x, int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%f:", x[i]);
}


x86 assembly (clang, -O0):
<printDoubleArray>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1159 <printDoubleArray+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printDoubleArray+0x16>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f:\00"
define void @printDoubleArray(double* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds double, double* %0, i64 %7
%9 = load double, double* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
int linearSearch(const int array[], int key, int size) {
  int n;
  for (n = 0; n < size; ++n) {
    if (array[n] == key) {
      return n;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<linearSearch>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1153 <linearSearch+0x53>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
cmp    -0x14(%rbp),%eax
jne    1140 <linearSearch+0x40>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115a <linearSearch+0x5a>
jmp    1145 <linearSearch+0x45>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1115 <linearSearch+0x15>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<linearSearch>:
mov    $0xffffffff,%eax
test   %edx,%edx
jle    111e <linearSearch+0x1e>
mov    %edx,%edx
xor    %ecx,%ecx
nopl   (%rax)
cmp    %esi,(%rdi,%rcx,4)
je     111f <linearSearch+0x1f>
add    $0x1,%rcx
cmp    %rcx,%rdx
jne    1110 <linearSearch+0x10>
ret
mov    %ecx,%eax
ret

LLVM IR (-O0):
define i32 @linearSearch(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
store i32 0, i32* %8
br label %9
9: ; preds = %24, %3
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %27
13: ; preds = %9
%14 = load i32*, i32** %5
%15 = load i32, i32* %8
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %14, i64 %16
%18 = load i32, i32* %17
%19 = load i32, i32* %6
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %23
21: ; preds = %13
%22 = load i32, i32* %8
store i32 %22, i32* %4
br label %28
23: ; preds = %13
br label %24
24: ; preds = %23
%25 = load i32, i32* %8
%26 = add nsw i32 %25, 1
store i32 %26, i32* %8
br label %9
27: ; preds = %9
store i32 -1, i32* %4
br label %28
28: ; preds = %27, %21
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @linearSearch(i32* nocapture %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %7
7: ; preds = %5, %12
%8 = phi i64 [ 0, %5 ], [ %13, %12 ]
%9 = getelementptr inbounds i32, i32* %0, i64 %8
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, %1
br i1 %11, label %15, label %12
12: ; preds = %7
%13 = add nuw nsw i64 %8, 1
%14 = icmp eq i64 %13, %6
br i1 %14, label %17, label %7
15: ; preds = %7
%16 = trunc i64 %8 to i32
br label %17
17: ; preds = %12, %15, %3
%18 = phi i32 [ -1, %3 ], [ %16, %15 ], [ -1, %12 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ mbedtls_sha256(unsigned char const *, size_t,
                                  unsigned char *, int /*<<< orphan*/);
void sha256_wrap(const unsigned char *input, size_t ilen,
                 unsigned char *output) {
  mbedtls_sha256(input, ilen, output, 0);
}


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

x86 assembly (clang, -O2):
<sha256_wrap>:
xor    %ecx,%ecx
jmp    1030 <mbedtls_sha256@plt>

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

LLVM IR (-O2):
define void @sha256_wrap(i8* %0, i64 %1, i8* %2) {
%4 = tail call i32 @mbedtls_sha256(i8* %0, i64 %1, i8* %2, i32 0)
ret void
}
bar(int a, int b) {
  if (a + b == a)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1125 <bar+0x25>
movl   $0x1,-0x4(%rbp)
jmp    112c <bar+0x2c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
xor    %eax,%eax
test   %esi,%esi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @bar(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
char foo(char *);
int main(void) {
  if (foo("xy") != 'y')
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <foo@plt>
movsbl %al,%eax
cmp    $0x79,%eax
je     115e <main+0x2e>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <foo@plt>
cmp    $0x79,%al
jne    1148 <main+0x18>
xor    %edi,%edi
call   1050 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"xy\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call signext i8 @foo(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = sext i8 %2 to i32
%4 = icmp ne i32 %3, 121
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 (...) @abort()
unreachable
7: ; preds = %0
%8 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"xy\00"
define i32 @main() {
%1 = tail call signext i8 @foo(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8 %1, 121
br i1 %2, label %5, label %3
3: ; preds = %0
%4 = tail call i32 (...) @abort()
unreachable
5: ; preds = %0
%6 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ disp_zoom(int, int);
void cmd_zoom_in(int argc, const char **argv) { disp_zoom(1, 1); }


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

x86 assembly (clang, -O2):
<cmd_zoom_in>:
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <disp_zoom@plt>

LLVM IR (-O0):
define void @cmd_zoom_in(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @disp_zoom(i32 1, i32 1)
ret void
}

LLVM IR (-O2):
define void @cmd_zoom_in(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @disp_zoom(i32 1, i32 1)
ret void
}
/* Variables and functions */
int main_entry(int, int);
int func(int a, int b) { return main_entry(a, b); }


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

x86 assembly (clang, -O2):
<func>:
jmp    1030 <main_entry@plt>

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

LLVM IR (-O2):
define i32 @func(i32 %0, i32 %1) {
%3 = tail call i32 @main_entry(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ htobe16(int /*<<< orphan*/);
void knot_wire_write_u16(uint8_t *pos, uint16_t data) {
  *(uint16_t *)pos = htobe16(data);
}


x86 assembly (clang, -O0):
<knot_wire_write_u16>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <htobe16@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<knot_wire_write_u16>:
push   %rbx
mov    %rdi,%rbx
mov    %esi,%edi
call   1030 <htobe16@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @knot_wire_write_u16(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @htobe16(i32 %1)
store i32 %3, i32* %0
ret void
}
int SM_ctl(int channel, int cmd, void *ptr) { return -2; }


x86 assembly (clang, -O0):
<SM_ctl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0xfffffffe,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @SM_ctl(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
ret i32 -2
}

LLVM IR (-O2):
define i32 @SM_ctl(i32 %0, i32 %1, i8* nocapture readnone %2) {
ret i32 -2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *);
void print_hello(const char *s) { printf("hello: %s\n", s); }


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

x86 assembly (clang, -O2):
<print_hello>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [11 x i8] c"hello: %s\0A\00"
define void @print_hello(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
unsigned char Read_MFRC522(int);
int /*<<< orphan*/ Write_MFRC522(int, int);
int /*<<< orphan*/ bcm2835_delay(int);
void MFRC522_Reset(void) {
  unsigned char val;
  Write_MFRC522(0x01, 0x0F);
  bcm2835_delay(50);
  do {
    val = Read_MFRC522(0x01);
  } while (val & 0b00010000 > 0);
}


x86 assembly (clang, -O0):
<MFRC522_Reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x1,%edi
mov    $0xf,%esi
call   1050 <Write_MFRC522@plt>
mov    $0x32,%edi
call   1040 <bcm2835_delay@plt>
mov    $0x1,%edi
call   1030 <Read_MFRC522@plt>
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
jne    1151 <MFRC522_Reset+0x21>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<MFRC522_Reset>:
push   %rax
mov    $0x1,%edi
mov    $0xf,%esi
call   1050 <Write_MFRC522@plt>
mov    $0x32,%edi
call   1040 <bcm2835_delay@plt>
nopw   0x0(%rax,%rax,1)
mov    $0x1,%edi
call   1030 <Read_MFRC522@plt>
test   $0x1,%al
jne    1150 <MFRC522_Reset+0x20>
pop    %rax
ret

LLVM IR (-O0):
define void @MFRC522_Reset() {
%1 = alloca i8
%2 = call i32 @Write_MFRC522(i32 1, i32 15)
%3 = call i32 @bcm2835_delay(i32 50)
br label %4
4: ; preds = %6, %0
%5 = call zeroext i8 @Read_MFRC522(i32 1)
store i8 %5, i8* %1
br label %6
6: ; preds = %4
%7 = load i8, i8* %1
%8 = zext i8 %7 to i32
%9 = and i32 %8, 1
%10 = icmp ne i32 %9, 0
br i1 %10, label %4, label %11
11: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @MFRC522_Reset() {
%1 = tail call i32 @Write_MFRC522(i32 1, i32 15)
%2 = tail call i32 @bcm2835_delay(i32 50)
br label %3
3: ; preds = %3, %0
%4 = tail call zeroext i8 @Read_MFRC522(i32 1)
%5 = and i8 %4, 1
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %3
7: ; preds = %3
ret void
}
void whereami(void) {}


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

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

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

LLVM IR (-O2):
define void @whereami() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
void set_tweak_in_tweakey(uint8_t *tweakey, uint8_t *tweak) {
  memcpy(tweakey + 8, tweak, 8);
}


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

x86 assembly (clang, -O2):
<set_tweak_in_tweakey>:
add    $0x20,%rdi
mov    $0x8,%edx
jmp    1030 <memcpy@plt>

LLVM IR (-O0):
define void @set_tweak_in_tweakey(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 = getelementptr inbounds i32, i32* %5, i64 8
%7 = load i32*, i32** %4
%8 = call i32 @memcpy(i32* %6, i32* %7, i32 8)
ret void
}

LLVM IR (-O2):
define void @set_tweak_in_tweakey(i32* %0, i32* %1) {
%3 = getelementptr inbounds i32, i32* %0, i64 8
%4 = tail call i32 @memcpy(i32* %3, i32* %1, i32 8)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *name) {
  fprintf(stderr,
          "Usage: %s [-e|-d] [-s sector_size] [-o output_file]"
          "[-i input file] -k encryption_key\n",
          name);
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s [-e|-d] [-s sector_size] [-o output_file][-i input file] -k encryption_key\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [86 x i8] c"Usage: %s [-e|-d] [-s sector_size] [-o output_file][-i input file] -k encryption_key\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([86 x i8], [86 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
int gdt_compare_schar(const void *p1, const void *p2) {
  signed char c1 = *((signed char *)p1);
  signed char c2 = *((signed char *)p2);
  if (c1 < c2) {
    return -1;
  } else if (c1 > c2) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<gdt_compare_schar>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x1a(%rbp)
movsbl -0x19(%rbp),%eax
movsbl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
jge    113a <gdt_compare_schar+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    115d <gdt_compare_schar+0x5d>
movsbl -0x19(%rbp),%eax
movsbl -0x1a(%rbp),%ecx
cmp    %ecx,%eax
jle    1156 <gdt_compare_schar+0x56>
movl   $0x1,-0x4(%rbp)
jmp    115d <gdt_compare_schar+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdt_compare_schar>:
mov    (%rdi),%al
xor    %ecx,%ecx
cmp    (%rsi),%al
setg   %cl
mov    $0xffffffff,%eax
cmovge %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @gdt_compare_schar(i8* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %0
%4 = load i8, i8* %1
%5 = icmp slt i8 %3, %4
%6 = icmp sgt i8 %3, %4
%7 = zext i1 %6 to i32
%8 = select i1 %5, i32 -1, i32 %7
ret i32 %8
}
extern int __get_adc_mode(void) { return 255; }


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

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

LLVM IR (-O0):
define i32 @__get_adc_mode() {
ret i32 255
}

LLVM IR (-O2):
define i32 @__get_adc_mode() {
ret i32 255
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *);
int /*<<< orphan*/ debug_flush();
int /*<<< orphan*/ hal_adc_init();
void adc_init(void) {
  debug("adc: init\n");
  debug_flush();
  hal_adc_init();
}


x86 assembly (clang, -O0):
<adc_init>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1040 <debug@plt>
mov    $0x0,%al
call   1030 <debug_flush@plt>
mov    $0x0,%al
call   1050 <hal_adc_init@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<adc_init>:
push   %rax
lea    0xec8(%rip),%rdi
call   1040 <debug@plt>
xor    %eax,%eax
call   1030 <debug_flush@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <hal_adc_init@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"adc: init\0A\00"
define void @adc_init() {
%1 = call i32 @debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @debug_flush()
%3 = call i32 (...) @hal_adc_init()
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"adc: init\0A\00"
define void @adc_init() {
%1 = tail call i32 @debug(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @debug_flush()
%3 = tail call i32 (...) @hal_adc_init()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ executeApplescriptToGetInt(char *, char *, int *);
int getVolume() {
  int volume = 0;
  executeApplescriptToGetInt("iTunes", "sound volume as integer", &volume);
  return volume;
}


x86 assembly (clang, -O0):
<getVolume>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    0xeda(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1030 <executeApplescriptToGetInt@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getVolume>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee0(%rip),%rdi
lea    0xee0(%rip),%rsi
lea    0x4(%rsp),%rdx
call   1030 <executeApplescriptToGetInt@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"iTunes\00"
@.str.1 = [24 x i8] c"sound volume as integer\00"
define i32 @getVolume() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @executeApplescriptToGetInt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@.str = [7 x i8] c"iTunes\00"
@.str.1 = [24 x i8] c"sound volume as integer\00"
define i32 @getVolume() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = call i32 @executeApplescriptToGetInt(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void show_version() { printf("Version - %s\n", "No version"); }


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

x86 assembly (clang, -O2):
<show_version>:
lea    0xee9(%rip),%rdi
lea    0xef0(%rip),%rsi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [14 x i8] c"Version - %s\0A\00"
@.str.1 = [11 x i8] c"No version\00"
define void @show_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"Version - %s\0A\00"
@.str.1 = [11 x i8] c"No version\00"
define void @show_version() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
ret void
}