xunge/DecIR huggingface dataset:
/* Variables and functions */
int strlen(char *);
void fpad(char *str, int maxlen) {
  int i;
  for (i = strlen(str); i < maxlen; i++)
    str[i] = ' ';
}


x86 assembly (clang, -O0):
<fpad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <fpad+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movb   $0x20,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112b <fpad+0x1b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fpad>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    %ebp,%eax
jge    114f <fpad+0x2f>
movslq %eax,%rcx
add    %rcx,%rbx
not    %eax
add    %ebp,%eax
add    $0x1,%rax
mov    %rbx,%rdi
mov    $0x20,%esi
mov    %rax,%rdx
call   1040 <memset@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fpad(i8* %0, i32 %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = icmp slt i32 %3, %1
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = sext i32 %3 to i64
%7 = getelementptr i8, i8* %0, i64 %6
%8 = xor i32 %3, -1
%9 = add i32 %8, %1
%10 = zext i32 %9 to i64
%11 = add nuw nsw i64 %10, 1
br label %12
12: ; preds = %5, %2
ret void
}
__attribute__((always_)) void
kmemcheck_mark_uninitialized_pages(struct page *p, unsigned int n) {}


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

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

LLVM IR (-O0):
%struct.page = type opaque
define void @kmemcheck_mark_uninitialized_pages(%struct.page* %0, i32 %1) {
%3 = alloca %struct.page*
%4 = alloca i32
store %struct.page* %0, %struct.page** %3
store i32 %1, i32* %4
ret void
}

