xunge/DecIR huggingface dataset:
/* Type definitions */
struct DSListNode {
  int dummy;
};
struct DSLinkedList {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ds_list_unlink(struct DSLinkedList *, struct DSListNode *);
int /*<<< orphan*/ free(struct DSListNode *);
void ds_list_remove(struct DSLinkedList *lst, struct DSListNode *remove) {
  ds_list_unlink(lst, remove);
  free(remove);
}


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

x86 assembly (clang, -O2):
<ds_list_remove>:
push   %rbx
mov    %rsi,%rbx
call   1040 <ds_list_unlink@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.DSLinkedList = type { i32 }
%struct.DSListNode = type { i32 }
define void @ds_list_remove(%struct.DSLinkedList* %0, %struct.DSListNode* %1) {
%3 = alloca %struct.DSLinkedList*
%4 = alloca %struct.DSListNode*
store %struct.DSLinkedList* %0, %struct.DSLinkedList** %3
store %struct.DSListNode* %1, %struct.DSListNode** %4
%5 = load %struct.DSLinkedList*, %struct.DSLinkedList** %3
%6 = load %struct.DSListNode*, %struct.DSListNode** %4
%7 = call i32 @ds_list_unlink(%struct.DSLinkedList* %5, %struct.DSListNode* %6)
%8 = load %struct.DSListNode*, %struct.DSListNode** %4
%9 = call i32 @free(%struct.DSListNode* %8)
ret void
}

LLVM IR (-O2):
%struct.DSLinkedList = type { i32 }
%struct.DSListNode = type { i32 }
define void @ds_list_remove(%struct.DSLinkedList* %0, %struct.DSListNode* %1) {
%3 = tail call i32 @ds_list_unlink(%struct.DSLinkedList* %0, %struct.DSListNode* %1)
%4 = tail call i32 @free(%struct.DSListNode* %1)
ret void
}
/* Type definitions */
struct kp_file {
  int dummy;
};

/* Variables and functions */
int skip_section(struct kp_file *, int, char *);
int skip_eh_frame_section(struct kp_file *f, int l0) {
  return skip_section(f, l0, ".eh_frame");
}


x86 assembly (clang, -O0):
<skip_eh_frame_section>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
lea    0xed3(%rip),%rdx
call   1030 <skip_section@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<skip_eh_frame_section>:
lea    0xee9(%rip),%rdx
jmp    1030 <skip_section@plt>

LLVM IR (-O0):
%struct.kp_file = type { i32 }
@.str = [10 x i8] c".eh_frame\00"
define i32 @skip_eh_frame_section(%struct.kp_file* %0, i32 %1) {
%3 = alloca %struct.kp_file*
%4 = alloca i32
store %struct.kp_file* %0, %struct.kp_file** %3
store i32 %1, i32* %4
%5 = load %struct.kp_file*, %struct.kp_file** %3
%6 = load i32, i32* %4
%7 = call i32 @skip_section(%struct.kp_file* %5, i32 %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %7
}

LLVM IR (-O2):
%struct.kp_file = type { i32 }
@.str = [10 x i8] c".eh_frame\00"
define i32 @skip_eh_frame_section(%struct.kp_file* %0, i32 %1) {
%3 = tail call i32 @skip_section(%struct.kp_file* %0, i32 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
unsigned long long swap_long_long(unsigned long long);
unsigned long long host_long_long_to_network(unsigned long long x) {
  return swap_long_long(x);
}


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

x86 assembly (clang, -O2):
<host_long_long_to_network>:
jmp    1030 <swap_long_long@plt>

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

LLVM IR (-O2):
define i64 @host_long_long_to_network(i64 %0) {
%2 = tail call i64 @swap_long_long(i64 %0)
ret i64 %2
}
/* Variables and functions */
char tolower(char);
void strtolower(char *a) {
  int index;
  for (index = 0; a[index]; ++index)
    a[index] = tolower(a[index]);
}


x86 assembly (clang, -O0):
<strtolower>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1161 <strtolower+0x51>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <tolower@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <strtolower+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtolower>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     1136 <strtolower+0x26>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1030 <tolower@plt>
mov    %al,-0x1(%rbx)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <strtolower+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @strtolower(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %9, %4 ], [ 0, %1 ]
%6 = phi i8 [ %11, %4 ], [ %2, %1 ]
%7 = phi i8* [ %10, %4 ], [ %0, %1 ]
%8 = tail call signext i8 @tolower(i8 signext %6)
store i8 %8, i8* %7
%9 = add nuw i64 %5, 1
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %4
13: ; preds = %4, %1
ret void
}
/* Variables and functions */
int lremovexattr(char *, char *);
int main(void) { return lremovexattr("examplefile", "name"); }


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

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

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

LLVM IR (-O2):
@.str = [12 x i8] c"examplefile\00"
@.str.1 = [5 x i8] c"name\00"
define i32 @main() {
%1 = tail call i32 @lremovexattr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
ret i32 %1
}
void func2(void) { int x; }


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

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

LLVM IR (-O0):
define void @func2() {
%1 = alloca i32
ret void
}

LLVM IR (-O2):
define void @func2() {
ret void
}
/* Variables and functions */
char *strdup(char const *);
char *C_strdup(const char *string) {
  if (!string)
    return NULL;
  return strdup(string);
}


x86 assembly (clang, -O0):
<C_strdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1134 <C_strdup+0x24>
movq   $0x0,-0x8(%rbp)
jmp    1141 <C_strdup+0x31>
mov    -0x10(%rbp),%rdi
call   1030 <strdup@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C_strdup>:
test   %rdi,%rdi
je     111a <C_strdup+0xa>
jmp    1030 <strdup@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define noalias i8* @C_strdup(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i8* @strdup(i8* %0)
br label %5
5: ; preds = %1, %3
%6 = phi i8* [ %4, %3 ], [ null, %1 ]
ret i8* %6
}
double rsqrt_d(double a) { return 1.0 / __builtin_sqrt(a); }


x86 assembly (clang, -O0):
<rsqrt_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  0xece(%rip),%xmm0
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rsqrt_d>:
push   %rax
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1121 <rsqrt_d+0x11>
sqrtsd %xmm0,%xmm0
jmp    1126 <rsqrt_d+0x16>
call   1030 <sqrt@plt>
movsd  0xed2(%rip),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @rsqrt_d(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @sqrt(double %3)
%5 = fdiv double 1.000000e+00, %4
ret double %5
}

LLVM IR (-O2):
define double @rsqrt_d(double %0) {
%2 = tail call double @sqrt(double %0)
%3 = fdiv double 1.000000e+00, %2
ret double %3
}
void websils_openid_abi_0() {}


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

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

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

LLVM IR (-O2):
define void @websils_openid_abi_0() {
ret void
}
/* Variables and functions */
int memcmp(char *, char *, int);
int __test_diff_longer() {
  void;
  if ((memcmp("foobar", "foobaz", 7)) == (-1))
    return 0;
  else
    return 1;
}


x86 assembly (clang, -O0):
<__test_diff_longer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    0xee1(%rip),%rsi
mov    $0x7,%edx
call   1030 <memcmp@plt>
cmp    $0xffffffff,%eax
jne    1145 <__test_diff_longer+0x35>
movl   $0x0,-0x4(%rbp)
jmp    114c <__test_diff_longer+0x3c>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__test_diff_longer>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee8(%rip),%rsi
mov    $0x7,%edx
call   1030 <memcmp@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"foobar\00"
@.str.1 = [7 x i8] c"foobaz\00"
define i32 @__test_diff_longer() {
%1 = alloca i32
%2 = call i32 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 7)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* %1
br label %6
5: ; preds = %0
store i32 1, i32* %1
br label %6
6: ; preds = %5, %4
%7 = load i32, i32* %1
ret i32 %7
}

LLVM IR (-O2):
@.str = [7 x i8] c"foobar\00"
@.str.1 = [7 x i8] c"foobaz\00"
define i32 @__test_diff_longer() {
%1 = tail call i32 @memcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 7)
%2 = icmp ne i32 %1, -1
%3 = zext i1 %2 to i32
ret i32 %3
}
unsigned umax(unsigned u, unsigned v) { return (u > v ? u : v); }


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

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

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

LLVM IR (-O2):
define i32 @umax(i32 %0, i32 %1) {
%3 = icmp ugt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ __debugfs_init();
int __real_fstat(int, struct stat *);
int /*<<< orphan*/ printf(char *);
int fstat(int fd, struct stat *info) {
  printf("calling "
         "fstat"
         "\n");
  __debugfs_init();
  return (__real_fstat(fd, info));
}


x86 assembly (clang, -O0):
<fstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <__debugfs_init@plt>
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1050 <__real_fstat@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fstat>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xec1(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <__debugfs_init@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <__real_fstat@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [15 x i8] c"calling fstat\0A\00"
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @__debugfs_init()
%7 = load i32, i32* %3
%8 = load %struct.stat*, %struct.stat** %4
%9 = call i32 @__real_fstat(i32 %7, %struct.stat* %8)
ret i32 %9
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@str = [14 x i8] c"calling fstat\00"
define i32 @fstat(i32 %0, %struct.stat* %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @__debugfs_init()
%5 = tail call i32 @__real_fstat(i32 %0, %struct.stat* %1)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  int *pi;
  *pi = 123;
  printf("%d\n", *pi);
  return 0;
}


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

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

LLVM IR (-O2):
/* Variables and functions */
char *result_cmd(char *);
int /*<<< orphan*/ write(int, char *, int);
void show_time(void) {
  char *result;
  result = result_cmd("date");
  if (result)
    write(1, &result[11], 5);
}


x86 assembly (clang, -O0):
<show_time>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1040 <result_cmd@plt>
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     115a <show_time+0x3a>
mov    -0x8(%rbp),%rsi
add    $0xb,%rsi
mov    $0x1,%edi
mov    $0x5,%edx
call   1030 <write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_time>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <result_cmd@plt>
test   %rax,%rax
je     1149 <show_time+0x29>
add    $0xb,%rax
mov    $0x1,%edi
mov    %rax,%rsi
mov    $0x5,%edx
pop    %rax
jmp    1030 <write@plt>
pop    %rax
ret

LLVM IR (-O0):
@.str = [5 x i8] c"date\00"
define void @show_time() {
%1 = alloca i8*
%2 = call i8* @result_cmd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = icmp ne i8* %3, null
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = load i8*, i8** %1
%7 = getelementptr inbounds i8, i8* %6, i64 11
%8 = call i32 @write(i32 1, i8* %7, i32 5)
br label %9
9: ; preds = %5, %0
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"date\00"
define void @show_time() {
%1 = tail call i8* @result_cmd(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = getelementptr inbounds i8, i8* %1, i64 11
%5 = tail call i32 @write(i32 1, i8* %4, i32 5)
br label %6
6: ; preds = %3, %0
ret void
}
/* Variables and functions */
int rom_present(char *);
int wd1007vse1_available() { return rom_present("roms/62-000279-061.bin"); }


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

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

LLVM IR (-O0):
@.str = [23 x i8] c"roms/62-000279-061.bin\00"
define i32 @wd1007vse1_available() {
%1 = call i32 @rom_present(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}

LLVM IR (-O2):
@.str = [23 x i8] c"roms/62-000279-061.bin\00"
define i32 @wd1007vse1_available() {
%1 = tail call i32 @rom_present(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
ret i32 %1
}
void launch(void (*func)(void *)) { func(0); }


x86 assembly (clang, -O0):
<launch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   *-0x8(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<launch>:
mov    %rdi,%rax
xor    %edi,%edi
jmp    *%rax

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

LLVM IR (-O2):
define void @launch(void (i8*)* nocapture %0) {
tail call void %0(i8* null)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ reset;

/* Variables and functions */
int write_exact(int, char const *, int);
int send_hmr_reset(int fd) {
  static const char reset[] = {0x20, 0x00, 0x08, 0x01, 0x00, 0x00, 0x00, 0x00};
  return write_exact(fd, reset, sizeof(reset));
}


x86 assembly (clang, -O0):
<send_hmr_reset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
lea    0xedb(%rip),%rsi
mov    $0x8,%edx
call   1030 <write_exact@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_hmr_reset>:
lea    0xee9(%rip),%rsi
mov    $0x8,%edx
jmp    1030 <write_exact@plt>

LLVM IR (-O0):
@send_hmr_reset.reset = internal constant [8 x i8] c" \00\08\01\00\00\00\00"
define i32 @send_hmr_reset(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @write_exact(i32 %3, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @send_hmr_reset.reset, i64 0, i64 0), i32 8)
ret i32 %4
}

LLVM IR (-O2):
@send_hmr_reset.reset = internal constant [8 x i8] c" \00\08\01\00\00\00\00"
define i32 @send_hmr_reset(i32 %0) {
%2 = tail call i32 @write_exact(i32 %0, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @send_hmr_reset.reset, i64 0, i64 0), i32 8)
ret i32 %2
}
/* Variables and functions */
float tml_sr_vMaxExt(float const *, int, int *);
float tml_sr_vMax(const float *vec, int n) {
  int index;
  return tml_sr_vMaxExt(vec, n, &index);
}


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

x86 assembly (clang, -O2):
<tml_sr_vMax>:
push   %rax
lea    0x4(%rsp),%rdx
call   1030 <tml_sr_vMaxExt@plt>
pop    %rax
ret

LLVM IR (-O0):
define float @tml_sr_vMax(float* %0, i32 %1) {
%3 = alloca float*
%4 = alloca i32
%5 = alloca i32
store float* %0, float** %3
store i32 %1, i32* %4
%6 = load float*, float** %3
%7 = load i32, i32* %4
%8 = call float @tml_sr_vMaxExt(float* %6, i32 %7, i32* %5)
ret float %8
}

LLVM IR (-O2):
define float @tml_sr_vMax(float* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = call float @tml_sr_vMaxExt(float* %0, i32 %1, i32* %3)
ret float %5
}
int test_imm_3Fuint32_reg(unsigned int val) {
  return ((val) & (0x3F << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_3Fuint32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 63
%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_3Fuint32_reg(i32 %0) {
%2 = and i32 %0, 63
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
int int_cmp(const void *a, const void *b) {
  int res = *(int *)a > *(int *)b ? -1 : *(int *)a - *(int *)b ? 1 : 0;
  return res;
}


x86 assembly (clang, -O0):
<int_cmp>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jle    112b <int_cmp+0x2b>
mov    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1147 <int_cmp+0x47>
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rax
sub    (%rax),%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<int_cmp>:
mov    (%rdi),%eax
xor    %ecx,%ecx
cmp    (%rsi),%eax
setne  %cl
mov    $0xffffffff,%eax
cmovle %ecx,%eax
ret

LLVM IR (-O0):
define i32 @int_cmp(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 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
%11 = load i32, i32* %10
%12 = icmp sgt i32 %8, %11
br i1 %12, label %13, label %14
13: ; preds = %2
br label %25
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = bitcast i8* %15 to i32*
%17 = load i32, i32* %16
%18 = load i8*, i8** %4
%19 = bitcast i8* %18 to i32*
%20 = load i32, i32* %19
%21 = sub nsw i32 %17, %20
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i32 1, i32 0
br label %25
25: ; preds = %14, %13
%26 = phi i32 [ -1, %13 ], [ %24, %14 ]
store i32 %26, i32* %5
%27 = load i32, i32* %5
ret i32 %27
}

LLVM IR (-O2):
define i32 @int_cmp(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = bitcast i8* %1 to i32*
%6 = load i32, i32* %5
%7 = icmp sgt i32 %4, %6
%8 = icmp ne i32 %4, %6
%9 = zext i1 %8 to i32
%10 = select i1 %7, i32 -1, i32 %9
ret i32 %10
}
void ScaleRowDown2Linear_Any_SSSE3() {}


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

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

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

LLVM IR (-O2):
define void @ScaleRowDown2Linear_Any_SSSE3() {
ret void
}
/* Type definitions */
typedef int uint8_t;
struct dbuf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ dbuf_append(struct dbuf *, int *, int);
void dbuf_append_c(struct dbuf *dbuf, int c) {
  uint8_t val = c & 0xff;
  dbuf_append(dbuf, &val, 1);
}


x86 assembly (clang, -O0):
<dbuf_append_c>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x1,%edx
call   1030 <dbuf_append@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dbuf_append_c>:
push   %rax
movzbl %sil,%eax
mov    %eax,0x4(%rsp)
lea    0x4(%rsp),%rsi
mov    $0x1,%edx
call   1030 <dbuf_append@plt>
pop    %rax
ret

LLVM IR (-O0):
%struct.dbuf = type { i32 }
define void @dbuf_append_c(%struct.dbuf* %0, i32 %1) {
%3 = alloca %struct.dbuf*
%4 = alloca i32
%5 = alloca i32
store %struct.dbuf* %0, %struct.dbuf** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = and i32 %6, 255
store i32 %7, i32* %5
%8 = load %struct.dbuf*, %struct.dbuf** %3
%9 = call i32 @dbuf_append(%struct.dbuf* %8, i32* %5, i32 1)
ret void
}

LLVM IR (-O2):
%struct.dbuf = type { i32 }
define void @dbuf_append_c(%struct.dbuf* %0, i32 %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = and i32 %1, 255
store i32 %5, i32* %3
%6 = call i32 @dbuf_append(%struct.dbuf* %0, i32* %3, i32 1)
ret void
}
__attribute__((used)) void foo() {}


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

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
define void @foo() {
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @foo to i8*)], section "llvm.metadata"
define void @foo() {
ret void
}
void X509_REQ_add1_attr_by_txt(void) {}


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

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

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

LLVM IR (-O2):
define void @X509_REQ_add1_attr_by_txt() {
ret void
}
char *ultoa(unsigned long val) {
  char *p;
  static char buf[12];
  p = buf + sizeof(buf);
  *--p = '\0';
  do {
    *--p = '0' + val % 10;
    val /= 10;
  } while (val);
  return p;
}


x86 assembly (clang, -O0):
<ultoa>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
lea    0x2f12(%rip),%rax
add    $0xc,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
movb   $0x0,-0x1(%rax)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
add    $0x30,%rdx
mov    %dl,%cl
mov    -0x10(%rbp),%rax
mov    %rax,%rdx
add    $0xffffffffffffffff,%rdx
mov    %rdx,-0x10(%rbp)
mov    %cl,-0x1(%rax)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
xor    %edx,%edx
div    %rcx
mov    %rax,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
jne    112a <ultoa+0x2a>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ultoa>:
movb   $0x0,0x2f25(%rip)
lea    0x2f1e(%rip),%rcx
movabs $0xcccccccccccccccd,%r8
cc cc cc
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
mul    %r8
shr    $0x3,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %edi,%esi
sub    %eax,%esi
or     $0x30,%sil
mov    %sil,-0x1(%rcx)
add    $0xffffffffffffffff,%rcx
cmp    $0x9,%rdi
mov    %rdx,%rdi
ja     1120 <ultoa+0x20>
mov    %rcx,%rax
ret

LLVM IR (-O0):
@ultoa.buf = internal global [12 x i8] zeroinitializer
define i8* @ultoa(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @ultoa.buf, i64 1, i64 0), i8** %3
%4 = load i8*, i8** %3
%5 = getelementptr inbounds i8, i8* %4, i32 -1
store i8* %5, i8** %3
store i8 0, i8* %5
br label %6
6: ; preds = %15, %1
%7 = load i64, i64* %2
%8 = urem i64 %7, 10
%9 = add i64 48, %8
%10 = trunc i64 %9 to i8
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 -1
store i8* %12, i8** %3
store i8 %10, i8* %12
%13 = load i64, i64* %2
%14 = udiv i64 %13, 10
store i64 %14, i64* %2
br label %15
15: ; preds = %6
%16 = load i64, i64* %2
%17 = icmp ne i64 %16, 0
br i1 %17, label %6, label %18
18: ; preds = %15
%19 = load i8*, i8** %3
ret i8* %19
}

LLVM IR (-O2):
@ultoa.buf = internal global [12 x i8] zeroinitializer
define i8* @ultoa(i64 %0) {
store i8 0, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @ultoa.buf, i64 0, i64 11)
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %0, %1 ], [ %9, %2 ]
%4 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @ultoa.buf, i64 0, i64 11), %1 ], [ %8, %2 ]
%5 = urem i64 %3, 10
%6 = trunc i64 %5 to i8
%7 = or i8 %6, 48
%8 = getelementptr inbounds i8, i8* %4, i64 -1
store i8 %7, i8* %8
%9 = udiv i64 %3, 10
%10 = icmp ult i64 %3, 10
br i1 %10, label %11, label %2
11: ; preds = %2
ret i8* %8
}
/* Type definitions */
struct bitfield {
  int dummy;
};

/* Variables and functions */
scalar_t__ bftouint16(struct bitfield const *);
scalar_t__ bftouint32(struct bitfield const *);
unsigned short *bf2short(const struct bitfield *input) {
  unsigned short *output;
  if (sizeof(unsigned short) == 2)
    output = (unsigned short *)bftouint16(input);
  else
    output = (unsigned short *)bftouint32(input);
  return output;
}


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

x86 assembly (clang, -O2):
<bf2short>:
jmp    1030 <bftouint16@plt>

LLVM IR (-O0):
%struct.bitfield = type { i32 }
define i16* @bf2short(%struct.bitfield* %0) {
%2 = alloca %struct.bitfield*
%3 = alloca i16*
store %struct.bitfield* %0, %struct.bitfield** %2
%4 = load %struct.bitfield*, %struct.bitfield** %2
%5 = call i64 @bftouint16(%struct.bitfield* %4)
%6 = inttoptr i64 %5 to i16*
store i16* %6, i16** %3
%7 = load i16*, i16** %3
ret i16* %7
}

LLVM IR (-O2):
%struct.bitfield = type { i32 }
define i16* @bf2short(%struct.bitfield* %0) {
%2 = tail call i64 @bftouint16(%struct.bitfield* %0)
%3 = inttoptr i64 %2 to i16*
ret i16* %3
}
int __svgalib_laguna_inis1(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @__svgalib_laguna_inis1() {
ret i32 0
}

LLVM IR (-O2):
define i32 @__svgalib_laguna_inis1() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fatal(char *);
void sigint(int signo) { fatal("\nInterrupt"); }


x86 assembly (clang, -O0):
<sigint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
call   1030 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [11 x i8] c"\0AInterrupt\00"
define void @sigint(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0AInterrupt\00"
define void @sigint(i32 %0) {
%2 = tail call i32 @fatal(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ puts(char *);
__attribute__((__weak__, __always___)) void softboundmpx_puts(char *ptr) {
  puts(ptr);
}


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

x86 assembly (clang, -O2):
<softboundmpx_puts>:
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
define weak void @softboundmpx_puts(i8* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) %0)
ret void
}
/* Variables and functions */
int ERR;
int getch();
int /*<<< orphan*/ ungetch(int);
int kbdhit() {
  int key = getch();
  if (key != ERR) {
    ungetch(key);
    return 0;
  } else {
    return 1;
  }
}


x86 assembly (clang, -O0):
<kbdhit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    0x2eac(%rip),%rcx
cmp    (%rcx),%eax
je     1158 <kbdhit+0x38>
mov    -0x8(%rbp),%edi
call   1030 <ungetch@plt>
movl   $0x0,-0x4(%rbp)
jmp    115f <kbdhit+0x3f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kbdhit>:
push   %rax
xor    %eax,%eax
call   1040 <getch@plt>
mov    0x2eb9(%rip),%rdx
mov    $0x1,%ecx
cmp    (%rdx),%eax
je     1141 <kbdhit+0x21>
mov    %eax,%edi
call   1030 <ungetch@plt>
xor    %ecx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@ERR = global i32 0
define i32 @kbdhit() {
%1 = tail call i32 (...) @getch()
%2 = load i32, i32* @ERR
%3 = icmp eq i32 %1, %2
br i1 %3, label %6, label %4
4: ; preds = %0
%5 = tail call i32 @ungetch(i32 %1)
br label %6
6: ; preds = %0, %4
%7 = phi i32 [ 0, %4 ], [ 1, %0 ]
ret i32 %7
}
int return_int_2() { return 1073741823; }


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

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

LLVM IR (-O0):
define i32 @return_int_2() {
ret i32 1073741823
}

LLVM IR (-O2):
define i32 @return_int_2() {
ret i32 1073741823
}
int compare(const void *a, const void *b) {
  const int *ia = (const int *)a;
  const int *ib = (const int *)b;
  return *ia - *ib;
}


x86 assembly (clang, -O0):
<compare>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    -0x20(%rbp),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @compare(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i32*
store i8* %0, i8** %3
store i8* %1, i8** %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to i32*
store i32* %8, i32** %5
%9 = load i8*, i8** %4
%10 = bitcast i8* %9 to i32*
store i32* %10, i32** %6
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = load i32*, i32** %6
%14 = load i32, i32* %13
%15 = sub nsw i32 %12, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @compare(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i32*
%4 = bitcast i8* %1 to i32*
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = sub nsw i32 %5, %6
ret i32 %7
}
/* Type definitions */
struct regs {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ kp(char *);
void ehci_irq(struct regs *r) { kp("ehci irq"); }


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

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

LLVM IR (-O0):
%struct.regs = type { i32 }
@.str = [9 x i8] c"ehci irq\00"
define void @ehci_irq(%struct.regs* %0) {
%2 = alloca %struct.regs*
store %struct.regs* %0, %struct.regs** %2
%3 = call i32 @kp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.regs = type { i32 }
@.str = [9 x i8] c"ehci irq\00"
define void @ehci_irq(%struct.regs* nocapture readnone %0) {
%2 = tail call i32 @kp(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Type definitions */
typedef int uint8_t;

/* Variables and functions */
char Lookup_Hex_Low(uint8_t byte) {
  const char hex[16] = "0123456789ABCDEF";
  byte = byte & 0x0F;
  return hex[byte];
}


x86 assembly (clang, -O0):
<Lookup_Hex_Low>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    0xef2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x4(%rbp),%eax
and    $0xf,%eax
mov    %eax,-0x4(%rbp)
movslq -0x4(%rbp),%rax
movsbl -0x20(%rbp,%rax,1),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Lookup_Hex_Low>:
and    $0xf,%edi
lea    0xef6(%rip),%rax
mov    (%rdi,%rax,1),%al
ret

LLVM IR (-O0):
@__const.Lookup_Hex_Low.hex = [16 x i8] c"0123456789ABCDEF"
define signext i8 @Lookup_Hex_Low(i32 %0) {
%2 = alloca i32
%3 = alloca [16 x i8]
store i32 %0, i32* %2
%4 = bitcast [16 x i8]* %3 to i8*
%5 = load i32, i32* %2
%6 = and i32 %5, 15
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [16 x i8], [16 x i8]* %3, i64 0, i64 %8
%10 = load i8, i8* %9
ret i8 %10
}

LLVM IR (-O2):
@__const.Lookup_Hex_Low.hex = [16 x i8] c"0123456789ABCDEF"
define signext i8 @Lookup_Hex_Low(i32 %0) {
%2 = and i32 %0, 15
%3 = zext i32 %2 to i64
%4 = getelementptr inbounds [16 x i8], [16 x i8]* @__const.Lookup_Hex_Low.hex, i64 0, i64 %3
%5 = load i8, i8* %4
ret i8 %5
}
/* Variables and functions */
char *b64encode(char const *);
int /*<<< orphan*/ free(char *);
void testB64Encode(const char *raw, const char *encoded) {
  char *b64e = b64encode(raw);
  ;
  free(b64e);
}


x86 assembly (clang, -O0):
<testB64Encode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <b64encode@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testB64Encode>:
push   %rax
call   1040 <b64encode@plt>
mov    %rax,%rdi
pop    %rax
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @testB64Encode(i8* %0, i8* nocapture readnone %1) {
%3 = tail call i8* @b64encode(i8* %0)
%4 = tail call i32 @free(i8* %3)
ret void
}
/* Variables and functions */
scalar_t__ strtoul(char const *, char **, int);
long int strtol(const char *nptr, char **endptr, int base) {
  return ((long int)strtoul(nptr, endptr, base));
}


x86 assembly (clang, -O0):
<strtol>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <strtoul@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtol>:
jmp    1030 <strtoul@plt>

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

LLVM IR (-O2):
define i64 @strtol(i8* %0, i8** nocapture %1, i32 %2) {
%4 = tail call i64 @strtoul(i8* %0, i8** %1, i32 %2)
ret i64 %4
}
/* Variables and functions */
char *checking_strdup(char *);
char *strrchr(char *, char);
void windows_main(char **exec_name) {
  char *p;
  *exec_name = checking_strdup(*exec_name);
  p = strrchr(*exec_name, '.');
  if (p)
    *p = '\0';
}


x86 assembly (clang, -O0):
<windows_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
call   1040 <checking_strdup@plt>
mov    %rax,%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1169 <windows_main+0x49>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<windows_main>:
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%rdi
call   1040 <checking_strdup@plt>
mov    %rax,(%rbx)
mov    %rax,%rdi
mov    $0x2e,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1144 <windows_main+0x24>
movb   $0x0,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @windows_main(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
store i8** %0, i8*** %2
%4 = load i8**, i8*** %2
%5 = load i8*, i8** %4
%6 = call i8* @checking_strdup(i8* %5)
%7 = load i8**, i8*** %2
store i8* %6, i8** %7
%8 = load i8**, i8*** %2
%9 = load i8*, i8** %8
%10 = call i8* @strrchr(i8* %9, i8 signext 46)
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %1
%14 = load i8*, i8** %3
store i8 0, i8* %14
br label %15
15: ; preds = %13, %1
ret void
}

LLVM IR (-O2):
define void @windows_main(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = tail call i8* @checking_strdup(i8* %2)
store i8* %3, i8** %0
%4 = tail call i8* @strrchr(i8* dereferenceable(1) %3, i8 signext 46)
%5 = icmp eq i8* %4, null
br i1 %5, label %7, label %6
6: ; preds = %1
store i8 0, i8* %4
br label %7
7: ; preds = %6, %1
ret void
}
void Strcpy(char *t, char *s) {
  while (*s++ = *t++)
    ;
}


x86 assembly (clang, -O0):
<Strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x10(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x10(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113b <Strcpy+0x3b>
jmp    110c <Strcpy+0xc>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Strcpy>:
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rdi,%rax,1),%ecx
mov    %cl,(%rsi,%rax,1)
add    $0x1,%rax
test   %cl,%cl
jne    1110 <Strcpy+0x10>
ret

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

LLVM IR (-O2):
define void @Strcpy(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %6, %3 ]
%5 = phi i8* [ %1, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret void
}
__attribute__((always_)) void pci_disable_ats(struct pci_dev *dev) {}


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

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

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

LLVM IR (-O2):
%struct.pci_dev = type opaque
define void @pci_disable_ats(%struct.pci_dev* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
void fn_test4(void) {
  static int ia = 10, ib = 20;
  ia++;
  ib++;
  printf("fn_test4: %d, %d\n", ia, ib);
}


x86 assembly (clang, -O0):
<fn_test4>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0e(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f05(%rip)
mov    0x2f03(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2efa(%rip)
mov    0x2ef0(%rip),%esi
mov    0x2eee(%rip),%edx
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<fn_test4>:
mov    0x2f12(%rip),%esi
add    $0x1,%esi
mov    %esi,0x2f09(%rip)
mov    0x2f07(%rip),%edx
add    $0x1,%edx
mov    %edx,0x2efe(%rip)
lea    0xecb(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@fn_test4.ia = internal global i32 10
@fn_test4.ib = internal global i32 20
@.str = [18 x i8] c"fn_test4: %d, %d\0A\00"
define void @fn_test4() {
%1 = load i32, i32* @fn_test4.ia
%2 = add nsw i32 %1, 1
store i32 %2, i32* @fn_test4.ia
%3 = load i32, i32* @fn_test4.ib
%4 = add nsw i32 %3, 1
store i32 %4, i32* @fn_test4.ib
%5 = load i32, i32* @fn_test4.ia
%6 = load i32, i32* @fn_test4.ib
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %6)
ret void
}

LLVM IR (-O2):
@fn_test4.ia = internal unnamed_addr global i32 10
@fn_test4.ib = internal unnamed_addr global i32 20
@.str = [18 x i8] c"fn_test4: %d, %d\0A\00"
define void @fn_test4() {
%1 = load i32, i32* @fn_test4.ia
%2 = add nsw i32 %1, 1
store i32 %2, i32* @fn_test4.ia
%3 = load i32, i32* @fn_test4.ib
%4 = add nsw i32 %3, 1
store i32 %4, i32* @fn_test4.ib
%5 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %2, i32 %4)
ret void
}
void ARGBDetect() {}


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

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

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

LLVM IR (-O2):
define void @ARGBDetect() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_to_98(int n) {
  while (n != 98) {
    printf("%i, ", n);
    if (n > 98)
      n--;
    else
      n++;
  }
  printf("98\n");
}


x86 assembly (clang, -O0):
<print_to_98>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x62,-0x4(%rbp)
je     115c <print_to_98+0x4c>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x62,-0x4(%rbp)
jle    114e <print_to_98+0x3e>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    1157 <print_to_98+0x47>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <print_to_98+0xb>
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_to_98>:
push   %r14
push   %rbx
push   %rax
cmp    $0x62,%edi
je     115f <print_to_98+0x3f>
mov    %edi,%ebx
lea    0xece(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
cmp    $0x63,%ebx
setl   %al
lea    (%rbx,%rax,2),%ebx
add    $0xffffffff,%ebx
cmp    $0x62,%ebx
jne    1140 <print_to_98+0x20>
lea    0xe9f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"%i, \00"
@.str.1 = [4 x i8] c"98\0A\00"
define void @print_to_98(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %17, %1
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 98
br i1 %5, label %6, label %18
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 98
br i1 %10, label %11, label %14
11: ; preds = %6
%12 = load i32, i32* %2
%13 = add nsw i32 %12, -1
store i32 %13, i32* %2
br label %17
14: ; preds = %6
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %17
17: ; preds = %14, %11
br label %3
18: ; preds = %3
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"%i, \00"
@str = [3 x i8] c"98\00"
define void @print_to_98(i32 %0) {
%2 = icmp eq i32 %0, 98
br i1 %2, label %10, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %8, %3 ], [ %0, %1 ]
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = icmp sgt i32 %4, 98
%7 = select i1 %6, i32 -1, i32 1
%8 = add nsw i32 %7, %4
%9 = icmp eq i32 %8, 98
br i1 %9, label %10, label %3
10: ; preds = %3, %1
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @str, i64 0, i64 0))
ret void
}