xunge/DecIR huggingface dataset:
unsigned char read_byte(const unsigned char **src) {
  assert(src);
  assert(*src);
  unsigned char value = **src;
  (*src)++;
  return value;
}


x86 assembly (clang, -O0):
<read_byte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x0,%al
call   1030 <assert@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0x1,%rcx
mov    %rcx,(%rax)
movzbl -0x9(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_byte>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <assert@plt>
mov    (%rbx),%rdi
xor    %eax,%eax
call   1030 <assert@plt>
mov    (%rbx),%rcx
mov    (%rcx),%al
add    $0x1,%rcx
mov    %rcx,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define zeroext i8 @read_byte(i8** %0) {
%2 = alloca i8**
%3 = alloca i8
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = call i32 (i8**, ...) bitcast (i32 (...)* @assert to i32 (i8**, ...)*)(i8** %4)
%6 = load i8**, i8*** %2
%7 = load i8*, i8** %6
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %7)
%9 = load i8**, i8*** %2
%10 = load i8*, i8** %9
%11 = load i8, i8* %10
store i8 %11, i8* %3
%12 = load i8**, i8*** %2
%13 = load i8*, i8** %12
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %12
%15 = load i8, i8* %3
ret i8 %15
}

LLVM IR (-O2):
define zeroext i8 @read_byte(i8** %0) {
%2 = tail call i32 (i8**, ...) bitcast (i32 (...)* @assert to i32 (i8**, ...)*)(i8** %0)
%3 = load i8*, i8** %0
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @assert to i32 (i8*, ...)*)(i8* %3)
%5 = load i8*, i8** %0
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %5, i64 1
store i8* %7, i8** %0
ret i8 %6
}
void clear_bit(int nr, volatile void *addr) {
  asm volatile(""
               "btrl %1,%0"
               : "=m"((*(volatile long *)addr))
               : "Ir"(nr), "m"((*(volatile long *)addr))
               : "memory");
}


x86 assembly (clang, -O0):
<clear_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
mov    -0x10(%rbp),%rdx
btr    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_bit>:
btr    %edi,(%rsi)
ret

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

LLVM IR (-O2):
define void @clear_bit(i32 %0, i8* %1) {
%3 = bitcast i8* %1 to i64*
tail call void asm sideeffect "btrl $1,$0", "=*m,Ir,*m,~{memory},~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %3, i32 %0, i64* elementtype(i64) %3)
ret void
}
/* Variables and functions */
unsigned long strtoul(char const *, char **, int);
unsigned long c_strtoul(const char *nptr, char **endptr, int base) {
  return strtoul(nptr, endptr, base);
}


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

x86 assembly (clang, -O2):
<c_strtoul>:
jmp    1030 <strtoul@plt>

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

