xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint;

/* Variables and functions */
char char_code(uint c) {
  switch (c) {
  case 1:
    return 'C';
  case 2:
    return 'G';
  case 3:
    return 'A';
  case 4:
    return 'T';
  case 0:
    return 'N';
  default:
    return '?';
  }
}


x86 assembly (clang, -O0):
<char_code>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x4,%rax
ja     1159 <char_code+0x59>
mov    -0x10(%rbp),%rax
lea    0xedd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x43,-0x1(%rbp)
jmp    115d <char_code+0x5d>
movb   $0x47,-0x1(%rbp)
jmp    115d <char_code+0x5d>
movb   $0x41,-0x1(%rbp)
jmp    115d <char_code+0x5d>
movb   $0x54,-0x1(%rbp)
jmp    115d <char_code+0x5d>
movb   $0x4e,-0x1(%rbp)
jmp    115d <char_code+0x5d>
movb   $0x3f,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<char_code>:
lea    0x0(,%rdi,8),%ecx
movabs $0x544147434e,%rdx
shr    %cl,%rdx
cmp    $0x5,%edi
mov    $0x3f,%eax
cmovb  %edx,%eax
ret

LLVM IR (-O0):
define signext i8 @char_code(i32 %0) {
%2 = alloca i8
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %10 [
i32 1, label %5
i32 2, label %6
i32 3, label %7
i32 4, label %8
i32 0, label %9
]
5: ; preds = %1
store i8 67, i8* %2
br label %11
6: ; preds = %1
store i8 71, i8* %2
br label %11
7: ; preds = %1
store i8 65, i8* %2
br label %11
8: ; preds = %1
store i8 84, i8* %2
br label %11
9: ; preds = %1
store i8 78, i8* %2
br label %11
10: ; preds = %1
store i8 63, i8* %2
br label %11
11: ; preds = %10, %9, %8, %7, %6, %5
%12 = load i8, i8* %2
ret i8 %12
}

