xunge/DecIR huggingface dataset:
int test_imm_DFuint32_reg(unsigned int val) {
  return ((val) & (0xDF << 0)) ? -20 : -40;
}


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

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

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

LLVM IR (-O2):
define i32 @test_imm_DFuint32_reg(i32 %0) {
%2 = and i32 %0, 223
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int sum(const int a, const int b) { return a + b; }


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

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

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

LLVM IR (-O2):
define i32 @sum(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ swap(int *, int *);
void sort(int arr[]) { swap(&arr[0], &arr[1]); }


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

x86 assembly (clang, -O2):
<sort>:
lea    0x4(%rdi),%rsi
jmp    1030 <swap@plt>

LLVM IR (-O0):
define void @sort(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = getelementptr inbounds i32, i32* %3, i64 0
%5 = load i32*, i32** %2
%6 = getelementptr inbounds i32, i32* %5, i64 1
%7 = call i32 @swap(i32* %4, i32* %6)
ret void
}

LLVM IR (-O2):
define void @sort(i32* %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = tail call i32 @swap(i32* %0, i32* %2)
ret void
}
/* Variables and functions */
double **calloc(int, size_t);
double **allocMatrix(int r, int c) {
  double **ret;
  ret = calloc(sizeof(double), (size_t)(r * c));
  return ret;
}


x86 assembly (clang, -O0):
<allocMatrix>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
movslq %eax,%rsi
mov    $0x8,%edi
call   1030 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<allocMatrix>:
imul   %esi,%edi
movslq %edi,%rsi
mov    $0x8,%edi
jmp    1030 <calloc@plt>

LLVM IR (-O0):
define double** @allocMatrix(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double**
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = load i32, i32* %4
%8 = mul nsw i32 %6, %7
%9 = sext i32 %8 to i64
%10 = call double** @calloc(i32 8, i64 %9)
store double** %10, double*** %5
%11 = load double**, double*** %5
ret double** %11
}

LLVM IR (-O2):
define double** @allocMatrix(i32 %0, i32 %1) {
%3 = mul nsw i32 %1, %0
%4 = sext i32 %3 to i64
%5 = tail call double** @calloc(i32 8, i64 %4)
ret double** %5
}
/* Variables and functions */
int /*<<< orphan*/ subcycle1();
void __attribute__((flatten)) subcycle(void) { subcycle1(); }


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

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

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

LLVM IR (-O2):
define void @subcycle() {
%1 = tail call i32 (...) @subcycle1()
ret void
}
/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
void clearBufffer() {
  int ch;
  do {
    ch = fgetc(stdin);
  } while (ch != EOF && ch != '\n');
}


x86 assembly (clang, -O0):
<clearBufffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
call   1030 <fgetc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%ecx
xor    %eax,%eax
mov    0x2eab(%rip),%rdx
cmp    (%rdx),%ecx
mov    %al,-0x5(%rbp)
je     114a <clearBufffer+0x3a>
cmpl   $0xa,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
test   $0x1,%al
jne    1118 <clearBufffer+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearBufffer>:
push   %r14
push   %rbx
push   %rax
mov    0x2ecd(%rip),%r14
mov    0x2ebe(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14),%edi
call   1030 <fgetc@plt>
cmp    $0xa,%eax
je     1141 <clearBufffer+0x31>
cmp    (%rbx),%eax
jne    1130 <clearBufffer+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stdin = global i32 0
@EOF = global i32 0
define void @clearBufffer() {
%1 = alloca i32
br label %2
2: ; preds = %12, %0
%3 = load i32, i32* @stdin
%4 = call i32 @fgetc(i32 %3)
store i32 %4, i32* %1
br label %5
5: ; preds = %2
%6 = load i32, i32* %1
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = load i32, i32* %1
%11 = icmp ne i32 %10, 10
br label %12
12: ; preds = %9, %5
%13 = phi i1 [ false, %5 ], [ %11, %9 ]
br i1 %13, label %2, label %14
14: ; preds = %12
ret void
}

LLVM IR (-O2):
@stdin = global i32 0
@EOF = global i32 0
define void @clearBufffer() {
br label %1
1: ; preds = %1, %0
%2 = load i32, i32* @stdin
%3 = tail call i32 @fgetc(i32 %2)
%4 = load i32, i32* @EOF
%5 = icmp ne i32 %3, %4
%6 = icmp ne i32 %3, 10
%7 = and i1 %6, %5
br i1 %7, label %1, label %8
8: ; preds = %1
ret void
}
int main() {
  int b, c, d, i;
  b = c = d = 0;
  int N = 5, a[5];
  for (i = 0; i < N; a[i++] = i)
    ;
  for (i = 0; i < N; a[++i] = i)
    ;
  i = 1;
  while ((i *= 2) < N)
    ;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x5,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1158 <main+0x58>
jmp    113f <main+0x3f>
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%eax
mov    %eax,%edx
add    $0x1,%edx
mov    %edx,-0x14(%rbp)
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    112e <main+0x2e>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1187 <main+0x87>
jmp    1170 <main+0x70>
mov    -0x14(%rbp),%ecx
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cltq
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    115f <main+0x5f>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmp    -0x18(%rbp),%eax
jge    11a5 <main+0xa5>
jmp    118e <main+0x8e>
mov    -0x4(%rbp),%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
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca [5 x i32]
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %3
store i32 0, i32* %2
store i32 5, i32* %6
store i32 0, i32* %5
br label %8
8: ; preds = %13, %0
%9 = load i32, i32* %5
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %19
12: ; preds = %8
br label %13
13: ; preds = %12
%14 = load i32, i32* %5
%15 = load i32, i32* %5
%16 = add nsw i32 %15, 1
store i32 %16, i32* %5
%17 = sext i32 %15 to i64
%18 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %17
store i32 %14, i32* %18
br label %8
19: ; preds = %8
store i32 0, i32* %5
br label %20
20: ; preds = %25, %19
%21 = load i32, i32* %5
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %31
24: ; preds = %20
br label %25
25: ; preds = %24
%26 = load i32, i32* %5
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %7, i64 0, i64 %29
store i32 %26, i32* %30
br label %20
31: ; preds = %20
store i32 1, i32* %5
br label %32
32: ; preds = %37, %31
%33 = load i32, i32* %5
%34 = mul nsw i32 %33, 2
store i32 %34, i32* %5
%35 = load i32, i32* %6
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %38
37: ; preds = %32
br label %32
38: ; preds = %32
%39 = load i32, i32* %1
ret i32 %39
}

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
/* Variables and functions */
int rand();
void foo(void) {
  int a, b;
  int i;
  a = rand() % 65536;
  b = rand() % 65536;
  for (i = 0; i < b; i++)
    a += b;
  i = a;
  return;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    $0x10000,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1166 <foo+0x56>
mov    -0x8(%rbp),%eax
add    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1143 <foo+0x33>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo>:
push   %rax
xor    %eax,%eax
call   1030 <rand@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <rand@plt>

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

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

/* Variables and functions */
int EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int getc(int /*<<< orphan*/ *);
int /*<<< orphan*/ putchar(int);
void aboutThisApp() {
  FILE *file = fopen("about.txt", "r");
  int c;
  while ((c = getc(file)) != EOF)
    putchar(c);
  fclose(file);
}


x86 assembly (clang, -O0):
<aboutThisApp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    0xeb4(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1060 <getc@plt>
mov    %eax,-0xc(%rbp)
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%eax
je     1187 <aboutThisApp+0x47>
mov    -0xc(%rbp),%edi
call   1030 <putchar@plt>
jmp    115f <aboutThisApp+0x1f>
mov    -0x8(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aboutThisApp>:
push   %r14
push   %rbx
push   %rax
lea    0xeb5(%rip),%rdi
lea    0xeb8(%rip),%rsi
call   1050 <fopen@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <getc@plt>
mov    0x2e7f(%rip),%r14
cmp    (%r14),%eax
je     1184 <aboutThisApp+0x44>
xchg   %ax,%ax
mov    %eax,%edi
call   1030 <putchar@plt>
mov    %rbx,%rdi
call   1060 <getc@plt>
cmp    (%r14),%eax
jne    1170 <aboutThisApp+0x30>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <fclose@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"about.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
define void @aboutThisApp() {
%1 = alloca i32*
%2 = alloca i32
%3 = call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %3, i32** %1
br label %4
4: ; preds = %9, %0
%5 = load i32*, i32** %1
%6 = call i32 @getc(i32* %5)
store i32 %6, i32* %2
%7 = load i32, i32* @EOF
%8 = icmp ne i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* %2
%11 = call i32 @putchar(i32 %10)
br label %4
12: ; preds = %4
%13 = load i32*, i32** %1
%14 = call i32 @fclose(i32* %13)
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"about.txt\00"
@.str.1 = [2 x i8] c"r\00"
@EOF = global i32 0
define void @aboutThisApp() {
%1 = tail call i32* @fopen(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @getc(i32* %1)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %11, label %5
5: ; preds = %0, %5
%6 = phi i32 [ %8, %5 ], [ %2, %0 ]
%7 = tail call i32 @putchar(i32 %6)
%8 = tail call i32 @getc(i32* %1)
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %5
11: ; preds = %5, %0
%12 = tail call i32 @fclose(i32* %1)
ret void
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("%lu", sizeof(void *));
  return EXIT_SUCCESS;
}


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

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

LLVM IR (-O0):
@.str = [4 x i8] c"%lu\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lu\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 8)
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_is_fd_nonblock() {
  printf("NOT IMPLEMENTED:"
         "pa_is_fd_nonblock"
         "\n");
}


x86 assembly (clang, -O0):
<pa_is_fd_nonblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [35 x i8] c"NOT IMPLEMENTED:pa_is_fd_nonblock\0A\00"
define i32 @pa_is_fd_nonblock() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
@str = [34 x i8] c"NOT IMPLEMENTED:pa_is_fd_nonblock\00"
define i32 @pa_is_fd_nonblock() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
unsigned int hash(char *s) {
  unsigned int hashval;
  for (hashval = 0; *s != '\0'; s++)
    hashval = *s + 31 * hashval;
  return hashval % 101;
}


x86 assembly (clang, -O0):
<hash>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1140 <hash+0x40>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
imul   $0x1f,-0xc(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110f <hash+0xf>
mov    -0xc(%rbp),%eax
mov    $0x65,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hash>:
mov    (%rdi),%cl
test   %cl,%cl
je     1147 <hash+0x47>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movsbl %cl,%ecx
mov    %eax,%edx
shl    $0x5,%edx
sub    %eax,%edx
mov    %edx,%eax
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jne    1110 <hash+0x10>
mov    %eax,%ecx
imul   $0x446f8657,%rcx,%rcx
shr    $0x20,%rcx
mov    %eax,%edx
sub    %ecx,%edx
shr    %edx
add    %ecx,%edx
shr    $0x6,%edx
imul   $0x65,%edx,%ecx
sub    %ecx,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @hash(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %16, %1
%5 = load i8*, i8** %2
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %4
%10 = load i8*, i8** %2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = load i32, i32* %3
%14 = mul i32 31, %13
%15 = add i32 %12, %14
store i32 %15, i32* %3
br label %16
16: ; preds = %9
%17 = load i8*, i8** %2
%18 = getelementptr inbounds i8, i8* %17, i32 1
store i8* %18, i8** %2
br label %4
19: ; preds = %4
%20 = load i32, i32* %3
%21 = urem i32 %20, 101
ret i32 %21
}

LLVM IR (-O2):
define i32 @hash(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %12, %4 ], [ %2, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = phi i8* [ %11, %4 ], [ %0, %1 ]
%8 = sext i8 %5 to i32
%9 = mul i32 %6, 31
%10 = add i32 %9, %8
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = urem i32 %10, 101
br label %16
16: ; preds = %14, %1
%17 = phi i32 [ 0, %1 ], [ %15, %14 ]
ret i32 %17
}
_Bool NE(double __complex A, double __complex B) { return A != B; }


x86 assembly (clang, -O0):
<NE>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x8(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm2
movsd  -0x8(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm3
movsd  -0x18(%rbp),%xmm1
ucomisd %xmm3,%xmm2
setne  %al
setp   %cl
or     %cl,%al
ucomisd %xmm1,%xmm0
setne  %cl
setp   %dl
or     %dl,%cl
or     %cl,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<NE>:
ucomisd %xmm2,%xmm0
setp   %al
setne  %cl
or     %al,%cl
ucomisd %xmm3,%xmm1
setp   %dl
setne  %al
or     %dl,%al
or     %cl,%al
ret

LLVM IR (-O0):
define zeroext i1 @NE(double %0, double %1, double %2, double %3) {
%5 = alloca { double, double }
%6 = alloca { double, double }
%7 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
store double %0, double* %7
%8 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
store double %1, double* %8
%9 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 0
store double %2, double* %9
%10 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 1
store double %3, double* %10
%11 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 0
%12 = load double, double* %11
%13 = getelementptr inbounds { double, double }, { double, double }* %5, i32 0, i32 1
%14 = load double, double* %13
%15 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 0
%16 = load double, double* %15
%17 = getelementptr inbounds { double, double }, { double, double }* %6, i32 0, i32 1
%18 = load double, double* %17
%19 = fcmp une double %12, %16
%20 = fcmp une double %14, %18
%21 = or i1 %19, %20
ret i1 %21
}

LLVM IR (-O2):
define zeroext i1 @NE(double %0, double %1, double %2, double %3) {
%5 = fcmp une double %0, %2
%6 = fcmp une double %1, %3
%7 = or i1 %5, %6
ret i1 %7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void trotHookFree(void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @trotHookFree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print_hello_from_python(char *);
int main() {
  print_hello_from_python("Montse");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"Montse\00"
define i32 @main() {
%1 = tail call i32 @print_hello_from_python(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ clear();
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printw(char *);
int /*<<< orphan*/ refresh();
void rules() {
  clear();
  printw("> Rules\n\n");
  printw("Reach the escape door ( )\n");
  refresh();
  getch();
}


x86 assembly (clang, -O0):
<rules>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1060 <clear@plt>
lea    0xeae(%rip),%rdi
call   1030 <printw@plt>
lea    0xeac(%rip),%rdi
call   1030 <printw@plt>
mov    $0x0,%al
call   1040 <refresh@plt>
mov    $0x0,%al
call   1050 <getch@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<rules>:
push   %rax
xor    %eax,%eax
call   1060 <clear@plt>
lea    0xeb1(%rip),%rdi
call   1030 <printw@plt>
lea    0xeaf(%rip),%rdi
call   1030 <printw@plt>
xor    %eax,%eax
call   1040 <refresh@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <getch@plt>

LLVM IR (-O0):
@.str = [10 x i8] c"> Rules\0A\0A\00"
@.str.1 = [27 x i8] c"Reach the escape door ( )\0A\00"
define void @rules() {
%1 = call i32 (...) @clear()
%2 = call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printw(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (...) @refresh()
%5 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"> Rules\0A\0A\00"
@.str.1 = [27 x i8] c"Reach the escape door ( )\0A\00"
define void @rules() {
%1 = tail call i32 (...) @clear()
%2 = tail call i32 @printw(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @printw(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.1, i64 0, i64 0))
%4 = tail call i32 (...) @refresh()
%5 = tail call i32 (...) @getch()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ func();
int f0(int val) {
  if (val == 0) {
    func();
  } else if (val == 1) {
    func();
  }
  return 0;
}


x86 assembly (clang, -O0):
<f0>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1131 <f0+0x21>
mov    $0x0,%al
call   1030 <func@plt>
jmp    1147 <f0+0x37>
cmpl   $0x1,-0x4(%rbp)
jne    1142 <f0+0x32>
mov    $0x0,%al
call   1030 <func@plt>
jmp    1147 <f0+0x37>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f0>:
cmp    $0x1,%edi
ja     1121 <f0+0x11>
push   %rax
xor    %eax,%eax
call   1030 <func@plt>
add    $0x8,%rsp
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @f0(i32 %0) {
%2 = icmp ult i32 %0, 2
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 (...) @func()
br label %5
5: ; preds = %1, %3
ret i32 0
}
int foo(int x) { return x < 0 ? -x : x; }


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <foo+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <foo+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @foo(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @foo(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ STRNCAT(char **, char *, int);
int /*<<< orphan*/ printid(char *);
void main() {
  char s1[] = "abc";
  char s2[] = "defg";
  printid(s1);
  printid(s2);
  STRNCAT(&s1, s2, 3);
  printid(s1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed2(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x9(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0x4(%rbp),%rdi
call   1040 <printid@plt>
lea    -0x9(%rbp),%rdi
call   1040 <printid@plt>
lea    -0x4(%rbp),%rdi
lea    -0x9(%rbp),%rsi
mov    $0x3,%edx
call   1030 <STRNCAT@plt>
lea    -0x4(%rbp),%rdi
call   1040 <printid@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
movl   $0x636261,0x14(%rsp)
movb   $0x0,0x10(%rsp)
movl   $0x67666564,0xc(%rsp)
67
lea    0x14(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <printid@plt>
lea    0xc(%rsp),%r14
mov    %r14,%rdi
call   1040 <printid@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x3,%edx
call   1030 <STRNCAT@plt>
mov    %rbx,%rdi
call   1040 <printid@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.main.s1 = [4 x i8] c"abc\00"
@__const.main.s2 = [5 x i8] c"defg\00"
define void @main() {
%1 = alloca [4 x i8]
%2 = alloca [5 x i8]
%3 = bitcast [4 x i8]* %1 to i8*
%4 = bitcast [5 x i8]* %2 to i8*
%5 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%6 = call i32 @printid(i8* %5)
%7 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%8 = call i32 @printid(i8* %7)
%9 = bitcast [4 x i8]* %1 to i8**
%10 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%11 = call i32 @STRNCAT(i8** %9, i8* %10, i32 3)
%12 = getelementptr inbounds [4 x i8], [4 x i8]* %1, i64 0, i64 0
%13 = call i32 @printid(i8* %12)
ret void
}

LLVM IR (-O2):
@__const.main.s2 = [5 x i8] c"defg\00"
define void @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = bitcast i32* %1 to i8*
store i32 6513249, i32* %1
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%5 = call i32 @printid(i8* %3)
%6 = call i32 @printid(i8* %4)
%7 = bitcast i32* %1 to i8**
%8 = call i32 @STRNCAT(i8** %7, i8* %4, i32 3)
%9 = call i32 @printid(i8* %3)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ int64_t;

/* Variables and functions */
double sqrt(int /*<<< orphan*/);
int /*<<< orphan*/ stdlib_strided_dvariancepn(int /*<<< orphan*/ const,
                                              double const, double const *,
                                              int /*<<< orphan*/ const);
double stdlib_strided_dstdevpn(const int64_t N, const double correction,
                               const double *X, const int64_t stride) {
  return sqrt(stdlib_strided_dvariancepn(N, correction, X, stride));
}


x86 assembly (clang, -O0):
<stdlib_strided_dstdevpn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
movsd  -0x10(%rbp),%xmm0
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
call   1030 <stdlib_strided_dvariancepn@plt>
mov    %eax,%edi
call   1040 <sqrt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stdlib_strided_dstdevpn>:
push   %rax
call   1030 <stdlib_strided_dvariancepn@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <sqrt@plt>

LLVM IR (-O0):
define double @stdlib_strided_dstdevpn(i32 %0, double %1, double* %2, i32 %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double*
%8 = alloca i32
store i32 %0, i32* %5
store double %1, double* %6
store double* %2, double** %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load double, double* %6
%11 = load double*, double** %7
%12 = load i32, i32* %8
%13 = call i32 @stdlib_strided_dvariancepn(i32 %9, double %10, double* %11, i32 %12)
%14 = call double @sqrt(i32 %13)
ret double %14
}

LLVM IR (-O2):
define double @stdlib_strided_dstdevpn(i32 %0, double %1, double* %2, i32 %3) {
%5 = tail call i32 @stdlib_strided_dvariancepn(i32 %0, double %1, double* %2, i32 %3)
%6 = tail call double @sqrt(i32 %5)
ret double %6
}
/* Variables and functions */
int /*<<< orphan*/ sgen(char *, char *, char *);
void cgldgw(char *s) { sgen("%s\tax,%s", "mov", s); }


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

x86 assembly (clang, -O2):
<cgldgw>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xee8(%rip),%rsi
jmp    1030 <sgen@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"%s\09ax,%s\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgldgw(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @sgen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%s\09ax,%s\00"
@.str.1 = [4 x i8] c"mov\00"
define void @cgldgw(i8* %0) {
%2 = tail call i32 @sgen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ RevoSettingsHandle();
int /*<<< orphan*/ UAVObjRequestUpdate(int /*<<< orphan*/);
void RevoSettingsRequestUpdate() { UAVObjRequestUpdate(RevoSettingsHandle()); }


x86 assembly (clang, -O0):
<RevoSettingsRequestUpdate>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <RevoSettingsHandle@plt>
mov    %eax,%edi
call   1030 <UAVObjRequestUpdate@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<RevoSettingsRequestUpdate>:
push   %rax
xor    %eax,%eax
call   1040 <RevoSettingsHandle@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <UAVObjRequestUpdate@plt>

LLVM IR (-O0):
define void @RevoSettingsRequestUpdate() {
%1 = call i32 (...) @RevoSettingsHandle()
%2 = call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}

LLVM IR (-O2):
define void @RevoSettingsRequestUpdate() {
%1 = tail call i32 (...) @RevoSettingsHandle()
%2 = tail call i32 @UAVObjRequestUpdate(i32 %1)
ret void
}
int fun(int a[]) {}


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

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

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

LLVM IR (-O2):
define i32 @fun(i32* nocapture readnone %0) {
ret i32 undef
}
unsigned int DMTimerCounterGet(unsigned int baseAdd) {
  return ((*((volatile unsigned int *)(baseAdd + (0x3C)))));
}


x86 assembly (clang, -O0):
<DMTimerCounterGet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
mov    %eax,%eax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<DMTimerCounterGet>:
add    $0x3c,%edi
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @DMTimerCounterGet(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add i32 %3, 60
%5 = zext i32 %4 to i64
%6 = inttoptr i64 %5 to i32*
%7 = load volatile i32, i32* %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @DMTimerCounterGet(i32 %0) {
%2 = add i32 %0, 60
%3 = zext i32 %2 to i64
%4 = inttoptr i64 %3 to i32*
%5 = load volatile i32, i32* %4
ret i32 %5
}
unsigned long cvt_ul_from_u32_le(const unsigned char in[4U]) {
  unsigned long x;
  x = in[3];
  x <<= 8;
  x |= in[2];
  x <<= 8;
  x |= in[1];
  x <<= 8;
  x |= in[0];
  return x;
}


x86 assembly (clang, -O0):
<cvt_ul_from_u32_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x3(%rax),%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x2(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl 0x1(%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
shl    $0x8,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
or     -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvt_ul_from_u32_le>:
mov    (%rdi),%eax
ret

LLVM IR (-O0):
define i64 @cvt_ul_from_u32_le(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = getelementptr inbounds i8, i8* %4, i64 3
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
store i64 %7, i64* %3
%8 = load i64, i64* %3
%9 = shl i64 %8, 8
store i64 %9, i64* %3
%10 = load i8*, i8** %2
%11 = getelementptr inbounds i8, i8* %10, i64 2
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = load i64, i64* %3
%15 = or i64 %14, %13
store i64 %15, i64* %3
%16 = load i64, i64* %3
%17 = shl i64 %16, 8
store i64 %17, i64* %3
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = zext i8 %20 to i64
%22 = load i64, i64* %3
%23 = or i64 %22, %21
store i64 %23, i64* %3
%24 = load i64, i64* %3
%25 = shl i64 %24, 8
store i64 %25, i64* %3
%26 = load i8*, i8** %2
%27 = getelementptr inbounds i8, i8* %26, i64 0
%28 = load i8, i8* %27
%29 = zext i8 %28 to i64
%30 = load i64, i64* %3
%31 = or i64 %30, %29
store i64 %31, i64* %3
%32 = load i64, i64* %3
ret i64 %32
}

LLVM IR (-O2):
define i64 @cvt_ul_from_u32_le(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 3
%3 = load i8, i8* %2
%4 = zext i8 %3 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = zext i8 %6 to i64
%8 = shl nuw nsw i64 %4, 16
%9 = shl nuw nsw i64 %7, 8
%10 = or i64 %9, %8
%11 = getelementptr inbounds i8, i8* %0, i64 1
%12 = load i8, i8* %11
%13 = zext i8 %12 to i64
%14 = or i64 %10, %13
%15 = shl nuw nsw i64 %14, 8
%16 = load i8, i8* %0
%17 = zext i8 %16 to i64
%18 = or i64 %15, %17
ret i64 %18
}
/* Variables and functions */
void swap_chars(char *seq, size_t a, size_t b) {
  char t = seq[a];
  seq[a] = seq[b];
  seq[b] = t;
}


x86 assembly (clang, -O0):
<swap_chars>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x19(%rbp)
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x19(%rbp),%dl
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<swap_chars>:
mov    (%rdi,%rsi,1),%al
mov    (%rdi,%rdx,1),%cl
mov    %cl,(%rdi,%rsi,1)
mov    %al,(%rdi,%rdx,1)
ret

LLVM IR (-O0):
define void @swap_chars(i8* %0, i64 %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
%7 = alloca i8
store i8* %0, i8** %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%8 = load i8*, i8** %4
%9 = load i64, i64* %5
%10 = getelementptr inbounds i8, i8* %8, i64 %9
%11 = load i8, i8* %10
store i8 %11, i8* %7
%12 = load i8*, i8** %4
%13 = load i64, i64* %6
%14 = getelementptr inbounds i8, i8* %12, i64 %13
%15 = load i8, i8* %14
%16 = load i8*, i8** %4
%17 = load i64, i64* %5
%18 = getelementptr inbounds i8, i8* %16, i64 %17
store i8 %15, i8* %18
%19 = load i8, i8* %7
%20 = load i8*, i8** %4
%21 = load i64, i64* %6
%22 = getelementptr inbounds i8, i8* %20, i64 %21
store i8 %19, i8* %22
ret void
}

LLVM IR (-O2):
define void @swap_chars(i8* nocapture %0, i64 %1, i64 %2) {
%4 = getelementptr inbounds i8, i8* %0, i64 %1
%5 = load i8, i8* %4
%6 = getelementptr inbounds i8, i8* %0, i64 %2
%7 = load i8, i8* %6
store i8 %7, i8* %4
store i8 %5, i8* %6
ret void
}
/* Variables and functions */
int /*<<< orphan*/ tone(int);
void lose_sound() {
  tone(5);
  tone(4);
  tone(3);
}


x86 assembly (clang, -O0):
<lose_sound>:
push   %rbp
mov    %rsp,%rbp
mov    $0x5,%edi
call   1030 <tone@plt>
mov    $0x4,%edi
call   1030 <tone@plt>
mov    $0x3,%edi
call   1030 <tone@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<lose_sound>:
push   %rax
mov    $0x5,%edi
call   1030 <tone@plt>
mov    $0x4,%edi
call   1030 <tone@plt>
mov    $0x3,%edi
pop    %rax
jmp    1030 <tone@plt>

LLVM IR (-O0):
define void @lose_sound() {
%1 = call i32 @tone(i32 5)
%2 = call i32 @tone(i32 4)
%3 = call i32 @tone(i32 3)
ret void
}

LLVM IR (-O2):
define void @lose_sound() {
%1 = tail call i32 @tone(i32 5)
%2 = tail call i32 @tone(i32 4)
%3 = tail call i32 @tone(i32 3)
ret void
}
/* Variables and functions */
int crypto_stream_chacha20_xor(unsigned char *, unsigned char *,
                               unsigned long long, unsigned char const *,
                               unsigned char const *);
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/,
                          unsigned long long);
int crypto_stream_chacha20(unsigned char *out, unsigned long long outlen,
                           const unsigned char *n, const unsigned char *k) {
  memset(out, 0, outlen);
  return crypto_stream_chacha20_xor(out, out, outlen, n, k);
}


x86 assembly (clang, -O0):
<crypto_stream_chacha20>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
xor    %esi,%esi
call   1030 <memset@plt>
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
call   1040 <crypto_stream_chacha20_xor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<crypto_stream_chacha20>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%r12
mov    %rdi,%rbx
xor    %esi,%esi
mov    %r12,%rdx
call   1030 <memset@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
mov    %r15,%rcx
mov    %r14,%r8
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <crypto_stream_chacha20_xor@plt>

LLVM IR (-O0):
define i32 @crypto_stream_chacha20(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i8*
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i8* %3, i8** %8
%9 = load i8*, i8** %5
%10 = load i64, i64* %6
%11 = call i32 @memset(i8* %9, i32 0, i64 %10)
%12 = load i8*, i8** %5
%13 = load i8*, i8** %5
%14 = load i64, i64* %6
%15 = load i8*, i8** %7
%16 = load i8*, i8** %8
%17 = call i32 @crypto_stream_chacha20_xor(i8* %12, i8* %13, i64 %14, i8* %15, i8* %16)
ret i32 %17
}

LLVM IR (-O2):
define i32 @crypto_stream_chacha20(i8* %0, i64 %1, i8* %2, i8* %3) {
%5 = tail call i32 @memset(i8* %0, i32 0, i64 %1)
%6 = tail call i32 @crypto_stream_chacha20_xor(i8* %0, i8* %0, i64 %1, i8* %2, i8* %3)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void losing(void) {
  printf("%s", "Sorry the I told you, you could not win LULZ.\n");
}


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

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

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [47 x i8] c"Sorry the I told you, you could not win LULZ.\0A\00"
define void @losing() {
%1 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [47 x i8] c"Sorry the I told you, you could not win LULZ.\0A\00"
define void @losing() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void test42_TestMod_test__E() { printf("Im in test!"); }


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

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

LLVM IR (-O0):
@.str = [12 x i8] c"Im in test!\00"
define void @test42_TestMod_test__E() {
%1 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Im in test!\00"
define void @test42_TestMod_test__E() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *,
                           unsigned int, char const *);
int /*<<< orphan*/ print_backtrace(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void log_failed_assert(const char *filename, unsigned int line,
                       const char *msg) {
  fprintf(stderr, "%s.%d: %s\n", filename, line, msg);
  print_backtrace(stderr);
  fflush(stderr);
  abort();
}


x86 assembly (clang, -O0):
<log_failed_assert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
mov    -0xc(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xe92(%rip),%rsi
call   1050 <fprintf@plt>
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
call   1040 <print_backtrace@plt>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    $0x0,%al
call   1030 <abort@plt>

x86 assembly (clang, -O2):
<log_failed_assert>:
push   %rbx
mov    %rdx,%r8
mov    %esi,%ecx
mov    %rdi,%rdx
mov    0x2e90(%rip),%rbx
mov    (%rbx),%edi
lea    0xea7(%rip),%rsi
call   1050 <fprintf@plt>
mov    (%rbx),%edi
call   1040 <print_backtrace@plt>
mov    (%rbx),%edi
call   1060 <fflush@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [11 x i8] c"%s.%d: %s\0A\00"
define void @log_failed_assert(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i32 %9, i8* %10)
%12 = load i32, i32* @stderr
%13 = call i32 @print_backtrace(i32 %12)
%14 = load i32, i32* @stderr
%15 = call i32 @fflush(i32 %14)
%16 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [11 x i8] c"%s.%d: %s\0A\00"
define void @log_failed_assert(i8* %0, i32 %1, i8* %2) {
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %1, i8* %2)
%6 = load i32, i32* @stderr
%7 = tail call i32 @print_backtrace(i32 %6)
%8 = load i32, i32* @stderr
%9 = tail call i32 @fflush(i32 %8)
%10 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
struct sigevent {
  int dummy;
};
typedef int /*<<< orphan*/ mqd_t;

/* Variables and functions */
int /*<<< orphan*/ __NR_mq_notify;
int syscall(int /*<<< orphan*/, int /*<<< orphan*/, struct sigevent const *);
int stp_mq_notify(mqd_t mqdes, const struct sigevent *sevp) {
  return syscall(__NR_mq_notify, mqdes, sevp);
}


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

x86 assembly (clang, -O2):
<stp_mq_notify>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    0x2ec4(%rip),%rax
mov    (%rax),%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.sigevent = type { i32 }
@__NR_mq_notify = global i32 0
define i32 @stp_mq_notify(i32 %0, %struct.sigevent* %1) {
%3 = alloca i32
%4 = alloca %struct.sigevent*
store i32 %0, i32* %3
store %struct.sigevent* %1, %struct.sigevent** %4
%5 = load i32, i32* @__NR_mq_notify
%6 = load i32, i32* %3
%7 = load %struct.sigevent*, %struct.sigevent** %4
%8 = call i32 @syscall(i32 %5, i32 %6, %struct.sigevent* %7)
ret i32 %8
}

LLVM IR (-O2):
%struct.sigevent = type { i32 }
@__NR_mq_notify = global i32 0
define i32 @stp_mq_notify(i32 %0, %struct.sigevent* %1) {
%3 = load i32, i32* @__NR_mq_notify
%4 = tail call i32 @syscall(i32 %3, i32 %0, %struct.sigevent* %1)
ret i32 %4
}
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  scalar_t__ tv_usec;
  scalar_t__ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
double wtime() {
  struct timeval tp;
  struct timezone tz;
  gettimeofday(&tp, &tz);
  return (double)tp.tv_sec + (double)tp.tv_usec * 1.e-6;
}


x86 assembly (clang, -O0):
<wtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq -0x8(%rbp),%xmm1
cvtsi2sdq -0x10(%rbp),%xmm0
movsd  0xec7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wtime>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <gettimeofday@plt>
cvtsi2sdq 0x10(%rsp),%xmm1
cvtsi2sdq 0x8(%rsp),%xmm0
mulsd  0xec9(%rip),%xmm0
addsd  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%5 = load i64, i64* %4
%6 = sitofp i64 %5 to double
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%8 = load i64, i64* %7
%9 = sitofp i64 %8 to double
%10 = call double @llvm.fmuladd.f64(double %9, double 0x3EB0C6F7A0B5ED8D, double %6)
ret double %10
}

LLVM IR (-O2):
%struct.timeval = type { i64, i64 }
%struct.timezone = type { i32 }
define double @wtime() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i64, i64* %6
%8 = sitofp i64 %7 to double
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%10 = load i64, i64* %9
%11 = sitofp i64 %10 to double
%12 = tail call double @llvm.fmuladd.f64(double %11, double 0x3EB0C6F7A0B5ED8D, double %8)
ret double %12
}
/* Variables and functions */
int /*<<< orphan*/ get_short_code();
void get_int_code(void) {
  get_short_code();
  get_short_code();
}


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

x86 assembly (clang, -O2):
<get_int_code>:
push   %rax
xor    %eax,%eax
call   1030 <get_short_code@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <get_short_code@plt>

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

LLVM IR (-O2):
define void @get_int_code() {
%1 = tail call i32 (...) @get_short_code()
%2 = tail call i32 (...) @get_short_code()
ret void
}