LLVM IR (-O2):
%struct.page = type opaque
define void @kmemcheck_mark_uninitialized_pages(%struct.page* nocapture %0, i32 %1) {
ret void
}
/* Type definitions */
struct timespec {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_MONOTONIC_RAW;
int /*<<< orphan*/ clock_gettime(int /*<<< orphan*/, struct timespec *);
void timespec_now(struct timespec *ts) {
  clock_gettime(CLOCK_MONOTONIC_RAW, ts);
}


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

x86 assembly (clang, -O2):
<timespec_now>:
mov    %rdi,%rsi
mov    0x2ece(%rip),%rax
mov    (%rax),%edi
jmp    1030 <clock_gettime@plt>

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC_RAW = global i32 0
define void @timespec_now(%struct.timespec* %0) {
%2 = alloca %struct.timespec*
store %struct.timespec* %0, %struct.timespec** %2
%3 = load i32, i32* @CLOCK_MONOTONIC_RAW
%4 = load %struct.timespec*, %struct.timespec** %2
%5 = call i32 @clock_gettime(i32 %3, %struct.timespec* %4)
ret void
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_MONOTONIC_RAW = global i32 0
define void @timespec_now(%struct.timespec* %0) {
%2 = load i32, i32* @CLOCK_MONOTONIC_RAW
%3 = tail call i32 @clock_gettime(i32 %2, %struct.timespec* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ OpenSSL_add_all_algorithms();
int /*<<< orphan*/ SSL_library_init();
int /*<<< orphan*/ SSL_load_error_strings();
void initSSL() {
  SSL_load_error_strings();
  SSL_library_init();
  OpenSSL_add_all_algorithms();
}


x86 assembly (clang, -O0):
<initSSL>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1050 <SSL_load_error_strings@plt>
mov    $0x0,%al
call   1030 <SSL_library_init@plt>
mov    $0x0,%al
call   1040 <OpenSSL_add_all_algorithms@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<initSSL>:
push   %rax
xor    %eax,%eax
call   1050 <SSL_load_error_strings@plt>
xor    %eax,%eax
call   1030 <SSL_library_init@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <OpenSSL_add_all_algorithms@plt>

LLVM IR (-O0):
define void @initSSL() {
%1 = call i32 (...) @SSL_load_error_strings()
%2 = call i32 (...) @SSL_library_init()
%3 = call i32 (...) @OpenSSL_add_all_algorithms()
ret void
}

LLVM IR (-O2):
define void @initSSL() {
%1 = tail call i32 (...) @SSL_load_error_strings()
%2 = tail call i32 (...) @SSL_library_init()
%3 = tail call i32 (...) @OpenSSL_add_all_algorithms()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ arm_memio_ldrh(int /*<<< orphan*/);
int /*<<< orphan*/ t16_memio_imm5_op(int);
void t16_ldrh_imm5() { arm_memio_ldrh(t16_memio_imm5_op(2)); }


x86 assembly (clang, -O0):
<t16_ldrh_imm5>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1040 <t16_memio_imm5_op@plt>
mov    %eax,%edi
call   1030 <arm_memio_ldrh@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<t16_ldrh_imm5>:
push   %rax
mov    $0x2,%edi
call   1040 <t16_memio_imm5_op@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <arm_memio_ldrh@plt>

LLVM IR (-O0):
define void @t16_ldrh_imm5() {
%1 = call i32 @t16_memio_imm5_op(i32 2)
%2 = call i32 @arm_memio_ldrh(i32 %1)
ret void
}

LLVM IR (-O2):
define void @t16_ldrh_imm5() {
%1 = tail call i32 @t16_memio_imm5_op(i32 2)
%2 = tail call i32 @arm_memio_ldrh(i32 %1)
ret void
}
/* Variables and functions */
char *checked_malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int);
char *get_level_id_suffix(int id_nr) {
  char *id_suffix = checked_malloc(1 + 3 + 1);
  if (id_nr < 0 || id_nr > 999)
    id_nr = 0;
  sprintf(id_suffix, ".%03d", id_nr);
  return id_suffix;
}


x86 assembly (clang, -O0):
<get_level_id_suffix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x5,%edi
call   1030 <checked_malloc@plt>
mov    %rax,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1150 <get_level_id_suffix+0x30>
cmpl   $0x3e7,-0x4(%rbp)
jle    1157 <get_level_id_suffix+0x37>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x4(%rbp),%edx
lea    0xe9b(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_level_id_suffix>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x5,%edi
call   1030 <checked_malloc@plt>
mov    %rax,%r14
xor    %edx,%edx
cmp    $0x3e8,%ebx
cmovb  %ebx,%edx
lea    0xebb(%rip),%rsi
mov    %rax,%rdi
call   1040 <sprintf@plt>
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [6 x i8] c".%03d\00"
define i8* @get_level_id_suffix(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* @checked_malloc(i32 5)
store i8* %4, i8** %3
%5 = load i32, i32* %2
%6 = icmp slt i32 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %1
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 999
br i1 %9, label %10, label %11
10: ; preds = %7, %1
store i32 0, i32* %2
br label %11
11: ; preds = %10, %7
%12 = load i8*, i8** %3
%13 = load i32, i32* %2
%14 = call i32 @sprintf(i8* %12, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i8*, i8** %3
ret i8* %15
}

LLVM IR (-O2):
@.str = [6 x i8] c".%03d\00"
define i8* @get_level_id_suffix(i32 %0) {
%2 = tail call i8* @checked_malloc(i32 5)
%3 = icmp ugt i32 %0, 999
%4 = select i1 %3, i32 0, i32 %0
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i8* %2
}
void sws_normalizeVec() {}


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

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

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

LLVM IR (-O2):
define void @sws_normalizeVec() {
ret void
}
/* Variables and functions */
unsigned long str_to_i(char const *);
unsigned long str_to_u(const char *s) { return str_to_i(s); }


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

x86 assembly (clang, -O2):
<str_to_u>:
jmp    1030 <str_to_i@plt>

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

LLVM IR (-O2):
define i64 @str_to_u(i8* %0) {
%2 = tail call i64 @str_to_i(i8* %0)
ret i64 %2
}
void unregister_ioctl32_conversion(unsigned int cmd) {}


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

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

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

LLVM IR (-O2):
define void @unregister_ioctl32_conversion(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("hello \n"); }


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

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

LLVM IR (-O0):
@.str = [8 x i8] c"hello \0A\00"
define void @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [7 x i8] c"hello \00"
define void @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void showHelp() {
  printf("Argumenty programu:\n"
         "--help  zpusobi, ze program vytiskne napovedu pouzivani programu a "
         "skonci.\n"
         "--sqrt X vypocita a vypise druhou odmocninu z cisla X.\n"
         "--asin X vypocita a vypise arcus sinus z cisla X.\n"
         "--triangle AX AY BX BY CX CY vypocita a vypise tri uhly "
         "troujuhelniku, ktery je dan vrcholy A=AX,AY, B=BX,BY a C=CX,CY.\n");
}


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

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

LLVM IR (-O0):
@.str = [321 x i8] c"Argumenty programu:\0A--help zpusobi, ze program vytiskne napovedu pouzivani programu a skonci.\0A--sqrt X vypocita a vypise druhou odmocninu z cisla X.\0A--asin X vypocita a vypise arcus sinus z cisla X.\0A--triangle AX AY BX BY CX CY vypocita a vypise tri uhly troujuhelniku, ktery je dan vrcholy A=AX,AY, B=BX,BY a C=CX,CY.\0A\00"
define void @showHelp() {
%1 = call i32 @printf(i8* getelementptr inbounds ([321 x i8], [321 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [320 x i8] c"Argumenty programu:\0A--help zpusobi, ze program vytiskne napovedu pouzivani programu a skonci.\0A--sqrt X vypocita a vypise druhou odmocninu z cisla X.\0A--asin X vypocita a vypise arcus sinus z cisla X.\0A--triangle AX AY BX BY CX CY vypocita a vypise tri uhly troujuhelniku, ktery je dan vrcholy A=AX,AY, B=BX,BY a C=CX,CY.\00"
define void @showHelp() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([320 x i8], [320 x i8]* @str, i64 0, i64 0))
ret void
}
/* Type definitions */
struct dirent {
  int /*<<< orphan*/ d_name;
};

/* Variables and functions */
int strverscmp(int /*<<< orphan*/, int /*<<< orphan*/);
int vsort(const struct dirent **a, const struct dirent **b) {
  return strverscmp((*a)->d_name, (*b)->d_name);
}


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

x86 assembly (clang, -O2):
<vsort>:
mov    (%rdi),%rax
mov    (%rax),%edi
mov    (%rsi),%rax
mov    (%rax),%esi
jmp    1030 <strverscmp@plt>

LLVM IR (-O0):
%struct.dirent = type { i32 }
define i32 @vsort(%struct.dirent** %0, %struct.dirent** %1) {
%3 = alloca %struct.dirent**
%4 = alloca %struct.dirent**
store %struct.dirent** %0, %struct.dirent*** %3
store %struct.dirent** %1, %struct.dirent*** %4
%5 = load %struct.dirent**, %struct.dirent*** %3
%6 = load %struct.dirent*, %struct.dirent** %5
%7 = getelementptr inbounds %struct.dirent, %struct.dirent* %6, i32 0, i32 0
%8 = load i32, i32* %7
%9 = load %struct.dirent**, %struct.dirent*** %4
%10 = load %struct.dirent*, %struct.dirent** %9
%11 = getelementptr inbounds %struct.dirent, %struct.dirent* %10, i32 0, i32 0
%12 = load i32, i32* %11
%13 = call i32 @strverscmp(i32 %8, i32 %12)
ret i32 %13
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
define i32 @vsort(%struct.dirent** nocapture %0, %struct.dirent** nocapture %1) {
%3 = load %struct.dirent*, %struct.dirent** %0
%4 = getelementptr inbounds %struct.dirent, %struct.dirent* %3, i64 0, i32 0
%5 = load i32, i32* %4
%6 = load %struct.dirent*, %struct.dirent** %1
%7 = getelementptr inbounds %struct.dirent, %struct.dirent* %6, i64 0, i32 0
%8 = load i32, i32* %7
%9 = tail call i32 @strverscmp(i32 %5, i32 %8)
ret i32 %9
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ sleep(int);
int main(int argc, char **argv) {
  int time;
  if (argc > 1) {
    time = 4 * atoi(argv[1]);
  }
  sleep(time);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1153 <main+0x33>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1030 <atoi@plt>
shl    $0x2,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <sleep@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x8(%rsi),%rdi
call   1030 <atoi@plt>
lea    0x0(,%rax,4),%edi
call   1040 <sleep@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @atoi(i8* %12)
%14 = mul nsw i32 4, %13
store i32 %14, i32* %6
br label %15
15: ; preds = %9, %2
%16 = load i32, i32* %6
%17 = call i32 @sleep(i32 %16)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
tail call void @llvm.assume(i1 %3)
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = tail call i32 @atoi(i8* %5)
%7 = shl nsw i32 %6, 2
%8 = tail call i32 @sleep(i32 %7)
ret i32 0
}
/* Variables and functions */
int new_clone(int);
int /*<<< orphan*/ printf(char *);
page49() {
  printf("The instructor drags your inert body into a specimen detainment "
         "cage.\n");
  printf("\"He\'ll make a good subject for tomorrow\'s mutant dissection "
         "class,\" you hear.\n");
  return new_clone(32);
}


x86 assembly (clang, -O0):
<page49>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
lea    0xf10(%rip),%rdi
call   1030 <printf@plt>
mov    $0x20,%edi
call   1040 <new_clone@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<page49>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf12(%rip),%rdi
call   1030 <puts@plt>
mov    $0x20,%edi
pop    %rax
jmp    1040 <new_clone@plt>

LLVM IR (-O0):
@.str = [71 x i8] c"The instructor drags your inert body into a specimen detainment cage.\0A\00"
@.str.1 = [79 x i8] c"\22He'll make a good subject for tomorrow's mutant dissection class,\22 you hear.\0A\00"
define i32 @page49() {
%1 = call i32 @printf(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @new_clone(i32 32)
ret i32 %3
}

LLVM IR (-O2):
@str = [70 x i8] c"The instructor drags your inert body into a specimen detainment cage.\00"
@str.2 = [78 x i8] c"\22He'll make a good subject for tomorrow's mutant dissection class,\22 you hear.\00"
define i32 @page49() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.2, i64 0, i64 0))
%3 = tail call i32 @new_clone(i32 32)
ret i32 %3
}
/* Type definitions */
typedef scalar_t__ off_t;
typedef int /*<<< orphan*/ __ptr_t;
typedef scalar_t__ __off64_t;

/* Variables and functions */
int /*<<< orphan*/ EOVERFLOW;
int /*<<< orphan*/ MAP_FAILED;
int /*<<< orphan*/ __mmap(int /*<<< orphan*/, size_t, int, int, int,
                          scalar_t__);
int /*<<< orphan*/ __set_errno(int /*<<< orphan*/);
__ptr_t __mmap64(__ptr_t addr, size_t len, int prot, int flags, int fd,
                 __off64_t offset) {
  off_t small_offset = (off_t)offset;
  if (small_offset != offset) {
    __set_errno(EOVERFLOW);
    return MAP_FAILED;
  }
  return __mmap(addr, len, prot, flags, fd, small_offset);
}


x86 assembly (clang, -O0):
<__mmap64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x28(%rbp),%rax
je     1172 <__mmap64+0x52>
mov    0x2e96(%rip),%rax
mov    (%rax),%edi
call   1030 <__set_errno@plt>
mov    0x2e70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    118f <__mmap64+0x6f>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
mov    -0x30(%rbp),%r9
call   1040 <__mmap@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__mmap64>:
jmp    1030 <__mmap@plt>

LLVM IR (-O0):
@EOVERFLOW = global i32 0
@MAP_FAILED = global i32 0
define i32 @__mmap64(i32 %0, i64 %1, i32 %2, i32 %3, i32 %4, i64 %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i64
%14 = alloca i64
store i32 %0, i32* %8
store i64 %1, i64* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i64 %5, i64* %13
%15 = load i64, i64* %13
store i64 %15, i64* %14
%16 = load i64, i64* %14
%17 = load i64, i64* %13
%18 = icmp ne i64 %16, %17
br i1 %18, label %19, label %23
19: ; preds = %6
%20 = load i32, i32* @EOVERFLOW
%21 = call i32 @__set_errno(i32 %20)
%22 = load i32, i32* @MAP_FAILED
store i32 %22, i32* %7
br label %31
23: ; preds = %6
%24 = load i32, i32* %8
%25 = load i64, i64* %9
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = load i32, i32* %12
%29 = load i64, i64* %14
%30 = call i32 @__mmap(i32 %24, i64 %25, i32 %26, i32 %27, i32 %28, i64 %29)
store i32 %30, i32* %7
br label %31
31: ; preds = %23, %19
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
@EOVERFLOW = global i32 0
@MAP_FAILED = global i32 0
define i32 @__mmap64(i32 %0, i64 %1, i32 %2, i32 %3, i32 %4, i64 %5) {
%7 = tail call i32 @__mmap(i32 %0, i64 %1, i32 %2, i32 %3, i32 %4, i64 %5)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void f2(void) { printf("the second exit handler\n"); }


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

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

LLVM IR (-O0):
@.str = [25 x i8] c"the second exit handler\0A\00"
define void @f2() {
%1 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [24 x i8] c"the second exit handler\00"
define void @f2() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ my_strrev(char *);
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char string[] = "foobar12345";
  my_strrev(string);
  printf("%s\n", string);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movabs $0x32317261626f6f66,%rax
72 31 32
mov    %rax,(%rsp)
movl   $0x353433,0x8(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <my_strrev@plt>
lea    0xebf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.string = [12 x i8] c"foobar12345\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [12 x i8]
store i32 0, i32* %1
%3 = bitcast [12 x i8]* %2 to i8*
%4 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%5 = call i32 @my_strrev(i8* %4)
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %6)
ret i32 0
}

LLVM IR (-O2):
@__const.main.string = [12 x i8] c"foobar12345\00"
@.str = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca [12 x i8]
%2 = getelementptr inbounds [12 x i8], [12 x i8]* %1, i64 0, i64 0
%3 = call i32 @my_strrev(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ unlink(char *);
void remove_pid(char *filename) {
  if (*filename)
    unlink(filename);
}


x86 assembly (clang, -O0):
<remove_pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1132 <remove_pid+0x22>
mov    -0x8(%rbp),%rdi
call   1030 <unlink@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<remove_pid>:
cmpb   $0x0,(%rdi)
je     111a <remove_pid+0xa>
jmp    1030 <unlink@plt>
ret

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

LLVM IR (-O2):
define void @remove_pid(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @unlink(i8* %0)
br label %6
6: ; preds = %4, %1
ret void
}
int main(void) {
  int a = 1, b;
  return 0;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Type definitions */
struct qcom_smem_state_ops {
  int dummy;
};
struct qcom_smem_state {
  int dummy;
};
struct device_node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EINVAL;
struct qcom_smem_state *ERR_PTR(int /*<<< orphan*/);
struct qcom_smem_state *
qcom_smem_state_register(struct device_node *of_node,
                         const struct qcom_smem_state_ops *ops, void *data) {
  return ERR_PTR(-EINVAL);
}


x86 assembly (clang, -O0):
<qcom_smem_state_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %edi,%edi
mov    0x2eb3(%rip),%rax
sub    (%rax),%edi
call   1030 <ERR_PTR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qcom_smem_state_register>:
mov    0x2ec9(%rip),%rax
xor    %edi,%edi
sub    (%rax),%edi
jmp    1030 <ERR_PTR@plt>

LLVM IR (-O0):
%struct.qcom_smem_state = type { i32 }
%struct.device_node = type { i32 }
%struct.qcom_smem_state_ops = type { i32 }
@EINVAL = global i32 0
define %struct.qcom_smem_state* @qcom_smem_state_register(%struct.device_node* %0, %struct.qcom_smem_state_ops* %1, i8* %2) {
%4 = alloca %struct.device_node*
%5 = alloca %struct.qcom_smem_state_ops*
%6 = alloca i8*
store %struct.device_node* %0, %struct.device_node** %4
store %struct.qcom_smem_state_ops* %1, %struct.qcom_smem_state_ops** %5
store i8* %2, i8** %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
%9 = call %struct.qcom_smem_state* @ERR_PTR(i32 %8)
ret %struct.qcom_smem_state* %9
}

LLVM IR (-O2):
%struct.qcom_smem_state = type { i32 }
%struct.device_node = type { i32 }
%struct.qcom_smem_state_ops = type { i32 }
@EINVAL = global i32 0
define %struct.qcom_smem_state* @qcom_smem_state_register(%struct.device_node* nocapture readnone %0, %struct.qcom_smem_state_ops* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
%6 = tail call %struct.qcom_smem_state* @ERR_PTR(i32 %5)
ret %struct.qcom_smem_state* %6
}
int f_blt_mr2(float *a1, float a2) { return !(__builtin_isless(*a1, a2)); }


x86 assembly (clang, -O0):
<f_blt_mr2>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
seta   %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f_blt_mr2>:
xor    %eax,%eax
ucomiss (%rdi),%xmm0
setbe  %al
ret

LLVM IR (-O0):
define i32 @f_blt_mr2(float* %0, float %1) {
%3 = alloca float*
%4 = alloca float
store float* %0, float** %3
store float %1, float* %4
%5 = load float*, float** %3
%6 = load float, float* %5
%7 = load float, float* %4
%8 = fcmp olt float %6, %7
%9 = xor i1 %8, true
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @f_blt_mr2(float* nocapture %0, float %1) {
%3 = load float, float* %0
%4 = fcmp uge float %3, %1
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
void *function(void *threadid) {
  long tid;
  tid = (long)threadid;
  printf("thread #%ld!\n", tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [14 x i8] c"thread #%ld!\0A\00"
define i8* @function(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = ptrtoint i8* %5 to i64
store i64 %6, i64* %4
%7 = load i64, i64* %4
%8 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %7)
%9 = call i32 @pthread_exit(i32* null)
%10 = load i8*, i8** %2
ret i8* %10
}

LLVM IR (-O2):
@.str = [14 x i8] c"thread #%ld!\0A\00"
define noalias i8* @function(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i64 %2)
%4 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Variables and functions */
int *malloc(int);
int *compound_return_no_leak() {
  return ({
    int *p = malloc(sizeof(int));
    p;
  });
}


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

x86 assembly (clang, -O2):
<compound_return_no_leak>:
mov    $0x4,%edi
jmp    1030 <malloc@plt>

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

LLVM IR (-O2):
define noalias i32* @compound_return_no_leak() {
%1 = tail call i32* @malloc(i32 4)
ret i32* %1
}
/* Variables and functions */
int /*<<< orphan*/ ld_nn_sp();
void opcode_08() { ld_nn_sp(); }


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

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

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

LLVM IR (-O2):
define void @opcode_08() {
%1 = tail call i32 (...) @ld_nn_sp()
ret void
}
/* Type definitions */
struct dm_map {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dm_process_tiles(struct dm_map *);
int /*<<< orphan*/ ge_process(struct dm_map *);
int /*<<< orphan*/ tt_process_items(struct dm_map *);
int /*<<< orphan*/ tt_process_monsters(struct dm_map *);
int /*<<< orphan*/ tt_process_status_effects();
void tt_process(struct dm_map *map) {
  tt_process_monsters(map);
  tt_process_items(map);
  dm_process_tiles(map);
  ge_process(map);
  tt_process_status_effects();
}


x86 assembly (clang, -O0):
<tt_process>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <tt_process_monsters@plt>
mov    -0x8(%rbp),%rdi
call   1050 <tt_process_items@plt>
mov    -0x8(%rbp),%rdi
call   1060 <dm_process_tiles@plt>
mov    -0x8(%rbp),%rdi
call   1040 <ge_process@plt>
mov    $0x0,%al
call   1030 <tt_process_status_effects@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tt_process>:
push   %rbx
mov    %rdi,%rbx
call   1070 <tt_process_monsters@plt>
mov    %rbx,%rdi
call   1050 <tt_process_items@plt>
mov    %rbx,%rdi
call   1060 <dm_process_tiles@plt>
mov    %rbx,%rdi
call   1040 <ge_process@plt>
xor    %eax,%eax
pop    %rbx
jmp    1030 <tt_process_status_effects@plt>

LLVM IR (-O0):
%struct.dm_map = type { i32 }
define void @tt_process(%struct.dm_map* %0) {
%2 = alloca %struct.dm_map*
store %struct.dm_map* %0, %struct.dm_map** %2
%3 = load %struct.dm_map*, %struct.dm_map** %2
%4 = call i32 @tt_process_monsters(%struct.dm_map* %3)
%5 = load %struct.dm_map*, %struct.dm_map** %2
%6 = call i32 @tt_process_items(%struct.dm_map* %5)
%7 = load %struct.dm_map*, %struct.dm_map** %2
%8 = call i32 @dm_process_tiles(%struct.dm_map* %7)
%9 = load %struct.dm_map*, %struct.dm_map** %2
%10 = call i32 @ge_process(%struct.dm_map* %9)
%11 = call i32 (...) @tt_process_status_effects()
ret void
}

LLVM IR (-O2):
%struct.dm_map = type { i32 }
define void @tt_process(%struct.dm_map* %0) {
%2 = tail call i32 @tt_process_monsters(%struct.dm_map* %0)
%3 = tail call i32 @tt_process_items(%struct.dm_map* %0)
%4 = tail call i32 @dm_process_tiles(%struct.dm_map* %0)
%5 = tail call i32 @ge_process(%struct.dm_map* %0)
%6 = tail call i32 (...) @tt_process_status_effects()
ret void
}
unsigned tcp_hash(unsigned ip_src, unsigned ip_dst, unsigned port_src,
                  unsigned port_dst) {
  unsigned result;
  result = ip_src;
  result ^= ip_dst * 2;
  result ^= port_src;
  result ^= port_dst * 2;
  result &= 4096 - 1;
  return result;
}


x86 assembly (clang, -O0):
<tcp_hash>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
shl    $0x1,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
xor    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xfff,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tcp_hash>:
add    %esi,%esi
xor    %edx,%edi
xor    %edi,%esi
lea    (%rcx,%rcx,1),%eax
xor    %esi,%eax
and    $0xfff,%eax
ret

LLVM IR (-O0):
define i32 @tcp_hash(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
store i32 %10, i32* %9
%11 = load i32, i32* %6
%12 = mul i32 %11, 2
%13 = load i32, i32* %9
%14 = xor i32 %13, %12
store i32 %14, i32* %9
%15 = load i32, i32* %7
%16 = load i32, i32* %9
%17 = xor i32 %16, %15
store i32 %17, i32* %9
%18 = load i32, i32* %8
%19 = mul i32 %18, 2
%20 = load i32, i32* %9
%21 = xor i32 %20, %19
store i32 %21, i32* %9
%22 = load i32, i32* %9
%23 = and i32 %22, 4095
store i32 %23, i32* %9
%24 = load i32, i32* %9
ret i32 %24
}

LLVM IR (-O2):
define i32 @tcp_hash(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = shl i32 %1, 1
%6 = xor i32 %5, %0
%7 = xor i32 %6, %2
%8 = shl i32 %3, 1
%9 = xor i32 %7, %8
%10 = and i32 %9, 4095
ret i32 %10
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ fe_delivery_system_t;

/* Variables and functions */
int /*<<< orphan*/ DTV_DELIVERY_SYSTEM;
int get_property(int, int /*<<< orphan*/, int /*<<< orphan*/ *,
                 int /*<<< orphan*/ *);
int dvbfe_get_delsys(int fd, fe_delivery_system_t *delsys) {
  uint32_t len;
  return get_property(fd, DTV_DELIVERY_SYSTEM, &len, (uint8_t *)delsys);
}


x86 assembly (clang, -O0):
<dvbfe_get_delsys>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ebf(%rip),%rax
mov    (%rax),%esi
mov    -0x10(%rbp),%rcx
lea    -0x14(%rbp),%rdx
call   1030 <get_property@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dvbfe_get_delsys>:
push   %rax
mov    %rsi,%rcx
mov    0x2ecd(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rdx
call   1030 <get_property@plt>
pop    %rcx
ret

LLVM IR (-O0):
@DTV_DELIVERY_SYSTEM = global i32 0
define i32 @dvbfe_get_delsys(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* @DTV_DELIVERY_SYSTEM
%8 = load i32*, i32** %4
%9 = call i32 @get_property(i32 %6, i32 %7, i32* %5, i32* %8)
ret i32 %9
}

LLVM IR (-O2):
@DTV_DELIVERY_SYSTEM = global i32 0
define i32 @dvbfe_get_delsys(i32 %0, i32* %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = load i32, i32* @DTV_DELIVERY_SYSTEM
%6 = call i32 @get_property(i32 %0, i32 %5, i32* %3, i32* %1)
ret i32 %6
}
int tas(long *x) {
  int v;
  __asm__("movl   $1, %%eax\n\t"
          "xchgl  %%eax,(%%ecx)"
          : "=a"(v)
          : "c"(x));
  switch (v) {
  case 0:
  case 1:
    return v;
  default:
    print("canlock: corrupted 0x%lux\n", v);
    return 1;
  }
}


x86 assembly (clang, -O0):
<tas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x1,%eax
xchg   %eax,(%ecx)
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
ja     1147 <tas+0x37>
jmp    113c <tas+0x2c>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115f <tas+0x4f>
mov    -0x14(%rbp),%esi
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <print@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tas>:
mov    %rdi,%rcx
mov    $0x1,%eax
xchg   %eax,(%ecx)
cmp    $0x2,%eax
jb     113a <tas+0x2a>
push   %rax
lea    0xed8(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <print@plt>
mov    $0x1,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"canlock: corrupted 0x%lux\0A\00"
define i32 @tas(i64* %0) {
%2 = alloca i32
%3 = alloca i64*
%4 = alloca i32
store i64* %0, i64** %3
%5 = load i64*, i64** %3
%6 = call i32 asm "movl $$1, %eax\0A\09xchgl %eax,(%ecx)", "={ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64* %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
switch i32 %7, label %10 [
i32 0, label %8
i32 1, label %8
]
8: ; preds = %1, %1
%9 = load i32, i32* %4
store i32 %9, i32* %2
br label %13
10: ; preds = %1
%11 = load i32, i32* %4
%12 = call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %11)
store i32 1, i32* %2
br label %13
13: ; preds = %10, %8
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
@.str = [27 x i8] c"canlock: corrupted 0x%lux\0A\00"
define i32 @tas(i64* %0) {
%2 = tail call i32 asm "movl $$1, %eax\0A\09xchgl %eax,(%ecx)", "={ax},{cx},~{dirflag},~{fpsr},~{flags}"(i64* %0)
%3 = icmp ult i32 %2, 2
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, i32, ...) bitcast (i32 (...)* @print to i32 (i8*, i32, ...)*)(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i32 %2)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ 1, %4 ], [ %2, %1 ]
ret i32 %7
}
/* Variables and functions */
void *fz_malloc_array(void *, unsigned int, unsigned int);
void *zalloc(void *opaque, unsigned int items, unsigned int size) {
  return fz_malloc_array(opaque, items, size);
}


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

x86 assembly (clang, -O2):
<zalloc>:
jmp    1030 <fz_malloc_array@plt>

LLVM IR (-O0):
define i8* @zalloc(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
%7 = load i8*, i8** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i8* @fz_malloc_array(i8* %7, i32 %8, i32 %9)
ret i8* %10
}

LLVM IR (-O2):
define i8* @zalloc(i8* %0, i32 %1, i32 %2) {
%4 = tail call i8* @fz_malloc_array(i8* %0, i32 %1, i32 %2)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ X509;

/* Variables and functions */
char *X509_NAME_oneline(int /*<<< orphan*/, int /*<<< orphan*/,
                        int /*<<< orphan*/);
int /*<<< orphan*/ X509_get_issuer_name(int /*<<< orphan*/ *);
char *abac_get_issuer(X509 *cert) {
  char *ptr = X509_NAME_oneline(X509_get_issuer_name(cert), 0, 0);
  return ptr;
}


x86 assembly (clang, -O0):
<abac_get_issuer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <X509_get_issuer_name@plt>
mov    %eax,%edi
xor    %edx,%edx
mov    %edx,%esi
call   1030 <X509_NAME_oneline@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<abac_get_issuer>:
push   %rax
call   1040 <X509_get_issuer_name@plt>
mov    %eax,%edi
xor    %esi,%esi
xor    %edx,%edx
pop    %rax
jmp    1030 <X509_NAME_oneline@plt>

LLVM IR (-O0):
define i8* @abac_get_issuer(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = call i32 @X509_get_issuer_name(i32* %4)
%6 = call i8* @X509_NAME_oneline(i32 %5, i32 0, i32 0)
store i8* %6, i8** %3
%7 = load i8*, i8** %3
ret i8* %7
}

LLVM IR (-O2):
define i8* @abac_get_issuer(i32* %0) {
%2 = tail call i32 @X509_get_issuer_name(i32* %0)
%3 = tail call i8* @X509_NAME_oneline(i32 %2, i32 0, i32 0)
ret i8* %3
}
void init_once(int *once, void (*func)(void)) {
  if (*once == 0) {
    func();
    *once = 1;
  }
}


x86 assembly (clang, -O0):
<init_once>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    112a <init_once+0x2a>
call   *-0x10(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_once>:
push   %rbx
cmpl   $0x0,(%rdi)
je     1108 <init_once+0x8>
pop    %rbx
ret
mov    %rdi,%rbx
call   *%rsi
movl   $0x1,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @init_once(i32* nocapture %0, void ()* nocapture %1) {
%3 = load i32, i32* %0
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %2
tail call void %1()
store i32 1, i32* %0
br label %6
6: ; preds = %5, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ const ptrdiff_t;

/* Variables and functions */
ptrdiff_t qks_min(const ptrdiff_t a, const ptrdiff_t b) {
  return (a < b) ? a : b;
}


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

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

LLVM IR (-O0):
define i32 @qks_min(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 @qks_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
float abs2f(float x) { return x * x; }


x86 assembly (clang, -O0):
<abs2f>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<abs2f>:
mulss  %xmm0,%xmm0
ret

LLVM IR (-O0):
define float @abs2f(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = load float, float* %2
%5 = fmul float %3, %4
ret float %5
}

LLVM IR (-O2):
define float @abs2f(float %0) {
%2 = fmul float %0, %0
ret float %2
}
/* Variables and functions */
void *dlsym(void *, char const *);
void *dlwrap_dlsym(void *handle, const char *symbol) {
  void *ret;
  ret = dlsym(handle, symbol);
  return ret;
}


x86 assembly (clang, -O0):
<dlwrap_dlsym>:
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 <dlsym@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dlwrap_dlsym>:
jmp    1030 <dlsym@plt>

LLVM IR (-O0):
define i8* @dlwrap_dlsym(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8*, i8** %4
%8 = call i8* @dlsym(i8* %6, i8* %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
ret i8* %9
}

LLVM IR (-O2):
define i8* @dlwrap_dlsym(i8* %0, i8* %1) {
%3 = tail call i8* @dlsym(i8* %0, i8* %1)
ret i8* %3
}
int test_imm_2Bint16_reg(short val) {
  return ((val) & (-0x2B << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_2Bint16_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movswl -0x2(%rbp),%edx
and    $0xffffffd5,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_2Bint16_reg(i16 signext %0) {
%2 = and i16 %0, -43
%3 = icmp eq i16 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_help() {
  printf("compress BMP file into JPEG file.\n");
  printf("Usage:\n");
  printf("    cjpeg {BMP} {JPEG}\n");
  printf("\n");
  printf("Author: Yu, Le <yeolar@gmail.com>\n");
}


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

x86 assembly (clang, -O2):
<print_help>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <puts@plt>
lea    0xeee(%rip),%rdi
call   1040 <puts@plt>
lea    0xee9(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xeea(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [35 x i8] c"compress BMP file into JPEG file.\0A\00"
@.str.1 = [8 x i8] c"Usage:\0A\00"
@.str.2 = [24 x i8] c" cjpeg {BMP} {JPEG}\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
@.str.4 = [35 x i8] c"Author: Yu, Le <yeolar@gmail.com>\0A\00"
define void @print_help() {
%1 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [34 x i8] c"compress BMP file into JPEG file.\00"
@str.5 = [7 x i8] c"Usage:\00"
@str.6 = [23 x i8] c" cjpeg {BMP} {JPEG}\00"
@str.7 = [34 x i8] c"Author: Yu, Le <yeolar@gmail.com>\00"
define void @print_help() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.5, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.6, i64 0, i64 0))
%4 = tail call i32 @putchar(i32 10)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.7, i64 0, i64 0))
ret void
}
/* Variables and functions */
int INT_MIN;
int /*<<< orphan*/ this_comparison_is_true();
void bla1ge(int var) {
  if (var + 10 >= INT_MIN + 10)
    this_comparison_is_true();
}


x86 assembly (clang, -O0):
<bla1ge>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xa,%eax
mov    0x2ec0(%rip),%rcx
mov    (%rcx),%ecx
add    $0xa,%ecx
cmp    %ecx,%eax
jl     113c <bla1ge+0x2c>
mov    $0x0,%al
call   1030 <this_comparison_is_true@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bla1ge>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jle    111c <bla1ge+0xc>
ret
xor    %eax,%eax
jmp    1030 <this_comparison_is_true@plt>

LLVM IR (-O0):
@INT_MIN = global i32 0
define void @bla1ge(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 10
%5 = load i32, i32* @INT_MIN
%6 = add nsw i32 %5, 10
%7 = icmp sge i32 %4, %6
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = call i32 (...) @this_comparison_is_true()
br label %10
10: ; preds = %8, %1
ret void
}

LLVM IR (-O2):
@INT_MIN = global i32 0
define void @bla1ge(i32 %0) {
%2 = load i32, i32* @INT_MIN
%3 = icmp sgt i32 %2, %0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (...) @this_comparison_is_true()
br label %6
6: ; preds = %4, %1
ret void
}