xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int findWord(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, int);
int main() {
  FILE *f;
  f = fopen("file/doc1.txt", "r");
  char str[10] = {'s', 't', 'r', 'i', 'n', 'g', '\0'};
  printf("this should be 1: %d", findWord(f, str));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
lea    0xec8(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x8(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xecc(%rip),%ax
mov    %ax,-0xa(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x12(%rbp),%rsi
call   1050 <findWord@plt>
mov    %eax,%esi
lea    0xe95(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xec5(%rip),%rdi
lea    0xecc(%rip),%rsi
call   1040 <fopen@plt>
movabs $0x676e69727473,%rcx
mov    %rcx,0x8(%rsp)
movw   $0x0,0x10(%rsp)
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
call   1050 <findWord@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"file/doc1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@__const.main.str = [10 x i8] c"string\00\00\00\00"
@.str.2 = [21 x i8] c"this should be 1: %d\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca [10 x i8]
%3 = call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 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
%4 = bitcast [10 x i8]* %2 to i8*
%5 = load i32*, i32** %1
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%7 = call i32 @findWord(i32* %5, i8* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"file/doc1.txt\00"
@.str.1 = [2 x i8] c"r\00"
@__const.main.str = [10 x i8] c"string\00\00\00\00"
@.str.2 = [21 x i8] c"this should be 1: %d\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @findWord(i32* %2, i8* %3)
%5 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Variables and functions */
size_t align(size_t sz, size_t log_alignment) {
  return sz + (-sz & (((size_t)1 << log_alignment) - 1));
}


x86 assembly (clang, -O0):
<align>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    -0x8(%rbp),%rcx
mov    %rcx,-0x18(%rbp)
mov    -0x10(%rbp),%rcx
mov    $0x1,%edx
shl    %cl,%rdx
mov    -0x18(%rbp),%rcx
sub    $0x1,%rdx
and    %rdx,%rcx
add    %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<align>:
mov    %rsi,%rcx
mov    %rdi,%rdx
mov    $0xffffffffffffffff,%rax
shl    %cl,%rax
neg    %rdx
not    %rax
and    %rdx,%rax
add    %rdi,%rax
ret

LLVM IR (-O0):
define i64 @align(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %3
%7 = sub i64 0, %6
%8 = load i64, i64* %4
%9 = shl i64 1, %8
%10 = sub i64 %9, 1
%11 = and i64 %7, %10
%12 = add i64 %5, %11
ret i64 %12
}

LLVM IR (-O2):
define i64 @align(i64 %0, i64 %1) {
%3 = sub i64 0, %0
%4 = shl nsw i64 -1, %1
%5 = xor i64 %4, -1
%6 = and i64 %5, %3
%7 = add i64 %6, %0
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ generateMaterial(int);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void *generator(void *ptr) {
  int i, gen_id;
  int *id_ptr;
  id_ptr = (int *)ptr;
  gen_id = *id_ptr;
  for (i = 1; i <= 1000000; i++) {
    generateMaterial(gen_id);
  }
  pthread_exit(0);
}


x86 assembly (clang, -O0):
<generator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0xf4240,-0x14(%rbp)
jg     1167 <generator+0x47>
mov    -0x18(%rbp),%edi
call   1030 <generateMaterial@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <generator+0x24>
xor    %edi,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generator>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%ebx
mov    $0xf4240,%ebp
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1030 <generateMaterial@plt>
add    $0xffffffff,%ebp
jne    1130 <generator+0x10>
xor    %edi,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
define i8* @generator(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32*
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %6
%9 = load i32*, i32** %6
%10 = load i32, i32* %9
store i32 %10, i32* %5
store i32 1, i32* %4
br label %11
11: ; preds = %17, %1
%12 = load i32, i32* %4
%13 = icmp sle i32 %12, 1000000
br i1 %13, label %14, label %20
14: ; preds = %11
%15 = load i32, i32* %5
%16 = call i32 @generateMaterial(i32 %15)
br label %17
17: ; preds = %14
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %11
20: ; preds = %11
%21 = call i32 @pthread_exit(i32 0)
%22 = load i8*, i8** %2
ret i8* %22
}

LLVM IR (-O2):
define noalias i8* @generator(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
br label %4
4: ; preds = %1, %4
%5 = phi i32 [ 1, %1 ], [ %7, %4 ]
%6 = tail call i32 @generateMaterial(i32 %3)
%7 = add nuw nsw i32 %5, 1
%8 = icmp eq i32 %7, 1000001
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = tail call i32 @pthread_exit(i32 0)
ret i8* undef
}
/* Type definitions */
typedef unsigned int uint16_t;

/* Variables and functions */
void _clr_bit(uint16_t *x, const int b) { *x &= ~(1U << b); }


x86 assembly (clang, -O0):
<_clr_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,%ecx
xor    $0xffffffff,%ecx
mov    -0x8(%rbp),%rax
and    (%rax),%ecx
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<_clr_bit>:
mov    %esi,%ecx
mov    $0xfffffffe,%eax
rol    %cl,%eax
and    %eax,(%rdi)
ret

LLVM IR (-O0):
define void @_clr_bit(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = shl i32 1, %5
%7 = xor i32 %6, -1
%8 = load i32*, i32** %3
%9 = load i32, i32* %8
%10 = and i32 %9, %7
store i32 %10, i32* %8
ret void
}

LLVM IR (-O2):
define void @_clr_bit(i32* nocapture %0, i32 %1) {
%3 = shl nuw i32 1, %1
%4 = xor i32 %3, -1
%5 = load i32, i32* %0
%6 = and i32 %5, %4
store i32 %6, i32* %0
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, char *);
FILE *open_file(char *fname, char *flags) {
  FILE *f = fopen(fname, flags);
  if (f == NULL) {
    printf("Error opening file %s\n", fname);
    exit(1);
  }
  return f;
}


x86 assembly (clang, -O0):
<open_file>:
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   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1176 <open_file+0x46>
mov    -0x8(%rbp),%rsi
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [23 x i8] c"Error opening file %s\0A\00"
define noalias i32* @open_file(i8* %0, i8* nocapture %1) {
%3 = tail call i32* @fopen(i8* %0, i8* %1)
%4 = icmp eq i32* %3, null
br i1 %4, label %5, label %8
5: ; preds = %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
ret i32* %3
}
/* Type definitions */
struct bytering_head {
  int dummy;
};

/* Variables and functions */
scalar_t__ bytering_empty(struct bytering_head *);
int bytering_pop_nocheck(struct bytering_head *);
int bytering_pop(struct bytering_head *r) {
  if (bytering_empty(r))
    return -1;
  return bytering_pop_nocheck(r);
}


x86 assembly (clang, -O0):
<bytering_pop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <bytering_empty@plt>
cmp    $0x0,%rax
je     114b <bytering_pop+0x2b>
movl   $0xffffffff,-0x4(%rbp)
jmp    1157 <bytering_pop+0x37>
mov    -0x10(%rbp),%rdi
call   1030 <bytering_pop_nocheck@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bytering_pop>:
push   %rbx
mov    %rdi,%rbx
call   1040 <bytering_empty@plt>
test   %rax,%rax
je     1135 <bytering_pop+0x15>
mov    $0xffffffff,%eax
pop    %rbx
ret
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <bytering_pop_nocheck@plt>

LLVM IR (-O0):
%struct.bytering_head = type { i32 }
define i32 @bytering_pop(%struct.bytering_head* %0) {
%2 = alloca i32
%3 = alloca %struct.bytering_head*
store %struct.bytering_head* %0, %struct.bytering_head** %3
%4 = load %struct.bytering_head*, %struct.bytering_head** %3
%5 = call i64 @bytering_empty(%struct.bytering_head* %4)
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %11
8: ; preds = %1
%9 = load %struct.bytering_head*, %struct.bytering_head** %3
%10 = call i32 @bytering_pop_nocheck(%struct.bytering_head* %9)
store i32 %10, i32* %2
br label %11
11: ; preds = %8, %7
%12 = load i32, i32* %2
ret i32 %12
}

LLVM IR (-O2):
%struct.bytering_head = type { i32 }
define i32 @bytering_pop(%struct.bytering_head* %0) {
%2 = tail call i64 @bytering_empty(%struct.bytering_head* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @bytering_pop_nocheck(%struct.bytering_head* %0)
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ -1, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ puts(char *);
int main() {
  char str[3];
  printf("Enter a value :");
  gets(str);
  printf("\nYou entered: ");
  puts(str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1040 <printf@plt>
lea    -0x7(%rbp),%rdi
call   1050 <gets@plt>
lea    0xeb5(%rip),%rdi
call   1040 <printf@plt>
lea    -0x7(%rbp),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
call   1040 <printf@plt>
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <gets@plt>
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter a value :\00"
@.str.1 = [15 x i8] c"\0AYou entered: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [3 x i8]
store i32 0, i32* %1
%3 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%5 = call i32 @gets(i8* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%7 = getelementptr inbounds [3 x i8], [3 x i8]* %2, i64 0, i64 0
%8 = call i32 @puts(i8* %7)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter a value :\00"
@.str.1 = [15 x i8] c"\0AYou entered: \00"
define i32 @main() {
%1 = alloca [3 x i8]
%2 = getelementptr inbounds [3 x i8], [3 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @gets(i8* %2)
%5 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 @puts(i8* %2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ hash(char *);
int /*<<< orphan*/ printf(char *, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, char *);
int main() {
  char c[201] = {0};
  scanf("%s", c);
  char *word;
  word = c;
  printf("%ld", hash(word));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xd0(%rbp),%rdi
xor    %esi,%esi
mov    $0xc9,%edx
call   1050 <memset@plt>
lea    -0xd0(%rbp),%rsi
lea    0xe8d(%rip),%rdi
call   1060 <scanf@plt>
lea    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rdi
call   1030 <hash@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0xd0,%rsp
xorps  %xmm0,%xmm0
movups %xmm0,0xb9(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movaps %xmm0,0x80(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0xe6f(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1050 <scanf@plt>
mov    %rbx,%rdi
call   1030 <hash@plt>
lea    0xe58(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xd0,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [201 x i8]
%3 = alloca i8*
store i32 0, i32* %1
%4 = bitcast [201 x i8]* %2 to i8*
%5 = getelementptr inbounds [201 x i8], [201 x i8]* %2, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [201 x i8], [201 x i8]* %2, i64 0, i64 0
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call i32 @hash(i8* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@.str.1 = [4 x i8] c"%ld\00"
define i32 @main() {
%1 = alloca [201 x i8]
%2 = getelementptr inbounds [201 x i8], [201 x i8]* %1, i64 0, i64 0
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @hash(i8* %2)
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %4)
ret i32 0
}
adrreg0indreg1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((p0[10000000]) <= (*p1))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<adrreg0indreg1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movswl 0x1312d00(%rax),%eax
mov    -0x20(%rbp),%rcx
movswl (%rcx),%ecx
cmp    %ecx,%eax
jg     1145 <adrreg0indreg1+0x45>
movl   $0x1,-0x4(%rbp)
jmp    114c <adrreg0indreg1+0x4c>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<adrreg0indreg1>:
movzwl 0x1312d00(%r8),%ecx
01
xor    %eax,%eax
cmp    (%r9),%cx
setle  %al
ret

LLVM IR (-O0):
define i32 @adrreg0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* %4, i16* %5) {
%7 = alloca i32
%8 = alloca i16
%9 = alloca i16
%10 = alloca i32
%11 = alloca i32
%12 = alloca i16*
%13 = alloca i16*
%14 = trunc i32 %0 to i16
%15 = trunc i32 %1 to i16
store i16 %14, i16* %8
store i16 %15, i16* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i16* %4, i16** %12
store i16* %5, i16** %13
%16 = load i16*, i16** %12
%17 = getelementptr inbounds i16, i16* %16, i64 10000000
%18 = load i16, i16* %17
%19 = sext i16 %18 to i32
%20 = load i16*, i16** %13
%21 = load i16, i16* %20
%22 = sext i16 %21 to i32
%23 = icmp sle i32 %19, %22
br i1 %23, label %24, label %25
24: ; preds = %6
store i32 1, i32* %7
br label %26
25: ; preds = %6
store i32 0, i32* %7
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %7
ret i32 %27
}

LLVM IR (-O2):
define i32 @adrreg0indreg1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture %5) {
%7 = getelementptr inbounds i16, i16* %4, i64 10000000
%8 = load i16, i16* %7
%9 = load i16, i16* %5
%10 = icmp sle i16 %8, %9
%11 = zext i1 %10 to i32
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stdout;
void print_version(void) {
  fprintf(stdout, "Kvazaar "
                  "1.1.0"
                  "\n"
                  "Kvazaar license: LGPL version 2\n");
}


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

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

LLVM IR (-O0):
@stdout = global i32 0
@.str = [47 x i8] c"Kvazaar 1.1.0\0AKvazaar license: LGPL version 2\0A\00"
define void @print_version() {
%1 = load i32, i32* @stdout
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [47 x i8] c"Kvazaar 1.1.0\0AKvazaar license: LGPL version 2\0A\00"
define void @print_version() {
%1 = load i32, i32* @stdout
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str, i64 0, i64 0))
ret void
}
void osalInit(void) {}


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

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

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

LLVM IR (-O2):
define void @osalInit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int main() {
  char hello[20] = "Hello world!";
  printf("%s\n\r", hello);
  return 0;
}


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

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
lea    0xee6(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.hello = [20 x i8] c"Hello world!\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"%s\0A\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [20 x i8]
store i32 0, i32* %1
%3 = bitcast [20 x i8]* %2 to i8*
%4 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%5 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}

LLVM IR (-O2):
@__const.main.hello = [20 x i8] c"Hello world!\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"%s\0A\0D\00"
define i32 @main() {
%1 = alloca [20 x i8]
%2 = getelementptr inbounds [20 x i8], [20 x i8]* %1, i64 0, i64 0
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void XcmsCIELabClipL() {}


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

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

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

LLVM IR (-O2):
define void @XcmsCIELabClipL() {
ret void
}
int test_imm_B8int64_midword_reg(long long val) {
  return ((val >> 16) & (0xB8 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_B8int64_midword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = ashr i64 %3, 16
%5 = and i64 %4, 184
%6 = icmp ne i64 %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_B8int64_midword_reg(i64 %0) {
%2 = and i64 %0, 12058624
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ vuln();
int main(void) {
  printf("Welcome! Can you figure out how to get this program to give you a "
         "shell?\n");
  vuln();
  printf("Unfortunately, you did not win. Please try again another time!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <vuln@plt>
lea    0xf0c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [74 x i8] c"Welcome! Can you figure out how to get this program to give you a shell?\0A\00"
@.str.1 = [64 x i8] c"Unfortunately, you did not win. Please try again another time!\0A\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @vuln()
%3 = call i32 @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [73 x i8] c"Welcome! Can you figure out how to get this program to give you a shell?\00"
@str.2 = [63 x i8] c"Unfortunately, you did not win. Please try again another time!\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 (...) @vuln()
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([63 x i8], [63 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ abs(int);
int floor(int /*<<< orphan*/);
int /*<<< orphan*/ log10(int /*<<< orphan*/);
int get_n_digits(int x) {
  if (x == 0)
    return 0;
  return floor(log10(abs(x))) + 1 + (x < 0);
}


x86 assembly (clang, -O0):
<get_n_digits>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1151 <get_n_digits+0x21>
movl   $0x0,-0x4(%rbp)
jmp    117c <get_n_digits+0x4c>
mov    -0x8(%rbp),%edi
call   1030 <abs@plt>
mov    %eax,%edi
call   1040 <log10@plt>
mov    %eax,%edi
call   1050 <floor@plt>
add    $0x1,%eax
cmpl   $0x0,-0x8(%rbp)
setl   %cl
and    $0x1,%cl
movzbl %cl,%ecx
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_n_digits>:
test   %edi,%edi
je     1142 <get_n_digits+0x22>
push   %rbx
mov    %edi,%ebx
neg    %edi
cmovs  %ebx,%edi
call   1030 <log10@plt>
mov    %eax,%edi
call   1040 <floor@plt>
shr    $0x1f,%ebx
add    %ebx,%eax
add    $0x1,%eax
pop    %rbx
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @get_n_digits(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %10, label %3
3: ; preds = %1
%4 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
%5 = tail call i32 @log10(i32 %4)
%6 = tail call i32 @floor(i32 %5)
%7 = lshr i32 %0, 31
%8 = add nuw nsw i32 %7, 1
%9 = add i32 %8, %6
br label %10
10: ; preds = %1, %3
%11 = phi i32 [ %9, %3 ], [ 0, %1 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ mem_write_ram(int, int /*<<< orphan*/, void *);
void ps2_write_shadow_ram(uint32_t addr, uint8_t val, void *priv) {
  addr = (addr & 0x1ffff) + 0xe0000;
  mem_write_ram(addr, val, priv);
}


x86 assembly (clang, -O0):
<ps2_write_shadow_ram>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%eax
and    $0x1ffff,%eax
add    $0xe0000,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x10(%rbp),%rdx
call   1030 <mem_write_ram@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ps2_write_shadow_ram>:
and    $0x1ffff,%edi
or     $0xe0000,%edi
jmp    1030 <mem_write_ram@plt>

LLVM IR (-O0):
define void @ps2_write_shadow_ram(i32 %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
store i32 %0, i32* %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load i32, i32* %4
%8 = and i32 %7, 131071
%9 = add nsw i32 %8, 917504
store i32 %9, i32* %4
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = load i8*, i8** %6
%13 = call i32 @mem_write_ram(i32 %10, i32 %11, i8* %12)
ret void
}

LLVM IR (-O2):
define void @ps2_write_shadow_ram(i32 %0, i32 %1, i8* %2) {
%4 = and i32 %0, 131071
%5 = or i32 %4, 917504
%6 = tail call i32 @mem_write_ram(i32 %5, i32 %1, i8* %2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ e_rol();
int /*<<< orphan*/ e_writeback();
int /*<<< orphan*/ e_zp();
void e_rol_zp() {
  e_zp();
  e_rol();
  e_writeback();
}


x86 assembly (clang, -O0):
<e_rol_zp>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <e_zp@plt>
mov    $0x0,%al
call   1050 <e_rol@plt>
mov    $0x0,%al
call   1030 <e_writeback@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<e_rol_zp>:
push   %rax
xor    %eax,%eax
call   1040 <e_zp@plt>
xor    %eax,%eax
call   1050 <e_rol@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <e_writeback@plt>

LLVM IR (-O0):
define void @e_rol_zp() {
%1 = call i32 (...) @e_zp()
%2 = call i32 (...) @e_rol()
%3 = call i32 (...) @e_writeback()
ret void
}

LLVM IR (-O2):
define void @e_rol_zp() {
%1 = tail call i32 (...) @e_zp()
%2 = tail call i32 (...) @e_rol()
%3 = tail call i32 (...) @e_writeback()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() { printf("Mamali"); }


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 <printf@plt>

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

LLVM IR (-O2):
@.str = [7 x i8] c"Mamali\00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
ret void
}
int test_pointer() {
  int x[10];
  x[4] = 41;
  x[5] = 42;
  int *y = &x[4];
  y = y + 1;
  return *y;
}


x86 assembly (clang, -O0):
<test_pointer>:
push   %rbp
mov    %rsp,%rbp
movl   $0x29,-0x20(%rbp)
movl   $0x2a,-0x1c(%rbp)
lea    -0x30(%rbp),%rax
add    $0x10,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
add    $0x4,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @test_pointer() {
%1 = alloca [10 x i32]
%2 = alloca i32*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32 41, i32* %3
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
store i32 42, i32* %4
%5 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
store i32* %5, i32** %2
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 1
store i32* %7, i32** %2
%8 = load i32*, i32** %2
%9 = load i32, i32* %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_pointer() {
ret i32 42
}
unsigned short LPCHalfWordRead(unsigned long ulBase, unsigned long ulOffset) {
  ;
  ;

  ;
  return ((*((volatile unsigned short *)(ulBase + 0x00000400 + ulOffset))));
}


x86 assembly (clang, -O0):
<LPCHalfWordRead>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x400,%rax
add    -0x10(%rbp),%rax
mov    (%rax),%ax
movzwl %ax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<LPCHalfWordRead>:
movzwl 0x400(%rdi,%rsi,1),%eax
ret

LLVM IR (-O0):
define zeroext i16 @LPCHalfWordRead(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = add i64 %5, 1024
%7 = load i64, i64* %4
%8 = add i64 %6, %7
%9 = inttoptr i64 %8 to i16*
%10 = load volatile i16, i16* %9
ret i16 %10
}

LLVM IR (-O2):
define zeroext i16 @LPCHalfWordRead(i64 %0, i64 %1) {
%3 = add i64 %0, 1024
%4 = add i64 %3, %1
%5 = inttoptr i64 %4 to i16*
%6 = load volatile i16, i16* %5
ret i16 %6
}
__attribute__((always_)) void __CLREX(void) {}


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

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

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

LLVM IR (-O2):
define void @__CLREX() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
uint32_t BOOT_RemapAddress(uint32_t address) {
  uint32_t (*p_BOOT_RemapAddress)(uint32_t address);
  p_BOOT_RemapAddress = (uint32_t(*)(uint32_t address))0x03000dc9U;
  return p_BOOT_RemapAddress(address);
}


x86 assembly (clang, -O0):
<BOOT_RemapAddress>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x3000dc9,%eax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%edi
call   *%rax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @BOOT_RemapAddress(i32 %0) {
%2 = alloca i32
%3 = alloca i32 (i32)*
store i32 %0, i32* %2
store i32 (i32)* inttoptr (i64 50335177 to i32 (i32)*), i32 (i32)** %3
%4 = load i32 (i32)*, i32 (i32)** %3
%5 = load i32, i32* %2
%6 = call i32 %4(i32 %5)
ret i32 %6
}

LLVM IR (-O2):
define i32 @BOOT_RemapAddress(i32 %0) {
%2 = tail call i32 inttoptr (i64 50335177 to i32 (i32)*)(i32 %0)
ret i32 %2
}
/* Variables and functions */
char *notImplemented();
char *serverGetKeys(char *unused1, char *unused2, char *unused3) {
  (void)(unused1);
  (void)(unused2);
  (void)(unused3);
  return notImplemented();
}


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

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

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

LLVM IR (-O2):
define i8* @serverGetKeys(i8* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture readnone %2) {
%4 = tail call i8* (...) @notImplemented()
ret i8* %4
}
void gdk_gc_set_function() {}


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

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

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

LLVM IR (-O2):
define void @gdk_gc_set_function() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ print(char *);
int /*<<< orphan*/ test_basic();
int /*<<< orphan*/ test_bool();
int /*<<< orphan*/ test_comma();
int /*<<< orphan*/ test_inc_dec();
int /*<<< orphan*/ test_relative();
int /*<<< orphan*/ test_ternary();
int /*<<< orphan*/ test_unary();
void testmain() {
  print("basic arithmetic");
  test_basic();
  test_relative();
  test_inc_dec();
  test_bool();
  test_unary();
  test_ternary();
  test_comma();
}


x86 assembly (clang, -O0):
<testmain>:
push   %rbp
mov    %rsp,%rbp
lea    0xe75(%rip),%rdi
call   1060 <print@plt>
mov    $0x0,%al
call   10a0 <test_basic@plt>
mov    $0x0,%al
call   1030 <test_relative@plt>
mov    $0x0,%al
call   1070 <test_inc_dec@plt>
mov    $0x0,%al
call   1050 <test_bool@plt>
mov    $0x0,%al
call   1080 <test_unary@plt>
mov    $0x0,%al
call   1090 <test_ternary@plt>
mov    $0x0,%al
call   1040 <test_comma@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<testmain>:
push   %rax
lea    0xe78(%rip),%rdi
call   1060 <print@plt>
xor    %eax,%eax
call   10a0 <test_basic@plt>
xor    %eax,%eax
call   1030 <test_relative@plt>
xor    %eax,%eax
call   1070 <test_inc_dec@plt>
xor    %eax,%eax
call   1050 <test_bool@plt>
xor    %eax,%eax
call   1080 <test_unary@plt>
xor    %eax,%eax
call   1090 <test_ternary@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <test_comma@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"basic arithmetic\00"
define void @testmain() {
%1 = call i32 @print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = call i32 (...) @test_basic()
%3 = call i32 (...) @test_relative()
%4 = call i32 (...) @test_inc_dec()
%5 = call i32 (...) @test_bool()
%6 = call i32 (...) @test_unary()
%7 = call i32 (...) @test_ternary()
%8 = call i32 (...) @test_comma()
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"basic arithmetic\00"
define void @testmain() {
%1 = tail call i32 @print(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @test_basic()
%3 = tail call i32 (...) @test_relative()
%4 = tail call i32 (...) @test_inc_dec()
%5 = tail call i32 (...) @test_bool()
%6 = tail call i32 (...) @test_unary()
%7 = tail call i32 (...) @test_ternary()
%8 = tail call i32 (...) @test_comma()
ret void
}
/* Variables and functions */
int gmatrix_lrand();
int rand_geno() { return gmatrix_lrand() % 3; }


x86 assembly (clang, -O0):
<rand_geno>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <gmatrix_lrand@plt>
mov    $0x3,%ecx
cltd
idiv   %ecx
mov    %edx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<rand_geno>:
push   %rax
xor    %eax,%eax
call   1030 <gmatrix_lrand@plt>
cltq
imul   $0x55555556,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
shr    $0x20,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,2),%ecx
sub    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @rand_geno() {
%1 = call i32 (...) @gmatrix_lrand()
%2 = srem i32 %1, 3
ret i32 %2
}

LLVM IR (-O2):
define i32 @rand_geno() {
%1 = tail call i32 (...) @gmatrix_lrand()
%2 = srem i32 %1, 3
ret i32 %2
}
int quicktime_base64_encode_len(int len) { return ((len + 2) / 3 * 4) + 1; }


x86 assembly (clang, -O0):
<quicktime_base64_encode_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicktime_base64_encode_len>:
add    $0x2,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    0x1(,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @quicktime_base64_encode_len(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = sdiv i32 %2, 3
%4 = shl nsw i32 %3, 2
%5 = or i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ SIG_DFL;
scalar_t__ SIG_ERR;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ signal(int, int /*<<< orphan*/);
void resetSignal(int sig) {
  if (signal(sig, SIG_DFL) == SIG_ERR) {
    printf("Failed to reset signal handler for signal %d\n", sig);
    exit(1);
  }
}


x86 assembly (clang, -O0):
<resetSignal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2e93(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e8d(%rip),%rcx
cmp    (%rcx),%rax
jne    1175 <resetSignal+0x45>
mov    -0x4(%rbp),%esi
lea    0xe9a(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<resetSignal>:
push   %rbx
mov    %edi,%ebx
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
call   1040 <signal@plt>
mov    0x2e98(%rip),%rcx
cmp    (%rcx),%rax
je     114f <resetSignal+0x1f>
pop    %rbx
ret
lea    0xeaa(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@SIG_DFL = global i32 0
@SIG_ERR = global i64 0
@.str = [46 x i8] c"Failed to reset signal handler for signal %d\0A\00"
define void @resetSignal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIG_DFL
%5 = call i64 @signal(i32 %3, i32 %4)
%6 = load i64, i64* @SIG_ERR
%7 = icmp eq i64 %5, %6
br i1 %7, label %8, label %12
8: ; preds = %1
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
ret void
}

LLVM IR (-O2):
@SIG_DFL = global i32 0
@SIG_ERR = global i64 0
@.str = [46 x i8] c"Failed to reset signal handler for signal %d\0A\00"
define void @resetSignal(i32 %0) {
%2 = load i32, i32* @SIG_DFL
%3 = tail call i64 @signal(i32 %0, i32 %2)
%4 = load i64, i64* @SIG_ERR
%5 = icmp eq i64 %3, %4
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = tail call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0), i32 %0)
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %1
ret void
}
void link_state_change_init(
    volatile struct link_state_notify_t *monitored_links,
    volatile int *notify) {}


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

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

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

LLVM IR (-O2):
%struct.link_state_notify_t = type opaque
define void @link_state_change_init(%struct.link_state_notify_t* nocapture %0, i32* nocapture %1) {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ SOL_SOCKET;
int setsockopt(int /*<<< orphan*/, int /*<<< orphan*/, int, char const *, int);
int setSockNoBlock(uint32_t s, uint32_t val) {
  return setsockopt(s, SOL_SOCKET, 0x1009, (const char *)&val,
                    sizeof(uint32_t));
}


x86 assembly (clang, -O0):
<setSockNoBlock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    -0x8(%rbp),%rcx
mov    $0x1009,%edx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setSockNoBlock>:
push   %rax
mov    %esi,0x4(%rsp)
mov    0x2ecc(%rip),%rax
mov    (%rax),%esi
lea    0x4(%rsp),%rcx
mov    $0x1009,%edx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
pop    %rcx
ret

LLVM IR (-O0):
@SOL_SOCKET = global i32 0
define i32 @setSockNoBlock(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* @SOL_SOCKET
%7 = bitcast i32* %4 to i8*
%8 = call i32 @setsockopt(i32 %5, i32 %6, i32 4105, i8* %7, i32 4)
ret i32 %8
}

LLVM IR (-O2):
@SOL_SOCKET = global i32 0
define i32 @setSockNoBlock(i32 %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = load i32, i32* @SOL_SOCKET
%5 = bitcast i32* %3 to i8*
%6 = call i32 @setsockopt(i32 %0, i32 %4, i32 4105, i8* %5, i32 4)
ret i32 %6
}
int test_imm_F0int64_lowword_reg(long long val) {
  return ((val) & (0xF0 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_F0int64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 240
%5 = icmp ne i64 %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_F0int64_lowword_reg(i64 %0) {
%2 = and i64 %0, 240
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void acpi_video_exit(void) { return; }


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

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

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

LLVM IR (-O2):
define void @acpi_video_exit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int _printString(char *s) { printf("%s\n", s); }


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @_printString(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
ret i32 undef
}
int verify_benchmark(int r) {
  int expected = 102;
  if (r != expected)
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<verify_benchmark>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
movl   $0x66,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     1126 <verify_benchmark+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <verify_benchmark+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<verify_benchmark>:
xor    %eax,%eax
cmp    $0x66,%edi
sete   %al
ret

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

LLVM IR (-O2):
define i32 @verify_benchmark(i32 %0) {
%2 = icmp eq i32 %0, 102
%3 = zext i1 %2 to i32
ret i32 %3
}
int permissible(long long unsigned x, long long unsigned y) {
  if (x > y)
    return 0;
  else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<permissible>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jbe    1126 <permissible+0x26>
movl   $0x0,-0x4(%rbp)
jmp    112d <permissible+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<permissible>:
xor    %eax,%eax
cmp    %rsi,%rdi
setbe  %al
ret

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

LLVM IR (-O2):
define i32 @permissible(i64 %0, i64 %1) {
%3 = icmp ule i64 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
void foo212() {}


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

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

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

LLVM IR (-O2):
define void @foo212() {
ret void
}
/* Variables and functions */
int close(int);
int spi_close(int fd) { return close(fd); }


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

x86 assembly (clang, -O2):
<spi_close>:
jmp    1030 <close@plt>

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

LLVM IR (-O2):
define i32 @spi_close(i32 %0) {
%2 = tail call i32 @close(i32 %0)
ret i32 %2
}
/* Variables and functions */
int or_l(int *, int *);
int intr_wrap_549(int p1, int p2) { return or_l(&p1, &p2); }


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

x86 assembly (clang, -O2):
<intr_wrap_549>:
push   %rax
mov    %edi,0x4(%rsp)
mov    %esi,(%rsp)
lea    0x4(%rsp),%rdi
mov    %rsp,%rsi
call   1030 <or_l@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @intr_wrap_549(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @or_l(i32* %3, i32* %4)
ret i32 %5
}

LLVM IR (-O2):
define i32 @intr_wrap_549(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @or_l(i32* %3, i32* %4)
ret i32 %5
}
void invalid_seq(int c) {}


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

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

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

LLVM IR (-O2):
define void @invalid_seq(i32 %0) {
ret void
}