xunge/DecIR huggingface dataset:
void do_cpuid(unsigned ax, unsigned *p) {
  __asm__ __volatile__("cpuid"
                       : "=a"(p[0]), "=b"(p[1]), "=c"(p[2]), "=d"(p[3])
                       : "0"(ax));
}


x86 assembly (clang, -O0):
<do_cpuid>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %edi,-0xc(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%r8
mov    -0x18(%rbp),%rdi
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
cpuid
mov    %eax,%r9d
mov    -0x28(%rbp),%rax
mov    %ecx,%esi
mov    -0x20(%rbp),%rcx
mov    %r9d,(%r8)
mov    %ebx,0x4(%rdi)
mov    %esi,0x8(%rcx)
mov    %edx,0xc(%rax)
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_cpuid>:
push   %rbx
mov    %edi,%eax
cpuid
mov    %eax,(%rsi)
mov    %ebx,0x4(%rsi)
mov    %ecx,0x8(%rsi)
mov    %edx,0xc(%rsi)
pop    %rbx
ret

LLVM IR (-O0):
define void @do_cpuid(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 = getelementptr inbounds i32, i32* %5, i64 0
%7 = load i32*, i32** %4
%8 = getelementptr inbounds i32, i32* %7, i64 1
%9 = load i32*, i32** %4
%10 = getelementptr inbounds i32, i32* %9, i64 2
%11 = load i32*, i32** %4
%12 = getelementptr inbounds i32, i32* %11, i64 3
%13 = load i32, i32* %3
%14 = call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %13)
%15 = extractvalue { i32, i32, i32, i32 } %14, 0
%16 = extractvalue { i32, i32, i32, i32 } %14, 1
%17 = extractvalue { i32, i32, i32, i32 } %14, 2
%18 = extractvalue { i32, i32, i32, i32 } %14, 3
store i32 %15, i32* %6
store i32 %16, i32* %8
store i32 %17, i32* %10
store i32 %18, i32* %12
ret void
}

