xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ putchar(char);
void do_indent(int indent) {
  int i;
  for (i = 0; i < indent; i++)
    putchar(' ');
}


x86 assembly (clang, -O0):
<do_indent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1146 <do_indent+0x36>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1122 <do_indent+0x12>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_indent>:
push   %rbx
test   %edi,%edi
jle    112f <do_indent+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    1120 <do_indent+0x10>
pop    %rbx
ret

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

LLVM IR (-O2):
define void @do_indent(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @putchar(i8 signext 32)
%6 = add nuw nsw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clean_socks();
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void error(const char *reason) {
  fprintf(stderr, "[-] Error: %s\n", reason);
  fprintf(stderr, "netsed: exiting.\n");
  clean_socks();
  exit(2);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2e9d(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb0(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
lea    0xea8(%rip),%rsi
mov    $0x0,%al
call   1040 <fprintf@plt>
mov    $0x0,%al
call   1030 <clean_socks@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %rdi,%rdx
mov    0x2ea5(%rip),%rbx
mov    (%rbx),%edi
lea    0xebc(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
mov    (%rbx),%edi
lea    0xebb(%rip),%rsi
xor    %eax,%eax
call   1040 <fprintf@plt>
xor    %eax,%eax
call   1030 <clean_socks@plt>
mov    $0x2,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [15 x i8] c"[-] Error: %s\0A\00"
@.str.1 = [18 x i8] c"netsed: exiting.\0A\00"
define void @error(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = load i32, i32* @stderr
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %6, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 (...) @clean_socks()
%9 = call i32 @exit(i32 2)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [15 x i8] c"[-] Error: %s\0A\00"
@.str.1 = [18 x i8] c"netsed: exiting.\0A\00"
define void @error(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 (i32, i8*, ...) @fprintf(i32 %2, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = load i32, i32* @stderr
%5 = tail call i32 (i32, i8*, ...) @fprintf(i32 %4, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 (...) @clean_socks()
%7 = tail call i32 @exit(i32 2)
unreachable
}
void quicksort() {}


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

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

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

LLVM IR (-O2):
define void @quicksort() {
ret void
}
int gcd(a, b)
int a;
int b;
{
  int c;
  c = a % b;
  while (c != 0) {
    a = b;
    b = c;
    c = a % b;
  }
  return b;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     1139 <gcd+0x39>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %edx,-0xc(%rbp)
jmp    1114 <gcd+0x14>
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %edi,%eax
cltd
idiv   %esi
test   %edx,%edx
je     1120 <gcd+0x20>
nopl   0x0(%rax)
mov    %edx,%ecx
mov    %esi,%eax
cltd
idiv   %ecx
mov    %ecx,%esi
test   %edx,%edx
jne    1110 <gcd+0x10>
mov    %ecx,%eax
ret
mov    %esi,%eax
ret

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

LLVM IR (-O2):
define i32 @gcd(i32 %0, i32 %1) {
%3 = srem i32 %0, %1
%4 = icmp eq i32 %3, 0
br i1 %4, label %10, label %5
5: ; preds = %2, %5
%6 = phi i32 [ %8, %5 ], [ %3, %2 ]
%7 = phi i32 [ %6, %5 ], [ %1, %2 ]
%8 = srem i32 %7, %6
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %5
10: ; preds = %5, %2
%11 = phi i32 [ %1, %2 ], [ %6, %5 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
int first(int arr[], int lb, int ub) {
  assert(arr != NULL && lb <= ub);
  return lb < ub ? lb : -1;
}


x86 assembly (clang, -O0):
<first>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x11(%rbp)
je     113e <first+0x2e>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1162 <first+0x52>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    116f <first+0x5f>
mov    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    116f <first+0x5f>
mov    -0x18(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<first>:
push   %rbx
test   %rdi,%rdi
setne  %al
cmp    %edx,%esi
setle  %cl
mov    $0xffffffff,%ebx
cmovl  %esi,%ebx
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @first(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 = icmp ne i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %3
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = icmp sle i32 %10, %11
br label %13
13: ; preds = %9, %3
%14 = phi i1 [ false, %3 ], [ %12, %9 ]
%15 = zext i1 %14 to i32
%16 = call i32 @assert(i32 %15)
%17 = load i32, i32* %5
%18 = load i32, i32* %6
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %22
20: ; preds = %13
%21 = load i32, i32* %5
br label %23
22: ; preds = %13
br label %23
23: ; preds = %22, %20
%24 = phi i32 [ %21, %20 ], [ -1, %22 ]
ret i32 %24
}

LLVM IR (-O2):
define i32 @first(i32* readnone %0, i32 %1, i32 %2) {
%4 = icmp ne i32* %0, null
%5 = icmp sle i32 %1, %2
%6 = and i1 %4, %5
%7 = zext i1 %6 to i32
%8 = tail call i32 @assert(i32 %7)
%9 = icmp slt i32 %1, %2
%10 = select i1 %9, i32 %1, i32 -1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ max_heapify(int *, int, int);
void build_max_heap(int A[], int heapsize) {
  int i;
  for (i = (heapsize - 1) / 2; i >= 0; i--)
    max_heapify(A, i, heapsize);
}


x86 assembly (clang, -O0):
<build_max_heap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jl     1157 <build_max_heap+0x47>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <max_heapify@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
jmp    1130 <build_max_heap+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_max_heap>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
js     1141 <build_max_heap+0x31>
mov    %esi,%ebx
mov    %rdi,%r14
lea    -0x1(%rbx),%eax
shr    $0x1f,%eax
lea    (%rbx,%rax,1),%ebp
add    $0xffffffff,%ebp
sar    %ebp
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebp,%esi
mov    %ebx,%edx
call   1030 <max_heapify@plt>
add    $0xffffffff,%ebp
jb     1130 <build_max_heap+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define void @build_max_heap(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = sub nsw i32 %6, 1
%8 = sdiv i32 %7, 2
store i32 %8, i32* %5
br label %9
9: ; preds = %17, %2
%10 = load i32, i32* %5
%11 = icmp sge i32 %10, 0
br i1 %11, label %12, label %20
12: ; preds = %9
%13 = load i32*, i32** %3
%14 = load i32, i32* %5
%15 = load i32, i32* %4
%16 = call i32 @max_heapify(i32* %13, i32 %14, i32 %15)
br label %17
17: ; preds = %12
%18 = load i32, i32* %5
%19 = add nsw i32 %18, -1
store i32 %19, i32* %5
br label %9
20: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @build_max_heap(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = add nsw i32 %1, -1
%6 = sdiv i32 %5, 2
br label %7
7: ; preds = %4, %7
%8 = phi i32 [ %10, %7 ], [ %6, %4 ]
%9 = tail call i32 @max_heapify(i32* %0, i32 %8, i32 %1)
%10 = add nsw i32 %8, -1
%11 = icmp eq i32 %8, 0
br i1 %11, label %12, label %7
12: ; preds = %7, %2
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
FILE *open_input_file(const char *fn) {
  FILE *fh;
  if ((fh = fopen(fn, "rb")))
    return fh;
  fprintf(stderr, "Failed to open input file: %s\n", fn);
  return 0;
}


x86 assembly (clang, -O0):
<open_input_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xec9(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1157 <open_input_file+0x37>
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1178 <open_input_file+0x58>
mov    0x2e82(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe98(%rip),%rsi
call   1030 <fprintf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<open_input_file>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
lea    0xed2(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1153 <open_input_file+0x33>
mov    0x2e9e(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"Failed to open input file: %s\0A\00"
define i32* @open_input_file(i8* %0) {
%2 = alloca i32*
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %6, i32** %4
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32*, i32** %4
store i32* %9, i32** %2
br label %14
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = load i8*, i8** %3
%13 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %12)
store i32* null, i32** %2
br label %14
14: ; preds = %10, %8
%15 = load i32*, i32** %2
ret i32* %15
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [31 x i8] c"Failed to open input file: %s\0A\00"
define noalias i32* @open_input_file(i8* %0) {
%2 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32* %2, null
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %7
7: ; preds = %1, %4
ret i32* %2
}
int array_is_sorted(unsigned *val, int n) {
  int i;
  for (i = 1; i < n; i++)
    if (val[i - 1] > val[i])
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<array_is_sorted>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    115e <array_is_sorted+0x5e>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jbe    114b <array_is_sorted+0x4b>
movl   $0x0,-0x4(%rbp)
jmp    1165 <array_is_sorted+0x65>
jmp    1150 <array_is_sorted+0x50>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1112 <array_is_sorted+0x12>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_is_sorted>:
mov    $0x1,%eax
cmp    $0x2,%esi
jl     1132 <array_is_sorted+0x32>
mov    %esi,%r8d
mov    (%rdi),%edx
mov    $0x1,%esi
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %edx,%ecx
mov    (%rdi,%rsi,4),%edx
cmp    %edx,%ecx
ja     1133 <array_is_sorted+0x33>
add    $0x1,%rsi
cmp    %rsi,%r8
jne    1120 <array_is_sorted+0x20>
ret
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @array_is_sorted(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %16
4: ; preds = %2
%5 = zext i32 %1 to i64
%6 = load i32, i32* %0
br label %9
7: ; preds = %9
%8 = icmp eq i64 %15, %5
br i1 %8, label %16, label %9
9: ; preds = %4, %7
%10 = phi i32 [ %6, %4 ], [ %13, %7 ]
%11 = phi i64 [ 1, %4 ], [ %15, %7 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = icmp ugt i32 %10, %13
%15 = add nuw nsw i64 %11, 1
br i1 %14, label %16, label %7
16: ; preds = %9, %7, %2
%17 = phi i32 [ 1, %2 ], [ 1, %7 ], [ 0, %9 ]
ret i32 %17
}
/* Variables and functions */
int /*<<< orphan*/ die(char *);
int /*<<< orphan*/ strcpy(char *, char const *);
scalar_t__ strlen(char const *);
char *xalloc(scalar_t__);
char *xstrdup(const char *str) {
  char *ret = xalloc(strlen(str) + 1);
  if (!ret)
    die("xstrdup");
  strcpy(ret, str);
  return ret;
}


x86 assembly (clang, -O0):
<xstrdup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,%rdi
add    $0x1,%rdi
call   1060 <xalloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    117c <xstrdup+0x3c>
lea    0xe89(%rip),%rdi
call   1050 <die@plt>
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xstrdup>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%rdi
call   1060 <xalloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1169 <xstrdup+0x29>
lea    0xe9c(%rip),%rdi
call   1050 <die@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"xstrdup\00"
define i8* @xstrdup(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i64 @strlen(i8* %4)
%6 = add nsw i64 %5, 1
%7 = call i8* @xalloc(i64 %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = icmp ne i8* %8, null
br i1 %9, label %12, label %10
10: ; preds = %1
%11 = call i32 @die(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %12
12: ; preds = %10, %1
%13 = load i8*, i8** %3
%14 = load i8*, i8** %2
%15 = call i32 @strcpy(i8* %13, i8* %14)
%16 = load i8*, i8** %3
ret i8* %16
}

LLVM IR (-O2):
@.str = [8 x i8] c"xstrdup\00"
define i8* @xstrdup(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add nsw i64 %2, 1
%4 = tail call i8* @xalloc(i64 %3)
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = tail call i32 @die(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
%9 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_attr_t;

/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
scalar_t__ pthread_attr_setdetachstate(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ stderr;
void sirius_pthread_attr_setdetachstate(pthread_attr_t *attr, int detachstate) {
  if (pthread_attr_setdetachstate(attr, detachstate)) {
    fprintf(stderr, "pthread_setdetachstate() failed.\n");
    exit(1);
  }
}


x86 assembly (clang, -O0):
<sirius_pthread_attr_setdetachstate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1040 <pthread_attr_setdetachstate@plt>
cmp    $0x0,%rax
je     1174 <sirius_pthread_attr_setdetachstate+0x44>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
lea    0xe9b(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sirius_pthread_attr_setdetachstate>:
push   %rax
call   1040 <pthread_attr_setdetachstate@plt>
test   %rax,%rax
jne    113d <sirius_pthread_attr_setdetachstate+0xd>
pop    %rax
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"pthread_setdetachstate() failed.\0A\00"
define void @sirius_pthread_attr_setdetachstate(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32*, i32** %3
%6 = load i32, i32* %4
%7 = call i64 @pthread_attr_setdetachstate(i32* %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @exit(i32 1)
unreachable
13: ; preds = %2
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"pthread_setdetachstate() failed.\0A\00"
define void @sirius_pthread_attr_setdetachstate(i32* %0, i32 %1) {
%3 = tail call i64 @pthread_attr_setdetachstate(i32* %0, i32 %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %9, label %5
5: ; preds = %2
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int pa_maybe_prefix_path() {
  printf("NOT IMPLEMENTED:"
         "pa_maybe_prefix_path"
         "\n");
}


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

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

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

LLVM IR (-O2):
@str = [37 x i8] c"NOT IMPLEMENTED:pa_maybe_prefix_path\00"
define i32 @pa_maybe_prefix_path() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
ret i32 undef
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, long long const);
void printVector(const long long *v, const int n) {
  int i;
  for (i = 0; i < n; i++) {
    printf("%d ", v[i]);
  }
}


x86 assembly (clang, -O0):
<printVector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1158 <printVector+0x48>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <printVector+0x16>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printVector>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1145 <printVector+0x35>
mov    %rdi,%r15
mov    %esi,%r12d
xor    %ebx,%ebx
lea    0xed5(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,8),%rsi
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1130 <printVector+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @printVector(i64* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i64, i64* %0, i64 %7
%9 = load i64, i64* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i64 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DrawBMP225(unsigned long, unsigned long, unsigned long);
void drawbmp(unsigned long xd, unsigned long yd, unsigned long c) {
  DrawBMP225(xd, yd, c);
}


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

x86 assembly (clang, -O2):
<drawbmp>:
jmp    1030 <DrawBMP225@plt>

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

LLVM IR (-O2):
define void @drawbmp(i64 %0, i64 %1, i64 %2) {
%4 = tail call i32 @DrawBMP225(i64 %0, i64 %1, i64 %2)
ret void
}
/* Type definitions */
struct plainstring {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ cstr_loaddouble(char *, double);
int plainstring_less(struct plainstring const *, char *);
int plainstring_less_double(const struct plainstring *this_string, double d) {
  char buffer[0xFF];
  cstr_loaddouble(buffer, d);
  return plainstring_less(this_string, buffer);
}


x86 assembly (clang, -O0):
<plainstring_less_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
lea    -0x110(%rbp),%rdi
movsd  -0x10(%rbp),%xmm0
call   1030 <cstr_loaddouble@plt>
mov    -0x8(%rbp),%rdi
lea    -0x110(%rbp),%rsi
call   1040 <plainstring_less@plt>
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<plainstring_less_double>:
push   %r14
push   %rbx
sub    $0x108,%rsp
mov    %rdi,%rbx
mov    %rsp,%r14
mov    %r14,%rdi
call   1030 <cstr_loaddouble@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <plainstring_less@plt>
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.plainstring = type { i32 }
define i32 @plainstring_less_double(%struct.plainstring* %0, double %1) {
%3 = alloca %struct.plainstring*
%4 = alloca double
%5 = alloca [255 x i8]
store %struct.plainstring* %0, %struct.plainstring** %3
store double %1, double* %4
%6 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%7 = load double, double* %4
%8 = call i32 @cstr_loaddouble(i8* %6, double %7)
%9 = load %struct.plainstring*, %struct.plainstring** %3
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%11 = call i32 @plainstring_less(%struct.plainstring* %9, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
%struct.plainstring = type { i32 }
define i32 @plainstring_less_double(%struct.plainstring* %0, double %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = call i32 @cstr_loaddouble(i8* %4, double %1)
%6 = call i32 @plainstring_less(%struct.plainstring* %0, i8* %4)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ btesh2_gfxcon_scrollUp();
int btesh2_gfxcon_scrollUpN(int n) {
  while ((n--) > 0)
    btesh2_gfxcon_scrollUp();
  return (0);
}


x86 assembly (clang, -O0):
<btesh2_gfxcon_scrollUpN>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x4(%rbp)
cmp    $0x0,%eax
jle    113b <btesh2_gfxcon_scrollUpN+0x2b>
mov    $0x0,%al
call   1030 <btesh2_gfxcon_scrollUp@plt>
jmp    111b <btesh2_gfxcon_scrollUpN+0xb>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<btesh2_gfxcon_scrollUpN>:
push   %rbx
test   %edi,%edi
jle    112f <btesh2_gfxcon_scrollUpN+0x1f>
mov    %edi,%ebx
add    $0x1,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <btesh2_gfxcon_scrollUp@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     1120 <btesh2_gfxcon_scrollUpN+0x10>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @btesh2_gfxcon_scrollUpN(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %7, %1
%4 = load i32, i32* %2
%5 = add nsw i32 %4, -1
store i32 %5, i32* %2
%6 = icmp sgt i32 %4, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = call i32 (...) @btesh2_gfxcon_scrollUp()
br label %3
9: ; preds = %3
ret i32 0
}

LLVM IR (-O2):
define i32 @btesh2_gfxcon_scrollUpN(i32 %0) {
%2 = icmp sgt i32 %0, 0
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %5, %3 ], [ %0, %1 ]
%5 = add nsw i32 %4, -1
%6 = tail call i32 (...) @btesh2_gfxcon_scrollUp()
%7 = icmp ugt i32 %4, 1
br i1 %7, label %3, label %8
8: ; preds = %3, %1
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Z_BEST_COMPRESSION;
int /*<<< orphan*/ png_write_palette_based2(char const *, unsigned char *,
                                            unsigned int, unsigned int,
                                            int /*<<< orphan*/,
                                            int /*<<< orphan*/);
void png_write(const char *filename, unsigned char *data, unsigned width,
               unsigned height) {
  png_write_palette_based2(filename, data, width, height, 0,
                           Z_BEST_COMPRESSION);
}


x86 assembly (clang, -O0):
<png_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    0x2ead(%rip),%rax
mov    (%rax),%r9d
xor    %r8d,%r8d
call   1030 <png_write_palette_based2@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<png_write>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%r9d
xor    %r8d,%r8d
jmp    1030 <png_write_palette_based2@plt>

LLVM IR (-O0):
@Z_BEST_COMPRESSION = global i32 0
define void @png_write(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = load i8*, i8** %6
%11 = load i32, i32* %7
%12 = load i32, i32* %8
%13 = load i32, i32* @Z_BEST_COMPRESSION
%14 = call i32 @png_write_palette_based2(i8* %9, i8* %10, i32 %11, i32 %12, i32 0, i32 %13)
ret void
}

LLVM IR (-O2):
@Z_BEST_COMPRESSION = global i32 0
define void @png_write(i8* %0, i8* %1, i32 %2, i32 %3) {
%5 = load i32, i32* @Z_BEST_COMPRESSION
%6 = tail call i32 @png_write_palette_based2(i8* %0, i8* %1, i32 %2, i32 %3, i32 0, i32 %5)
ret void
}
void tegra_dvfs_core_lock(void) { return; }


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

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

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

LLVM IR (-O2):
define void @tegra_dvfs_core_lock() {
ret void
}
/* Variables and functions */
int creat(char *, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ stderr;
int openout(char *outfile) {
  int rawfd;
  if ((rawfd = creat(outfile, 0666)) == -1) {
    fprintf(stderr, "%s - ", outfile);
    perror("create raw output file");
    return -1;
  }
  return rawfd;
}


x86 assembly (clang, -O0):
<openout>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x1b6,%esi
call   1050 <creat@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1187 <openout+0x57>
mov    0x2e83(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
lea    0xe90(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118d <openout+0x5d>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<openout>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    $0x1b6,%esi
call   1050 <creat@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
je     1152 <openout+0x22>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    0x2e87(%rip),%rax
mov    (%rax),%edi
lea    0xe9e(%rip),%rsi
mov    %r14,%rdx
call   1030 <fprintf@plt>
lea    0xe95(%rip),%rdi
call   1040 <perror@plt>
jmp    1148 <openout+0x18>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [6 x i8] c"%s - \00"
@.str.1 = [23 x i8] c"create raw output file\00"
define i32 @openout(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @creat(i8* %5, i32 438)
store i32 %6, i32* %4
%7 = icmp eq i32 %6, -1
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = load i8*, i8** %3
%11 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %10)
%12 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %2
br label %15
13: ; preds = %1
%14 = load i32, i32* %4
store i32 %14, i32* %2
br label %15
15: ; preds = %13, %8
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [6 x i8] c"%s - \00"
@.str.1 = [23 x i8] c"create raw output file\00"
define i32 @openout(i8* %0) {
%2 = tail call i32 @creat(i8* %0, i32 438)
%3 = icmp eq i32 %2, -1
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %0)
%7 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0))
br label %8
8: ; preds = %1, %4
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ detect_memory_88();
int /*<<< orphan*/ detect_memory_e801();
scalar_t__ detect_memory_e820();
int detect_memory(void) {
  int err = -1;
  if (detect_memory_e820() > 0)
    err = 0;
  if (!detect_memory_e801())
    err = 0;
  if (!detect_memory_88())
    err = 0;
  return err;
}


x86 assembly (clang, -O0):
<detect_memory>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0xffffffff,-0x4(%rbp)
mov    $0x0,%al
call   1040 <detect_memory_e820@plt>
cmp    $0x0,%rax
jle    1157 <detect_memory+0x27>
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1030 <detect_memory_e801@plt>
cmp    $0x0,%eax
jne    116e <detect_memory+0x3e>
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1050 <detect_memory_88@plt>
cmp    $0x0,%eax
jne    1185 <detect_memory+0x55>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detect_memory>:
push   %rbp
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <detect_memory_e820@plt>
test   %rax,%rax
setle  %bpl
xor    %eax,%eax
call   1030 <detect_memory_e801@plt>
test   %eax,%eax
setne  %bl
xor    %eax,%eax
call   1050 <detect_memory_88@plt>
test   %eax,%eax
setne  %al
and    %bl,%al
and    %bpl,%al
movzbl %al,%eax
neg    %eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @detect_memory() {
%1 = alloca i32
store i32 -1, i32* %1
%2 = call i64 (...) @detect_memory_e820()
%3 = icmp sgt i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %0
store i32 0, i32* %1
br label %5
5: ; preds = %4, %0
%6 = call i32 (...) @detect_memory_e801()
%7 = icmp ne i32 %6, 0
br i1 %7, label %9, label %8
8: ; preds = %5
store i32 0, i32* %1
br label %9
9: ; preds = %8, %5
%10 = call i32 (...) @detect_memory_88()
%11 = icmp ne i32 %10, 0
br i1 %11, label %13, label %12
12: ; preds = %9
store i32 0, i32* %1
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %1
ret i32 %14
}

LLVM IR (-O2):
define i32 @detect_memory() {
%1 = tail call i64 (...) @detect_memory_e820()
%2 = icmp slt i64 %1, 1
%3 = tail call i32 (...) @detect_memory_e801()
%4 = icmp ne i32 %3, 0
%5 = tail call i32 (...) @detect_memory_88()
%6 = icmp ne i32 %5, 0
%7 = select i1 %6, i1 %4, i1 false
%8 = select i1 %7, i1 %2, i1 false
%9 = sext i1 %8 to i32
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ LCD_Out(int, int, char);
void mostraplinha(char plinha) { LCD_Out(1, 1, plinha); }


x86 assembly (clang, -O0):
<mostraplinha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
movsbl -0x1(%rbp),%edx
call   1030 <LCD_Out@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostraplinha>:
mov    %edi,%edx
mov    $0x1,%edi
mov    $0x1,%esi
jmp    1030 <LCD_Out@plt>

LLVM IR (-O0):
define void @mostraplinha(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = call i32 @LCD_Out(i32 1, i32 1, i8 signext %3)
ret void
}

LLVM IR (-O2):
define void @mostraplinha(i8 signext %0) {
%2 = tail call i32 @LCD_Out(i32 1, i32 1, i8 signext %0)
ret void
}
int v9fs_set_create_acl(struct inode *inode, struct p9_fid *fid,
                        struct posix_acl *dacl, struct posix_acl *acl) {
  return 0;
}


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

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

LLVM IR (-O0):
%struct.inode = type opaque
%struct.p9_fid = type opaque
%struct.posix_acl = type opaque
define i32 @v9fs_set_create_acl(%struct.inode* %0, %struct.p9_fid* %1, %struct.posix_acl* %2, %struct.posix_acl* %3) {
%5 = alloca %struct.inode*
%6 = alloca %struct.p9_fid*
%7 = alloca %struct.posix_acl*
%8 = alloca %struct.posix_acl*
store %struct.inode* %0, %struct.inode** %5
store %struct.p9_fid* %1, %struct.p9_fid** %6
store %struct.posix_acl* %2, %struct.posix_acl** %7
store %struct.posix_acl* %3, %struct.posix_acl** %8
ret i32 0
}

LLVM IR (-O2):
%struct.inode = type opaque
%struct.p9_fid = type opaque
%struct.posix_acl = type opaque
define i32 @v9fs_set_create_acl(%struct.inode* nocapture readnone %0, %struct.p9_fid* nocapture readnone %1, %struct.posix_acl* nocapture readnone %2, %struct.posix_acl* nocapture readnone %3) {
ret i32 0
}
unsigned short inw(unsigned short port) {
  short value;
  asm volatile("inw %%dx, %%ax" : "=a"(value) : "d"(port));
  return value;
}


x86 assembly (clang, -O0):
<inw>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    -0x2(%rbp),%dx
in     (%dx),%ax
mov    %ax,-0x4(%rbp)
movzwl -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<inw>:
mov    %edi,%edx
in     (%dx),%ax
ret

LLVM IR (-O0):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = alloca i16
%3 = alloca i16
store i16 %0, i16* %2
%4 = load i16, i16* %2
%5 = call i16 asm sideeffect "inw %dx, %ax", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %4)
store i16 %5, i16* %3
%6 = load i16, i16* %3
ret i16 %6
}

LLVM IR (-O2):
define zeroext i16 @inw(i16 zeroext %0) {
%2 = tail call i16 asm sideeffect "inw %dx, %ax", "={ax},{dx},~{dirflag},~{fpsr},~{flags}"(i16 %0)
ret i16 %2
}
long long r16(void *x) { return *(long long *)(x + 32752); }


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

x86 assembly (clang, -O2):
<r16>:
mov    0x7ff0(%rdi),%rax
ret

LLVM IR (-O0):
define i64 @r16(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 32752
%5 = bitcast i8* %4 to i64*
%6 = load i64, i64* %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @r16(i8* nocapture %0) {
%2 = getelementptr i8, i8* %0, i64 32752
%3 = bitcast i8* %2 to i64*
%4 = load i64, i64* %3
ret i64 %4
}
/* Type definitions */
typedef scalar_t__ pthread_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, long, unsigned long);
int /*<<< orphan*/ pthread_exit(int /*<<< orphan*/ *);
scalar_t__ pthread_self();
void *PrintID(void *arg) {
  long int number = (long int)arg;
  pthread_t tid = pthread_self();
  printf("TID %ld=  %lu.\n", number, (long unsigned int)tid);
  pthread_exit(NULL);
}


x86 assembly (clang, -O0):
<PrintID>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <pthread_self@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1040 <pthread_exit@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrintID>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1050 <pthread_self@plt>
lea    0xebe(%rip),%rdi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1030 <printf@plt>
xor    %edi,%edi
pop    %rbx
jmp    1040 <pthread_exit@plt>

LLVM IR (-O0):
@.str = [16 x i8] c"TID %ld= %lu.\0A\00"
define i8* @PrintID(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = ptrtoint i8* %6 to i64
store i64 %7, i64* %4
%8 = call i64 (...) @pthread_self()
store i64 %8, i64* %5
%9 = load i64, i64* %4
%10 = load i64, i64* %5
%11 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %9, i64 %10)
%12 = call i32 @pthread_exit(i32* null)
%13 = load i8*, i8** %2
ret i8* %13
}

LLVM IR (-O2):
@.str = [16 x i8] c"TID %ld= %lu.\0A\00"
define noalias i8* @PrintID(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = tail call i64 (...) @pthread_self()
%4 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i64 %2, i64 %3)
%5 = tail call i32 @pthread_exit(i32* null)
ret i8* undef
}
/* Type definitions */
struct fins_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ fins_command(struct fins_t *, int, int, int const, int const,
                                int const, int const, unsigned short const *,
                                int /*<<< orphan*/, int /*<<< orphan*/ *);
int fins_write(struct fins_t *c, const int type, const int from, const int nb,
               const short unsigned int *iData) {
  fins_command(c, 1, 2, type, from, nb, nb, iData, 0, NULL);
  return nb;
}


x86 assembly (clang, -O0):
<fins_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
mov    -0x14(%rbp),%r9d
mov    -0x14(%rbp),%r10d
mov    -0x20(%rbp),%rax
mov    $0x1,%esi
mov    $0x2,%edx
xor    %r11d,%r11d
xor    %r11d,%r11d
mov    %r10d,(%rsp)
mov    %rax,0x8(%rsp)
movl   $0x0,0x10(%rsp)
movq   $0x0,0x18(%rsp)
call   1030 <fins_command@plt>
mov    -0x14(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fins_write>:
push   %rbx
mov    %r8,%rax
mov    %ecx,%ebx
mov    %edx,%r8d
mov    %esi,%ecx
mov    $0x1,%esi
mov    $0x2,%edx
mov    %ebx,%r9d
push   $0x0
push   $0x0
push   %rax
push   %rbx
call   1030 <fins_command@plt>
add    $0x20,%rsp
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.fins_t = type { i32 }
define i32 @fins_write(%struct.fins_t* %0, i32 %1, i32 %2, i32 %3, i16* %4) {
%6 = alloca %struct.fins_t*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i16*
store %struct.fins_t* %0, %struct.fins_t** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i16* %4, i16** %10
%11 = load %struct.fins_t*, %struct.fins_t** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = load i32, i32* %9
%15 = load i32, i32* %9
%16 = load i16*, i16** %10
%17 = call i32 @fins_command(%struct.fins_t* %11, i32 1, i32 2, i32 %12, i32 %13, i32 %14, i32 %15, i16* %16, i32 0, i32* null)
%18 = load i32, i32* %9
ret i32 %18
}

LLVM IR (-O2):
%struct.fins_t = type { i32 }
define i32 @fins_write(%struct.fins_t* %0, i32 %1, i32 %2, i32 returned %3, i16* %4) {
%6 = tail call i32 @fins_command(%struct.fins_t* %0, i32 1, i32 2, i32 %1, i32 %2, i32 %3, i32 %3, i16* %4, i32 0, i32* null)
ret i32 %3
}
void chemo_periodic(void) {}


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

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

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

LLVM IR (-O2):
define void @chemo_periodic() {
ret void
}
int asm_test_bit(int nr, const volatile unsigned long *addr) {
  int oldbit;
  __asm__ __volatile__("btl %2,%1\n\tsbbl %0,%0"
                       : "=r"(oldbit)
                       : "m"((*(volatile long *)addr)), "Ir"(nr));
  return oldbit;
}


x86 assembly (clang, -O0):
<asm_test_bit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x4(%rbp),%ecx
bt     %ecx,(%rax)
sbb    %eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<asm_test_bit>:
bt     %edi,(%rsi)
sbb    %eax,%eax
ret

LLVM IR (-O0):
define i32 @asm_test_bit(i32 %0, i64* %1) {
%3 = alloca i32
%4 = alloca i64*
%5 = alloca i32
store i32 %0, i32* %3
store i64* %1, i64** %4
%6 = load i64*, i64** %4
%7 = load i32, i32* %3
%8 = call i32 asm sideeffect "btl $2,$1\0A\09sbbl $0,$0", "=r,*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %6, i32 %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
define i32 @asm_test_bit(i32 %0, i64* %1) {
%3 = tail call i32 asm sideeffect "btl $2,$1\0A\09sbbl $0,$0", "=r,*m,Ir,~{dirflag},~{fpsr},~{flags}"(i64* elementtype(i64) %1, i32 %0)
ret i32 %3
}
/* Type definitions */
struct in_addr {
  int s_addr;
};

/* Variables and functions */
int is_same_net(struct in_addr a, struct in_addr b, struct in_addr mask) {
  return (a.s_addr & mask.s_addr) == (b.s_addr & mask.s_addr);
}


x86 assembly (clang, -O0):
<is_same_net>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%eax
and    -0x18(%rbp),%eax
mov    -0x10(%rbp),%ecx
and    -0x18(%rbp),%ecx
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_same_net>:
xor    %esi,%edi
xor    %eax,%eax
test   %edx,%edi
sete   %al
ret

LLVM IR (-O0):
%struct.in_addr = type { i32 }
define i32 @is_same_net(i32 %0, i32 %1, i32 %2) {
%4 = alloca %struct.in_addr
%5 = alloca %struct.in_addr
%6 = alloca %struct.in_addr
%7 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %4, i32 0, i32 0
store i32 %0, i32* %7
%8 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %5, i32 0, i32 0
store i32 %1, i32* %8
%9 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
store i32 %2, i32* %9
%10 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%13 = load i32, i32* %12
%14 = and i32 %11, %13
%15 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %5, i32 0, i32 0
%16 = load i32, i32* %15
%17 = getelementptr inbounds %struct.in_addr, %struct.in_addr* %6, i32 0, i32 0
%18 = load i32, i32* %17
%19 = and i32 %16, %18
%20 = icmp eq i32 %14, %19
%21 = zext i1 %20 to i32
ret i32 %21
}

LLVM IR (-O2):
define i32 @is_same_net(i32 %0, i32 %1, i32 %2) {
%4 = xor i32 %1, %0
%5 = and i32 %4, %2
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ TCIFLUSH;
scalar_t__ tcflush(int, int /*<<< orphan*/);
int kiss_platform_serial_iflush(int handle) {
  if (tcflush(handle, TCIFLUSH))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<kiss_platform_serial_iflush>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2ebb(%rip),%rax
mov    (%rax),%esi
call   1030 <tcflush@plt>
cmp    $0x0,%rax
je     1142 <kiss_platform_serial_iflush+0x32>
movl   $0x0,-0x4(%rbp)
jmp    1149 <kiss_platform_serial_iflush+0x39>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kiss_platform_serial_iflush>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%esi
call   1030 <tcflush@plt>
xor    %ecx,%ecx
test   %rax,%rax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@TCIFLUSH = global i32 0
define i32 @kiss_platform_serial_iflush(i32 %0) {
%2 = load i32, i32* @TCIFLUSH
%3 = tail call i64 @tcflush(i32 %0, i32 %2)
%4 = icmp eq i64 %3, 0
%5 = zext i1 %4 to i32
ret i32 %5
}