xunge/DecIR huggingface dataset:
STO_BTSN(rr, len, reg, nn, bb) int *rr, len, reg, nn, bb;
{ MMS_BTSN(rr, reg, nn, nn, bb); }


x86 assembly (clang, -O0):
<STO_BTSN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    $0x0,%al
call   1030 <MMS_BTSN@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STO_BTSN>:
mov    %edx,%esi
mov    %ecx,%edx
xor    %eax,%eax
jmp    1030 <MMS_BTSN@plt>

LLVM IR (-O0):
define i32 @STO_BTSN(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load i32*, i32** %7
%13 = load i32, i32* %9
%14 = load i32, i32* %10
%15 = load i32, i32* %10
%16 = load i32, i32* %11
%17 = call i32 (i32*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @MMS_BTSN to i32 (i32*, i32, i32, i32, i32, ...)*)(i32* %12, i32 %13, i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %6
ret i32 %18
}

LLVM IR (-O2):
define i32 @STO_BTSN(i32* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 (i32*, i32, i32, i32, i32, ...) bitcast (i32 (...)* @MMS_BTSN to i32 (i32*, i32, i32, i32, i32, ...)*)(i32* %0, i32 %2, i32 %3, i32 %3, i32 %4)
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char **argv) {
  int x;
  int total;
  for (x = 1; x <= 1000; x++) {
    total += x;
  }
  printf("%d\n", total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jg     1151 <main+0x41>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <main+0x1d>
mov    -0x18(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 undef)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ stdin;
int enterChoice(void) {
  int menuChoice;
  printf("Enter your choice\n"
         "1 - store a formatted text file of accounts called\n"
         "    \"accounts.txt\" for printing\n"
         "2 - update an account\n"
         "3 - add a new account\n"
         "4 - delete an account\n"
         "5 - end program\n? ");
  scanf("%d", &menuChoice);
  fflush(stdin);
  return menuChoice;
}


x86 assembly (clang, -O0):
<enterChoice>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
lea    0xf6f(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e8d(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enterChoice>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
lea    0xf76(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e93(%rip),%rax
mov    (%rax),%edi
call   1040 <fflush@plt>
mov    0x4(%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [186 x i8] c"Enter your choice\0A1 - store a formatted text file of accounts called\0A \22accounts.txt\22 for printing\0A2 - update an account\0A3 - add a new account\0A4 - delete an account\0A5 - end program\0A? \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
define i32 @enterChoice() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([186 x i8], [186 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* @stdin
%5 = call i32 @fflush(i32 %4)
%6 = load i32, i32* %1
ret i32 %6
}

LLVM IR (-O2):
@.str = [186 x i8] c"Enter your choice\0A1 - store a formatted text file of accounts called\0A \22accounts.txt\22 for printing\0A2 - update an account\0A3 - add a new account\0A4 - delete an account\0A5 - end program\0A? \00"
@.str.1 = [3 x i8] c"%d\00"
@stdin = global i32 0
define i32 @enterChoice() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([186 x i8], [186 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* @stdin
%6 = call i32 @fflush(i32 %5)
%7 = load i32, i32* %1
ret i32 %7
}
int xor (int a, int b) { return (a ^ b) != 0; }


x86 assembly (clang, -O0):
<xor>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
cmp    $0x0,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<xor>:
xor    %eax,%eax
cmp    %esi,%edi
setne  %al
ret

LLVM IR (-O0):
define i32 @xor(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 = xor i32 %5, %6
%8 = icmp ne i32 %7, 0
%9 = zext i1 %8 to i32
ret i32 %9
}

LLVM IR (-O2):
define i32 @xor(i32 %0, i32 %1) {
%3 = icmp ne i32 %0, %1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ lprcat(char *);
void iopts() { lprcat(", or (i) ignore it? "); }


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

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

LLVM IR (-O0):
@.str = [21 x i8] c", or (i) ignore it? \00"
define void @iopts() {
%1 = call i32 @lprcat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c", or (i) ignore it? \00"
define void @iopts() {
%1 = tail call i32 @lprcat(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
ret void
}
void test___atomic_sub_fetch_1(short *mem) { __atomic_sub_fetch(mem, 1, 4); }


x86 assembly (clang, -O0):
<test___atomic_sub_fetch_1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
movw   $0x1,-0xa(%rbp)
movzwl -0xa(%rbp),%eax
mov    %ax,%cx
neg    %eax
lock xadd %ax,(%rdx)
sub    %cx,%ax
mov    %ax,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<test___atomic_sub_fetch_1>:
lock subw $0x1,(%rdi)
ret

LLVM IR (-O0):
define void @test___atomic_sub_fetch_1(i16* %0) {
%2 = alloca i16*
%3 = alloca i16
%4 = alloca i16
store i16* %0, i16** %2
%5 = load i16*, i16** %2
store i16 1, i16* %3
%6 = load i16, i16* %3
%7 = atomicrmw sub i16* %5, i16 %6 acq_rel
%8 = sub i16 %7, %6
store i16 %8, i16* %4
%9 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @test___atomic_sub_fetch_1(i16* nocapture %0) {
%2 = atomicrmw sub i16* %0, i16 1 acq_rel
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, int);
void init_buf(char buf[(1024 * 1024 * 8)], int num) {
  int i;
  char tmp_buf[2];
  sprintf(tmp_buf, "%d", num);
  for (i = 0; i < (1024 * 1024 * 8); i++)
    buf[i] = tmp_buf[0];
}


x86 assembly (clang, -O0):
<init_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x12(%rbp),%rdi
mov    -0xc(%rbp),%edx
lea    0xed3(%rip),%rsi
call   1030 <sprintf@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x800000,-0x10(%rbp)
jge    1162 <init_buf+0x52>
mov    -0x12(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1139 <init_buf+0x29>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_buf>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%edx
mov    %rdi,%rbx
lea    0xecf(%rip),%rsi
lea    0xe(%rsp),%rdi
call   1040 <sprintf@plt>
movzbl 0xe(%rsp),%esi
mov    $0x800000,%edx
mov    %rbx,%rdi
call   1030 <memset@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
define void @init_buf(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca [2 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%8 = load i32, i32* %4
%9 = call i32 @sprintf(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %8)
store i32 0, i32* %5
br label %10
10: ; preds = %20, %2
%11 = load i32, i32* %5
%12 = icmp slt i32 %11, 8388608
br i1 %12, label %13, label %23
13: ; preds = %10
%14 = getelementptr inbounds [2 x i8], [2 x i8]* %6, i64 0, i64 0
%15 = load i8, i8* %14
%16 = load i8*, i8** %3
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %16, i64 %18
store i8 %15, i8* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %10
23: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define void @init_buf(i8* nocapture writeonly %0, i32 %1) {
%3 = alloca [2 x i8]
%4 = getelementptr inbounds [2 x i8], [2 x i8]* %3, i64 0, i64 0
%5 = call i32 @sprintf(i8* %4, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
%6 = load i8, i8* %4
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ enable;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, unsigned char *, int, int /*<<< orphan*/);
void enable_sixaxis(int csk) {
  char buf[128];
  unsigned char enable[] = {0x53, 0xf4, 0x42, 0x03, 0x00, 0x00};
  send(csk, enable, sizeof(enable), 0);
  recv(csk, buf, sizeof(buf), 0);
}


x86 assembly (clang, -O0):
<enable_sixaxis>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %edi,-0x4(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x96(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x92(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x96(%rbp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    -0x4(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enable_sixaxis>:
push   %rbx
sub    $0x90,%rsp
mov    %edi,%ebx
movw   $0x0,0xc(%rsp)
movl   $0x342f453,0x8(%rsp)
03
lea    0x8(%rsp),%rsi
mov    $0x6,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
lea    0x10(%rsp),%rsi
mov    %ebx,%edi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.enable_sixaxis.enable = [6 x i8] c"S\F4B\03\00\00"
define void @enable_sixaxis(i32 %0) {
%2 = alloca i32
%3 = alloca [128 x i8]
%4 = alloca [6 x i8]
store i32 %0, i32* %2
%5 = bitcast [6 x i8]* %4 to i8*
%6 = load i32, i32* %2
%7 = getelementptr inbounds [6 x i8], [6 x i8]* %4, i64 0, i64 0
%8 = call i32 @send(i32 %6, i8* %7, i32 6, i32 0)
%9 = load i32, i32* %2
%10 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%11 = call i32 @recv(i32 %9, i8* %10, i32 128, i32 0)
ret void
}

LLVM IR (-O2):
@__const.enable_sixaxis.enable = [6 x i8] c"S\F4B\03\00\00"
define void @enable_sixaxis(i32 %0) {
%2 = alloca [128 x i8]
%3 = alloca [6 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = call i32 @send(i32 %0, i8* %5, i32 6, i32 0)
%7 = call i32 @recv(i32 %0, i8* %4, i32 128, i32 0)
ret void
}
int test_imm_9Aint64_lowword_reg(long long val) {
  return ((val) & (0x9A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_9Aint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 154
%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_9Aint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 154
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
void test_multiline(void) {}


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

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

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

LLVM IR (-O2):
define void @test_multiline() {
ret void
}
void *avpriv_atomic_ptr_cas(void *volatile *ptr, void *oldval, void *newval) {
  if (*ptr == oldval) {
    *ptr = newval;
    return oldval;
  }
  return *ptr;
}


x86 assembly (clang, -O0):
<avpriv_atomic_ptr_cas>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
cmp    -0x18(%rbp),%rax
jne    1139 <avpriv_atomic_ptr_cas+0x39>
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1144 <avpriv_atomic_ptr_cas+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<avpriv_atomic_ptr_cas>:
mov    (%rdi),%rcx
cmp    %rsi,%rcx
je     110c <avpriv_atomic_ptr_cas+0xc>
mov    (%rdi),%rax
ret
mov    %rsi,%rax
mov    %rdx,(%rdi)
ret

LLVM IR (-O0):
define i8* @avpriv_atomic_ptr_cas(i8** %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
store i8** %0, i8*** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8**, i8*** %5
%9 = load volatile i8*, i8** %8
%10 = load i8*, i8** %6
%11 = icmp eq i8* %9, %10
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = load i8*, i8** %7
%14 = load i8**, i8*** %5
store volatile i8* %13, i8** %14
%15 = load i8*, i8** %6
store i8* %15, i8** %4
br label %19
16: ; preds = %3
%17 = load i8**, i8*** %5
%18 = load volatile i8*, i8** %17
store i8* %18, i8** %4
br label %19
19: ; preds = %16, %12
%20 = load i8*, i8** %4
ret i8* %20
}

LLVM IR (-O2):
define i8* @avpriv_atomic_ptr_cas(i8** %0, i8* readnone %1, i8* %2) {
%4 = load volatile i8*, i8** %0
%5 = icmp eq i8* %4, %1
br i1 %5, label %6, label %7
6: ; preds = %3
store volatile i8* %2, i8** %0
br label %9
7: ; preds = %3
%8 = load volatile i8*, i8** %0
br label %9
9: ; preds = %7, %6
%10 = phi i8* [ %1, %6 ], [ %8, %7 ]
ret i8* %10
}
/* Variables and functions */
double rand_srp();
void create_srp(double *X, int M, int Mp) {
  int j;
  for (j = 0; j < M * Mp; j++)
    X[j] = rand_srp();
}


x86 assembly (clang, -O0):
<create_srp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0xc(%rbp),%ecx
imul   -0x10(%rbp),%ecx
cmp    %ecx,%eax
jge    115d <create_srp+0x4d>
mov    $0x0,%al
call   1030 <rand_srp@plt>
mov    -0x8(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1129 <create_srp+0x19>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_srp>:
push   %r15
push   %r14
push   %rbx
imul   %edx,%esi
test   %esi,%esi
jle    1146 <create_srp+0x36>
mov    %rdi,%r14
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
xor    %eax,%eax
call   1030 <rand_srp@plt>
movsd  %xmm0,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <create_srp+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @create_srp(double* nocapture writeonly %0, i32 %1, i32 %2) {
%4 = mul i32 %2, %1
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = zext i32 %4 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %12, %8 ]
%10 = tail call double (...) @rand_srp()
%11 = getelementptr inbounds double, double* %0, i64 %9
store double %10, double* %11
%12 = add nuw nsw i64 %9, 1
%13 = icmp eq i64 %12, %7
br i1 %13, label %14, label %8
14: ; preds = %8, %3
ret void
}
/* Type definitions */
struct libavl_allocator {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(int);
void *malloc(size_t);
void *pbst_malloc(struct libavl_allocator *allocator, size_t size) {
  assert(allocator != NULL && size > 0);
  return malloc(size);
}


x86 assembly (clang, -O0):
<pbst_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     114b <pbst_malloc+0x2b>
cmpq   $0x0,-0x10(%rbp)
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1040 <malloc@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pbst_malloc>:
push   %rbx
mov    %rsi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <malloc@plt>

LLVM IR (-O0):
%struct.libavl_allocator = type { i32 }
define i8* @pbst_malloc(%struct.libavl_allocator* %0, i64 %1) {
%3 = alloca %struct.libavl_allocator*
%4 = alloca i64
store %struct.libavl_allocator* %0, %struct.libavl_allocator** %3
store i64 %1, i64* %4
%5 = load %struct.libavl_allocator*, %struct.libavl_allocator** %3
%6 = icmp ne %struct.libavl_allocator* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i64, i64* %4
%9 = icmp ugt i64 %8, 0
br label %10
10: ; preds = %7, %2
%11 = phi i1 [ false, %2 ], [ %9, %7 ]
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = load i64, i64* %4
%15 = call i8* @malloc(i64 %14)
ret i8* %15
}

LLVM IR (-O2):
%struct.libavl_allocator = type { i32 }
define noalias i8* @pbst_malloc(%struct.libavl_allocator* readnone %0, i64 %1) {
%3 = icmp ne %struct.libavl_allocator* %0, null
%4 = icmp ne i64 %1, 0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = tail call i8* @malloc(i64 %1)
ret i8* %8
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void printPieces(void) {
  printf(
      "The pieces are numbered as follows:\n"
      "  0  0  0  0  0  0  0  0  1  1  1  1  1  1  1  1  [0=black  1=white]\n"
      "  0  0  0  0  1  1  1  1  0  0  0  0  1  1  1  1  [0=short  1=tall ]\n"
      "  0  0  1  1  0  0  1  1  0  0  1  1  0  0  1  1  [0=square 1=round]\n"
      "  0  1  0  1  0  1  0  1  0  1  0  1  0  1  0  1  [0=hollow 1=solid]\n"
      "-------------------------------------------------\n"
      "  0  1  2  3  4  5  6  7  8  9 10 11 12 13 14 15\n");
}


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

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

LLVM IR (-O0):
@.str = [412 x i8] c"The pieces are numbered as follows:\0A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [0=black 1=white]\0A 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 [0=short 1=tall ]\0A 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 [0=square 1=round]\0A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 [0=hollow 1=solid]\0A-------------------------------------------------\0A 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\0A\00"
define void @printPieces() {
%1 = call i32 @printf(i8* getelementptr inbounds ([412 x i8], [412 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [411 x i8] c"The pieces are numbered as follows:\0A 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 [0=black 1=white]\0A 0 0 0 0 1 1 1 1 0 0 0 0 1 1 1 1 [0=short 1=tall ]\0A 0 0 1 1 0 0 1 1 0 0 1 1 0 0 1 1 [0=square 1=round]\0A 0 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1 [0=hollow 1=solid]\0A-------------------------------------------------\0A 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15\00"
define void @printPieces() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([411 x i8], [411 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int fds_recv(int *, int);
int fds_recv_one(void) {
  int fd, ret;
  ret = fds_recv(&fd, 1);
  if (ret)
    fd = -1;
  return fd;
}


x86 assembly (clang, -O0):
<fds_recv_one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x4(%rbp),%rdi
mov    $0x1,%esi
call   1030 <fds_recv@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     113a <fds_recv_one+0x2a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fds_recv_one>:
push   %rax
lea    0x4(%rsp),%rdi
mov    $0x1,%esi
call   1030 <fds_recv@plt>
neg    %eax
sbb    %eax,%eax
or     0x4(%rsp),%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @fds_recv_one() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @fds_recv(i32* %1, i32 1)
%4 = icmp eq i32 %3, 0
%5 = load i32, i32* %1
%6 = select i1 %4, i32 %5, i32 -1
ret i32 %6
}
float add(float first, float second) { return first + second; }


x86 assembly (clang, -O0):
<add>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<add>:
addss  %xmm1,%xmm0
ret

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

LLVM IR (-O2):
define float @add(float %0, float %1) {
%3 = fadd float %0, %1
ret float %3
}
void c_pomp_end_(struct ompregdescr *r) { (void)0; }


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

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

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

LLVM IR (-O2):
%struct.ompregdescr = type opaque
define void @c_pomp_end_(%struct.ompregdescr* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void usage(const char *name) {
  fprintf(stderr, "Usage: %s [COMMAND] [OPTIONS] INPUT_FILE [OUTPUT_FILE]\n",
          name);
  fprintf(stderr, "Try `%s --help' for more information.\n", name);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xed0(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2ea4(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeef(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<usage>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x2ec2(%rip),%r14
mov    (%r14),%edi
lea    0xed8(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    (%r14),%edi
lea    0xefe(%rip),%rsi
mov    %rbx,%rdx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: %s [COMMAND] [OPTIONS] INPUT_FILE [OUTPUT_FILE]\0A\00"
@.str.1 = [39 x i8] c"Try `%s --help' for more information.\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = load i8*, i8** %2
%8 = call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %7)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [56 x i8] c"Usage: %s [COMMAND] [OPTIONS] INPUT_FILE [OUTPUT_FILE]\0A\00"
@.str.1 = [39 x i8] c"Try `%s --help' for more information.\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
long get_stack_direction(void) {
  auto char dummy;
  static char *dummyaddr = (char *)0;
  if (dummyaddr != (char *)0) {
    return (&dummy) - dummyaddr;
  } else {
    dummyaddr = &dummy;
    {
      long result = get_stack_direction();
      dummyaddr = (char *)0;
      return result;
    }
  }
}


x86 assembly (clang, -O0):
<get_stack_direction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
cmpq   $0x0,0x2f10(%rip)
je     113d <get_stack_direction+0x2d>
mov    0x2f03(%rip),%rcx
lea    -0x9(%rbp),%rax
sub    %rcx,%rax
mov    %rax,-0x8(%rbp)
jmp    1164 <get_stack_direction+0x54>
lea    -0x9(%rbp),%rax
mov    %rax,0x2ee8(%rip)
call   1030 <get_stack_direction@plt>
mov    %rax,-0x18(%rbp)
movq   $0x0,0x2ed4(%rip)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_stack_direction>:
push   %rax
mov    0x2f18(%rip),%rcx
lea    0x7(%rsp),%rax
test   %rcx,%rcx
je     1127 <get_stack_direction+0x17>
sub    %rcx,%rax
pop    %rcx
ret
mov    %rax,0x2f02(%rip)
call   1030 <get_stack_direction@plt>
movq   $0x0,0x2ef2(%rip)
pop    %rcx
ret

LLVM IR (-O0):
@get_stack_direction.dummyaddr = internal global i8* null
define i64 @get_stack_direction() {
%1 = alloca i64
%2 = alloca i8
%3 = alloca i64
%4 = load i8*, i8** @get_stack_direction.dummyaddr
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %11
6: ; preds = %0
%7 = load i8*, i8** @get_stack_direction.dummyaddr
%8 = ptrtoint i8* %2 to i64
%9 = ptrtoint i8* %7 to i64
%10 = sub i64 %8, %9
store i64 %10, i64* %1
br label %14
11: ; preds = %0
store i8* %2, i8** @get_stack_direction.dummyaddr
%12 = call i64 @get_stack_direction()
store i64 %12, i64* %3
store i8* null, i8** @get_stack_direction.dummyaddr
%13 = load i64, i64* %3
store i64 %13, i64* %1
br label %14
14: ; preds = %11, %6
%15 = load i64, i64* %1
ret i64 %15
}

LLVM IR (-O2):
@get_stack_direction.dummyaddr = internal unnamed_addr global i8* null
define i64 @get_stack_direction() {
%1 = alloca i8
%2 = load i8*, i8** @get_stack_direction.dummyaddr
%3 = icmp eq i8* %2, null
br i1 %3, label %8, label %4
4: ; preds = %0
%5 = ptrtoint i8* %1 to i64
%6 = ptrtoint i8* %2 to i64
%7 = sub i64 %5, %6
br label %10
8: ; preds = %0
store i8* %1, i8** @get_stack_direction.dummyaddr
%9 = call i64 @get_stack_direction()
store i8* null, i8** @get_stack_direction.dummyaddr
br label %10
10: ; preds = %8, %4
%11 = phi i64 [ %7, %4 ], [ %9, %8 ]
ret i64 %11
}
/* Type definitions */
struct list {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct list *);
int /*<<< orphan*/ list_delete_front(struct list *);
int /*<<< orphan*/ list_is_empty(struct list *);
void list_destroy(struct list *list) {
  while (!list_is_empty(list)) {
    list_delete_front(list);
  }
  free(list);
}


x86 assembly (clang, -O0):
<list_destroy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <list_is_empty@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    115a <list_destroy+0x2a>
jmp    1168 <list_destroy+0x38>
mov    -0x8(%rbp),%rdi
call   1030 <list_delete_front@plt>
jmp    113c <list_destroy+0xc>
mov    -0x8(%rbp),%rdi
call   1040 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<list_destroy>:
push   %rbx
mov    %rdi,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
call   1050 <list_is_empty@plt>
test   %eax,%eax
jne    1156 <list_destroy+0x26>
mov    %rbx,%rdi
call   1030 <list_delete_front@plt>
mov    %rbx,%rdi
jmp    1140 <list_destroy+0x10>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <free@plt>

LLVM IR (-O0):
%struct.list = type { i32 }
define void @list_destroy(%struct.list* %0) {
%2 = alloca %struct.list*
store %struct.list* %0, %struct.list** %2
br label %3
3: ; preds = %8, %1
%4 = load %struct.list*, %struct.list** %2
%5 = call i32 @list_is_empty(%struct.list* %4)
%6 = icmp ne i32 %5, 0
%7 = xor i1 %6, true
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load %struct.list*, %struct.list** %2
%10 = call i32 @list_delete_front(%struct.list* %9)
br label %3
11: ; preds = %3
%12 = load %struct.list*, %struct.list** %2
%13 = call i32 @free(%struct.list* %12)
ret void
}

LLVM IR (-O2):
%struct.list = type { i32 }
define void @list_destroy(%struct.list* %0) {
%2 = tail call i32 @list_is_empty(%struct.list* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1, %4
%5 = tail call i32 @list_delete_front(%struct.list* %0)
%6 = tail call i32 @list_is_empty(%struct.list* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %4, label %8
8: ; preds = %4, %1
%9 = tail call i32 @free(%struct.list* %0)
ret void
}
unsigned int f(unsigned int X, unsigned int Y, unsigned int Z) {
  return ((X & Y) | (~X & Z));
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
and    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
xor    $0xffffffff,%ecx
and    -0xc(%rbp),%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
mov    %esi,%eax
xor    %edx,%eax
and    %edi,%eax
xor    %edx,%eax
ret

LLVM IR (-O0):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = and i32 %7, %8
%10 = load i32, i32* %4
%11 = xor i32 %10, -1
%12 = load i32, i32* %6
%13 = and i32 %11, %12
%14 = or i32 %9, %13
ret i32 %14
}

LLVM IR (-O2):
define i32 @f(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, %0
%5 = xor i32 %0, -1
%6 = and i32 %5, %2
%7 = or i32 %6, %4
ret i32 %7
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int kvprintf(char const *, int /*<<< orphan*/ *, void *, int,
             int /*<<< orphan*/);
int vsprintf(char *buf, const char *cfmt, va_list ap) {
  int retval;
  retval = kvprintf(cfmt, NULL, (void *)buf, 10, ap);
  buf[retval] = '\0';
  return (retval);
}


x86 assembly (clang, -O0):
<vsprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x14(%rbp),%r8d
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%ecx
call   1030 <kvprintf@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vsprintf>:
push   %rbx
mov    %edx,%r8d
mov    %rdi,%rbx
mov    %rsi,%rdi
xor    %esi,%esi
mov    %rbx,%rdx
mov    $0xa,%ecx
call   1030 <kvprintf@plt>
cltq
movb   $0x0,(%rbx,%rax,1)
pop    %rbx
ret

LLVM IR (-O0):
define i32 @vsprintf(i8* %0, i8* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = load i8*, i8** %4
%10 = load i32, i32* %6
%11 = call i32 @kvprintf(i8* %8, i32* null, i8* %9, i32 10, i32 %10)
store i32 %11, i32* %7
%12 = load i8*, i8** %4
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
store i8 0, i8* %15
%16 = load i32, i32* %7
ret i32 %16
}

LLVM IR (-O2):
define i32 @vsprintf(i8* %0, i8* %1, i32 %2) {
%4 = tail call i32 @kvprintf(i8* %1, i32* null, i8* %0, i32 10, i32 %2)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %0, i64 %5
store i8 0, i8* %6
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ SIGUSR2;
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ kill(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void sig_usr1(int sig) {
  printf("SIGUSR1 started.\n");
  kill(getpid(), SIGUSR2);
  printf("SIGUSR1 ended.\n");
}


x86 assembly (clang, -O0):
<sig_usr1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
mov    0x2e89(%rip),%rax
mov    (%rax),%esi
call   1050 <kill@plt>
lea    0xead(%rip),%rdi
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_usr1>:
push   %rax
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1040 <getpid@plt>
mov    0x2e95(%rip),%rcx
mov    (%rcx),%esi
mov    %eax,%edi
call   1050 <kill@plt>
lea    0xeb6(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [18 x i8] c"SIGUSR1 started.\0A\00"
@SIGUSR2 = global i32 0
@.str.1 = [16 x i8] c"SIGUSR1 ended.\0A\00"
define void @sig_usr1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (...) @getpid()
%5 = load i32, i32* @SIGUSR2
%6 = call i32 @kill(i32 %4, i32 %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@SIGUSR2 = global i32 0
@str = [17 x i8] c"SIGUSR1 started.\00"
@str.2 = [15 x i8] c"SIGUSR1 ended.\00"
define void @sig_usr1(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 (...) @getpid()
%4 = load i32, i32* @SIGUSR2
%5 = tail call i32 @kill(i32 %3, i32 %4)
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.2, i64 0, i64 0))
ret void
}
int okn_tsm_rot_y_by(struct okn_tsm *t, struct okn_vec3f *v, float y) {
  return 1;
}


x86 assembly (clang, -O0):
<okn_tsm_rot_y_by>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movss  %xmm0,-0x14(%rbp)
mov    $0x1,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.okn_tsm = type opaque
%struct.okn_vec3f = type opaque
define i32 @okn_tsm_rot_y_by(%struct.okn_tsm* %0, %struct.okn_vec3f* %1, float %2) {
%4 = alloca %struct.okn_tsm*
%5 = alloca %struct.okn_vec3f*
%6 = alloca float
store %struct.okn_tsm* %0, %struct.okn_tsm** %4
store %struct.okn_vec3f* %1, %struct.okn_vec3f** %5
store float %2, float* %6
ret i32 1
}

LLVM IR (-O2):
%struct.okn_tsm = type opaque
%struct.okn_vec3f = type opaque
define i32 @okn_tsm_rot_y_by(%struct.okn_tsm* nocapture readnone %0, %struct.okn_vec3f* nocapture readnone %1, float %2) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ reversestr(char *);
int main() {
  char str[] = "Fatima";
  reversestr(str);
  printf("\nThe reverse is %s", str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xecb(%rip),%eax
mov    %eax,-0xb(%rbp)
mov    0xec5(%rip),%ax
mov    %ax,-0x7(%rbp)
mov    0xebd(%rip),%al
mov    %al,-0x5(%rbp)
lea    -0xb(%rbp),%rdi
call   1040 <reversestr@plt>
lea    -0xb(%rbp),%rsi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x616d69,0xb(%rsp)
movl   $0x69746146,0x8(%rsp)
69
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <reversestr@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@__const.main.str = [7 x i8] c"Fatima\00"
@.str = [19 x i8] c"\0AThe reverse is %s\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
%3 = call i32 @reversestr(i8* %2)
%4 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %2)
ret i32 0
}
void __DELETE_org_xmlvm_runtime_XMLVMOutputStream(void *me, void *client_data) {
}


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

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

LLVM IR (-O0):
define void @__DELETE_org_xmlvm_runtime_XMLVMOutputStream(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @__DELETE_org_xmlvm_runtime_XMLVMOutputStream(i8* nocapture %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int cgetc(int /*<<< orphan*/);
int /*<<< orphan*/ cin;
getchar() {
  extern cin;
  return (cgetc(cin));
}


x86 assembly (clang, -O0):
<getchar>:
push   %rbp
mov    %rsp,%rbp
mov    0x2edd(%rip),%rax
mov    (%rax),%edi
call   1030 <cgetc@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<getchar>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%edi
jmp    1030 <cgetc@plt>

LLVM IR (-O0):
@cin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @cin
%2 = call i32 @cgetc(i32 %1)
ret i32 %2
}

LLVM IR (-O2):
@cin = global i32 0
define i32 @getchar() {
%1 = load i32, i32* @cin
%2 = tail call i32 @cgetc(i32 %1)
ret i32 %2
}
void foo(void) {
  int a = 5;
  int b;
}


x86 assembly (clang, -O0):
<foo>:
push   %rbp
mov    %rsp,%rbp
movl   $0x5,-0x4(%rbp)
pop    %rbp
ret

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

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

LLVM IR (-O2):
define void @foo() {
ret void
}
/* Type definitions */
struct RNAparconv_args_info {
  int dummy;
};

/* Variables and functions */
int EXIT_SUCCESS;
int RNAparconv_cmdline_parser_required(struct RNAparconv_args_info *args_info,
                                       const char *prog_name) {
  (void)(args_info);
  (void)(prog_name);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<RNAparconv_cmdline_parser_required>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2ecd(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<RNAparconv_cmdline_parser_required>:
mov    0x2ed9(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.RNAparconv_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @RNAparconv_cmdline_parser_required(%struct.RNAparconv_args_info* %0, i8* %1) {
%3 = alloca %struct.RNAparconv_args_info*
%4 = alloca i8*
store %struct.RNAparconv_args_info* %0, %struct.RNAparconv_args_info** %3
store i8* %1, i8** %4
%5 = load %struct.RNAparconv_args_info*, %struct.RNAparconv_args_info** %3
%6 = load i8*, i8** %4
%7 = load i32, i32* @EXIT_SUCCESS
ret i32 %7
}

LLVM IR (-O2):
%struct.RNAparconv_args_info = type { i32 }
@EXIT_SUCCESS = global i32 0
define i32 @RNAparconv_cmdline_parser_required(%struct.RNAparconv_args_info* nocapture readnone %0, i8* nocapture readnone %1) {
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ write(int, int /*<<< orphan*/, int);
int my_putstr(void *str) {
  while (*(char *)str)
    write(1, str++, 1);
  return (0);
}


x86 assembly (clang, -O0):
<my_putstr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     114b <my_putstr+0x3b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    %eax,%esi
mov    $0x1,%edx
mov    %edx,%edi
call   1030 <write@plt>
jmp    111c <my_putstr+0xc>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_putstr>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     113e <my_putstr+0x2e>
mov    %rdi,%rbx
lea    0x1(%rdi),%r14
mov    $0x1,%edi
mov    %ebx,%esi
mov    $0x1,%edx
call   1030 <write@plt>
add    $0x1,%ebx
cmpb   $0x0,(%r14)
lea    0x1(%r14),%r14
jne    1120 <my_putstr+0x10>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @my_putstr(i8* %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %12, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %6, %4 ], [ %0, %1 ]
%6 = getelementptr inbounds i8, i8* %5, i64 1
%7 = ptrtoint i8* %5 to i64
%8 = trunc i64 %7 to i32
%9 = tail call i32 @write(i32 1, i32 %8, i32 1)
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4, %1
ret i32 0
}
int fst_global_init(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @fst_global_init() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int text(char *buf, int sze, void *data) {
  FILE *fp = NULL;
  if (data != NULL)
    fp = (FILE *)data;
  else
    fp = stderr;
  fwrite(buf, sze, 1, fp);
  return 0;
}


x86 assembly (clang, -O0):
<text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1143 <text+0x33>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
jmp    1151 <text+0x41>
mov    0x2e96(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<text>:
push   %rax
mov    %rdx,%rcx
test   %rdx,%rdx
jne    1123 <text+0x13>
mov    0x2ec0(%rip),%rax
mov    (%rax),%rcx
mov    $0x1,%edx
call   1030 <fwrite@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32* null
define i32 @text(i8* %0, i32 %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
store i32* null, i32** %7
%8 = load i8*, i8** %6
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %6
%12 = bitcast i8* %11 to i32*
store i32* %12, i32** %7
br label %15
13: ; preds = %3
%14 = load i32*, i32** @stderr
store i32* %14, i32** %7
br label %15
15: ; preds = %13, %10
%16 = load i8*, i8** %4
%17 = load i32, i32* %5
%18 = load i32*, i32** %7
%19 = call i32 @fwrite(i8* %16, i32 %17, i32 1, i32* %18)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32* null
define i32 @text(i8* nocapture %0, i32 %1, i8* %2) {
%4 = icmp eq i8* %2, null
%5 = bitcast i8* %2 to i32*
%6 = load i32*, i32** @stderr
%7 = select i1 %4, i32* %6, i32* %5
%8 = tail call i32 @fwrite(i8* %0, i32 %1, i32 1, i32* %7)
ret i32 0
}
int nand_support_vertical_interleave(void) { return 1 ? 1 : 0; }


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

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

LLVM IR (-O0):
define i32 @nand_support_vertical_interleave() {
ret i32 1
}

LLVM IR (-O2):
define i32 @nand_support_vertical_interleave() {
ret i32 1
}