LLVM IR (-O2):
define void @do_cpuid(i32 %0, i32* nocapture writeonly %1) {
%3 = getelementptr inbounds i32, i32* %1, i64 1
%4 = getelementptr inbounds i32, i32* %1, i64 2
%5 = getelementptr inbounds i32, i32* %1, i64 3
%6 = tail call { i32, i32, i32, i32 } asm sideeffect "cpuid", "={ax},={bx},={cx},={dx},0,~{dirflag},~{fpsr},~{flags}"(i32 %0)
%7 = extractvalue { i32, i32, i32, i32 } %6, 0
%8 = extractvalue { i32, i32, i32, i32 } %6, 1
%9 = extractvalue { i32, i32, i32, i32 } %6, 2
%10 = extractvalue { i32, i32, i32, i32 } %6, 3
store i32 %7, i32* %1
store i32 %8, i32* %3
store i32 %9, i32* %4
store i32 %10, i32* %5
ret void
}
/* Variables and functions */
int /*<<< orphan*/ cc32xx_binary_file_store(char *, char const *, size_t);
void ext_configuration_store(const char *buffer, size_t buffer_size) {
  cc32xx_binary_file_store("kaa_configuration.bin", buffer, buffer_size);
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"kaa_configuration.bin\00"
define void @ext_configuration_store(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
store i8* %0, i8** %3
store i64 %1, i64* %4
%5 = load i8*, i8** %3
%6 = load i64, i64* %4
%7 = call i32 @cc32xx_binary_file_store(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %5, i64 %6)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"kaa_configuration.bin\00"
define void @ext_configuration_store(i8* %0, i64 %1) {
%3 = tail call i32 @cc32xx_binary_file_store(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0, i64 %1)
ret void
}
void RTPathJoin(void) {}


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

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

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

LLVM IR (-O2):
define void @RTPathJoin() {
ret void
}
/* Variables and functions */
int fact(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int n = 4;
  printf("result is %d\n", fact(n));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [14 x i8] c"result is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @fact(i32 4)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void *free_f77_func_data(void *p) {
  free(p);
  return NULL;
}


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

x86 assembly (clang, -O2):
<free_f77_func_data>:
push   %rax
call   1030 <free@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define noalias i8* @free_f77_func_data(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret i8* null
}
/* Type definitions */
typedef int uid_t;

/* Variables and functions */
int /*<<< orphan*/ ENOSYS;
int /*<<< orphan*/ errno;
uid_t geteuid(void) {
  errno = ENOSYS;
  return -1;
}


x86 assembly (clang, -O0):
<geteuid>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec4(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<geteuid>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%eax
mov    0x2ec8(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @geteuid() {
%1 = load i32, i32* @ENOSYS
store i32 %1, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOSYS = global i32 0
@errno = global i32 0
define i32 @geteuid() {
%1 = load i32, i32* @ENOSYS
store i32 %1, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(void *);
void althrd_exit(int res) { pthread_exit((void *)(intptr_t)res); }


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

x86 assembly (clang, -O2):
<althrd_exit>:
movslq %edi,%rdi
jmp    1030 <pthread_exit@plt>

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

LLVM IR (-O2):
define void @althrd_exit(i32 %0) {
%2 = sext i32 %0 to i64
%3 = inttoptr i64 %2 to i8*
%4 = tail call i32 @pthread_exit(i8* %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
void repeat_char(const char c, const int repeat) {
  for (int i = 0; i < repeat; i++)
    putchar(c);
}


x86 assembly (clang, -O0):
<repeat_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    114b <repeat_char+0x3b>
movsbl -0x1(%rbp),%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1128 <repeat_char+0x18>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat_char>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    112c <repeat_char+0x1c>
mov    %esi,%ebx
movsbl %dil,%ebp
nopl   (%rax)
mov    %ebp,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <repeat_char+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @repeat_char(i8 signext %0, i32 %1) {
%3 = alloca i8
%4 = alloca i32
%5 = alloca i32
store i8 %0, i8* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %6
6: ; preds = %13, %2
%7 = load i32, i32* %5
%8 = load i32, i32* %4
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = load i8, i8* %3
%12 = call i32 @putchar(i8 signext %11)
br label %13
13: ; preds = %10
%14 = load i32, i32* %5
%15 = add nsw i32 %14, 1
store i32 %15, i32* %5
br label %6
16: ; preds = %6
ret void
}

LLVM IR (-O2):
define void @repeat_char(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %5, label %4
4: ; preds = %5, %2
ret void
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ 0, %2 ]
%7 = tail call i32 @putchar(i8 signext %0)
%8 = add nuw nsw i32 %6, 1
%9 = icmp eq i32 %8, %1
br i1 %9, label %4, label %5
}
int mcfd_random_reseed(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @mcfd_random_reseed() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main() {
  printf("true and false is %d\n", 1 && 0);
  printf("true or false is %d\n", 1 || 0);
  printf("true xor false is %d\n", 1 ^ 0);
  printf("not true is %d", !1);
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [22 x i8] c"true and false is %d\0A\00"
@.str.1 = [21 x i8] c"true or false is %d\0A\00"
@.str.2 = [22 x i8] c"true xor false is %d\0A\00"
@.str.3 = [15 x i8] c"not true is %d\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0)
%3 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 1)
%4 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 1)
%5 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"true and false is %d\0A\00"
@.str.1 = [21 x i8] c"true or false is %d\0A\00"
@.str.2 = [22 x i8] c"true xor false is %d\0A\00"
@.str.3 = [15 x i8] c"not true is %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i32 1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i32 1)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
void quit(int ign1, char *ign2[]) {
  (void)ign1;
  (void)ign2;
  exit(0);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %edi,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
xor    %edi,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @quit(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = load i32, i32* %3
%6 = load i8**, i8*** %4
%7 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
define void @quit(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @exit(i32 0)
unreachable
}
int xopen() {}


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

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

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

LLVM IR (-O2):
define i32 @xopen() {
ret i32 undef
}
int test_imm_EAuint64_lowword_reg(unsigned long long val) {
  return ((val) & (0xEA << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_EAuint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 234
%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_EAuint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 234
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct object {
  int dummy;
};
struct lisp {
  int dummy;
};

/* Variables and functions */
struct object *intern(struct lisp *, void *, int /*<<< orphan*/);
int /*<<< orphan*/ make_string(struct lisp *, void *, char *);
struct object *top_intern(struct lisp *lisp, void *stack, char *name) {
  return intern(lisp, stack, make_string(lisp, stack, name));
}


x86 assembly (clang, -O0):
<top_intern>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <make_string@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    %eax,%edx
call   1030 <intern@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<top_intern>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1040 <make_string@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <intern@plt>

LLVM IR (-O0):
%struct.object = type { i32 }
%struct.lisp = type { i32 }
define %struct.object* @top_intern(%struct.lisp* %0, i8* %1, i8* %2) {
%4 = alloca %struct.lisp*
%5 = alloca i8*
%6 = alloca i8*
store %struct.lisp* %0, %struct.lisp** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%7 = load %struct.lisp*, %struct.lisp** %4
%8 = load i8*, i8** %5
%9 = load %struct.lisp*, %struct.lisp** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @make_string(%struct.lisp* %9, i8* %10, i8* %11)
%13 = call %struct.object* @intern(%struct.lisp* %7, i8* %8, i32 %12)
ret %struct.object* %13
}

LLVM IR (-O2):
%struct.object = type { i32 }
%struct.lisp = type { i32 }
define %struct.object* @top_intern(%struct.lisp* %0, i8* %1, i8* %2) {
%4 = tail call i32 @make_string(%struct.lisp* %0, i8* %1, i8* %2)
%5 = tail call %struct.object* @intern(%struct.lisp* %0, i8* %1, i32 %4)
ret %struct.object* %5
}
/* Variables and functions */
void *new_pq(size_t, int, int (*)(void const *, void const *));
void *priority_queue_max(size_t init_size, int (*compare)(const void *first,
                                                          const void *second)) {
  return new_pq(init_size, 1, compare);
}


x86 assembly (clang, -O0):
<priority_queue_max>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1,%esi
call   1030 <new_pq@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<priority_queue_max>:
mov    %rsi,%rdx
mov    $0x1,%esi
jmp    1030 <new_pq@plt>

LLVM IR (-O0):
define i8* @priority_queue_max(i64 %0, i32 (i8*, i8*)* %1) {
%3 = alloca i64
%4 = alloca i32 (i8*, i8*)*
store i64 %0, i64* %3
store i32 (i8*, i8*)* %1, i32 (i8*, i8*)** %4
%5 = load i64, i64* %3
%6 = load i32 (i8*, i8*)*, i32 (i8*, i8*)** %4
%7 = call i8* @new_pq(i64 %5, i32 1, i32 (i8*, i8*)* %6)
ret i8* %7
}

LLVM IR (-O2):
define i8* @priority_queue_max(i64 %0, i32 (i8*, i8*)* %1) {
%3 = tail call i8* @new_pq(i64 %0, i32 1, i32 (i8*, i8*)* %1)
ret i8* %3
}
/* Type definitions */
struct pci_dev {
  int dummy;
};

/* Variables and functions */
int enable_flash_sis5x0(struct pci_dev *, char const *, int, int);
int enable_flash_sis530(struct pci_dev *dev, const char *name) {
  return enable_flash_sis5x0(dev, name, 0x20, 0x04);
}


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

x86 assembly (clang, -O2):
<enable_flash_sis530>:
mov    $0x20,%edx
mov    $0x4,%ecx
jmp    1030 <enable_flash_sis5x0@plt>

LLVM IR (-O0):
%struct.pci_dev = type { i32 }
define i32 @enable_flash_sis530(%struct.pci_dev* %0, i8* %1) {
%3 = alloca %struct.pci_dev*
%4 = alloca i8*
store %struct.pci_dev* %0, %struct.pci_dev** %3
store i8* %1, i8** %4
%5 = load %struct.pci_dev*, %struct.pci_dev** %3
%6 = load i8*, i8** %4
%7 = call i32 @enable_flash_sis5x0(%struct.pci_dev* %5, i8* %6, i32 32, i32 4)
ret i32 %7
}

LLVM IR (-O2):
%struct.pci_dev = type { i32 }
define i32 @enable_flash_sis530(%struct.pci_dev* %0, i8* %1) {
%3 = tail call i32 @enable_flash_sis5x0(%struct.pci_dev* %0, i8* %1, i32 32, i32 4)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void iterateB(int n) {
  int k = 0;
  for (k = 0; k < n; k++) {
    printf("iterateB k = %d\n", k);
  }
}


x86 assembly (clang, -O0):
<iterateB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1152 <iterateB+0x42>
mov    -0x8(%rbp),%esi
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <iterateB+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterateB>:
push   %rbp
push   %r14
push   %rbx
test   %edi,%edi
jle    1141 <iterateB+0x31>
mov    %edi,%ebx
xor    %ebp,%ebp
lea    0xedd(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <iterateB+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [17 x i8] c"iterateB k = %d\0A\00"
define void @iterateB(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
int main(void) {
  char *s = "hello world";
  int *ptr = 0;
  *s = 'H';
  *ptr = 1;
  main();
  return 0;
}


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

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

LLVM IR (-O2):
/* Variables and functions */
scalar_t__ RAND_MAX;
double rand();
int random_int(int left, int right) {
  double d = rand() / ((double)RAND_MAX + 1);
  double d2 = (right - left + 1) * d;
  return (int)d2 + left;
}


x86 assembly (clang, -O0):
<random_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    0x2ebc(%rip),%rax
cvtsi2sdq (%rax),%xmm1
movsd  0xec7(%rip),%xmm2
addsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x4(%rbp),%eax
add    $0x1,%eax
cvtsi2sd %eax,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
cvttsd2si -0x18(%rbp),%eax
add    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
mov    0x2ec3(%rip),%rax
cvtsi2sdq (%rax),%xmm1
addsd  0xece(%rip),%xmm1
divsd  %xmm1,%xmm0
sub    %ebp,%ebx
add    $0x1,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
mulsd  %xmm0,%xmm1
cvttsd2si %xmm1,%eax
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@RAND_MAX = global i64 0
define i32 @random_int(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = call double (...) @rand()
%8 = load i64, i64* @RAND_MAX
%9 = sitofp i64 %8 to double
%10 = fadd double %9, 1.000000e+00
%11 = fdiv double %7, %10
store double %11, double* %5
%12 = load i32, i32* %4
%13 = load i32, i32* %3
%14 = sub nsw i32 %12, %13
%15 = add nsw i32 %14, 1
%16 = sitofp i32 %15 to double
%17 = load double, double* %5
%18 = fmul double %16, %17
store double %18, double* %6
%19 = load double, double* %6
%20 = fptosi double %19 to i32
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
ret i32 %22
}

LLVM IR (-O2):
@RAND_MAX = global i64 0
define i32 @random_int(i32 %0, i32 %1) {
%3 = tail call double (...) @rand()
%4 = load i64, i64* @RAND_MAX
%5 = sitofp i64 %4 to double
%6 = fadd double %5, 1.000000e+00
%7 = fdiv double %3, %6
%8 = sub i32 1, %0
%9 = add i32 %8, %1
%10 = sitofp i32 %9 to double
%11 = fmul double %7, %10
%12 = fptosi double %11 to i32
%13 = add nsw i32 %12, %0
ret i32 %13
}
/* Variables and functions */
int utf8_encode(unsigned int, char *, size_t);
int utf8_encode_nt(unsigned int unicode_value, char *dest, size_t size) {
  int len = utf8_encode(unicode_value, dest, size - 1);
  if (len > 0)
    dest[len] = 0;
  else
    dest[0] = 0;
  return len;
}


x86 assembly (clang, -O0):
<utf8_encode_nt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
sub    $0x1,%rdx
call   1030 <utf8_encode@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    1155 <utf8_encode_nt+0x45>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    115c <utf8_encode_nt+0x4c>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<utf8_encode_nt>:
push   %rbx
mov    %rsi,%rbx
add    $0xffffffffffffffff,%rdx
call   1030 <utf8_encode@plt>
xor    %ecx,%ecx
test   %eax,%eax
cmovns %eax,%ecx
movb   $0x0,(%rbx,%rcx,1)
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @utf8_encode_nt(i32 %0, i8* %1, i64 %2) {
%4 = add i64 %2, -1
%5 = tail call i32 @utf8_encode(i32 %0, i8* %1, i64 %4)
%6 = icmp sgt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
%8 = zext i32 %7 to i64
%9 = getelementptr i8, i8* %1, i64 %8
store i8 0, i8* %9
ret i32 %5
}
int pos(const char *s, const int c) {
  int i;
  for (i = 0; s[i] != '\0'; i++) {
    if (s[i] == c) {
      return i;
    }
  }
  return -1;
}


x86 assembly (clang, -O0):
<pos>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     115a <pos+0x5a>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    -0x14(%rbp),%eax
jne    1147 <pos+0x47>
mov    -0x18(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1161 <pos+0x61>
jmp    114c <pos+0x4c>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <pos+0x12>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<pos>:
mov    (%rdi),%dl
mov    $0xffffffff,%eax
test   %dl,%dl
je     1124 <pos+0x24>
xor    %ecx,%ecx
nopl   (%rax)
movsbl %dl,%edx
cmp    %esi,%edx
je     1125 <pos+0x25>
movzbl 0x1(%rdi,%rcx,1),%edx
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <pos+0x10>
ret
mov    %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @pos(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 0
br i1 %4, label %17, label %5
5: ; preds = %2, %10
%6 = phi i64 [ %11, %10 ], [ 0, %2 ]
%7 = phi i8 [ %13, %10 ], [ %3, %2 ]
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, %1
br i1 %9, label %15, label %10
10: ; preds = %5
%11 = add nuw i64 %6, 1
%12 = getelementptr inbounds i8, i8* %0, i64 %11
%13 = load i8, i8* %12
%14 = icmp eq i8 %13, 0
br i1 %14, label %17, label %5
15: ; preds = %5
%16 = trunc i64 %6 to i32
br label %17
17: ; preds = %10, %15, %2
%18 = phi i32 [ -1, %2 ], [ %16, %15 ], [ -1, %10 ]
ret i32 %18
}
int f(int dx, int dy) {
  int a, b;
  if ((dx == 0) || (dy == 0)) {
    return 1;
  }
  a = f(dx - 1, dy);
  b = f(dx, dy - 1);
  return (a + b);
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1132 <f+0x22>
cmpl   $0x0,-0xc(%rbp)
jne    113e <f+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    1169 <f+0x59>
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
mov    -0xc(%rbp),%esi
call   1030 <f@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
sub    $0x1,%esi
call   1030 <f@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbp
push   %r14
push   %rbx
mov    $0x1,%ebx
test   %edi,%edi
je     1144 <f+0x34>
mov    %esi,%ebp
test   %esi,%esi
je     1144 <f+0x34>
mov    %edi,%r14d
add    $0xffffffff,%r14d
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14d,%edi
mov    %ebp,%esi
call   1030 <f@plt>
add    %eax,%ebx
add    $0xffffffff,%ebp
jne    1130 <f+0x20>
add    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %2
%11 = load i32, i32* %5
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %2
store i32 1, i32* %3
br label %26
14: ; preds = %10
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %5
%18 = call i32 @f(i32 %16, i32 %17)
store i32 %18, i32* %6
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = sub nsw i32 %20, 1
%22 = call i32 @f(i32 %19, i32 %21)
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = add nsw i32 %23, %24
store i32 %25, i32* %3
br label %26
26: ; preds = %14, %13
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1) {
%3 = icmp eq i32 %0, 0
%4 = icmp eq i32 %1, 0
%5 = or i1 %3, %4
br i1 %5, label %17, label %6
6: ; preds = %2
%7 = add nsw i32 %0, -1
br label %8
8: ; preds = %6, %8
%9 = phi i32 [ %1, %6 ], [ %12, %8 ]
%10 = phi i32 [ 0, %6 ], [ %13, %8 ]
%11 = tail call i32 @f(i32 %7, i32 %9)
%12 = add nsw i32 %9, -1
%13 = add nsw i32 %11, %10
%14 = icmp eq i32 %12, 0
br i1 %14, label %15, label %8
15: ; preds = %8
%16 = add i32 %13, 1
br label %17
17: ; preds = %15, %2
%18 = phi i32 [ 1, %2 ], [ %16, %15 ]
ret i32 %18
}
/* Variables and functions */
int /*<<< orphan*/ dsDeInit();
void kragReset() { dsDeInit(); }


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

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

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

LLVM IR (-O2):
define void @kragReset() {
%1 = tail call i32 (...) @dsDeInit()
ret void
}
/* Variables and functions */
double fmod(double, double);
int /*<<< orphan*/ getch();
int /*<<< orphan*/ printf(char *, double, double, double);
main() {
  double x = 5.0, y = 2.0;
  double result;
  result = fmod(x, y);
  printf("The remainder of(%lf/%lf) is %lf\n", x, y, result);
  getch();
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  0xec8(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xeb3(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
call   1040 <fmod@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <getch@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef0(%rip),%rdi
movsd  0xed0(%rip),%xmm0
movsd  0xed0(%rip),%xmm1
movsd  0xed0(%rip),%xmm2
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <getch@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"The remainder of(%lf/%lf) is %lf\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
store double 5.000000e+00, double* %1
store double 2.000000e+00, double* %2
%4 = load double, double* %1
%5 = load double, double* %2
%6 = call double @fmod(double %4, double %5)
store double %6, double* %3
%7 = load double, double* %1
%8 = load double, double* %2
%9 = load double, double* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double %7, double %8, double %9)
%11 = call i32 (...) @getch()
ret i32 0
}

LLVM IR (-O2):
@.str = [34 x i8] c"The remainder of(%lf/%lf) is %lf\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), double 5.000000e+00, double 2.000000e+00, double 1.000000e+00)
%2 = tail call i32 (...) @getch()
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
extern void do_404(char *item, int sock_fd) {
  FILE *sock_fp = fdopen(sock_fd, "w");
  fprintf(sock_fp,
          "HTTP/1.0 404 Not Found\r\n"
          "Content-type: text/plain\r\n"
          "\r\n"
          "The item you requested: %s\r\n"
          "is not found\r\n",
          item);
  fclose(sock_fp);
}


x86 assembly (clang, -O0):
<do_404>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    0xeb7(%rip),%rsi
call   1050 <fdopen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xea1(%rip),%rsi
call   1040 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_404>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%eax
mov    %rdi,%r14
lea    0xec0(%rip),%rsi
mov    %eax,%edi
call   1050 <fdopen@plt>
mov    %rax,%rbx
lea    0xeb1(%rip),%rsi
mov    %rax,%rdi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fclose@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"w\00"
@.str.1 = [95 x i8] c"HTTP/1.0 404 Not Found\0D\0AContent-type: text/plain\0D\0A\0D\0AThe item you requested: %s\0D\0Ais not found\0D\0A\00"
define void @do_404(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = call i32* @fdopen(i32 %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = load i8*, i8** %3
%10 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i32*, i32** %5
%12 = call i32 @fclose(i32* %11)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"w\00"
@.str.1 = [95 x i8] c"HTTP/1.0 404 Not Found\0D\0AContent-type: text/plain\0D\0A\0D\0AThe item you requested: %s\0D\0Ais not found\0D\0A\00"
define void @do_404(i8* %0, i32 %1) {
%3 = tail call i32* @fdopen(i32 %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @fprintf(i32* %3, i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 @fclose(i32* %3)
ret void
}
int test_imm_D2int8_reg(signed char val) {
  return ((val) & (0xD2 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_D2int8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%edx
and    $0xd2,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_D2int8_reg(i8 signext %0) {
%2 = and i8 %0, -46
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
int IsDigit(char);
void GetNextDigit(int *dest, char *src) {
  if (IsDigit(src[0]) == 1) {
    *dest *= 10;
    *dest += src[0] - '0';
  }
}


x86 assembly (clang, -O0):
<GetNextDigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <IsDigit@plt>
cmp    $0x1,%eax
jne    1150 <GetNextDigit+0x40>
mov    -0x8(%rbp),%rax
imul   $0xa,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x30,%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetNextDigit>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
movsbl (%rsi),%edi
call   1030 <IsDigit@plt>
cmp    $0x1,%eax
jne    113d <GetNextDigit+0x2d>
mov    (%r14),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %eax,(%r14)
movsbl (%rbx),%ecx
add    %ecx,%eax
add    $0xffffffd0,%eax
mov    %eax,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @GetNextDigit(i32* nocapture %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = tail call i32 @IsDigit(i8 signext %3)
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %13
6: ; preds = %2
%7 = load i32, i32* %0
%8 = mul nsw i32 %7, 10
store i32 %8, i32* %0
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = add i32 %8, -48
%12 = add i32 %11, %10
store i32 %12, i32* %0
br label %13
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ scanf(char *, int *);
int input() {
  int x;
  scanf("%d", &x);
  return x;
}


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

x86 assembly (clang, -O2):
<input>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1030 <scanf@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @input() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ _qsort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void quicksort(int *arr, int len) {
  srand(time(NULL));
  _qsort(arr, 0, len - 1);
}


x86 assembly (clang, -O0):
<quicksort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1050 <_qsort@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
add    $0xffffffff,%ebx
mov    %r14,%rdi
xor    %esi,%esi
mov    %ebx,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <_qsort@plt>

LLVM IR (-O0):
define void @quicksort(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = call i32 @time(i32* null)
%6 = call i32 @srand(i32 %5)
%7 = load i32*, i32** %3
%8 = load i32, i32* %4
%9 = sub nsw i32 %8, 1
%10 = call i32 @_qsort(i32* %7, i32 0, i32 %9)
ret void
}

LLVM IR (-O2):
define void @quicksort(i32* %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = add nsw i32 %1, -1
%6 = tail call i32 @_qsort(i32* %0, i32 0, i32 %5)
ret void
}
int ld_ne_rm2(long double a1, long double *a2) { return !(((a1) != (*a2))); }


x86 assembly (clang, -O0):
<ld_ne_rm2>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
mov    %rdi,-0x18(%rbp)
fldt   -0x10(%rbp)
mov    -0x18(%rbp),%rax
fldt   (%rax)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
setp   %cl
setne  %al
or     %cl,%al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ld_ne_rm2>:
fldt   0x8(%rsp)
fldt   (%rdi)
fucomip %st(1),%st
fstp   %st(0)
setnp  %al
sete   %cl
and    %al,%cl
movzbl %cl,%eax
ret

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

LLVM IR (-O2):
define i32 @ld_ne_rm2(x86_fp80 %0, x86_fp80* nocapture %1) {
%3 = load x86_fp80, x86_fp80* %1
%4 = fcmp oeq x86_fp80 %3, %0
%5 = zext i1 %4 to i32
ret i32 %5
}
void view_writeAFileFromStack(void) {}


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

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

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

LLVM IR (-O2):
define void @view_writeAFileFromStack() {
ret void
}
void uart_1_putc(unsigned char ch) {
  while (1) {
    if (((*(volatile unsigned int *)(0x7F005410)) & 6) == 6)
      break;
  }
  (*(volatile unsigned int *)(0x7F005420)) = ch;
  return;
}


x86 assembly (clang, -O0):
<uart_1_putc>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x7f005410,%eax
mov    (%rax),%eax
and    $0x6,%eax
cmp    $0x6,%eax
jne    1122 <uart_1_putc+0x22>
jmp    1127 <uart_1_putc+0x27>
jmp    110a <uart_1_putc+0xa>
movzbl -0x1(%rbp),%ecx
mov    $0x7f005420,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uart_1_putc>:
mov    0x7f005410,%eax
not    %eax
test   $0x6,%al
jne    1100 <uart_1_putc>
movzbl %dil,%eax
mov    %eax,0x7f005420
ret

LLVM IR (-O0):
define void @uart_1_putc(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
br label %3
3: ; preds = %1, %8
%4 = load volatile i32, i32* inttoptr (i64 2130727952 to i32*)
%5 = and i32 %4, 6
%6 = icmp eq i32 %5, 6
br i1 %6, label %7, label %8
7: ; preds = %3
br label %9
8: ; preds = %3
br label %3
9: ; preds = %7
%10 = load i8, i8* %2
%11 = zext i8 %10 to i32
store volatile i32 %11, i32* inttoptr (i64 2130727968 to i32*)
ret void
}

LLVM IR (-O2):
define void @uart_1_putc(i8 zeroext %0) {
br label %2
2: ; preds = %2, %1
%3 = load volatile i32, i32* inttoptr (i64 2130727952 to i32*)
%4 = and i32 %3, 6
%5 = icmp eq i32 %4, 6
br i1 %5, label %6, label %2
6: ; preds = %2
%7 = zext i8 %0 to i32
store volatile i32 %7, i32* inttoptr (i64 2130727968 to i32*)
ret void
}
/* Variables and functions */
scalar_t__ __VERIFIER_nondet_int();
int /*<<< orphan*/ gl_insert(scalar_t__);
void gl_read() {
  do {
    gl_insert(__VERIFIER_nondet_int());
  } while (__VERIFIER_nondet_int());
}


x86 assembly (clang, -O0):
<gl_read>:
push   %rbp
mov    %rsp,%rbp
jmp    1129 <gl_read+0x9>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
mov    %rax,%rdi
call   1030 <gl_insert@plt>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
jne    1129 <gl_read+0x9>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gl_read>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
mov    %rax,%rdi
call   1030 <gl_insert@plt>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
jne    1130 <gl_read+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @gl_read() {
br label %1
1: ; preds = %4, %0
%2 = call i64 (...) @__VERIFIER_nondet_int()
%3 = call i32 @gl_insert(i64 %2)
br label %4
4: ; preds = %1
%5 = call i64 (...) @__VERIFIER_nondet_int()
%6 = icmp ne i64 %5, 0
br i1 %6, label %1, label %7
7: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @gl_read() {
br label %1
1: ; preds = %1, %0
%2 = tail call i64 (...) @__VERIFIER_nondet_int()
%3 = tail call i32 @gl_insert(i64 %2)
%4 = tail call i64 (...) @__VERIFIER_nondet_int()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %1
6: ; preds = %1
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;

/* Variables and functions */
int setreuid(int /*<<< orphan*/, int /*<<< orphan*/);
__attribute__((__weak__, __always___)) int softboundcets_setreuid(uid_t ruid,
                                                                  uid_t euid) {
  return setreuid(ruid, euid);
}


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

x86 assembly (clang, -O2):
<softboundcets_setreuid>:
jmp    1030 <setreuid@plt>

LLVM IR (-O0):
define weak i32 @softboundcets_setreuid(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 = call i32 @setreuid(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define weak i32 @softboundcets_setreuid(i32 %0, i32 %1) {
%3 = tail call i32 @setreuid(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main() {
  int x = 10;
  if (1 < x < 5) {
    printf("Really?\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    $0x1,%eax
cmp    -0x8(%rbp),%eax
setl   %al
and    $0x1,%al
movzbl %al,%eax
cmp    $0x5,%eax
jge    114b <main+0x3b>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [9 x i8] c"Really?\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 1, %3
%5 = zext i1 %4 to i32
%6 = icmp slt i32 %5, 5
br i1 %6, label %7, label %9
7: ; preds = %0
%8 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %7, %0
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@str = [8 x i8] c"Really?\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
ret i32 0
}