LLVM IR (-O2):
define i64 @c_strtoul(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtoul(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
int /*<<< orphan*/ scroll_output_win(int);
void scroll_page(uint8_t dir) {
  if (dir == 1) {
    scroll_output_win(25);
  } else if (dir == 0) {
    scroll_output_win(-25);
  }
}


x86 assembly (clang, -O0):
<scroll_page>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    1134 <scroll_page+0x24>
mov    $0x19,%edi
call   1030 <scroll_output_win@plt>
jmp    114d <scroll_page+0x3d>
cmpl   $0x0,-0x4(%rbp)
jne    1148 <scroll_page+0x38>
mov    $0xffffffe7,%edi
call   1030 <scroll_output_win@plt>
jmp    114d <scroll_page+0x3d>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<scroll_page>:
cmp    $0x1,%edi
je     1123 <scroll_page+0x13>
test   %edi,%edi
jne    112d <scroll_page+0x1d>
mov    $0xffffffe7,%edi
jmp    1030 <scroll_output_win@plt>
mov    $0x19,%edi
jmp    1030 <scroll_output_win@plt>
ret

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

LLVM IR (-O2):
define void @scroll_page(i32 %0) {
switch i32 %0, label %6 [
i32 1, label %3
i32 0, label %2
]
2: ; preds = %1
br label %3
3: ; preds = %1, %2
%4 = phi i32 [ -25, %2 ], [ 25, %1 ]
%5 = tail call i32 @scroll_output_win(i32 %4)
br label %6
6: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ UART1_Write_Text(char *);
void serial_write_text(char *text) { UART1_Write_Text(text); }


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

x86 assembly (clang, -O2):
<serial_write_text>:
jmp    1030 <UART1_Write_Text@plt>

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

LLVM IR (-O2):
define void @serial_write_text(i8* %0) {
%2 = tail call i32 @UART1_Write_Text(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(void *);
void __attribute__((noreturn)) thread_exit(void *value) { pthread_exit(value); }


x86 assembly (clang, -O0):
<thread_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <pthread_exit@plt>

x86 assembly (clang, -O2):
<thread_exit>:
push   %rax
call   1030 <pthread_exit@plt>

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

LLVM IR (-O2):
define void @thread_exit(i8* %0) {
%2 = tail call i32 @pthread_exit(i8* %0)
unreachable
}
int __attribute__((target("arch=icelake-server"))) foo(void) { return 7; }


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

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

LLVM IR (-O0):
define i32 @foo() {
ret i32 7
}

LLVM IR (-O2):
define i32 @foo() {
ret i32 7
}
/* Variables and functions */
short sin(short);
short internal_sin_s(short value) { return sin(value); }


x86 assembly (clang, -O0):
<internal_sin_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%ax
movswl %ax,%edi
call   1030 <sin@plt>
cwtl
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<internal_sin_s>:
jmp    1030 <sin@plt>

LLVM IR (-O0):
define signext i16 @internal_sin_s(i16 signext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = call signext i16 @sin(i16 signext %3)
ret i16 %4
}

LLVM IR (-O2):
define signext i16 @internal_sin_s(i16 signext %0) {
%2 = tail call signext i16 @sin(i16 signext %0)
ret i16 %2
}
/* Type definitions */
struct wl_surface {
  int dummy;
};
struct wl_proxy {
  int dummy;
};
typedef int /*<<< orphan*/ int32_t;

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_marshal(struct wl_proxy *, int, int /*<<< orphan*/);
void wl_surface_set_buffer_scale(struct wl_surface *wl_surface, int32_t scale) {
  wl_proxy_marshal((struct wl_proxy *)wl_surface, 8, scale);
}


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

x86 assembly (clang, -O2):
<wl_surface_set_buffer_scale>:
mov    %esi,%edx
mov    $0x8,%esi
jmp    1030 <wl_proxy_marshal@plt>

LLVM IR (-O0):
%struct.wl_surface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_set_buffer_scale(%struct.wl_surface* %0, i32 %1) {
%3 = alloca %struct.wl_surface*
%4 = alloca i32
store %struct.wl_surface* %0, %struct.wl_surface** %3
store i32 %1, i32* %4
%5 = load %struct.wl_surface*, %struct.wl_surface** %3
%6 = bitcast %struct.wl_surface* %5 to %struct.wl_proxy*
%7 = load i32, i32* %4
%8 = call i32 @wl_proxy_marshal(%struct.wl_proxy* %6, i32 8, i32 %7)
ret void
}

LLVM IR (-O2):
%struct.wl_surface = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_surface_set_buffer_scale(%struct.wl_surface* %0, i32 %1) {
%3 = bitcast %struct.wl_surface* %0 to %struct.wl_proxy*
%4 = tail call i32 @wl_proxy_marshal(%struct.wl_proxy* %3, i32 8, i32 %1)
ret void
}
/* Variables and functions */
int d01(int);
int d02(int a) { return d01(d01(a)); }


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

x86 assembly (clang, -O2):
<d02>:
push   %rax
call   1030 <d01@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <d01@plt>

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

LLVM IR (-O2):
define i32 @d02(i32 %0) {
%2 = tail call i32 @d01(i32 %0)
%3 = tail call i32 @d01(i32 %2)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ do_add();
scalar_t__ do_sum();
double do_some_work(int iter) {
  double sum = 0.0;
  if (iter > 0)
    sum += do_some_work(iter - 1);
  do_add();
  sum += do_sum();
  return sum;
}


x86 assembly (clang, -O0):
<do_some_work>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1162 <do_some_work+0x32>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
call   1050 <do_some_work@plt>
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    $0x0,%al
call   1030 <do_add@plt>
mov    $0x0,%al
call   1040 <do_sum@plt>
cvtsi2sd %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_some_work>:
push   %rax
test   %edi,%edi
jle    114c <do_some_work+0x1c>
add    $0xffffffff,%edi
call   1050 <do_some_work@plt>
xorpd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
jmp    1155 <do_some_work+0x25>
xorpd  %xmm0,%xmm0
movsd  %xmm0,(%rsp)
xor    %eax,%eax
call   1030 <do_add@plt>
xor    %eax,%eax
call   1040 <do_sum@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @do_some_work(i32 %0) {
%2 = alloca i32
%3 = alloca double
store i32 %0, i32* %2
store double 0.000000e+00, double* %3
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %2
%8 = sub nsw i32 %7, 1
%9 = call double @do_some_work(i32 %8)
%10 = load double, double* %3
%11 = fadd double %10, %9
store double %11, double* %3
br label %12
12: ; preds = %6, %1
%13 = call i32 (...) @do_add()
%14 = call i64 (...) @do_sum()
%15 = sitofp i64 %14 to double
%16 = load double, double* %3
%17 = fadd double %16, %15
store double %17, double* %3
%18 = load double, double* %3
ret double %18
}

LLVM IR (-O2):
define double @do_some_work(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = add nsw i32 %0, -1
%5 = tail call double @do_some_work(i32 %4)
%6 = fadd double %5, 0.000000e+00
br label %7
7: ; preds = %3, %1
%8 = phi double [ %6, %3 ], [ 0.000000e+00, %1 ]
%9 = tail call i32 (...) @do_add()
%10 = tail call i64 (...) @do_sum()
%11 = sitofp i64 %10 to double
%12 = fadd double %8, %11
ret double %12
}
void send_char_by_UART(char c) {}


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

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

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

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

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
FILE *UTIL_fopenW(char *filename) {
  FILE *filePtr = fopen(filename, "w");
  if (filePtr)
    return filePtr;
  printf("Error : cannot open output file %s\n", filename);
  exit(1);
}


x86 assembly (clang, -O0):
<UTIL_fopenW>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1165 <UTIL_fopenW+0x35>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret
mov    -0x8(%rbp),%rsi
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<UTIL_fopenW>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rsi
call   1040 <fopen@plt>
test   %rax,%rax
je     1147 <UTIL_fopenW+0x17>
pop    %rbx
ret
lea    0xeb4(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [36 x i8] c"Error : cannot open output file %s\0A\00"
define i32* @UTIL_fopenW(i8* %0) {
%2 = alloca i8*
%3 = alloca i32*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32* @fopen(i8* %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %5, i32** %3
%6 = load i32*, i32** %3
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32*, i32** %3
ret i32* %9
10: ; preds = %1
%11 = load i8*, i8** %2
%12 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [36 x i8] c"Error : cannot open output file %s\0A\00"
define noalias i32* @UTIL_fopenW(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
ret i32* %2
5: ; preds = %1
%6 = tail call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: comm [-123f] file1 file2\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"usage: comm [-123f] file1 file2\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"usage: comm [-123f] file1 file2\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
int fun948() { return 948; }


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

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

LLVM IR (-O0):
define i32 @fun948() {
ret i32 948
}

LLVM IR (-O2):
define i32 @fun948() {
ret i32 948
}
/* Variables and functions */
unsigned char *xsalsa8poly1305_encrypt(unsigned char *, size_t *,
                                       unsigned char const *, size_t,
                                       unsigned char const *,
                                       unsigned char const *);
unsigned char *crypt_encrypt_xsalsa8poly1305(
    unsigned char *out, size_t *out_len, const unsigned char *in, size_t in_len,
    const unsigned char *nonce, const unsigned char *key) {
  return xsalsa8poly1305_encrypt(out, out_len, in, in_len, nonce, key);
}


x86 assembly (clang, -O0):
<crypt_encrypt_xsalsa8poly1305>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
mov    -0x30(%rbp),%r9
call   1030 <xsalsa8poly1305_encrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypt_encrypt_xsalsa8poly1305>:
jmp    1030 <xsalsa8poly1305_encrypt@plt>

LLVM IR (-O0):
define i8* @crypt_encrypt_xsalsa8poly1305(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i64*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
store i8* %0, i8** %7
store i64* %1, i64** %8
store i8* %2, i8** %9
store i64 %3, i64* %10
store i8* %4, i8** %11
store i8* %5, i8** %12
%13 = load i8*, i8** %7
%14 = load i64*, i64** %8
%15 = load i8*, i8** %9
%16 = load i64, i64* %10
%17 = load i8*, i8** %11
%18 = load i8*, i8** %12
%19 = call i8* @xsalsa8poly1305_encrypt(i8* %13, i64* %14, i8* %15, i64 %16, i8* %17, i8* %18)
ret i8* %19
}

LLVM IR (-O2):
define i8* @crypt_encrypt_xsalsa8poly1305(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5) {
%7 = tail call i8* @xsalsa8poly1305_encrypt(i8* %0, i64* %1, i8* %2, i64 %3, i8* %4, i8* %5)
ret i8* %7
}
int switch_cond(int x) {
  switch (__builtin_expect(x, 5)) {
  default:
    return 0;
  case 0:
  case 1:
  case 2:
    return 1;
  case 5:
    return 5;
  };
  return 0;
}


x86 assembly (clang, -O0):
<switch_cond>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movslq -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
sub    $0x3,%rax
jb     113d <switch_cond+0x3d>
jmp    111e <switch_cond+0x1e>
mov    -0x10(%rbp),%rax
sub    $0x5,%rax
je     1149 <switch_cond+0x49>
jmp    1131 <switch_cond+0x31>
movl   $0x0,-0x4(%rbp)
jmp    1150 <switch_cond+0x50>
movl   $0x1,-0x4(%rbp)
jmp    1150 <switch_cond+0x50>
movl   $0x5,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<switch_cond>:
xor    %eax,%eax
cmp    $0x5,%edi
ja     1114 <switch_cond+0x14>
movslq %edi,%rax
lea    0xeef(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret

LLVM IR (-O0):
define i32 @switch_cond(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = sext i32 %4 to i64
switch i64 %5, label %6 [
i64 0, label %7
i64 1, label %7
i64 2, label %7
i64 5, label %8
]
6: ; preds = %1
store i32 0, i32* %2
br label %9
7: ; preds = %1, %1, %1
store i32 1, i32* %2
br label %9
8: ; preds = %1
store i32 5, i32* %2
br label %9
9: ; preds = %8, %7, %6
%10 = load i32, i32* %2
ret i32 %10
}

LLVM IR (-O2):
@switch.table.switch_cond = [6 x i32] [i32 1, i32 1, i32 1, i32 0, i32 0, i32 5]
define i32 @switch_cond(i32 %0) {
%2 = icmp ult i32 %0, 6
br i1 %2, label %3, label %7
3: ; preds = %1
%4 = sext i32 %0 to i64
%5 = getelementptr inbounds [6 x i32], [6 x i32]* @switch.table.switch_cond, i64 0, i64 %4
%6 = load i32, i32* %5
br label %7
7: ; preds = %3, %1
%8 = phi i32 [ 0, %1 ], [ %6, %3 ]
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *);
void Jump_Ret(void) { Inst_Printf("jmp", "*%%rax"); }


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

x86 assembly (clang, -O2):
<Jump_Ret>:
lea    0xee9(%rip),%rdi
lea    0xee6(%rip),%rsi
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"jmp\00"
@.str.1 = [7 x i8] c"*%%rax\00"
define void @Jump_Ret() {
%1 = call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"jmp\00"
@.str.1 = [7 x i8] c"*%%rax\00"
define void @Jump_Ret() {
%1 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *prog) {
  fprintf(stderr, "Usage: %s FileName HashTabSize\n", prog);
  exit(1);
}


x86 assembly (clang, -O0):
<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):
<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 = [32 x i8] c"Usage: %s FileName HashTabSize\0A\00"
define void @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 ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [32 x i8] c"Usage: %s FileName HashTabSize\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int syscall(int, int, char const *);
int fremovexattr(int fd, const char *name) { return syscall(237, fd, name); }


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

x86 assembly (clang, -O2):
<fremovexattr>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0xed,%edi
jmp    1030 <syscall@plt>

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

LLVM IR (-O2):
define i32 @fremovexattr(i32 %0, i8* %1) {
%3 = tail call i32 @syscall(i32 237, i32 %0, i8* %1)
ret i32 %3
}
void free(void *addr) {
  int (*func)(int *) = (int (*)(int *))0x08000B61;
  func(addr);
}


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

x86 assembly (clang, -O2):
<free>:
mov    $0x8000b61,%eax
jmp    *%rax

LLVM IR (-O0):
define void @free(i8* %0) {
%2 = alloca i8*
%3 = alloca i32 (i32*)*
store i8* %0, i8** %2
store i32 (i32*)* inttoptr (i64 134220641 to i32 (i32*)*), i32 (i32*)** %3
%4 = load i32 (i32*)*, i32 (i32*)** %3
%5 = load i8*, i8** %2
%6 = bitcast i8* %5 to i32*
%7 = call i32 %4(i32* %6)
ret void
}

LLVM IR (-O2):
define void @free(i8* %0) {
%2 = bitcast i8* %0 to i32*
%3 = tail call i32 inttoptr (i64 134220641 to i32 (i32*)*)(i32* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: idx_fqbin fqbin_file\n\n");
  exit(-1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"Usage: idx_fqbin fqbin_file\0A\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@str = [29 x i8] c"Usage: idx_fqbin fqbin_file\0A\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ realloc1();
int /*<<< orphan*/ realloc2();
int main(int argc, char *argv[]) {
  realloc1();
  realloc2();
  return 0;
}


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (...) @realloc1()
%7 = call i32 (...) @realloc2()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @realloc1()
%4 = tail call i32 (...) @realloc2()
ret i32 0
}
/* Type definitions */
typedef scalar_t__ __m64;

/* Variables and functions */
__m64 __attribute__((__always___, __nodebug__)) _mm_add_si64(__m64 a, __m64 b) {
  return a + b;
}


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

x86 assembly (clang, -O2):
<_mm_add_si64>:
lea    (%rdi,%rsi,1),%rax
ret

LLVM IR (-O0):
define i64 @_mm_add_si64(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = add nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @_mm_add_si64(i64 %0, i64 %1) {
%3 = add nsw i64 %1, %0
ret i64 %3
}
int main() {
  int foo;
  foo = 4 * 2;
  int bar = foo + 1;
  return bar;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x8,-0x8(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 8, i32* %2
%4 = load i32, i32* %2
%5 = add nsw i32 %4, 1
store i32 %5, i32* %3
%6 = load i32, i32* %3
ret i32 %6
}

LLVM IR (-O2):
define i32 @main() {
ret i32 9
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void printusage() {
  fprintf(stdout, "Usage: qethqoat [-h] [-v]\n"
                  "       qethqoat [-r] [-s scope] interface\n"
                  "       qethqoat -f file\n\n"
                  "Use qethqoat to query the OSA address table and display "
                  "physical and logical\ndevice information\n\n"
                  "-h,  --help     Displays the help information.\n"
                  "-r,  --raw      Writes raw data to stdout.\n"
                  "-f,  --file     Reads input from file.\n"
                  "-v,  --version  Prints the version number.\n"
                  "-s,  --scope    Defines the scope of the query.\n"
                  "\t  0  Query the level of the OSA address table\n"
                  "\t  1  Interface (default)\n");
}


x86 assembly (clang, -O0):
<printusage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<printusage>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
lea    0xee0(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stdout = global i32 0
@.str = [484 x i8] c"Usage: qethqoat [-h] [-v]\0A qethqoat [-r] [-s scope] interface\0A qethqoat -f file\0A\0AUse qethqoat to query the OSA address table and display physical and logical\0Adevice information\0A\0A-h, --help Displays the help information.\0A-r, --raw Writes raw data to stdout.\0A-f, --file Reads input from file.\0A-v, --version Prints the version number.\0A-s, --scope Defines the scope of the query.\0A\09 0 Query the level of the OSA address table\0A\09 1 Interface (default)\0A\00"
define void @printusage() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([484 x i8], [484 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [484 x i8] c"Usage: qethqoat [-h] [-v]\0A qethqoat [-r] [-s scope] interface\0A qethqoat -f file\0A\0AUse qethqoat to query the OSA address table and display physical and logical\0Adevice information\0A\0A-h, --help Displays the help information.\0A-r, --raw Writes raw data to stdout.\0A-f, --file Reads input from file.\0A-v, --version Prints the version number.\0A-s, --scope Defines the scope of the query.\0A\09 0 Query the level of the OSA address table\0A\09 1 Interface (default)\0A\00"
define void @printusage() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([484 x i8], [484 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int /*<<< orphan*/);
int str_has_prefix(const char *s, const char *prefix) {
  if (s == NULL || prefix == NULL)
    return 0;
  return strncmp(s, prefix, strlen(prefix)) == 0 ? 1 : 0;
}


x86 assembly (clang, -O0):
<str_has_prefix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1146 <str_has_prefix+0x26>
cmpq   $0x0,-0x18(%rbp)
jne    1152 <str_has_prefix+0x32>
movl   $0x0,-0x4(%rbp)
jmp    118e <str_has_prefix+0x6e>
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rdx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%rdx
cmove  %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_has_prefix>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     1156 <str_has_prefix+0x36>
mov    %rsi,%rbx
test   %rsi,%rsi
je     1156 <str_has_prefix+0x36>
mov    %rdi,%r14
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @str_has_prefix(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, null
%4 = icmp eq i8* %1, null
%5 = or i1 %3, %4
br i1 %5, label %11, label %6
6: ; preds = %2
%7 = tail call i32 @strlen(i8* %1)
%8 = tail call i64 @strncmp(i8* %0, i8* %1, i32 %7)
%9 = icmp eq i64 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %2, %6
%12 = phi i32 [ %10, %6 ], [ 0, %2 ]
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int menu() {
  int option = 0;
  printf("1 - Register one student\n"
         "2 - Delete last student\n"
         "3 - Class mean\n"
         "4 - Report\n"
         "5 - Reproved report\n"
         "6 - Approved report\n"
         "7 - Exit\n"
         "$ ");
  scanf("%d", &option);
  return option;
}


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

x86 assembly (clang, -O2):
<menu>:
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
lea    0xf43(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [127 x i8] c"1 - Register one student\0A2 - Delete last student\0A3 - Class mean\0A4 - Report\0A5 - Reproved report\0A6 - Approved report\0A7 - Exit\0A$ \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @menu() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}

LLVM IR (-O2):
@.str = [127 x i8] c"1 - Register one student\0A2 - Delete last student\0A3 - Class mean\0A4 - Report\0A5 - Reproved report\0A6 - Approved report\0A7 - Exit\0A$ \00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @menu() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([127 x i8], [127 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ usage(char *);
int help(int argc, char *argv[], void *__attribute__((unused)) config) {
  usage("cmail-admin-address");
  return -1;
}


x86 assembly (clang, -O0):
<help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <usage@plt>
mov    $0xffffffff,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <usage@plt>
mov    $0xffffffff,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"cmail-admin-address\00"
define i32 @help(i32 %0, i8** %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* %2, i8** %6
%7 = call i32 @usage(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}

LLVM IR (-O2):
@.str = [20 x i8] c"cmail-admin-address\00"
define i32 @help(i32 %0, i8** nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i32 @usage(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
ret i32 -1
}
void test_signess() {
  signed char a;
  signed short b;
  signed int c;
  signed long d;
  signed long long e;
  signed short int f;
  signed long int g;
  signed long long int h;
  unsigned char i;
  unsigned short j;
  unsigned int k;
  unsigned long l;
  unsigned long long m;
  unsigned short int n;
  unsigned long int o;
  unsigned long long int p;
}


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

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

LLVM IR (-O0):
define void @test_signess() {
%1 = alloca i8
%2 = alloca i16
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
%6 = alloca i16
%7 = alloca i64
%8 = alloca i64
%9 = alloca i8
%10 = alloca i16
%11 = alloca i32
%12 = alloca i64
%13 = alloca i64
%14 = alloca i16
%15 = alloca i64
%16 = alloca i64
ret void
}

LLVM IR (-O2):
define void @test_signess() {
ret void
}
int ft_is_prime(int n) {
  int i;
  i = 2;
  while (i < n) {
    if (n % i == 0)
      return (0);
    i++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<ft_is_prime>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x2,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1144 <ft_is_prime+0x44>
mov    -0x8(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cmp    $0x0,%edx
jne    1136 <ft_is_prime+0x36>
movl   $0x0,-0x4(%rbp)
jmp    114b <ft_is_prime+0x4b>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110e <ft_is_prime+0xe>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_is_prime>:
mov    $0x1,%ecx
cmp    $0x3,%edi
jl     1120 <ft_is_prime+0x20>
mov    $0x2,%esi
nop
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1123 <ft_is_prime+0x23>
add    $0x1,%esi
cmp    %esi,%edi
jne    1110 <ft_is_prime+0x10>
mov    %ecx,%eax
ret
xor    %ecx,%ecx
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_is_prime(i32 %0) {
%2 = icmp sgt i32 %0, 2
br i1 %2, label %5, label %10
3: ; preds = %5
%4 = icmp eq i32 %9, %0
br i1 %4, label %10, label %5
5: ; preds = %1, %3
%6 = phi i32 [ %9, %3 ], [ 2, %1 ]
%7 = srem i32 %0, %6
%8 = icmp eq i32 %7, 0
%9 = add nuw nsw i32 %6, 1
br i1 %8, label %10, label %3
10: ; preds = %5, %3, %1
%11 = phi i32 [ 1, %1 ], [ 1, %3 ], [ 0, %5 ]
ret i32 %11
}
/* Variables and functions */
scalar_t__ rnd_32int();
double rnd_r3(void) {
  return (((double)rnd_32int()) + 0.5) * (1.0 / 4294967296.0);
}


x86 assembly (clang, -O0):
<rnd_r3>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <rnd_32int@plt>
cvtsi2sd %rax,%xmm0
movsd  0xee0(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xecc(%rip),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rnd_r3>:
push   %rax
xor    %eax,%eax
call   1030 <rnd_32int@plt>
cvtsi2sd %rax,%xmm0
addsd  0xedb(%rip),%xmm0
mulsd  0xedb(%rip),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rnd_r3() {
%1 = call i64 (...) @rnd_32int()
%2 = sitofp i64 %1 to double
%3 = fadd double %2, 5.000000e-01
%4 = fmul double %3, 0x3DF0000000000000
ret double %4
}

LLVM IR (-O2):
define double @rnd_r3() {
%1 = tail call i64 (...) @rnd_32int()
%2 = sitofp i64 %1 to double
%3 = fadd double %2, 5.000000e-01
%4 = fmul double %3, 0x3DF0000000000000
ret double %4
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "usage: hlock [-v]\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"usage: hlock [-v]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"usage: hlock [-v]\0A\00"
@EXIT_FAILURE = global i32 0
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
/* Variables and functions */
void _out_null(char character, void *buffer, size_t idx, size_t maxlen) {
  (void)character;
  (void)buffer;
  (void)idx;
  (void)maxlen;
}


x86 assembly (clang, -O0):
<_out_null>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @_out_null(i8 signext %0, i8* nocapture %1, i64 %2, i64 %3) {
ret void
}
int test_imm_4Fint64_highword_mem(long long *val) {
  return ((*val >> 32) & (0x4F << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_4Fint64_highword_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
sar    $0x20,%rdx
and    $0x4f,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_imm_4Fint64_highword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = ashr i64 %4, 32
%6 = and i64 %5, 79
%7 = icmp ne i64 %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_4Fint64_highword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 339302416384
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void *memcpy(void *__restrict dstptr, const void *__restrict srcptr,
             size_t size) {
  abort();
  return 0;
}


x86 assembly (clang, -O0):
<memcpy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<memcpy>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i8* @memcpy(i8* noalias %0, i8* noalias %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%7 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define noalias i8* @memcpy(i8* noalias nocapture readnone %0, i8* noalias nocapture readnone %1, i64 %2) {
%4 = tail call i32 (...) @abort()
unreachable
}
void foo79() {}


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

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

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

LLVM IR (-O2):
define void @foo79() {
ret void
}
/* Variables and functions */
scalar_t__ lrint(double);
int cvRound(double value) { return (int)lrint(value); }


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

x86 assembly (clang, -O2):
<cvRound>:
jmp    1030 <lrint@plt>

LLVM IR (-O0):
define i32 @cvRound(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @lrint(double %3)
%5 = trunc i64 %4 to i32
ret i32 %5
}

LLVM IR (-O2):
define i32 @cvRound(double %0) {
%2 = tail call i64 @lrint(double %0)
%3 = trunc i64 %2 to i32
ret i32 %3
}
void debug_printf(int dp, char *format, ...) {}


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

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

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

LLVM IR (-O2):
define void @debug_printf(i32 %0, i8* nocapture %1, ...) {
ret void
}
/* Variables and functions */
int prj_find_package(char const *);
char const *prj_get_relativetarget_for(int);
const char *listReferenceDeps(const char *name) {
  int i = prj_find_package(name);
  if (i >= 0) {
    return prj_get_relativetarget_for(i);
  }
  return NULL;
}


x86 assembly (clang, -O0):
<listReferenceDeps>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <prj_find_package@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     1153 <listReferenceDeps+0x33>
mov    -0x14(%rbp),%edi
call   1030 <prj_get_relativetarget_for@plt>
mov    %rax,-0x8(%rbp)
jmp    115b <listReferenceDeps+0x3b>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<listReferenceDeps>:
push   %rax
call   1040 <prj_find_package@plt>
test   %eax,%eax
js     1132 <listReferenceDeps+0x12>
mov    %eax,%edi
pop    %rax
jmp    1030 <prj_get_relativetarget_for@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @listReferenceDeps(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @prj_find_package(i8* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp sge i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32, i32* %4
%11 = call i8* @prj_get_relativetarget_for(i32 %10)
store i8* %11, i8** %2
br label %13
12: ; preds = %1
store i8* null, i8** %2
br label %13
13: ; preds = %12, %9
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
define i8* @listReferenceDeps(i8* %0) {
%2 = tail call i32 @prj_find_package(i8* %0)
%3 = icmp sgt i32 %2, -1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i8* @prj_get_relativetarget_for(i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i8* [ %5, %4 ], [ null, %1 ]
ret i8* %7
}
/* Variables and functions */
int /*<<< orphan*/ CODESET;
int /*<<< orphan*/ nl_langinfo(int /*<<< orphan*/);
scalar_t__ norm_charmap(int /*<<< orphan*/);
char *get_charset(void) { return (char *)norm_charmap(nl_langinfo(CODESET)); }


x86 assembly (clang, -O0):
<get_charset>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
call   1030 <nl_langinfo@plt>
mov    %eax,%edi
call   1040 <norm_charmap@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_charset>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%edi
call   1030 <nl_langinfo@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <norm_charmap@plt>

LLVM IR (-O0):
@CODESET = global i32 0
define i8* @get_charset() {
%1 = load i32, i32* @CODESET
%2 = call i32 @nl_langinfo(i32 %1)
%3 = call i64 @norm_charmap(i32 %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}

LLVM IR (-O2):
@CODESET = global i32 0
define i8* @get_charset() {
%1 = load i32, i32* @CODESET
%2 = tail call i32 @nl_langinfo(i32 %1)
%3 = tail call i64 @norm_charmap(i32 %2)
%4 = inttoptr i64 %3 to i8*
ret i8* %4
}