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

/* Variables and functions */
int /*<<< orphan*/ leconvert_uint32_from(int /*<<< orphan*/);
int32_t leconvert_int32_from(int32_t little) {
  return leconvert_uint32_from(little);
}


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

x86 assembly (clang, -O2):
<leconvert_int32_from>:
jmp    1030 <leconvert_uint32_from@plt>

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

LLVM IR (-O2):
define i32 @leconvert_int32_from(i32 %0) {
%2 = tail call i32 @leconvert_uint32_from(i32 %0)
ret i32 %2
}
/* Variables and functions */
char *strrchr(char *, char);
char *program_name(char *command) {
  char *last_slash = strrchr(command, '/');
  if (!last_slash || !*(last_slash + 1))
    return command;
  return last_slash + 1;
}


x86 assembly (clang, -O0):
<program_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <strrchr@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1147 <program_name+0x37>
mov    -0x18(%rbp),%rax
cmpb   $0x0,0x1(%rax)
jne    1154 <program_name+0x44>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1160 <program_name+0x50>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<program_name>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <strrchr@plt>
test   %rax,%rax
je     1132 <program_name+0x22>
mov    %rax,%rcx
add    $0x1,%rcx
cmpb   $0x0,0x1(%rax)
cmovne %rcx,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @program_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strrchr(i8* %5, i8 signext 47)
store i8* %6, i8** %4
%7 = load i8*, i8** %4
%8 = icmp ne i8* %7, null
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8*, i8** %4
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9, %1
%15 = load i8*, i8** %3
store i8* %15, i8** %2
br label %19
16: ; preds = %9
%17 = load i8*, i8** %4
%18 = getelementptr inbounds i8, i8* %17, i64 1
store i8* %18, i8** %2
br label %19
19: ; preds = %16, %14
%20 = load i8*, i8** %2
ret i8* %20
}

LLVM IR (-O2):
define i8* @program_name(i8* %0) {
%2 = tail call i8* @strrchr(i8* dereferenceable(1) %0, i8 signext 47)
%3 = icmp eq i8* %2, null
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %2, i64 1
%6 = load i8, i8* %5
%7 = icmp eq i8 %6, 0
%8 = select i1 %7, i8* %0, i8* %5
br label %9
9: ; preds = %4, %1
%10 = phi i8* [ %0, %1 ], [ %8, %4 ]
ret i8* %10
}
/* Variables and functions */
bool is_little_endian(void) {
  bool ret = false;
  unsigned int test = 1;
  unsigned char *ptr = (unsigned char *)&test;
  if (*ptr == 1) {
    ret = true;
  }
  return ret;
}


x86 assembly (clang, -O0):
<is_little_endian>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x1,%eax
jne    1131 <is_little_endian+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @is_little_endian() {
ret i32 1
}
char *space(n)
int n;
{
  register char *cp;
  if ((cp = getcell(n)) == 0)
    err("out of string space");
  return (cp);
}


x86 assembly (clang, -O0):
<space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <getcell@plt>
cltq
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
jne    1153 <space+0x33>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <err@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<space>:
push   %rbx
xor    %eax,%eax
call   1040 <getcell@plt>
mov    %eax,%ebx
test   %eax,%eax
jne    113c <space+0x1c>
lea    0xecb(%rip),%rdi
xor    %eax,%eax
call   1030 <err@plt>
movslq %ebx,%rax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [20 x i8] c"out of string space\00"
define i8* @space(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = call i32 (i32, ...) bitcast (i32 (...)* @getcell to i32 (i32, ...)*)(i32 %4)
%6 = sext i32 %5 to i64
%7 = inttoptr i64 %6 to i8*
store i8* %7, i8** %3
%8 = icmp eq i8* %7, null
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %1
%12 = load i8*, i8** %3
ret i8* %12
}