LLVM IR (-O2):
define signext i8 @char_code(i32 %0) {
%2 = icmp ult i32 %0, 5
%3 = zext i32 %0 to i40
%4 = shl nuw nsw i40 %3, 3
%5 = lshr i40 361872442190, %4
%6 = trunc i40 %5 to i8
%7 = select i1 %2, i8 %6, i8 63
ret i8 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fgetc(int /*<<< orphan*/ *);
unsigned short read16u(FILE *f) {
  int n;
  n = fgetc(f);
  n += fgetc(f) << 8;
  return n;
}


x86 assembly (clang, -O0):
<read16u>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
shl    $0x8,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
movzwl %ax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read16u>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1030 <fgetc@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <fgetc@plt>
shl    $0x8,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i16 @read16u(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @fgetc(i32* %4)
store i32 %5, i32* %3
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
%8 = shl i32 %7, 8
%9 = load i32, i32* %3
%10 = add nsw i32 %9, %8
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = trunc i32 %11 to i16
ret i16 %12
}

LLVM IR (-O2):
define zeroext i16 @read16u(i32* nocapture %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = tail call i32 @fgetc(i32* %0)
%4 = shl i32 %3, 8
%5 = add nsw i32 %4, %2
%6 = trunc i32 %5 to i16
ret i16 %6
}
int foo13() { return 13; }


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

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

LLVM IR (-O0):
define i32 @foo13() {
ret i32 13
}

LLVM IR (-O2):
define i32 @foo13() {
ret i32 13
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ syscall(int, struct timeval *, struct timezone *);
void gettimeofdayoriginal(struct timeval *tv, struct timezone *tz) {
  syscall(314, tv, tz);
  return;
  syscall(351, tv, tz);
  return;
}


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

x86 assembly (clang, -O2):
<gettimeofdayoriginal>:
mov    %rsi,%rdx
mov    %rdi,%rsi
mov    $0x13a,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define void @gettimeofdayoriginal(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%5 = load %struct.timeval*, %struct.timeval** %3
%6 = load %struct.timezone*, %struct.timezone** %4
%7 = call i32 @syscall(i32 314, %struct.timeval* %5, %struct.timezone* %6)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32 }
%struct.timezone = type { i32 }
define void @gettimeofdayoriginal(%struct.timeval* %0, %struct.timezone* %1) {
%3 = tail call i32 @syscall(i32 314, %struct.timeval* %0, %struct.timezone* %1)
ret void
}
int stat_main(int argc, char *argv[]) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @stat_main(i32 %0, i8** nocapture readnone %1) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;
struct wl_proxy {
  int dummy;
};
struct wl_data_source {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ wl_proxy_marshal(struct wl_proxy *, int, int /*<<< orphan*/);
void wl_data_source_set_actions(struct wl_data_source *wl_data_source,
                                uint32_t dnd_actions) {
  wl_proxy_marshal((struct wl_proxy *)wl_data_source, 2, dnd_actions);
}


x86 assembly (clang, -O0):
<wl_data_source_set_actions>:
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    $0x2,%esi
call   1030 <wl_proxy_marshal@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
%struct.wl_data_source = type { i32 }
%struct.wl_proxy = type { i32 }
define void @wl_data_source_set_actions(%struct.wl_data_source* %0, i32 %1) {
%3 = bitcast %struct.wl_data_source* %0 to %struct.wl_proxy*
%4 = tail call i32 @wl_proxy_marshal(%struct.wl_proxy* %3, i32 2, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int scanf(char *, int *);
void scanfReturn() {
  int result;
  int ret = scanf("%d", &result);
  printf("ret = %d\n", ret);
  printf("result = %d\n", result);
}


x86 assembly (clang, -O0):
<scanfReturn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xebe(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xeb9(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [10 x i8] c"ret = %d\0A\00"
@.str.2 = [13 x i8] c"result = %d\0A\00"
define void @scanfReturn() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%5 = load i32, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret void
}
/* Variables and functions */
__attribute__((visibility("default"))) void *sd_bus_slot_ref(void *slot) {
  return NULL;
}


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

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

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

LLVM IR (-O2):
define noalias i8* @sd_bus_slot_ref(i8* nocapture readnone %0) {
ret i8* null
}
/* Variables and functions */
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, size_t);
void *umem_alloc(size_t, int);
void *umem_zalloc(size_t size, int flags) {
  void *ptr;
  ptr = umem_alloc(size, flags);
  if (ptr)
    memset(ptr, 0, size);
  return ptr;
}


x86 assembly (clang, -O0):
<umem_zalloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <umem_alloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1159 <umem_zalloc+0x39>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
xor    %esi,%esi
call   1040 <memset@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<umem_zalloc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <umem_alloc@plt>
mov    %rax,%rbx
test   %rax,%rax
je     1141 <umem_zalloc+0x21>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %r14,%rdx
call   1040 <memset@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i8* @umem_zalloc(i64 %0, i32 %1) {
%3 = tail call i8* @umem_alloc(i64 %0, i32 %1)
%4 = icmp eq i8* %3, null
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @memset(i8* %3, i32 0, i64 %0)
br label %7
7: ; preds = %5, %2
ret i8* %3
}
void dummy_free(void *unused) { (void)unused; }


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

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

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

LLVM IR (-O2):
define void @dummy_free(i8* nocapture %0) {
ret void
}
void socket_reset_listen_persistent(struct link_socket *s) {}


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

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

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

LLVM IR (-O2):
%struct.link_socket = type opaque
define void @socket_reset_listen_persistent(%struct.link_socket* nocapture %0) {
ret void
}
/* Type definitions */
struct emuState {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cursor_index(struct emuState *, int);
void do_IND(struct emuState *S) { cursor_index(S, 1); }


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

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

LLVM IR (-O0):
%struct.emuState = type { i32 }
define void @do_IND(%struct.emuState* %0) {
%2 = alloca %struct.emuState*
store %struct.emuState* %0, %struct.emuState** %2
%3 = load %struct.emuState*, %struct.emuState** %2
%4 = call i32 @cursor_index(%struct.emuState* %3, i32 1)
ret void
}

LLVM IR (-O2):
%struct.emuState = type { i32 }
define void @do_IND(%struct.emuState* %0) {
%2 = tail call i32 @cursor_index(%struct.emuState* %0, i32 1)
ret void
}
/* Variables and functions */
int fib(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int num;
  printf("Number: ");
  scanf("%d", &num);
  printf("Fibonacci is: %d\n", fib(num));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebc(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%edi
call   1050 <fib@plt>
mov    %eax,%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Fibonacci is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 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
%5 = call i32 @fib(i32 %4)
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Number: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [18 x i8] c"Fibonacci is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 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
%6 = call i32 @fib(i32 %5)
%7 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %6)
ret i32 0
}
unsigned int get_bit_uint(unsigned int pos, unsigned int val) {
  return (((val) >> (pos)) & 1);
}


x86 assembly (clang, -O0):
<get_bit_uint>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shr    %cl,%eax
and    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_bit_uint>:
mov    %esi,%eax
mov    %edi,%ecx
shr    %cl,%eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @get_bit_uint(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 = load i32, i32* %3
%7 = lshr i32 %5, %6
%8 = and i32 %7, 1
ret i32 %8
}

LLVM IR (-O2):
define i32 @get_bit_uint(i32 %0, i32 %1) {
%3 = lshr i32 %1, %0
%4 = and i32 %3, 1
ret i32 %4
}
/* Type definitions */
struct winsize {
  int ws_row;
  unsigned long ws_col;
};

/* Variables and functions */
int /*<<< orphan*/ TIOCGWINSZ;
scalar_t__ ioctl(int /*<<< orphan*/, int /*<<< orphan*/, struct winsize *);
unsigned long c_get_window_size(void) {
  struct winsize w;
  if (ioctl(0, TIOCGWINSZ, &w) >= 0)
    return (w.ws_row << 16) + w.ws_col;
  else
    return 0x190050;
}


x86 assembly (clang, -O0):
<c_get_window_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x2eb9(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x18(%rbp),%rdx
call   1030 <ioctl@plt>
cmp    $0x0,%rax
jl     114b <c_get_window_size+0x3b>
mov    -0x18(%rbp),%eax
shl    $0x10,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1153 <c_get_window_size+0x43>
movq   $0x190050,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_get_window_size>:
sub    $0x18,%rsp
mov    0x2ebd(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
xor    %edi,%edi
call   1030 <ioctl@plt>
test   %rax,%rax
js     1141 <c_get_window_size+0x31>
mov    0x8(%rsp),%eax
shl    $0x10,%eax
cltq
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret
mov    $0x190050,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.winsize = type { i32, i64 }
@TIOCGWINSZ = global i32 0
define i64 @c_get_window_size() {
%1 = alloca i64
%2 = alloca %struct.winsize
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i64 @ioctl(i32 0, i32 %3, %struct.winsize* %2)
%5 = icmp sge i64 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 0
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds %struct.winsize, %struct.winsize* %2, i32 0, i32 1
%12 = load i64, i64* %11
%13 = add i64 %10, %12
store i64 %13, i64* %1
br label %15
14: ; preds = %0
store i64 1638480, i64* %1
br label %15
15: ; preds = %14, %6
%16 = load i64, i64* %1
ret i64 %16
}

LLVM IR (-O2):
%struct.winsize = type { i32, i64 }
@TIOCGWINSZ = global i32 0
define i64 @c_get_window_size() {
%1 = alloca %struct.winsize
%2 = bitcast %struct.winsize* %1 to i8*
%3 = load i32, i32* @TIOCGWINSZ
%4 = call i64 @ioctl(i32 0, i32 %3, %struct.winsize* %1)
%5 = icmp sgt i64 %4, -1
br i1 %5, label %6, label %14
6: ; preds = %0
%7 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 0
%8 = load i32, i32* %7
%9 = shl i32 %8, 16
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds %struct.winsize, %struct.winsize* %1, i64 0, i32 1
%12 = load i64, i64* %11
%13 = add i64 %12, %10
br label %14
14: ; preds = %0, %6
%15 = phi i64 [ %13, %6 ], [ 1638480, %0 ]
ret i64 %15
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void do_version(const char *tool_name) {
  printf("%s "
         "v0.6final (2013-08-07)"
         "\n",
         tool_name);
  printf(
      "info at http://www.nex-hack.info\n\n"
      "BE WARNED! This is unfinished and/or incomplete and/or untested code!\n"
      "USE AT YOUR OWN RISK!\n\n");
}


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

x86 assembly (clang, -O2):
<do_version>:
push   %rax
mov    %rdi,%rsi
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xee2(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"%s v0.6final (2013-08-07)\0A\00"
@.str.1 = [128 x i8] c"info at http://www.nex-hack.info\0A\0ABE WARNED! This is unfinished and/or incomplete and/or untested code!\0AUSE AT YOUR OWN RISK!\0A\0A\00"
define void @do_version(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %3)
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([128 x i8], [128 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"%s v0.6final (2013-08-07)\0A\00"
@str = [127 x i8] c"info at http://www.nex-hack.info\0A\0ABE WARNED! This is unfinished and/or incomplete and/or untested code!\0AUSE AT YOUR OWN RISK!\0A\00"
define void @do_version(i8* %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %0)
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([127 x i8], [127 x i8]* @str, i64 0, i64 0))
ret void
}
int inner_add(int a, int b) { return (a + b); }


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

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

LLVM IR (-O0):
define i32 @inner_add(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 = add nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @inner_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ _isdisk_inval();
void _isam_exithook() { _isdisk_inval(); }


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

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

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

LLVM IR (-O2):
define void @_isam_exithook() {
%1 = tail call i32 (...) @_isdisk_inval()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
typedef int /*<<< orphan*/ int32_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ readChunkFromFile(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/, int);
int32_t readWordFromFile(FILE *pFile, uint16_t *dst, int32_t startPos) {
  return readChunkFromFile(pFile, dst, startPos, sizeof(uint16_t));
}


x86 assembly (clang, -O0):
<readWordFromFile>:
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
mov    $0x4,%ecx
call   1030 <readChunkFromFile@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readWordFromFile>:
mov    $0x4,%ecx
jmp    1030 <readChunkFromFile@plt>

LLVM IR (-O0):
define i32 @readWordFromFile(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 @readChunkFromFile(i32* %7, i32* %8, i32 %9, i32 4)
ret i32 %10
}

LLVM IR (-O2):
define i32 @readWordFromFile(i32* %0, i32* %1, i32 %2) {
%4 = tail call i32 @readChunkFromFile(i32* %0, i32* %1, i32 %2, i32 4)
ret i32 %4
}
void fa102(int n) {
a : {
  int b[n];
  {
    int c[n];
    0;
  }
  {
    int d[n];
    0;
  };
  int e[n];
  goto a;
  0;
};
  {
    int f[n];
    {
      int g[n];
      0;
    };
    {
      int h[n];
      0;
    };
    ;
    int i[n];
    0;
  };
  ;
  int j[n];
  0;
}


x86 assembly (clang, -O0):
<fa102>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rax,-0x40(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
jmp    110e <fa102+0xe>

x86 assembly (clang, -O2):
<fa102>:
jmp    1100 <fa102>

LLVM IR (-O0):
define void @fa102(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i64
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i64
%16 = alloca i64
%17 = alloca i8*
%18 = alloca i64
store i32 %0, i32* %2
br label %19
19: ; preds = %19, %1
%20 = load i32, i32* %2
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %3
%23 = alloca i32, i64 %21
store i64 %21, i64* %4
%24 = load i32, i32* %2
%25 = zext i32 %24 to i64
%26 = call i8* @llvm.stacksave()
store i8* %26, i8** %5
%27 = alloca i32, i64 %25
store i64 %25, i64* %6
%28 = load i8*, i8** %5
%29 = load i32, i32* %2
%30 = zext i32 %29 to i64
%31 = call i8* @llvm.stacksave()
store i8* %31, i8** %7
%32 = alloca i32, i64 %30
store i64 %30, i64* %8
%33 = load i8*, i8** %7
%34 = load i32, i32* %2
%35 = zext i32 %34 to i64
%36 = alloca i32, i64 %35
store i64 %35, i64* %9
%37 = load i8*, i8** %3
br label %19
38: ; No predecessors!
%39 = load i32, i32* %2
%40 = zext i32 %39 to i64
%41 = call i8* @llvm.stacksave()
store i8* %41, i8** %10
%42 = alloca i32, i64 %40
store i64 %40, i64* %11
%43 = load i32, i32* %2
%44 = zext i32 %43 to i64
%45 = call i8* @llvm.stacksave()
store i8* %45, i8** %12
%46 = alloca i32, i64 %44
store i64 %44, i64* %13
%47 = load i8*, i8** %12
%48 = load i32, i32* %2
%49 = zext i32 %48 to i64
%50 = call i8* @llvm.stacksave()
store i8* %50, i8** %14
%51 = alloca i32, i64 %49
store i64 %49, i64* %15
%52 = load i8*, i8** %14
%53 = load i32, i32* %2
%54 = zext i32 %53 to i64
%55 = alloca i32, i64 %54
store i64 %54, i64* %16
%56 = load i8*, i8** %10
%57 = load i32, i32* %2
%58 = zext i32 %57 to i64
%59 = call i8* @llvm.stacksave()
store i8* %59, i8** %17
%60 = alloca i32, i64 %58
store i64 %58, i64* %18
%61 = load i8*, i8** %17
ret void
}

LLVM IR (-O2):
define void @fa102(i32 %0) {
br label %2
2: ; preds = %2, %1
br label %2
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ headers_cleanup();
void fail() {
  headers_cleanup();
  exit(1);
}


x86 assembly (clang, -O0):
<fail>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <headers_cleanup@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<fail>:
push   %rax
xor    %eax,%eax
call   1030 <headers_cleanup@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @fail() {
%1 = call i32 (...) @headers_cleanup()
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @fail() {
%1 = tail call i32 (...) @headers_cleanup()
%2 = tail call i32 @exit(i32 1)
unreachable
}
int even(int i) { return !(i & 1); }


x86 assembly (clang, -O0):
<even>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1,%eax
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<even>:
mov    %edi,%eax
not    %eax
and    $0x1,%eax
ret

LLVM IR (-O0):
define i32 @even(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @even(i32 %0) {
%2 = and i32 %0, 1
%3 = xor i32 %2, 1
ret i32 %3
}
int main() {
  int arg1 = 44;
  int arg2 = 2;
  int sub = 0;
  __asm__("subl %%ebx, %%eax;" : "=a"(sub) : "a"(arg1), "b"(arg2));
  return sub;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
movl   $0x0,-0xc(%rbp)
movl   $0x2c,-0x10(%rbp)
movl   $0x2,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%eax
mov    -0x14(%rbp),%ebx
sub    %ebx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x2c,%eax
mov    $0x2,%ebx
sub    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 44, i32* %2
store i32 2, i32* %3
store i32 0, i32* %4
%5 = load i32, i32* %2
%6 = load i32, i32* %3
%7 = call i32 asm "subl %ebx, %eax;", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 %5, i32 %6)
store i32 %7, i32* %4
%8 = load i32, i32* %4
ret i32 %8
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 asm "subl %ebx, %eax;", "={ax},{ax},{bx},~{dirflag},~{fpsr},~{flags}"(i32 44, i32 2)
ret i32 %1
}
void _OS_ReturnNoSave(void) {
  _OS_SAVE_TEMP();
  _OS_RESTORE_SP();
  asm(" ret ");
}


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

x86 assembly (clang, -O2):
<_OS_ReturnNoSave>:
push   %rax
xor    %eax,%eax
call   1040 <_OS_SAVE_TEMP@plt>
xor    %eax,%eax
call   1030 <_OS_RESTORE_SP@plt>
ret
pop    %rax
ret

LLVM IR (-O0):
define void @_OS_ReturnNoSave() {
%1 = call i32 (...) @_OS_SAVE_TEMP()
%2 = call i32 (...) @_OS_RESTORE_SP()
ret void
}

LLVM IR (-O2):
define void @_OS_ReturnNoSave() {
%1 = tail call i32 (...) @_OS_SAVE_TEMP()
%2 = tail call i32 (...) @_OS_RESTORE_SP()
tail call void asm sideeffect " ret ", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int);
int /*<<< orphan*/ g(int);
int main() {
  f(3);
  g(0x03);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1030 <f@plt>
mov    $0x3,%edi
call   1040 <g@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x3,%edi
call   1030 <f@plt>
mov    $0x3,%edi
call   1040 <g@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 3)
%2 = call i32 @g(i32 3)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 3)
%2 = tail call i32 @g(i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void test(unsigned int a, unsigned int b) {
  if (a < 5)
    abort();
  if (b < 5)
    abort();
  if (a + b != 0U)
    abort();
}


x86 assembly (clang, -O0):
<test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x5,-0x4(%rbp)
jae    112f <test+0x1f>
mov    $0x0,%al
call   1030 <abort@plt>
cmpl   $0x5,-0x8(%rbp)
jae    1140 <test+0x30>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
cmp    $0x0,%eax
je     1156 <test+0x46>
mov    $0x0,%al
call   1030 <abort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test>:
push   %rax
cmp    $0x4,%edi
jbe    1121 <test+0x11>
cmp    $0x4,%esi
jbe    1121 <test+0x11>
add    %edi,%esi
jne    1121 <test+0x11>
pop    %rax
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @test(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 = icmp ult i32 %5, 5
br i1 %6, label %7, label %9
7: ; preds = %2
%8 = call i32 (...) @abort()
unreachable
9: ; preds = %2
%10 = load i32, i32* %4
%11 = icmp ult i32 %10, 5
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = call i32 (...) @abort()
unreachable
14: ; preds = %9
%15 = load i32, i32* %3
%16 = load i32, i32* %4
%17 = add i32 %15, %16
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %14
ret void
}

LLVM IR (-O2):
define void @test(i32 %0, i32 %1) {
%3 = icmp ult i32 %0, 5
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 (...) @abort()
unreachable
6: ; preds = %2
%7 = icmp ult i32 %1, 5
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 (...) @abort()
unreachable
10: ; preds = %6
%11 = sub i32 0, %1
%12 = icmp eq i32 %11, %0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 (...) @abort()
unreachable
15: ; preds = %10
ret void
}
/* Variables and functions */
int /*<<< orphan*/ raw();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ timeout(int);
void curs_resume(void) {
  raw();
  timeout(10);
  refresh();
}


x86 assembly (clang, -O0):
<curs_resume>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <raw@plt>
mov    $0xa,%edi
call   1040 <timeout@plt>
mov    $0x0,%al
call   1050 <refresh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<curs_resume>:
push   %rax
xor    %eax,%eax
call   1030 <raw@plt>
mov    $0xa,%edi
call   1040 <timeout@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <refresh@plt>

LLVM IR (-O0):
define void @curs_resume() {
%1 = call i32 (...) @raw()
%2 = call i32 @timeout(i32 10)
%3 = call i32 (...) @refresh()
ret void
}

LLVM IR (-O2):
define void @curs_resume() {
%1 = tail call i32 (...) @raw()
%2 = tail call i32 @timeout(i32 10)
%3 = tail call i32 (...) @refresh()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t buf_check(size_t *buf_max, size_t buf_cur, size_t count) {
  size_t max = *buf_max;
  assert(buf_cur <= max);
  return (buf_cur + count < max) ? count : max - buf_cur;
}


x86 assembly (clang, -O0):
<buf_check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x20(%rbp),%rax
setbe  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    1163 <buf_check+0x53>
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    116f <buf_check+0x5f>
mov    -0x20(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buf_check>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r15
mov    (%rdi),%r12
xor    %edi,%edi
mov    %r12,%rbx
sub    %rsi,%rbx
setae  %dil
call   1030 <assert@plt>
add    %r14,%r15
cmp    %r12,%r15
cmovb  %r14,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i64 @buf_check(i64* %0, i64 %1, i64 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
store i64* %0, i64** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i64*, i64** %4
%9 = load i64, i64* %8
store i64 %9, i64* %7
%10 = load i64, i64* %5
%11 = load i64, i64* %7
%12 = icmp ule i64 %10, %11
%13 = zext i1 %12 to i32
%14 = call i32 @assert(i32 %13)
%15 = load i64, i64* %5
%16 = load i64, i64* %6
%17 = add i64 %15, %16
%18 = load i64, i64* %7
%19 = icmp ult i64 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %3
%21 = load i64, i64* %6
br label %26
22: ; preds = %3
%23 = load i64, i64* %7
%24 = load i64, i64* %5
%25 = sub i64 %23, %24
br label %26
26: ; preds = %22, %20
%27 = phi i64 [ %21, %20 ], [ %25, %22 ]
ret i64 %27
}

LLVM IR (-O2):
define i64 @buf_check(i64* nocapture %0, i64 %1, i64 %2) {
%4 = load i64, i64* %0
%5 = icmp uge i64 %4, %1
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = add i64 %2, %1
%9 = icmp ult i64 %8, %4
%10 = sub i64 %4, %1
%11 = select i1 %9, i64 %2, i64 %10
ret i64 %11
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void drop_privs(const char *dir, const char *name) {
  fprintf(stderr, "WARNING: Cannot drop privileges!");
}


x86 assembly (clang, -O0):
<drop_privs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eb9(%rip),%rax
mov    (%rax),%edi
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [33 x i8] c"WARNING: Cannot drop privileges!\00"
define void @drop_privs(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [33 x i8] c"WARNING: Cannot drop privileges!\00"
define void @drop_privs(i8* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int /*<<< orphan*/ foo(int /*<<< orphan*/ *, int /*<<< orphan*/ *, size_t);
void bar(uint64_t *a, uint64_t *b, size_t len) {
  foo((uint8_t *)a, (uint8_t *)b, len * sizeof(uint64_t));
}


x86 assembly (clang, -O0):
<bar>:
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
shl    $0x2,%rdx
call   1030 <foo@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
shl    $0x2,%rdx
jmp    1030 <foo@plt>

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

LLVM IR (-O2):
define void @bar(i32* %0, i32* %1, i64 %2) {
%4 = shl i64 %2, 2
%5 = tail call i32 @foo(i32* %0, i32* %1, i64 %4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int paths_help(const char *device, int argc, char *argv[]) {
  printf("Access the path list.\n");
  printf("Commands supported: list, xor\n");
  return 0;
}


x86 assembly (clang, -O0):
<paths_help>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [23 x i8] c"Access the path list.\0A\00"
@.str.1 = [31 x i8] c"Commands supported: list, xor\0A\00"
define i32 @paths_help(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%7 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [22 x i8] c"Access the path list.\00"
@str.2 = [30 x i8] c"Commands supported: list, xor\00"
define i32 @paths_help(i8* nocapture readnone %0, i32 %1, i8** nocapture readnone %2) {
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
int tmax(void) { return ~(1 << 31); }


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

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

LLVM IR (-O0):
define i32 @tmax() {
ret i32 2147483647
}

LLVM IR (-O2):
define i32 @tmax() {
ret i32 2147483647
}
/* Variables and functions */
char *strstr(char const *, char const *);
char *module_libc_strstr(const char *haystack, const char *needle) {
  return strstr(haystack, needle);
}


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

x86 assembly (clang, -O2):
<module_libc_strstr>:
jmp    1030 <strstr@plt>

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

LLVM IR (-O2):
define i8* @module_libc_strstr(i8* %0, i8* nocapture %1) {
%3 = tail call i8* @strstr(i8* dereferenceable(1) %0, i8* dereferenceable(1) %1)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int scanf(char *, unsigned long long *);
void checkIntInput(unsigned long long *x) {
  if ((scanf("%llu", x)) != 1) {
    printf("Not digit!");
    exit(EXIT_FAILURE);
  }
}


x86 assembly (clang, -O0):
<checkIntInput>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xeb9(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     116f <checkIntInput+0x3f>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIntInput>:
push   %rax
mov    %rdi,%rsi
lea    0xec5(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x1,%eax
jne    1147 <checkIntInput+0x17>
pop    %rax
ret
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [11 x i8] c"Not digit!\00"
@EXIT_FAILURE = global i32 0
define void @checkIntInput(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %3)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = call i32 @exit(i32 %8)
unreachable
10: ; preds = %1
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@.str.1 = [11 x i8] c"Not digit!\00"
@EXIT_FAILURE = global i32 0
define void @checkIntInput(i64* %0) {
%2 = tail call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %0)
%3 = icmp eq i32 %2, 1
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%6 = load i32, i32* @EXIT_FAILURE
%7 = tail call i32 @exit(i32 %6)
unreachable
8: ; preds = %1
ret void
}
/* Type definitions */
struct RNAup_args_info {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ clear_args(struct RNAup_args_info *);
int /*<<< orphan*/ clear_given(struct RNAup_args_info *);
int /*<<< orphan*/ init_args_info(struct RNAup_args_info *);
void RNAup_cmdline_parser_init(struct RNAup_args_info *args_info) {
  clear_given(args_info);
  clear_args(args_info);
  init_args_info(args_info);
}


x86 assembly (clang, -O0):
<RNAup_cmdline_parser_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <clear_given@plt>
mov    -0x8(%rbp),%rdi
call   1030 <clear_args@plt>
mov    -0x8(%rbp),%rdi
call   1050 <init_args_info@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNAup_cmdline_parser_init>:
push   %rbx
mov    %rdi,%rbx
call   1040 <clear_given@plt>
mov    %rbx,%rdi
call   1030 <clear_args@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <init_args_info@plt>

LLVM IR (-O0):
%struct.RNAup_args_info = type { i32 }
define void @RNAup_cmdline_parser_init(%struct.RNAup_args_info* %0) {
%2 = alloca %struct.RNAup_args_info*
store %struct.RNAup_args_info* %0, %struct.RNAup_args_info** %2
%3 = load %struct.RNAup_args_info*, %struct.RNAup_args_info** %2
%4 = call i32 @clear_given(%struct.RNAup_args_info* %3)
%5 = load %struct.RNAup_args_info*, %struct.RNAup_args_info** %2
%6 = call i32 @clear_args(%struct.RNAup_args_info* %5)
%7 = load %struct.RNAup_args_info*, %struct.RNAup_args_info** %2
%8 = call i32 @init_args_info(%struct.RNAup_args_info* %7)
ret void
}

LLVM IR (-O2):
%struct.RNAup_args_info = type { i32 }
define void @RNAup_cmdline_parser_init(%struct.RNAup_args_info* %0) {
%2 = tail call i32 @clear_given(%struct.RNAup_args_info* %0)
%3 = tail call i32 @clear_args(%struct.RNAup_args_info* %0)
%4 = tail call i32 @init_args_info(%struct.RNAup_args_info* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ redecl2();
void use112() { redecl2(); }


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

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

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

LLVM IR (-O2):
define void @use112() {
%1 = tail call i32 (...) @redecl2()
ret void
}
int test_imm_10uint32_reg(unsigned int val) {
  return ((val) & (0x10 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_10uint32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0x10,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_10uint32_reg>:
test   $0x10,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_10uint32_reg(i32 %0) {
%2 = and i32 %0, 16
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ mode_t;

/* Variables and functions */
int sprint_open_modes(int /*<<< orphan*/);
int /*<<< orphan*/ tprints(int);
void tprint_open_modes(mode_t flags) {
  tprints(sprint_open_modes(flags) + sizeof("flags"));
}


x86 assembly (clang, -O0):
<tprint_open_modes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <sprint_open_modes@plt>
cltq
add    $0x6,%rax
mov    %eax,%edi
call   1040 <tprints@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tprint_open_modes>:
push   %rax
call   1030 <sprint_open_modes@plt>
lea    0x6(%rax),%edi
pop    %rax
jmp    1040 <tprints@plt>

LLVM IR (-O0):
define void @tprint_open_modes(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @sprint_open_modes(i32 %3)
%5 = sext i32 %4 to i64
%6 = add i64 %5, 6
%7 = trunc i64 %6 to i32
%8 = call i32 @tprints(i32 %7)
ret void
}

LLVM IR (-O2):
define void @tprint_open_modes(i32 %0) {
%2 = tail call i32 @sprint_open_modes(i32 %0)
%3 = add i32 %2, 6
%4 = tail call i32 @tprints(i32 %3)
ret void
}
void X509v3_get_ext(void) {}


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

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

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

LLVM IR (-O2):
define void @X509v3_get_ext() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
void printResault(double *resault) { printf("= %.2f\n", *resault); }


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

x86 assembly (clang, -O2):
<printResault>:
movsd  (%rdi),%xmm0
lea    0xee5(%rip),%rdi
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [8 x i8] c"= %.2f\0A\00"
define void @printResault(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), double %2)
ret void
}