xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ bnInit_32();
void bnInit(void) { bnInit_32(); }


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

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

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

LLVM IR (-O2):
define void @bnInit() {
%1 = tail call i32 (...) @bnInit_32()
ret void
}
void aeron_driver_receiver_on_close(void *clientd) {}


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

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

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

LLVM IR (-O2):
define void @aeron_driver_receiver_on_close(i8* nocapture %0) {
ret void
}
void __jit_debug_register_code(void) {}


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

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

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

LLVM IR (-O2):
define void @__jit_debug_register_code() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void banner() {
  printf("+------------------------------------------+           \n| trixd00rd "
         "- http://www.nullsecurity.net/ |           "
         "\n+------------------------------------------+\n");
  return;
}


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

x86 assembly (clang, -O2):
<banner>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [158 x i8] c"+------------------------------------------+ \0A| trixd00rd - http://www.nullsecurity.net/ | \0A+------------------------------------------+\0A\00"
define void @banner() {
%1 = call i32 @printf(i8* getelementptr inbounds ([158 x i8], [158 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [157 x i8] c"+------------------------------------------+ \0A| trixd00rd - http://www.nullsecurity.net/ | \0A+------------------------------------------+\00"
define void @banner() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([157 x i8], [157 x i8]* @str, i64 0, i64 0))
ret void
}
void ff_hevc_put_hevc_uni_epel_h48_8_avx2() {}


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

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

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

LLVM IR (-O2):
define void @ff_hevc_put_hevc_uni_epel_h48_8_avx2() {
ret void
}
int main() {
  goto L1;
  int a, b;
L2:
  b = 2;
  goto L3;
L1:
  goto L2;
L3:
  return b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
jmp    111c <main+0x1c>
movl   $0x2,-0xc(%rbp)
jmp    1121 <main+0x21>
jmp    1110 <main+0x10>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_usage(const char *self) {
  fprintf(stderr, "Usage: %s backup.ab [fixed_backup.ab] [shared_data.tar]\n",
          self);
}


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

x86 assembly (clang, -O2):
<print_usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [57 x i8] c"Usage: %s backup.ab [fixed_backup.ab] [shared_data.tar]\0A\00"
define void @print_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [57 x i8] c"Usage: %s backup.ab [fixed_backup.ab] [shared_data.tar]\0A\00"
define void @print_usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
void do_ln_s(src, dest) char *src, *dest;
{
  if (symlink(src, dest) == -1)
    perror(dest);
}


x86 assembly (clang, -O0):
<do_ln_s>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x0,%al
call   1030 <symlink@plt>
cmp    $0xffffffff,%eax
jne    1153 <do_ln_s+0x33>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1040 <perror@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_ln_s>:
push   %rbx
mov    %rsi,%rbx
xor    %eax,%eax
call   1030 <symlink@plt>
cmp    $0xffffffff,%eax
je     1132 <do_ln_s+0x12>
pop    %rbx
ret
mov    %rbx,%rdi
xor    %eax,%eax
pop    %rbx
jmp    1040 <perror@plt>

LLVM IR (-O0):
define void @do_ln_s(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @symlink to i32 (i8*, i8*, ...)*)(i8* %5, i8* %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = load i8*, i8** %4
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %10)
br label %12
12: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
define void @do_ln_s(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, i8*, ...) bitcast (i32 (...)* @symlink to i32 (i8*, i8*, ...)*)(i8* %0, i8* %1)
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @perror to i32 (i8*, ...)*)(i8* %1)
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ char_swap(char *, char *);
void reverse(char *arr, int lo, int hi) {
  while (lo < hi) {
    char_swap(arr + lo, arr + hi);
    hi--;
    lo++;
  }
}


x86 assembly (clang, -O0):
<reverse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1160 <reverse+0x50>
mov    -0x8(%rbp),%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    -0x8(%rbp),%rsi
movslq -0x10(%rbp),%rax
add    %rax,%rsi
call   1030 <char_swap@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1122 <reverse+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reverse>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1153 <reverse+0x43>
mov    %rdi,%r14
movslq %edx,%r15
movslq %esi,%r12
lea    (%rdi,%r12,1),%rbx
add    %r15,%r14
add    $0xffffffffffffffff,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <char_swap@plt>
add    $0x1,%r12
add    $0x1,%rbx
add    $0xffffffffffffffff,%r14
lea    -0x1(%r15),%rax
cmp    %r15,%r12
mov    %rax,%r15
jl     1130 <reverse+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @reverse(i8* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = sext i32 %2 to i64
%7 = sext i32 %1 to i64
br label %8
8: ; preds = %5, %8
%9 = phi i64 [ %7, %5 ], [ %15, %8 ]
%10 = phi i64 [ %6, %5 ], [ %14, %8 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %9
%12 = getelementptr inbounds i8, i8* %0, i64 %10
%13 = tail call i32 @char_swap(i8* %11, i8* %12)
%14 = add nsw i64 %10, -1
%15 = add nsw i64 %9, 1
%16 = icmp slt i64 %15, %14
br i1 %16, label %8, label %17
17: ; preds = %8, %3
ret void
}
/* Variables and functions */
void *calloc(int, int);
void *s_alloc(int n) { return calloc(1, n); }


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

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

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

LLVM IR (-O2):
define noalias i8* @s_alloc(i32 %0) {
%2 = tail call i8* @calloc(i32 1, i32 %0)
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int contestants[] = {1, 2, 3};
  int *choice = contestants;
  contestants[0] = 2;
  contestants[1] = contestants[2];
  contestants[2] = *choice;
  printf("I'm going to pick contestant number %i\n", contestants[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xed8(%rip),%eax
mov    %eax,-0x8(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x2,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.contestants = [3 x i32] [i32 1, i32 2, i32 3]
@.str = [40 x i8] c"I'm going to pick contestant number %i\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i32]
%3 = alloca i32*
store i32 0, i32* %1
%4 = bitcast [3 x i32]* %2 to i8*
%5 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32* %5, i32** %3
%6 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 2, i32* %6
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%8 = load i32, i32* %7
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 %8, i32* %9
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 %11, i32* %12
%13 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
%14 = load i32, i32* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [40 x i8] c"I'm going to pick contestant number %i\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i32 2)
ret i32 0
}
/* Type definitions */
struct evhttp_request {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ evhttp_send_error(struct evhttp_request *, int,
                                     char const *);
void send_client_error(struct evhttp_request *req, int code,
                       const char *reason) {
  evhttp_send_error(req, code, reason);
}


x86 assembly (clang, -O0):
<send_client_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <evhttp_send_error@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_client_error>:
jmp    1030 <evhttp_send_error@plt>

LLVM IR (-O0):
%struct.evhttp_request = type { i32 }
define void @send_client_error(%struct.evhttp_request* %0, i32 %1, i8* %2) {
%4 = alloca %struct.evhttp_request*
%5 = alloca i32
%6 = alloca i8*
store %struct.evhttp_request* %0, %struct.evhttp_request** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.evhttp_request*, %struct.evhttp_request** %4
%8 = load i32, i32* %5
%9 = load i8*, i8** %6
%10 = call i32 @evhttp_send_error(%struct.evhttp_request* %7, i32 %8, i8* %9)
ret void
}

LLVM IR (-O2):
%struct.evhttp_request = type { i32 }
define void @send_client_error(%struct.evhttp_request* %0, i32 %1, i8* %2) {
%4 = tail call i32 @evhttp_send_error(%struct.evhttp_request* %0, i32 %1, i8* %2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int FtdiReadReg(int, int, int /*<<< orphan*/ *);
int ReadTpmSts(uint32_t *status) {
  return FtdiReadReg(0x18, sizeof(*status), status);
}


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

x86 assembly (clang, -O2):
<ReadTpmSts>:
mov    %rdi,%rdx
mov    $0x18,%edi
mov    $0x4,%esi
jmp    1030 <FtdiReadReg@plt>

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

LLVM IR (-O2):
define i32 @ReadTpmSts(i32* %0) {
%2 = tail call i32 @FtdiReadReg(i32 24, i32 4, i32* %0)
ret i32 %2
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;
typedef int /*<<< orphan*/ pthread_cond_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
int pthread_cond_wait(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
void d_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex) {
  int rv = pthread_cond_wait(cond, mutex);
  if (rv != 0) {
    printf("error: pthread_cond_wait == %d\n", rv);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<d_cond_wait>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <pthread_cond_wait@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1173 <d_cond_wait+0x43>
mov    -0x14(%rbp),%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<d_cond_wait>:
push   %rax
call   1030 <pthread_cond_wait@plt>
test   %eax,%eax
jne    113c <d_cond_wait+0xc>
pop    %rax
ret
lea    0xebd(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [32 x i8] c"error: pthread_cond_wait == %d\0A\00"
define void @d_cond_wait(i32* %0, i32* %1) {
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
store i32* %0, i32** %3
store i32* %1, i32** %4
%6 = load i32*, i32** %3
%7 = load i32*, i32** %4
%8 = call i32 @pthread_cond_wait(i32* %6, i32* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %2
%12 = load i32, i32* %5
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"error: pthread_cond_wait == %d\0A\00"
define void @d_cond_wait(i32* %0, i32* %1) {
%3 = tail call i32 @pthread_cond_wait(i32* %0, i32* %1)
%4 = icmp eq i32 %3, 0
br i1 %4, label %8, label %5
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %3)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ R_OK;
int access(char *, int /*<<< orphan*/);
int check_path(char *path) {
  if (!path)
    return 0;
  return access(path, R_OK) != -1;
}


x86 assembly (clang, -O0):
<check_path>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <check_path+0x23>
movl   $0x0,-0x4(%rbp)
jmp    1153 <check_path+0x43>
mov    -0x10(%rbp),%rdi
mov    0x2ea2(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_path>:
test   %rdi,%rdi
je     1133 <check_path+0x23>
push   %rax
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <access@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0xffffffff,%ecx
setne  %al
add    $0x8,%rsp
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
@R_OK = global i32 0
define i32 @check_path(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %8, label %3
3: ; preds = %1
%4 = load i32, i32* @R_OK
%5 = tail call i32 @access(i8* %0, i32 %4)
%6 = icmp ne i32 %5, -1
%7 = zext i1 %6 to i32
br label %8
8: ; preds = %1, %3
%9 = phi i32 [ %7, %3 ], [ 0, %1 ]
ret i32 %9
}
int imin(int a, int b) { return ((a) < (b)) ? (a) : (b); }


x86 assembly (clang, -O0):
<imin>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <imin+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <imin+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<imin>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

LLVM IR (-O0):
define i32 @imin(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 = icmp slt i32 %5, %6
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* %3
br label %12
10: ; preds = %2
%11 = load i32, i32* %4
br label %12
12: ; preds = %10, %8
%13 = phi i32 [ %9, %8 ], [ %11, %10 ]
ret i32 %13
}

LLVM IR (-O2):
define i32 @imin(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
void foo637() {}


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

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

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

LLVM IR (-O2):
define void @foo637() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char const *, char const *);
void iter(const char *key, const char *value, const void *obj) {
  printf("menu item: %s menu position: %s\n", key, value);
}


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

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

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

LLVM IR (-O2):
@.str = [33 x i8] c"menu item: %s menu position: %s\0A\00"
define void @iter(i8* %0, i8* %1, i8* nocapture readnone %2) {
%4 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1)
ret void
}
/* Variables and functions */
int flfloor(float);
int flceil(float n) { return flfloor(n) + 1; }


x86 assembly (clang, -O0):
<flceil>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1030 <flfloor@plt>
add    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<flceil>:
push   %rax
call   1030 <flfloor@plt>
add    $0x1,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @flceil(float %0) {
%2 = tail call i32 @flfloor(float %0)
%3 = add nsw i32 %2, 1
ret i32 %3
}
void foo454() {}


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

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

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

LLVM IR (-O2):
define void @foo454() {
ret void
}
/* Variables and functions */
long function(char *);
int main() {
  long a = function("asdf");
  long b = function("asdf");
  return a == b;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <function@plt>
mov    %rax,-0x10(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <function@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee5(%rip),%r14
mov    %r14,%rdi
call   1030 <function@plt>
mov    %rax,%rbx
mov    %r14,%rdi
call   1030 <function@plt>
xor    %ecx,%ecx
cmp    %rax,%rbx
sete   %cl
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [5 x i8] c"asdf\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
store i32 0, i32* %1
%4 = call i64 @function(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i64 %4, i64* %2
%5 = call i64 @function(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i64 %5, i64* %3
%6 = load i64, i64* %2
%7 = load i64, i64* %3
%8 = icmp eq i64 %6, %7
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
@.str = [5 x i8] c"asdf\00"
define i32 @main() {
%1 = tail call i64 @function(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = tail call i64 @function(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i64 %1, %2
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ QRY_CheckMastersModified();
int /*<<< orphan*/ QRY_FL_CheckVarsModified();
int /*<<< orphan*/ QRY_HeartbeatMasters();
int /*<<< orphan*/ QRY_QueryMasters();
int /*<<< orphan*/ QRY_SV_PingServers();
void QRY_Frame(void) {
  QRY_FL_CheckVarsModified();
  QRY_CheckMastersModified();
  QRY_QueryMasters();
  QRY_HeartbeatMasters();
  QRY_SV_PingServers();
}


x86 assembly (clang, -O0):
<QRY_Frame>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1070 <QRY_FL_CheckVarsModified@plt>
mov    $0x0,%al
call   1040 <QRY_CheckMastersModified@plt>
mov    $0x0,%al
call   1060 <QRY_QueryMasters@plt>
mov    $0x0,%al
call   1050 <QRY_HeartbeatMasters@plt>
mov    $0x0,%al
call   1030 <QRY_SV_PingServers@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<QRY_Frame>:
push   %rax
xor    %eax,%eax
call   1070 <QRY_FL_CheckVarsModified@plt>
xor    %eax,%eax
call   1040 <QRY_CheckMastersModified@plt>
xor    %eax,%eax
call   1060 <QRY_QueryMasters@plt>
xor    %eax,%eax
call   1050 <QRY_HeartbeatMasters@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <QRY_SV_PingServers@plt>

LLVM IR (-O0):
define void @QRY_Frame() {
%1 = call i32 (...) @QRY_FL_CheckVarsModified()
%2 = call i32 (...) @QRY_CheckMastersModified()
%3 = call i32 (...) @QRY_QueryMasters()
%4 = call i32 (...) @QRY_HeartbeatMasters()
%5 = call i32 (...) @QRY_SV_PingServers()
ret void
}

LLVM IR (-O2):
define void @QRY_Frame() {
%1 = tail call i32 (...) @QRY_FL_CheckVarsModified()
%2 = tail call i32 (...) @QRY_CheckMastersModified()
%3 = tail call i32 (...) @QRY_QueryMasters()
%4 = tail call i32 (...) @QRY_HeartbeatMasters()
%5 = tail call i32 (...) @QRY_SV_PingServers()
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
uint32_t apic_is_integrated(uint8_t *baseapic) {
  uint32_t v = *((uint32_t *)&baseapic[0x30]);
  if (v & 0xf0) {
    return 1;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<apic_is_integrated>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0xc0(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xf0,%eax
cmp    $0x0,%eax
je     1132 <apic_is_integrated+0x32>
movl   $0x1,-0x4(%rbp)
jmp    1139 <apic_is_integrated+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<apic_is_integrated>:
xor    %eax,%eax
testb  $0xf0,0xc0(%rdi)
setne  %al
ret

LLVM IR (-O0):
define i32 @apic_is_integrated(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
%5 = load i32*, i32** %3
%6 = getelementptr inbounds i32, i32* %5, i64 48
%7 = load i32, i32* %6
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = and i32 %8, 240
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %1
store i32 1, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @apic_is_integrated(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 48
%3 = load i32, i32* %2
%4 = and i32 %3, 240
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i32
ret i32 %6
}
unsigned xrop3_1_1_0(unsigned char s, unsigned char t) {
  unsigned D = 0x00ff;
  unsigned S = ((unsigned)s << 8) | s;
  unsigned T = ((unsigned)t << 8) | t;
  unsigned stk1;
  unsigned stk2;
  stk2 = T | S;
  stk1 = D | stk2;
  stk1 = ~stk1;
  return (stk1 & (~S)) | (D & S);
}


x86 assembly (clang, -O0):
<xrop3_1_1_0>:
push   %rbp
mov    %rsp,%rbp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movl   $0xff,-0x8(%rbp)
movzbl -0x1(%rbp),%eax
shl    $0x8,%eax
movzbl -0x1(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0xc(%rbp)
movzbl -0x2(%rbp),%eax
shl    $0x8,%eax
movzbl -0x2(%rbp),%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
or     -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
xor    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
mov    -0x8(%rbp),%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xrop3_1_1_0>:
mov    %edi,%eax
shl    $0x8,%eax
shl    $0x8,%esi
or     %eax,%esi
or     %edi,%eax
xor    $0xffffff00,%esi
not    %eax
and    %esi,%eax
or     %edi,%eax
ret

LLVM IR (-O0):
define i32 @xrop3_1_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i32 255, i32* %5
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = shl i32 %11, 8
%13 = load i8, i8* %3
%14 = zext i8 %13 to i32
%15 = or i32 %12, %14
store i32 %15, i32* %6
%16 = load i8, i8* %4
%17 = zext i8 %16 to i32
%18 = shl i32 %17, 8
%19 = load i8, i8* %4
%20 = zext i8 %19 to i32
%21 = or i32 %18, %20
store i32 %21, i32* %7
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = or i32 %22, %23
store i32 %24, i32* %9
%25 = load i32, i32* %5
%26 = load i32, i32* %9
%27 = or i32 %25, %26
store i32 %27, i32* %8
%28 = load i32, i32* %8
%29 = xor i32 %28, -1
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = load i32, i32* %6
%32 = xor i32 %31, -1
%33 = and i32 %30, %32
%34 = load i32, i32* %5
%35 = load i32, i32* %6
%36 = and i32 %34, %35
%37 = or i32 %33, %36
ret i32 %37
}

LLVM IR (-O2):
define i32 @xrop3_1_1_0(i8 zeroext %0, i8 zeroext %1) {
%3 = zext i8 %0 to i32
%4 = shl nuw nsw i32 %3, 8
%5 = or i32 %4, %3
%6 = zext i8 %1 to i32
%7 = shl nuw nsw i32 %6, 8
%8 = or i32 %7, %4
%9 = xor i32 %8, -256
%10 = xor i32 %5, -1
%11 = and i32 %9, %10
%12 = or i32 %11, %3
ret i32 %12
}
/* Variables and functions */
char *OC_mkRef(char *);
char *UTIL_itoa(int);
int /*<<< orphan*/ free(char *);
char *OC_mkRefInt(int value) {
  char *valueText = UTIL_itoa(value);
  char *text = OC_mkRef(valueText);
  free(valueText);
  return text;
}


x86 assembly (clang, -O0):
<OC_mkRefInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <UTIL_itoa@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <OC_mkRef@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<OC_mkRefInt>:
push   %r14
push   %rbx
push   %rax
call   1030 <UTIL_itoa@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1050 <OC_mkRef@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @OC_mkRefInt(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = call i8* @UTIL_itoa(i32 %5)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = call i8* @OC_mkRef(i8* %7)
store i8* %8, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @free(i8* %9)
%11 = load i8*, i8** %4
ret i8* %11
}

LLVM IR (-O2):
define i8* @OC_mkRefInt(i32 %0) {
%2 = tail call i8* @UTIL_itoa(i32 %0)
%3 = tail call i8* @OC_mkRef(i8* %2)
%4 = tail call i32 @free(i8* %2)
ret i8* %3
}
void reset_interfaces() {}


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

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

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

LLVM IR (-O2):
define void @reset_interfaces() {
ret void
}
int iswhitespace(char ch) { return ((ch == ' ') || (ch == '\t')); }


x86 assembly (clang, -O0):
<iswhitespace>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x2(%rbp)
je     1129 <iswhitespace+0x29>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<iswhitespace>:
cmp    $0x20,%dil
sete   %al
cmp    $0x9,%dil
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @iswhitespace(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp eq i32 %4, 32
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 9
br label %10
10: ; preds = %6, %1
%11 = phi i1 [ true, %1 ], [ %9, %6 ]
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @iswhitespace(i8 signext %0) {
%2 = icmp eq i8 %0, 32
%3 = icmp eq i8 %0, 9
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int badUsage(const char *exename) {
  (void)exename;
  fprintf(stderr, "wrong parameter\n");
  return 1;
}


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

x86 assembly (clang, -O2):
<badUsage>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [17 x i8] c"wrong parameter\0A\00"
define i32 @badUsage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i32, i32* @stderr
%5 = call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 1
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [17 x i8] c"wrong parameter\0A\00"
define i32 @badUsage(i8* nocapture readnone %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret i32 1
}
/* Type definitions */
struct flock {
  scalar_t__ l_len;
  int /*<<< orphan*/ l_whence;
  scalar_t__ l_start;
  int /*<<< orphan*/ l_type;
};

/* Variables and functions */
int /*<<< orphan*/ F_SETLK;
int /*<<< orphan*/ F_WRLCK;
int /*<<< orphan*/ SEEK_SET;
int fcntl(int, int /*<<< orphan*/, struct flock *);
int lockfile(int fd) {
  struct flock fl;
  fl.l_type = F_WRLCK;
  fl.l_start = 0;
  fl.l_whence = SEEK_SET;
  fl.l_len = 0;
  return (fcntl(fd, F_SETLK, &fl));
}


x86 assembly (clang, -O0):
<lockfile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e9b(%rip),%rax
mov    (%rax),%esi
lea    -0x28(%rbp),%rdx
call   1030 <fcntl@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lockfile>:
sub    $0x28,%rsp
mov    0x2eb5(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x20(%rsp)
movq   $0x0,0x18(%rsp)
mov    0x2ea7(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
movq   $0x0,0x8(%rsp)
mov    0x2ea1(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rdx
call   1030 <fcntl@plt>
add    $0x28,%rsp
ret

LLVM IR (-O0):
%struct.flock = type { i64, i32, i64, i32 }
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLK = global i32 0
define i32 @lockfile(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.flock
store i32 %0, i32* %2
%4 = load i32, i32* @F_WRLCK
%5 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 3
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 2
store i64 0, i64* %6
%7 = load i32, i32* @SEEK_SET
%8 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 1
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.flock, %struct.flock* %3, i32 0, i32 0
store i64 0, i64* %9
%10 = load i32, i32* %2
%11 = load i32, i32* @F_SETLK
%12 = call i32 @fcntl(i32 %10, i32 %11, %struct.flock* %3)
ret i32 %12
}

LLVM IR (-O2):
%struct.flock = type { i64, i32, i64, i32 }
@F_WRLCK = global i32 0
@SEEK_SET = global i32 0
@F_SETLK = global i32 0
define i32 @lockfile(i32 %0) {
%2 = alloca %struct.flock
%3 = bitcast %struct.flock* %2 to i8*
%4 = load i32, i32* @F_WRLCK
%5 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 3
store i32 %4, i32* %5
%6 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 2
store i64 0, i64* %6
%7 = load i32, i32* @SEEK_SET
%8 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 1
store i32 %7, i32* %8
%9 = getelementptr inbounds %struct.flock, %struct.flock* %2, i64 0, i32 0
store i64 0, i64* %9
%10 = load i32, i32* @F_SETLK
%11 = call i32 @fcntl(i32 %0, i32 %10, %struct.flock* %2)
ret i32 %11
}
int test_imm_A8int8_mem(signed char *val) {
  return ((*val) & (-0xA8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_A8int8_mem>:
movsbl (%rdi),%eax
test   $0xffffff58,%eax
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_A8int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = sext i8 %2 to i32
%4 = and i32 %3, -168
%5 = icmp eq i32 %4, 0
%6 = select i1 %5, i32 -40, i32 -20
ret i32 %6
}
/* Variables and functions */
int do_comparison1(char *, char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
int main() {
  return do_comparison1("SHA256_compar_in", "SHA256_compare_out", NULL, 0);
}


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

x86 assembly (clang, -O2):
<main>:
lea    0xee9(%rip),%rdi
lea    0xef3(%rip),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
jmp    1030 <do_comparison1@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"SHA256_compar_in\00"
@.str.1 = [19 x i8] c"SHA256_compare_out\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @do_comparison1(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* null, i32 0)
ret i32 %2
}

LLVM IR (-O2):
@.str = [17 x i8] c"SHA256_compar_in\00"
@.str.1 = [19 x i8] c"SHA256_compare_out\00"
define i32 @main() {
%1 = tail call i32 @do_comparison1(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* null, i32 0)
ret i32 %1
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ FAT_IOCTL_GET_ATTRIBUTES;
int /*<<< orphan*/ err(int, char *);
int ioctl(int, int /*<<< orphan*/, int *);
uint32_t fat_fgetattr(int fd) {
  int r, attr;
  r = ioctl(fd, FAT_IOCTL_GET_ATTRIBUTES, &attr);
  if (r < 0)
    err(1, "could not get attributes");
  return attr;
}


x86 assembly (clang, -O0):
<fat_fgetattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2eb3(%rip),%rax
mov    (%rax),%esi
lea    -0xc(%rbp),%rdx
call   1030 <ioctl@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    115e <fat_fgetattr+0x3e>
mov    $0x1,%edi
lea    0xea7(%rip),%rsi
call   1040 <err@plt>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fat_fgetattr>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <ioctl@plt>
test   %eax,%eax
jns    1149 <fat_fgetattr+0x29>
lea    0xec1(%rip),%rsi
mov    $0x1,%edi
call   1040 <err@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@FAT_IOCTL_GET_ATTRIBUTES = global i32 0
@.str = [25 x i8] c"could not get attributes\00"
define i32 @fat_fgetattr(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* @FAT_IOCTL_GET_ATTRIBUTES
%7 = call i32 @ioctl(i32 %5, i32 %6, i32* %4)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %1
%11 = call i32 @err(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i32, i32* %4
ret i32 %13
}

LLVM IR (-O2):
@FAT_IOCTL_GET_ATTRIBUTES = global i32 0
@.str = [25 x i8] c"could not get attributes\00"
define i32 @fat_fgetattr(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = load i32, i32* @FAT_IOCTL_GET_ATTRIBUTES
%5 = call i32 @ioctl(i32 %0, i32 %4, i32* %2)
%6 = icmp slt i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = call i32 @err(i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %1
%10 = load i32, i32* %2
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ vuln(char *);
int main(int argc, char **argv) { vuln(argv[1]); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <vuln@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <vuln@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(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 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = call i32 @vuln(i8* %7)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @vuln(i8* %4)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void class_pend(FILE *fsrc) { fprintf(fsrc, "};\n\n"); }


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

x86 assembly (clang, -O2):
<class_pend>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
mov    $0x4,%esi
mov    $0x1,%edx
jmp    1030 <fwrite@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"};\0A\0A\00"
define void @class_pend(i32* nocapture %0) {
%2 = tail call i64 @fwrite(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 4, i64 1, i32* %0)
ret void
}
int f1(int a) { return 1; }


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

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

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

LLVM IR (-O2):
define i32 @f1(i32 %0) {
ret i32 1
}
/* Type definitions */
struct trienode {
  int dummy;
};

/* Variables and functions */
struct trienode *make_trienode();
void init_trie(struct trienode **root) {
  if (!root) {
    return;
  }
  *root = make_trienode();
}


x86 assembly (clang, -O0):
<init_trie>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112c <init_trie+0x1c>
jmp    113d <init_trie+0x2d>
mov    $0x0,%al
call   1030 <make_trienode@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_trie>:
test   %rdi,%rdi
je     1124 <init_trie+0x14>
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <make_trienode@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
%struct.trienode = type { i32 }
define void @init_trie(%struct.trienode** %0) {
%2 = alloca %struct.trienode**
store %struct.trienode** %0, %struct.trienode*** %2
%3 = load %struct.trienode**, %struct.trienode*** %2
%4 = icmp ne %struct.trienode** %3, null
br i1 %4, label %6, label %5
5: ; preds = %1
br label %9
6: ; preds = %1
%7 = call %struct.trienode* (...) @make_trienode()
%8 = load %struct.trienode**, %struct.trienode*** %2
store %struct.trienode* %7, %struct.trienode** %8
br label %9
9: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
%struct.trienode = type { i32 }
define void @init_trie(%struct.trienode** writeonly %0) {
%2 = icmp eq %struct.trienode** %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call %struct.trienode* (...) @make_trienode()
store %struct.trienode* %4, %struct.trienode** %0
br label %5
5: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, ...);
int /*<<< orphan*/ stderr;
void usage(char **a) {
  fprintf(stderr,
          "Usage: %s ROWS<=%d COLS<=%d [color 1-8]"
          " [wall char]\n",
          a[0], 69, 69);
  fprintf(stderr, "Example: %s 11 15 @\n", a[0]);
  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),%rax
mov    (%rax),%rdx
lea    0xebd(%rip),%rsi
mov    $0x45,%r8d
mov    %r8d,%ecx
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    (%rax),%rdx
lea    0xecb(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2eb2(%rip),%r14
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xec5(%rip),%rsi
mov    $0x45,%ecx
mov    $0x45,%r8d
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    (%r14),%edi
mov    (%rbx),%rdx
lea    0xedb(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [53 x i8] c"Usage: %s ROWS<=%d COLS<=%d [color 1-8] [wall char]\0A\00"
@.str.1 = [21 x i8] c"Example: %s 11 15 @\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 = getelementptr inbounds i8*, i8** %4, i64 0
%6 = load i8*, i8** %5
%7 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %6, i32 69, i32 69)
%8 = load i32, i32* @stderr
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = call i32 (i32, i8*, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [53 x i8] c"Usage: %s ROWS<=%d COLS<=%d [color 1-8] [wall char]\0A\00"
@.str.1 = [21 x i8] c"Example: %s 11 15 @\0A\00"
define void @usage(i8** nocapture %0) {
%2 = load i32, i32* @stderr
%3 = load i8*, i8** %0
%4 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str, i64 0, i64 0), i8* %3, i32 69, i32 69)
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %0
%7 = tail call i32 (i32, i8*, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M405_f(char *s) {
  debug("M405_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M405_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xefa(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M405_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf06(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [47 x i8] c"M405_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M405_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [47 x i8] c"M405_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M405_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}