LLVM IR (-O2):
@.str = [20 x i8] c"out of string space\00"
define i8* @space(i32 %0) {
%2 = tail call i32 (i32, ...) bitcast (i32 (...)* @getcell to i32 (i32, ...)*)(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (i8*, ...) bitcast (i32 (...)* @err to i32 (i8*, ...)*)(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = sext i32 %2 to i64
%8 = inttoptr i64 %7 to i8*
ret i8* %8
}
/* Variables and functions */
int printf(char *, int);
int main() {
  int i = 43;
  int a = 1;
  printf("%d\n", printf("%d", printf("%d", i)));
  printf("%c\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2b,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0x8(%rbp),%esi
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,%esi
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    %eax,%esi
lea    0xead(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xeec(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2b,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xeca(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [4 x i8] c"%c\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 43)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 1)
ret i32 0
}
/* Variables and functions */
int compress_file(char *);
int main(int argc, char *argv[]) {
  return compress_file("c:\\prj\\apl\\log\\20140621l.txt");
}


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

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

LLVM IR (-O0):
@.str = [29 x i8] c"c:\\prj\\apl\\log\\20140621l.txt\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 @compress_file(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 %6
}

LLVM IR (-O2):
@.str = [29 x i8] c"c:\\prj\\apl\\log\\20140621l.txt\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @compress_file(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
ret i32 %3
}
/* Variables and functions */
bool valid(int letter, int new_pos) {
  bool ret = true;
  return ret;
}


x86 assembly (clang, -O0):
<valid>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @valid(i32 %0, i32 %1) {
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ sla_hl();
void opcb_26() { sla_hl(); }


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

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

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

LLVM IR (-O2):
define void @opcb_26() {
%1 = tail call i32 (...) @sla_hl()
ret void
}
/* Variables and functions */
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void fnGenRandInput(int X[], int n) {
  int i;
  srand(time(NULL));
  for (i = 0; i < n; i++) {
    X[i] = rand() % 10000;
  }
}


x86 assembly (clang, -O0):
<fnGenRandInput>:
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>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    118a <fnGenRandInput+0x5a>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2710,%ecx
cltd
idiv   %ecx
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1156 <fnGenRandInput+0x26>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fnGenRandInput>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebp
mov    %rdi,%r14
xor    %edi,%edi
call   1040 <time@plt>
mov    %eax,%edi
call   1030 <srand@plt>
test   %ebp,%ebp
jle    1182 <fnGenRandInput+0x52>
mov    %ebp,%ebp
xor    %ebx,%ebx
nop
xor    %eax,%eax
call   1050 <rand@plt>
cltq
imul   $0x68db8bad,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x2c,%rcx
add    %edx,%ecx
imul   $0x2710,%ecx,%ecx
sub    %ecx,%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <fnGenRandInput+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define void @fnGenRandInput(i32* nocapture writeonly %0, i32 %1) {
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %15
6: ; preds = %2
%7 = zext i32 %1 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %13, %8 ]
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 10000
%12 = getelementptr inbounds i32, i32* %0, i64 %9
store i32 %11, i32* %12
%13 = add nuw nsw i64 %9, 1
%14 = icmp eq i64 %13, %7
br i1 %14, label %15, label %8
15: ; preds = %8, %2
ret void
}
/* Variables and functions */
size_t memTotal(void) {
  size_t memtotal = 0;
  return (memtotal);
}


x86 assembly (clang, -O0):
<memTotal>:
push   %rbp
mov    %rsp,%rbp
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @memTotal() {
%1 = alloca i64
store i64 0, i64* %1
%2 = load i64, i64* %1
ret i64 %2
}

LLVM IR (-O2):
define i64 @memTotal() {
ret i64 0
}
/* Variables and functions */
int atoi(char *);
int /*<<< orphan*/ swag();
int main(int argc, char *argv[]) {
  int i;
  int j = atoi(argv[1]);
  for (i = 0; i < j; i++) {
    swag();
  }
}


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)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    116e <main+0x4e>
mov    $0x0,%al
call   1030 <swag@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x2d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x8(%rsi),%rdi
call   1040 <atoi@plt>
test   %eax,%eax
jle    113c <main+0x1c>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <swag@plt>
add    $0xffffffff,%ebx
jne    1130 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
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
%8 = load i8**, i8*** %5
%9 = getelementptr inbounds i8*, i8** %8, i64 1
%10 = load i8*, i8** %9
%11 = call i32 @atoi(i8* %10)
store i32 %11, i32* %7
store i32 0, i32* %6
br label %12
12: ; preds = %18, %2
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %21
16: ; preds = %12
%17 = call i32 (...) @swag()
br label %18
18: ; preds = %16
%19 = load i32, i32* %6
%20 = add nsw i32 %19, 1
store i32 %20, i32* %6
br label %12
21: ; preds = %12
%22 = load i32, i32* %3
ret i32 %22
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = getelementptr inbounds i8*, i8** %1, i64 1
%4 = load i8*, i8** %3
%5 = tail call i32 @atoi(i8* %4)
%6 = icmp sgt i32 %5, 0
br i1 %6, label %7, label %12
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ 0, %2 ]
%9 = tail call i32 (...) @swag()
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %5
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret i32 0
}
/* Variables and functions */
int japi_choicebox2(int, char *, char *, char *, char *);
int j_choicebox2(int arg0, char *arg1, char *arg2, char *arg3, char *arg4) {
  return (japi_choicebox2(arg0, arg1, arg2, arg3, arg4));
}


x86 assembly (clang, -O0):
<j_choicebox2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
call   1030 <japi_choicebox2@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<j_choicebox2>:
jmp    1030 <japi_choicebox2@plt>

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

LLVM IR (-O2):
define i32 @j_choicebox2(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4) {
%6 = tail call i32 @japi_choicebox2(i32 %0, i8* %1, i8* %2, i8* %3, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ Exit(int /*<<< orphan*/);
int /*<<< orphan*/ Log(char *);
int access(const char *pathname, int mode) {
  Log("'"
      "access"
      "' is not implemented");
  Exit(0);
  ;
}


x86 assembly (clang, -O0):
<access>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
lea    0xeca(%rip),%rdi
call   1040 <Log@plt>
xor    %edi,%edi
call   1030 <Exit@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<access>:
push   %rax
lea    0xed8(%rip),%rdi
call   1040 <Log@plt>
xor    %edi,%edi
pop    %rax
jmp    1030 <Exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"'access' is not implemented\00"
define i32 @access(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = call i32 @Log(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @Exit(i32 0)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
@.str = [28 x i8] c"'access' is not implemented\00"
define i32 @access(i8* nocapture readnone %0, i32 %1) {
%3 = tail call i32 @Log(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @Exit(i32 0)
ret i32 undef
}
double dr2_dx1(double *x) { return 2 * x[0]; }


x86 assembly (clang, -O0):
<dr2_dx1>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  0xeec(%rip),%xmm0
mulsd  (%rax),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dr2_dx1>:
movsd  (%rdi),%xmm0
addsd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @dr2_dx1(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = fmul double 2.000000e+00, %5
ret double %6
}

LLVM IR (-O2):
define double @dr2_dx1(double* nocapture %0) {
%2 = load double, double* %0
%3 = fmul double %2, 2.000000e+00
ret double %3
}
/* Variables and functions */
unsigned char math___Byte_band___impl(unsigned char, unsigned char);
unsigned char core__math___Byte___band(unsigned char self, unsigned char p0) {
  unsigned char var;
  unsigned char var1;
  var1 = math___Byte_band___impl(self, p0);
  var = var1;
  goto RET_LABEL;
RET_LABEL:;
  return var;
}


x86 assembly (clang, -O0):
<core__math___Byte___band>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
mov    -0x1(%rbp),%al
movzbl %al,%edi
movzbl -0x2(%rbp),%esi
call   1030 <math___Byte_band___impl@plt>
mov    %al,-0x4(%rbp)
mov    -0x4(%rbp),%al
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<core__math___Byte___band>:
jmp    1030 <math___Byte_band___impl@plt>

LLVM IR (-O0):
define zeroext i8 @core__math___Byte___band(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
store i8 %0, i8* %3
store i8 %1, i8* %4
%7 = load i8, i8* %3
%8 = load i8, i8* %4
%9 = call zeroext i8 @math___Byte_band___impl(i8 zeroext %7, i8 zeroext %8)
store i8 %9, i8* %6
%10 = load i8, i8* %6
store i8 %10, i8* %5
br label %11
11: ; preds = %2
%12 = load i8, i8* %5
ret i8 %12
}

LLVM IR (-O2):
define zeroext i8 @core__math___Byte___band(i8 zeroext %0, i8 zeroext %1) {
%3 = tail call zeroext i8 @math___Byte_band___impl(i8 zeroext %0, i8 zeroext %1)
ret i8 %3
}
/* Variables and functions */
int strncasecmp(char const *, char const *, int);
int strcasecmp(const char *s1, const char *s2) {
  return strncasecmp(s1, s2, 1000000);
}


x86 assembly (clang, -O0):
<strcasecmp>:
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    $0xf4240,%edx
call   1030 <strncasecmp@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcasecmp>:
mov    $0xf4240,%edx
jmp    1030 <strncasecmp@plt>

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

LLVM IR (-O2):
define i32 @strcasecmp(i8* nocapture %0, i8* nocapture %1) {
%3 = tail call i32 @strncasecmp(i8* %0, i8* %1, i32 1000000)
ret i32 %3
}
unsigned char ascii2byte(char *val) {
  unsigned char temp = *val;
  if (temp > 0x60)
    temp -= 39;
  temp -= 48;
  temp *= 16;
  temp += *(val + 1);
  if (*(val + 1) > 0x60)
    temp -= 39;
  temp -= 48;
  return temp;
}


x86 assembly (clang, -O0):
<ascii2byte>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%al
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
cmp    $0x60,%eax
jle    1128 <ascii2byte+0x28>
movzbl -0x9(%rbp),%eax
sub    $0x27,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
shl    $0x4,%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%ecx
movzbl -0x9(%rbp),%eax
add    %ecx,%eax
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x60,%eax
jle    1168 <ascii2byte+0x68>
movzbl -0x9(%rbp),%eax
sub    $0x27,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
sub    $0x30,%eax
mov    %al,-0x9(%rbp)
movzbl -0x9(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ascii2byte>:
mov    (%rdi),%al
mov    0x1(%rdi),%cl
mov    %eax,%edx
shl    $0x4,%dl
lea    -0x70(%rdx),%esi
cmp    $0x61,%al
movzbl %dl,%eax
movzbl %sil,%edx
cmovb  %eax,%edx
add    %cl,%dl
lea    -0x27(%rdx),%eax
cmp    $0x61,%cl
movzbl %dl,%ecx
movzbl %al,%eax
cmovl  %ecx,%eax
add    $0xd0,%al
ret

LLVM IR (-O0):
define zeroext i8 @ascii2byte(i8* %0) {
%2 = alloca i8*
%3 = alloca i8
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = load i8, i8* %4
store i8 %5, i8* %3
%6 = load i8, i8* %3
%7 = zext i8 %6 to i32
%8 = icmp sgt i32 %7, 96
br i1 %8, label %9, label %14
9: ; preds = %1
%10 = load i8, i8* %3
%11 = zext i8 %10 to i32
%12 = sub nsw i32 %11, 39
%13 = trunc i32 %12 to i8
store i8 %13, i8* %3
br label %14
14: ; preds = %9, %1
%15 = load i8, i8* %3
%16 = zext i8 %15 to i32
%17 = sub nsw i32 %16, 48
%18 = trunc i32 %17 to i8
store i8 %18, i8* %3
%19 = load i8, i8* %3
%20 = zext i8 %19 to i32
%21 = mul nsw i32 %20, 16
%22 = trunc i32 %21 to i8
store i8 %22, i8* %3
%23 = load i8*, i8** %2
%24 = getelementptr inbounds i8, i8* %23, i64 1
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = load i8, i8* %3
%28 = zext i8 %27 to i32
%29 = add nsw i32 %28, %26
%30 = trunc i32 %29 to i8
store i8 %30, i8* %3
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i64 1
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp sgt i32 %34, 96
br i1 %35, label %36, label %41
36: ; preds = %14
%37 = load i8, i8* %3
%38 = zext i8 %37 to i32
%39 = sub nsw i32 %38, 39
%40 = trunc i32 %39 to i8
store i8 %40, i8* %3
br label %41
41: ; preds = %36, %14
%42 = load i8, i8* %3
%43 = zext i8 %42 to i32
%44 = sub nsw i32 %43, 48
%45 = trunc i32 %44 to i8
store i8 %45, i8* %3
%46 = load i8, i8* %3
ret i8 %46
}

LLVM IR (-O2):
define zeroext i8 @ascii2byte(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp ugt i8 %2, 96
%4 = shl i8 %2, 4
%5 = add i8 %4, -112
%6 = select i1 %3, i8 %5, i8 %4
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = add i8 %6, %8
%10 = icmp sgt i8 %8, 96
%11 = add i8 %9, -39
%12 = select i1 %10, i8 %11, i8 %9
%13 = add i8 %12, -48
ret i8 %13
}
/* Variables and functions */
int /*<<< orphan*/ handle_PWR(int /*<<< orphan*/);
int gen_PWR() { handle_PWR(0); }


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

x86 assembly (clang, -O2):
<gen_PWR>:
xor    %edi,%edi
jmp    1030 <handle_PWR@plt>

LLVM IR (-O0):
define i32 @gen_PWR() {
%1 = alloca i32
%2 = call i32 @handle_PWR(i32 0)
%3 = load i32, i32* %1
ret i32 %3
}

LLVM IR (-O2):
define i32 @gen_PWR() {
%1 = tail call i32 @handle_PWR(i32 0)
ret i32 undef
}
void unused_err_test() {
  int a, b;
#pragma unused
#pragma unused(a
#pragma unused(b) foo
}


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

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

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

LLVM IR (-O2):
define void @unused_err_test() {
ret void
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *, long);
void printTime() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  long t2 = ((tv.tv_usec + 1000000 * tv.tv_sec)) / 1000;
  printf("\033[1;31m !! Time !! \033[0m = %ld \n", t2);
}


x86 assembly (clang, -O0):
<printTime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1040 <gettimeofday@plt>
mov    -0x8(%rbp),%eax
imul   $0xf4240,-0x4(%rbp),%ecx
add    %ecx,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printTime>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <gettimeofday@plt>
imul   $0xf4240,0x4(%rsp),%eax
add    (%rsp),%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
movslq %eax,%rsi
lea    0xeaa(%rip),%rdi
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
@.str = [32 x i8] c"\1B[1;31m !! Time !! \1B[0m = %ld \0A\00"
define void @printTime() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 1000000, %7
%9 = add nsw i32 %5, %8
%10 = sdiv i32 %9, 1000
%11 = sext i32 %10 to i64
store i64 %11, i64* %2
%12 = load i64, i64* %2
%13 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %12)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
@.str = [32 x i8] c"\1B[1;31m !! Time !! \1B[0m = %ld \0A\00"
define void @printTime() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000000
%9 = add nsw i32 %8, %5
%10 = sdiv i32 %9, 1000
%11 = sext i32 %10 to i64
%12 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i64 %11)
ret void
}
double ABS(double X) {
  if (X < 0) {
    X = -X;
  }
  return X;
}


x86 assembly (clang, -O0):
<ABS>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    1138 <ABS+0x38>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<ABS>:
movapd 0xef8(%rip),%xmm2
xorpd  %xmm0,%xmm2
xorpd  %xmm3,%xmm3
movapd %xmm0,%xmm1
cmpltsd %xmm3,%xmm1
andpd  %xmm1,%xmm2
andnpd %xmm0,%xmm1
orpd   %xmm2,%xmm1
movapd %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @ABS(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fcmp olt double %3, 0.000000e+00
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load double, double* %2
%7 = fneg double %6
store double %7, double* %2
br label %8
8: ; preds = %5, %1
%9 = load double, double* %2
ret double %9
}

LLVM IR (-O2):
define double @ABS(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = fneg double %0
%4 = select i1 %2, double %3, double %0
ret double %4
}
unsigned int ic_parse_perm_has_read(unsigned int permissions) {
  return 0 != (permissions & 0x01);
}


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

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

LLVM IR (-O0):
define i32 @ic_parse_perm_has_read(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 1
%5 = icmp ne i32 0, %4
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @ic_parse_perm_has_read(i32 %0) {
%2 = and i32 %0, 1
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/);
void funcAlarm() { pthread_exit(0); }


x86 assembly (clang, -O0):
<funcAlarm>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <pthread_exit@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<funcAlarm>:
xor    %edi,%edi
jmp    1030 <pthread_exit@plt>

LLVM IR (-O0):
define void @funcAlarm() {
%1 = call i32 @pthread_exit(i32 0)
ret void
}

LLVM IR (-O2):
define void @funcAlarm() {
%1 = tail call i32 @pthread_exit(i32 0)
ret void
}
/* Variables and functions */
char *strtok(char *, char const *);
size_t split(char **result, char *string, const char *delimiters) {
  size_t j = 0;
  char *token = strtok(string, delimiters);
  while (token != NULL) {
    result[j++] = token;
    token = strtok(NULL, delimiters);
  }
  return j;
}


x86 assembly (clang, -O0):
<split>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1179 <split+0x69>
mov    -0x28(%rbp),%rdx
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x20(%rbp)
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <strtok@plt>
mov    %rax,-0x28(%rbp)
jmp    113d <split+0x2d>
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<split>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r15
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %rdx,%rsi
call   1030 <strtok@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1147 <split+0x37>
nopl   (%rax)
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <strtok@plt>
test   %rax,%rax
jne    1130 <split+0x20>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i64 @split(i8** nocapture writeonly %0, i8* %1, i8* nocapture %2) {
%4 = tail call i8* @strtok(i8* %1, i8* %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %13, label %6
6: ; preds = %3, %6
%7 = phi i8* [ %11, %6 ], [ %4, %3 ]
%8 = phi i64 [ %9, %6 ], [ 0, %3 ]
%9 = add i64 %8, 1
%10 = getelementptr inbounds i8*, i8** %0, i64 %8
store i8* %7, i8** %10
%11 = tail call i8* @strtok(i8* null, i8* %2)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %6
13: ; preds = %6, %3
%14 = phi i64 [ 0, %3 ], [ %9, %6 ]
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ feature();
int /*<<< orphan*/ methods();
int /*<<< orphan*/ version();
int main() {
  version();
  methods();
  feature();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1040 <version@plt>
mov    $0x0,%al
call   1030 <methods@plt>
mov    $0x0,%al
call   1050 <feature@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1040 <version@plt>
xor    %eax,%eax
call   1030 <methods@plt>
xor    %eax,%eax
call   1050 <feature@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @version()
%3 = call i32 (...) @methods()
%4 = call i32 (...) @feature()
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @version()
%2 = tail call i32 (...) @methods()
%3 = tail call i32 (...) @feature()
ret i32 0
}
/* Variables and functions */
double enth_L(int /*<<< orphan*/);
int /*<<< orphan*/ enth_melting_temperature(double);
double enth_water_fraction(double E, double E_cts, double P) {
  return (E - E_cts) / enth_L(enth_melting_temperature(P));
}


x86 assembly (clang, -O0):
<enth_water_fraction>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <enth_melting_temperature@plt>
mov    %eax,%edi
call   1040 <enth_L@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<enth_water_fraction>:
push   %rax
subsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
movapd %xmm2,%xmm0
call   1030 <enth_melting_temperature@plt>
mov    %eax,%edi
call   1040 <enth_L@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @enth_water_fraction(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = load double, double* %5
%9 = fsub double %7, %8
%10 = load double, double* %6
%11 = call i32 @enth_melting_temperature(double %10)
%12 = call double @enth_L(i32 %11)
%13 = fdiv double %9, %12
ret double %13
}

LLVM IR (-O2):
define double @enth_water_fraction(double %0, double %1, double %2) {
%4 = fsub double %0, %1
%5 = tail call i32 @enth_melting_temperature(double %2)
%6 = tail call double @enth_L(i32 %5)
%7 = fdiv double %4, %6
ret double %7
}
char upperCaseFromNumber(int n) { return (char)(n + 'A'); }


x86 assembly (clang, -O0):
<upperCaseFromNumber>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x41,%eax
movsbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<upperCaseFromNumber>:
lea    0x41(%rdi),%eax
ret

LLVM IR (-O0):
define signext i8 @upperCaseFromNumber(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = add nsw i32 %3, 65
%5 = trunc i32 %4 to i8
ret i8 %5
}

LLVM IR (-O2):
define signext i8 @upperCaseFromNumber(i32 %0) {
%2 = trunc i32 %0 to i8
%3 = add i8 %2, 65
ret i8 %3
}
/* Type definitions */
typedef scalar_t__ pthread_t;
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int kill(int /*<<< orphan*/, int);
int pthread_kill(pthread_t thread, int sig) {
  return (kill((pid_t)thread, sig));
}


x86 assembly (clang, -O0):
<pthread_kill>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    %eax,%edi
mov    -0xc(%rbp),%esi
call   1030 <kill@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pthread_kill>:
jmp    1030 <kill@plt>

LLVM IR (-O0):
define i32 @pthread_kill(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i64, i64* %3
%6 = trunc i64 %5 to i32
%7 = load i32, i32* %4
%8 = call i32 @kill(i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
define i32 @pthread_kill(i64 %0, i32 %1) {
%3 = trunc i64 %0 to i32
%4 = tail call i32 @kill(i32 %3, i32 %1)
ret i32 %4
}
/* Variables and functions */
size_t check_sep(char s) {
  char bf_chars[] = "+-.,[]><";
  size_t i = 0;
  while (bf_chars[i])
    if (bf_chars[i++] == s)
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_sep>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x9(%rbp)
mov    0xeef(%rip),%rax
mov    %rax,-0x12(%rbp)
mov    0xeed(%rip),%al
mov    %al,-0xa(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpb   $0x0,-0x12(%rbp,%rax,1)
je     1167 <check_sep+0x67>
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl -0x12(%rbp,%rax,1),%eax
movsbl -0x9(%rbp),%ecx
cmp    %ecx,%eax
jne    1162 <check_sep+0x62>
movq   $0x0,-0x8(%rbp)
jmp    116f <check_sep+0x6f>
jmp    1126 <check_sep+0x26>
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_sep>:
add    $0xd5,%dil
cmp    $0x32,%dil
ja     1121 <check_sep+0x21>
movzbl %dil,%eax
movabs $0x50000000a000f,%rcx
bt     %rax,%rcx
jae    1121 <check_sep+0x21>
xor    %eax,%eax
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@__const.check_sep.bf_chars = [9 x i8] c"+-.,[]><\00"
define i64 @check_sep(i8 signext %0) {
%2 = alloca i64
%3 = alloca i8
%4 = alloca [9 x i8]
%5 = alloca i64
store i8 %0, i8* %3
%6 = bitcast [9 x i8]* %4 to i8*
store i64 0, i64* %5
br label %7
7: ; preds = %22, %1
%8 = load i64, i64* %5
%9 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %23
12: ; preds = %7
%13 = load i64, i64* %5
%14 = add i64 %13, 1
store i64 %14, i64* %5
%15 = getelementptr inbounds [9 x i8], [9 x i8]* %4, i64 0, i64 %13
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = load i8, i8* %3
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %17, %19
br i1 %20, label %21, label %22
21: ; preds = %12
store i64 0, i64* %2
br label %24
22: ; preds = %12
br label %7
23: ; preds = %7
store i64 1, i64* %2
br label %24
24: ; preds = %23, %21
%25 = load i64, i64* %2
ret i64 %25
}

LLVM IR (-O2):
define i64 @check_sep(i8 signext %0) {
switch i8 %0, label %2 [
i8 43, label %3
i8 45, label %3
i8 46, label %3
i8 44, label %3
i8 91, label %3
i8 93, label %3
i8 62, label %3
i8 60, label %3
]
2: ; preds = %1
br label %3
3: ; preds = %1, %1, %1, %1, %1, %1, %1, %1, %2
%4 = phi i64 [ 0, %1 ], [ 1, %2 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ], [ 0, %1 ]
ret i64 %4
}
/* Type definitions */
struct proc {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ report_backtrace(struct proc *);
int /*<<< orphan*/ report_stack_data(struct proc *);
void report_stack(struct proc *p) {
  printf("{Call Stack}\n");
  report_backtrace(p);
  report_stack_data(p);
}


x86 assembly (clang, -O0):
<report_stack>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
call   1040 <report_backtrace@plt>
mov    -0x8(%rbp),%rdi
call   1050 <report_stack_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<report_stack>:
push   %rbx
mov    %rdi,%rbx
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1040 <report_backtrace@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1050 <report_stack_data@plt>

LLVM IR (-O0):
%struct.proc = type { i32 }
@.str = [14 x i8] c"{Call Stack}\0A\00"
define void @report_stack(%struct.proc* %0) {
%2 = alloca %struct.proc*
store %struct.proc* %0, %struct.proc** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%4 = load %struct.proc*, %struct.proc** %2
%5 = call i32 @report_backtrace(%struct.proc* %4)
%6 = load %struct.proc*, %struct.proc** %2
%7 = call i32 @report_stack_data(%struct.proc* %6)
ret void
}

LLVM IR (-O2):
%struct.proc = type { i32 }
@str = [13 x i8] c"{Call Stack}\00"
define void @report_stack(%struct.proc* %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%3 = tail call i32 @report_backtrace(%struct.proc* %0)
%4 = tail call i32 @report_stack_data(%struct.proc* %0)
ret void
}
/* Type definitions */
struct srcu_struct {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ BUG();
void synchronize_srcu(struct srcu_struct *sp) { BUG(); }


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

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

LLVM IR (-O0):
%struct.srcu_struct = type { i32 }
define void @synchronize_srcu(%struct.srcu_struct* %0) {
%2 = alloca %struct.srcu_struct*
store %struct.srcu_struct* %0, %struct.srcu_struct** %2
%3 = call i32 (...) @BUG()
ret void
}

LLVM IR (-O2):
%struct.srcu_struct = type { i32 }
define void @synchronize_srcu(%struct.srcu_struct* nocapture readnone %0) {
%2 = tail call i32 (...) @BUG()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ test_assert(int);
int main(void) {
  int a = 2, b = 3, c;
  int *p;
  if (a > b)
    p = &a;
  else
    p = &b;
  *p = 4;
  test_assert(b == 4);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
movl   $0x3,-0xc(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1146 <main+0x36>
lea    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    114e <main+0x3e>
lea    -0xc(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x4,(%rax)
cmpl   $0x4,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <test_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32*
store i32 0, i32* %1
store i32 2, i32* %2
store i32 3, i32* %3
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = icmp sgt i32 %6, %7
br i1 %8, label %9, label %10
9: ; preds = %0
store i32* %2, i32** %5
br label %11
10: ; preds = %0
store i32* %3, i32** %5
br label %11
11: ; preds = %10, %9
%12 = load i32*, i32** %5
store i32 4, i32* %12
%13 = load i32, i32* %3
%14 = icmp eq i32 %13, 4
%15 = zext i1 %14 to i32
%16 = call i32 @test_assert(i32 %15)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @test_assert(i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exibeNumero(int);
int obterBotaoPressionado();
int /*<<< orphan*/ setup();
int main() {
  int pressionado;
  int ultimo_pressionado;
  setup();
  while (1) {
    pressionado = obterBotaoPressionado();
    if (pressionado != ultimo_pressionado && pressionado != 0) {
      ultimo_pressionado = pressionado;
    }
    exibeNumero(ultimo_pressionado);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <setup@plt>
mov    $0x0,%al
call   1040 <obterBotaoPressionado@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
je     116c <main+0x3c>
cmpl   $0x0,-0x8(%rbp)
je     116c <main+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <exibeNumero@plt>
jmp    1146 <main+0x16>

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %eax,%eax
call   1050 <setup@plt>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <obterBotaoPressionado@plt>
test   %eax,%eax
mov    %ebx,%ecx
cmovne %eax,%ecx
cmp    %ebx,%eax
cmovne %ecx,%ebx
mov    %ebx,%edi
call   1030 <exibeNumero@plt>
jmp    1140 <main+0x10>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
%4 = call i32 (...) @setup()
br label %5
5: ; preds = %0, %15
%6 = call i32 (...) @obterBotaoPressionado()
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = load i32, i32* %3
%9 = icmp ne i32 %7, %8
br i1 %9, label %10, label %15
10: ; preds = %5
%11 = load i32, i32* %2
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %10
%14 = load i32, i32* %2
store i32 %14, i32* %3
br label %15
15: ; preds = %13, %10, %5
%16 = load i32, i32* %3
%17 = call i32 @exibeNumero(i32 %16)
br label %5
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @setup()
br label %2
2: ; preds = %2, %0
%3 = phi i32 [ undef, %0 ], [ %8, %2 ]
%4 = tail call i32 (...) @obterBotaoPressionado()
%5 = icmp ne i32 %4, %3
%6 = icmp ne i32 %4, 0
%7 = and i1 %5, %6
%8 = select i1 %7, i32 %4, i32 %3
%9 = tail call i32 @exibeNumero(i32 %8)
br label %2
}
/* Variables and functions */
int abs(int /*<<< orphan*/);
int /*<<< orphan*/ atoi(char *);
char *getenv(char *);
int get_max_finished_jobs() {
  char *limit;
  limit = getenv("TS_MAXFINISHED");
  if (limit == NULL)
    return 1000;
  return abs(atoi(limit));
}


x86 assembly (clang, -O0):
<get_max_finished_jobs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xec1(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    115f <get_max_finished_jobs+0x2f>
movl   $0x3e8,-0x4(%rbp)
jmp    1172 <get_max_finished_jobs+0x42>
mov    -0x10(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <abs@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_max_finished_jobs>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1143 <get_max_finished_jobs+0x23>
mov    %rax,%rdi
call   1040 <atoi@plt>
mov    %eax,%ecx
neg    %ecx
cmovns %ecx,%eax
pop    %rcx
ret
mov    $0x3e8,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"TS_MAXFINISHED\00"
define i32 @get_max_finished_jobs() {
%1 = alloca i32
%2 = alloca i8*
%3 = call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %7
6: ; preds = %0
store i32 1000, i32* %1
br label %11
7: ; preds = %0
%8 = load i8*, i8** %2
%9 = call i32 @atoi(i8* %8)
%10 = call i32 @abs(i32 %9)
store i32 %10, i32* %1
br label %11
11: ; preds = %7, %6
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [15 x i8] c"TS_MAXFINISHED\00"
define i32 @get_max_finished_jobs() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %6, label %3
3: ; preds = %0
%4 = tail call i32 @atoi(i8* %1)
%5 = tail call i32 @llvm.abs.i32(i32 %4, i1 true)
br label %6
6: ; preds = %0, %3
%7 = phi i32 [ %5, %3 ], [ 1000, %0 ]
ret i32 %7
}