xunge/DecIR huggingface dataset:
int vga_tryget(struct pci_dev *pdev, unsigned int rsrc) { return 0; }


x86 assembly (clang, -O0):
<vga_tryget>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.pci_dev = type opaque
define i32 @vga_tryget(%struct.pci_dev* %0, i32 %1) {
%3 = alloca %struct.pci_dev*
%4 = alloca i32
store %struct.pci_dev* %0, %struct.pci_dev** %3
store i32 %1, i32* %4
ret i32 0
}

LLVM IR (-O2):
%struct.pci_dev = type opaque
define i32 @vga_tryget(%struct.pci_dev* nocapture readnone %0, i32 %1) {
ret i32 0
}
/* Variables and functions */
int pow(int, int);
int maxXor(int l, int r) {
  int result;
  result = l ^ r;
  int i = 0;
  while (pow(2.0, (double)i) < result) {
    i += 1;
  }
  result = pow(2, i) - 1;
  return (result);
}


x86 assembly (clang, -O0):
<maxXor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
xor    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cvtsi2sdl -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%esi
mov    $0x2,%edi
call   1030 <pow@plt>
cmp    -0xc(%rbp),%eax
jge    1158 <maxXor+0x48>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112e <maxXor+0x1e>
mov    -0x10(%rbp),%esi
mov    $0x2,%edi
call   1030 <pow@plt>
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxXor>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebp
xor    %esi,%ebp
mov    $0xffffffff,%ebx
nopl   0x0(%rax)
add    $0x1,%ebx
mov    $0x2,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
cmp    %ebp,%eax
jl     1120 <maxXor+0x10>
mov    $0x2,%edi
mov    %ebx,%esi
call   1030 <pow@plt>
add    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @maxXor(i32 %0, i32 %1) {
%3 = xor i32 %1, %0
br label %4
4: ; preds = %4, %2
%5 = phi i32 [ 0, %2 ], [ %8, %4 ]
%6 = tail call i32 @pow(i32 2, i32 %5)
%7 = icmp slt i32 %6, %3
%8 = add nuw nsw i32 %5, 1
br i1 %7, label %4, label %9
9: ; preds = %4
%10 = tail call i32 @pow(i32 2, i32 %5)
%11 = add nsw i32 %10, -1
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ arr;

/* Variables and functions */
int maxSumIS(int *, int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int arr[] = {1, 101, 2, 3, 100, 4, 5};
  int n = sizeof(arr) / sizeof(arr[0]);
  printf("Sum of maximum sum increasing subsequence is %dn", maxSumIS(arr, n));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x8(%rbp)
movl   $0x7,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1040 <maxSumIS@plt>
mov    %eax,%esi
lea    0xea7(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
movups 0xee1(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1040 <maxSumIS@plt>
lea    0xecd(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.arr = [7 x i32] [i32 1, i32 101, i32 2, i32 3, i32 100, i32 4, i32 5]
@.str = [49 x i8] c"Sum of maximum sum increasing subsequence is %dn\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [7 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [7 x i32]* %2 to i8*
store i32 7, i32* %3
%5 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%6 = load i32, i32* %3
%7 = call i32 @maxSumIS(i32* %5, i32 %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %7)
ret i32 0
}

LLVM IR (-O2):
@__const.main.arr = [7 x i32] [i32 1, i32 101, i32 2, i32 3, i32 100, i32 4, i32 5]
@.str = [49 x i8] c"Sum of maximum sum increasing subsequence is %dn\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @maxSumIS(i32* %3, i32 7)
%5 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0), i32 %4)
ret i32 0
}
/* Type definitions */
typedef int int8_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int8_t sdiv8(int8_t a, int8_t b) {
  int8_t r;
  if (b == 0) {
    fprintf(stderr, "Should not happen\n");
    exit(EXIT_FAILURE);
  }
  r = a / b;
  return r;
}


x86 assembly (clang, -O0):
<sdiv8>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    115b <sdiv8+0x3b>
mov    0x2ea1(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e84(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>
mov    -0x4(%rbp),%eax
cltd
idivl  -0x8(%rbp)
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sdiv8>:
test   %esi,%esi
je     112a <sdiv8+0xa>
mov    %edi,%eax
cltd
idiv   %esi
ret
push   %rax
mov    0x2eae(%rip),%rax
mov    (%rax),%edi
lea    0xec5(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @sdiv8(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 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = call i32 @exit(i32 %11)
unreachable
13: ; preds = %2
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sdiv i32 %14, %15
store i32 %16, i32* %5
%17 = load i32, i32* %5
ret i32 %17
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Should not happen\0A\00"
@EXIT_FAILURE = global i32 0
define i32 @sdiv8(i32 %0, i32 %1) {
%3 = icmp eq i32 %1, 0
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* @EXIT_FAILURE
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = sdiv i32 %0, %1
ret i32 %10
}
/* Variables and functions */
int /*<<< orphan*/ access(int **, int);
int main() {
  int a[3][3] = {{0, 1, 2}, {3, 4, 5}, {6, 7, 8}};
  access(a, 3);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x30(%rbp),%rdi
lea    0xecd(%rip),%rsi
mov    $0x24,%edx
call   1030 <memcpy@plt>
lea    -0x30(%rbp),%rdi
mov    $0x3,%esi
call   1040 <access@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xf06(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xeeb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xecf(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x3,%esi
call   1030 <access@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [3 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5], [3 x i32] [i32 6, i32 7, i32 8]]
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = bitcast [3 x [3 x i32]]* %1 to i8*
%3 = getelementptr inbounds [3 x [3 x i32]], [3 x [3 x i32]]* %1, i64 0, i64 0
%4 = bitcast [3 x i32]* %3 to i32**
%5 = call i32 @access(i32** %4, i32 3)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [3 x [3 x i32]] [[3 x i32] [i32 0, i32 1, i32 2], [3 x i32] [i32 3, i32 4, i32 5], [3 x i32] [i32 6, i32 7, i32 8]]
define i32 @main() {
%1 = alloca [3 x [3 x i32]]
%2 = bitcast [3 x [3 x i32]]* %1 to i8*
%3 = bitcast [3 x [3 x i32]]* %1 to i32**
%4 = call i32 @access(i32** %3, i32 3)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ AbsoluteIndexedXX1(int);
int /*<<< orphan*/ LSR16(int /*<<< orphan*/, int);
void Op5EM0X1(void) { LSR16(AbsoluteIndexedXX1(3), 0xFFFFFF); }


x86 assembly (clang, -O0):
<Op5EM0X1>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3,%edi
call   1040 <AbsoluteIndexedXX1@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
call   1030 <LSR16@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<Op5EM0X1>:
push   %rax
mov    $0x3,%edi
call   1040 <AbsoluteIndexedXX1@plt>
mov    %eax,%edi
mov    $0xffffff,%esi
pop    %rax
jmp    1030 <LSR16@plt>

LLVM IR (-O0):
define void @Op5EM0X1() {
%1 = call i32 @AbsoluteIndexedXX1(i32 3)
%2 = call i32 @LSR16(i32 %1, i32 16777215)
ret void
}

LLVM IR (-O2):
define void @Op5EM0X1() {
%1 = tail call i32 @AbsoluteIndexedXX1(i32 3)
%2 = tail call i32 @LSR16(i32 %1, i32 16777215)
ret void
}
/* Type definitions */
struct rusage {
  int dummy;
};
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ waitpid(int /*<<< orphan*/, int *, int);
pid_t wait4(pid_t pid, int *status, int options, struct rusage *rusage) {
  return waitpid(pid, status, options);
}


x86 assembly (clang, -O0):
<wait4>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <waitpid@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wait4>:
jmp    1030 <waitpid@plt>

LLVM IR (-O0):
%struct.rusage = type { i32 }
define i32 @wait4(i32 %0, i32* %1, i32 %2, %struct.rusage* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca %struct.rusage*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store %struct.rusage* %3, %struct.rusage** %8
%9 = load i32, i32* %5
%10 = load i32*, i32** %6
%11 = load i32, i32* %7
%12 = call i32 @waitpid(i32 %9, i32* %10, i32 %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.rusage = type { i32 }
define i32 @wait4(i32 %0, i32* %1, i32 %2, %struct.rusage* nocapture readnone %3) {
%5 = tail call i32 @waitpid(i32 %0, i32* %1, i32 %2)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char);
void repeat_char(char c, int repeatings) {
  if (repeatings < 1) {
    repeatings = 1;
  }
  while (repeatings--) {
    printf("%c", c);
  }
}


x86 assembly (clang, -O0):
<repeat_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1132 <repeat_char+0x22>
movl   $0x1,-0x8(%rbp)
jmp    1137 <repeat_char+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     1160 <repeat_char+0x50>
lea    0xeae(%rip),%rdi
movsbl -0x1(%rbp),%esi
call   1030 <printf@plt>
jmp    1137 <repeat_char+0x27>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repeat_char>:
push   %rbp
push   %r14
push   %rbx
test   %esi,%esi
mov    $0x1,%ebp
cmovg  %esi,%ebp
movsbl %dil,%ebx
lea    0xed7(%rip),%r14
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0xffffffff,%ebp
jne    1130 <repeat_char+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @repeat_char(i8 signext %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
%4 = select i1 %3, i32 %1, i32 1
br label %5
5: ; preds = %2, %5
%6 = phi i32 [ %4, %2 ], [ %7, %5 ]
%7 = add nsw i32 %6, -1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %0)
%9 = icmp eq i32 %7, 0
br i1 %9, label %10, label %5
10: ; preds = %5
ret void
}
/* Variables and functions */
scalar_t__ isspace(char);
char *String_ltrimX(char *s) {
  while (isspace(*s))
    s++;
  return s;
}


x86 assembly (clang, -O0):
<String_ltrimX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     1143 <String_ltrimX+0x33>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    111c <String_ltrimX+0xc>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<String_ltrimX>:
push   %rbx
mov    %rdi,%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax,%rax,1)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isspace@plt>
test   %rax,%rax
jne    1120 <String_ltrimX+0x10>
mov    %rbx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i8* @String_ltrimX(i8* %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i8* [ %0, %1 ], [ %7, %2 ]
%4 = load i8, i8* %3
%5 = tail call i64 @isspace(i8 signext %4)
%6 = icmp eq i64 %5, 0
%7 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %6, label %8, label %2
8: ; preds = %2
ret i8* %3
}
/* Variables and functions */
int test_unpriv_remount(char *, int /*<<< orphan*/ *, int, int, int);
bool test_unpriv_remount_atime(int mount_flags, int invalid_flags) {
  return test_unpriv_remount("ramfs", NULL, mount_flags, mount_flags,
                             invalid_flags);
}


x86 assembly (clang, -O0):
<test_unpriv_remount_atime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edx
mov    -0x4(%rbp),%ecx
mov    -0x8(%rbp),%r8d
lea    0xed1(%rip),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <test_unpriv_remount@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_unpriv_remount_atime>:
mov    %esi,%r8d
mov    %edi,%ecx
lea    0xee4(%rip),%rdi
xor    %esi,%esi
mov    %ecx,%edx
jmp    1030 <test_unpriv_remount@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"ramfs\00"
define i32 @test_unpriv_remount_atime(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* %3
%7 = load i32, i32* %4
%8 = call i32 @test_unpriv_remount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null, i32 %5, i32 %6, i32 %7)
ret i32 %8
}

LLVM IR (-O2):
@.str = [6 x i8] c"ramfs\00"
define i32 @test_unpriv_remount_atime(i32 %0, i32 %1) {
%3 = tail call i32 @test_unpriv_remount(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32* null, i32 %0, i32 %0, i32 %1)
ret i32 %3
}
void zone_ctor_no_zero(void *arg) {}


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

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

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

LLVM IR (-O2):
define void @zone_ctor_no_zero(i8* nocapture %0) {
ret void
}
double logistic(double x, double r) { return (r * x * (1.0 - x)); }


x86 assembly (clang, -O0):
<logistic>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee0(%rip),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<logistic>:
mulsd  %xmm0,%xmm1
movsd  0xef4(%rip),%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,%xmm0
ret

LLVM IR (-O0):
define double @logistic(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %4
%6 = load double, double* %3
%7 = fmul double %5, %6
%8 = load double, double* %3
%9 = fsub double 1.000000e+00, %8
%10 = fmul double %7, %9
ret double %10
}

LLVM IR (-O2):
define double @logistic(double %0, double %1) {
%3 = fmul double %0, %1
%4 = fsub double 1.000000e+00, %0
%5 = fmul double %4, %3
ret double %5
}
/* Variables and functions */
int base64_encode(char const *, int /*<<< orphan*/, char *);
int /*<<< orphan*/ strlen(char const *);
int base64_encode_str(char const *in, char *out) {
  int n = base64_encode(in, strlen(in), out);
  out[n] = 0;
  return n;
}


x86 assembly (clang, -O0):
<base64_encode_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
mov    -0x10(%rbp),%rdx
call   1040 <base64_encode@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<base64_encode_str>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %rbx,%rdi
mov    %eax,%esi
mov    %r14,%rdx
call   1040 <base64_encode@plt>
cltq
movb   $0x0,(%r14,%rax,1)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @base64_encode_str(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %0)
%4 = tail call i32 @base64_encode(i8* %0, i32 %3, i8* %1)
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8, i8* %1, i64 %5
store i8 0, i8* %6
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ DMA12_DriverIRQHandler();
__attribute__((weak)) void DMA12_IRQHandler(void) { DMA12_DriverIRQHandler(); }


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

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

LLVM IR (-O0):
define weak void @DMA12_IRQHandler() {
%1 = call i32 (...) @DMA12_DriverIRQHandler()
ret void
}

LLVM IR (-O2):
define weak void @DMA12_IRQHandler() {
%1 = tail call i32 (...) @DMA12_DriverIRQHandler()
ret void
}
unsigned int call_unload(unsigned int descriptor) { return 0; }


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

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

LLVM IR (-O0):
define i32 @call_unload(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 0
}

LLVM IR (-O2):
define i32 @call_unload(i32 %0) {
ret i32 0
}
/* Variables and functions */
scalar_t__ malloc(int);
int /*<<< orphan*/ memcpy(char *, char const *, int);
char *soundio_str_dupe(const char *str, int str_len) {
  char *out = ((char *)malloc((str_len + 1) * sizeof(char)));
  if (!out)
    return NULL;
  memcpy(out, str, str_len);
  out[str_len] = 0;
  return out;
}


x86 assembly (clang, -O0):
<soundio_str_dupe>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    115e <soundio_str_dupe+0x3e>
movq   $0x0,-0x8(%rbp)
jmp    1182 <soundio_str_dupe+0x62>
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <memcpy@plt>
mov    -0x20(%rbp),%rax
movslq -0x14(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<soundio_str_dupe>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
lea    0x1(%r14),%edi
call   1040 <malloc@plt>
test   %rax,%rax
je     1153 <soundio_str_dupe+0x33>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r15,%rsi
mov    %r14d,%edx
call   1030 <memcpy@plt>
movslq %r14d,%rax
movb   $0x0,(%rbx,%rax,1)
jmp    1155 <soundio_str_dupe+0x35>
xor    %ebx,%ebx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i8* @soundio_str_dupe(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i64 @malloc(i32 %3)
%5 = inttoptr i64 %4 to i8*
%6 = icmp eq i64 %4, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = tail call i32 @memcpy(i8* %5, i8* %0, i32 %1)
%9 = sext i32 %1 to i64
%10 = getelementptr inbounds i8, i8* %5, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %2, %7
%12 = phi i8* [ %5, %7 ], [ null, %2 ]
ret i8* %12
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
uint32_t himult32(void *p) {
  uintptr_t k = ((uintptr_t)(p));
  return (uint32_t)k * 2654435761;
}


x86 assembly (clang, -O0):
<himult32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cltq
movabs $0x9e3779b1,%rcx
imul   %rcx,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<himult32>:
imul   $0x9e3779b1,%edi,%eax
ret

LLVM IR (-O0):
define i32 @himult32(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = ptrtoint i8* %4 to i64
store i64 %5, i64* %3
%6 = load i64, i64* %3
%7 = trunc i64 %6 to i32
%8 = sext i32 %7 to i64
%9 = mul nsw i64 %8, 2654435761
%10 = trunc i64 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
define i32 @himult32(i8* %0) {
%2 = ptrtoint i8* %0 to i64
%3 = trunc i64 %2 to i32
%4 = mul i32 %3, -1640531535
ret i32 %4
}
float signx(float x) {
  float sgn;
  if (x >= 0.) {
    sgn = 1.0;
  } else {
    sgn = -1.0;
  }
  return sgn;
}


x86 assembly (clang, -O0):
<signx>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1131 <signx+0x31>
movss  0xedd(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
jmp    113e <signx+0x3e>
movss  0xec7(%rip),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<signx>:
xorps  %xmm1,%xmm1
xor    %eax,%eax
ucomiss %xmm1,%xmm0
setb   %al
lea    0xeee(%rip),%rcx
movss  (%rcx,%rax,4),%xmm0
ret

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

LLVM IR (-O2):
define float @signx(float %0) {
%2 = fcmp ult float %0, 0.000000e+00
%3 = select i1 %2, float -1.000000e+00, float 1.000000e+00
ret float %3
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int x = 10, y = 20;
  x = x + y;
  printf("value of x: %d", x);
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [15 x i8] c"value of x: %d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 30)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void show_usage(char *name) {
  printf("Usage: %s\tget (begin|end|step|delimiter)\n"
         "\t\tset delimiter <delimiter>\n",
         name);
}


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

x86 assembly (clang, -O2):
<show_usage>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [70 x i8] c"Usage: %s\09get (begin|end|step|delimiter)\0A\09\09set delimiter <delimiter>\0A\00"
define void @show_usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [70 x i8] c"Usage: %s\09get (begin|end|step|delimiter)\0A\09\09set delimiter <delimiter>\0A\00"
define void @show_usage(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ f(int, int);
int main() { f(1, 2); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
mov    $0x2,%esi
call   1030 <f@plt>
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @f(i32 1, i32 2)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1, i32 2)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ putchar(char const);
int puts(const char *str) {
  int i = 0;
  while (str[i])
    putchar(str[i++]);
  putchar('\r');
  putchar('\n');
  return i + 2;
}


x86 assembly (clang, -O0):
<puts>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     1155 <puts+0x45>
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0xc(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <putchar@plt>
jmp    1123 <puts+0x13>
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<puts>:
push   %r14
push   %rbx
push   %rax
mov    (%rdi),%al
test   %al,%al
je     114a <puts+0x3a>
mov    %rdi,%r14
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl %al,%edi
call   1030 <putchar@plt>
movzbl (%r14,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <puts+0x20>
add    $0x1,%ebx
jmp    114f <puts+0x3f>
mov    $0x2,%ebx
mov    $0xd,%edi
call   1030 <putchar@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @puts(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %15, label %4
4: ; preds = %1, %4
%5 = phi i64 [ %7, %4 ], [ 0, %1 ]
%6 = phi i8 [ %10, %4 ], [ %2, %1 ]
%7 = add nuw i64 %5, 1
%8 = tail call i32 @putchar(i8 signext %6)
%9 = getelementptr inbounds i8, i8* %0, i64 %7
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %4
%13 = trunc i64 %7 to i32
%14 = add i32 %13, 2
br label %15
15: ; preds = %12, %1
%16 = phi i32 [ 2, %1 ], [ %14, %12 ]
%17 = tail call i32 @putchar(i8 signext 13)
%18 = tail call i32 @putchar(i8 signext 10)
ret i32 %16
}
void SPIFIFOLevelGet(unsigned long ulBase, unsigned long *pulTxLevel,
                     unsigned long *pulRxLevel) {
  unsigned long ulRegVal;
  ulRegVal = (*((volatile unsigned long *)(ulBase + 0x0000017C)));
  *pulTxLevel = (ulRegVal & 0xFF);
  *pulRxLevel = ((ulRegVal >> 8) & 0xFF);
}


x86 assembly (clang, -O0):
<SPIFIFOLevelGet>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x17c(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rcx
and    $0xff,%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rcx
shr    $0x8,%rcx
and    $0xff,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<SPIFIFOLevelGet>:
mov    0x17c(%rdi),%rax
movzbl %al,%ecx
mov    %rcx,(%rsi)
movzbl %ah,%eax
mov    %rax,(%rdx)
ret

LLVM IR (-O0):
define void @SPIFIFOLevelGet(i64 %0, i64* %1, i64* %2) {
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64*
%7 = alloca i64
store i64 %0, i64* %4
store i64* %1, i64** %5
store i64* %2, i64** %6
%8 = load i64, i64* %4
%9 = add i64 %8, 380
%10 = inttoptr i64 %9 to i64*
%11 = load volatile i64, i64* %10
store i64 %11, i64* %7
%12 = load i64, i64* %7
%13 = and i64 %12, 255
%14 = load i64*, i64** %5
store i64 %13, i64* %14
%15 = load i64, i64* %7
%16 = lshr i64 %15, 8
%17 = and i64 %16, 255
%18 = load i64*, i64** %6
store i64 %17, i64* %18
ret void
}

LLVM IR (-O2):
define void @SPIFIFOLevelGet(i64 %0, i64* nocapture writeonly %1, i64* nocapture writeonly %2) {
%4 = add i64 %0, 380
%5 = inttoptr i64 %4 to i64*
%6 = load volatile i64, i64* %5
%7 = and i64 %6, 255
store i64 %7, i64* %1
%8 = lshr i64 %6, 8
%9 = and i64 %8, 255
store i64 %9, i64* %2
ret void
}
/* Variables and functions */
int fce(int, int);
__attribute__((no)) int f1(int a) { return fce(a, 5) + fce(a, 7); }


x86 assembly (clang, -O0):
<f1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x5,%esi
call   1030 <fce@plt>
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x7,%esi
call   1030 <fce@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%eax
add    %ecx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f1>:
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
mov    $0x5,%esi
call   1030 <fce@plt>
mov    %eax,%ebp
mov    %ebx,%edi
mov    $0x7,%esi
call   1030 <fce@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @f1(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @fce(i32 %3, i32 5)
%5 = load i32, i32* %2
%6 = call i32 @fce(i32 %5, i32 7)
%7 = add nsw i32 %4, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @f1(i32 %0) {
%2 = tail call i32 @fce(i32 %0, i32 5)
%3 = tail call i32 @fce(i32 %0, i32 7)
%4 = add nsw i32 %3, %2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void Print_array(int A[], int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d ", A[i]);
  printf("\n");
}


x86 assembly (clang, -O0):
<Print_array>:
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    1159 <Print_array+0x49>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <Print_array+0x16>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_array>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
test   %esi,%esi
jle    1157 <Print_array+0x37>
mov    %rdi,%r15
mov    %esi,%r12d
lea    0xec7(%rip),%r14
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    (%r15,%rbx,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    1140 <Print_array+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define void @Print_array(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 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 i32*, i32** %3
%12 = load i32, i32* %5
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define void @Print_array(i32* 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 i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %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
%14 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void vohttpd_show_usage() {
  printf("usage: vohttpd [-bdhp?]\n\n");
  printf("example: vohttpd -d/var/www/html/cgi-bin/votest.so -p8080\n");
  printf("\t-b[path]  set www home/base folder, default /var/www/html.\n"
         "\t-d[path]  preload plugin.\n"
         "\t-h,-?     show this usage.\n"
         "\t-p[port]  set server listen port, default 8080.\n"
         "\n");
}


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

x86 assembly (clang, -O2):
<vohttpd_show_usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xef5(%rip),%rdi
call   1030 <puts@plt>
lea    0xf23(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [26 x i8] c"usage: vohttpd [-bdhp?]\0A\0A\00"
@.str.1 = [59 x i8] c"example: vohttpd -d/var/www/html/cgi-bin/votest.so -p8080\0A\00"
@.str.2 = [166 x i8] c"\09-b[path] set www home/base folder, default /var/www/html.\0A\09-d[path] preload plugin.\0A\09-h,-? show this usage.\0A\09-p[port] set server listen port, default 8080.\0A\0A\00"
define void @vohttpd_show_usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([166 x i8], [166 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [25 x i8] c"usage: vohttpd [-bdhp?]\0A\00"
@str.3 = [58 x i8] c"example: vohttpd -d/var/www/html/cgi-bin/votest.so -p8080\00"
@str.4 = [165 x i8] c"\09-b[path] set www home/base folder, default /var/www/html.\0A\09-d[path] preload plugin.\0A\09-h,-? show this usage.\0A\09-p[port] set server listen port, default 8080.\0A\00"
define void @vohttpd_show_usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([165 x i8], [165 x i8]* @str.4, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ FE_ALL_EXCEPT;
int /*<<< orphan*/ feclearexcept(int /*<<< orphan*/);
void dsp_util_clear_fp_exceptions() { feclearexcept(FE_ALL_EXCEPT); }


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

x86 assembly (clang, -O2):
<dsp_util_clear_fp_exceptions>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%edi
jmp    1030 <feclearexcept@plt>

LLVM IR (-O0):
@FE_ALL_EXCEPT = global i32 0
define void @dsp_util_clear_fp_exceptions() {
%1 = load i32, i32* @FE_ALL_EXCEPT
%2 = call i32 @feclearexcept(i32 %1)
ret void
}

LLVM IR (-O2):
@FE_ALL_EXCEPT = global i32 0
define void @dsp_util_clear_fp_exceptions() {
%1 = load i32, i32* @FE_ALL_EXCEPT
%2 = tail call i32 @feclearexcept(i32 %1)
ret void
}
/* Type definitions */
typedef int u_quad_t;
typedef int /*<<< orphan*/ register_t;
typedef scalar_t__ quad_t;
typedef int /*<<< orphan*/ off_t;

/* Variables and functions */
scalar_t__ BYTE_ORDER;
scalar_t__ LITTLE_ENDIAN;
scalar_t__ SYS_ftruncate;
scalar_t__ __syscall(scalar_t__, int, int /*<<< orphan*/, int /*<<< orphan*/);
int machdep_sys_ftruncate(int fd, off_t length) {
  quad_t q;
  int rv;
  q = __syscall((quad_t)SYS_ftruncate, fd, 0, length);
  if (sizeof(quad_t) == sizeof(register_t) || BYTE_ORDER == LITTLE_ENDIAN)
    rv = (int)q;
  else
    rv = (int)((u_quad_t)q >> 32);
  return rv;
}


x86 assembly (clang, -O0):
<machdep_sys_ftruncate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    0x2eb3(%rip),%rax
mov    (%rax),%rdi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%ecx
xor    %edx,%edx
call   1030 <__syscall@plt>
mov    %rax,-0x10(%rbp)
mov    0x2e90(%rip),%rax
mov    (%rax),%rax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%rax
jne    115f <machdep_sys_ftruncate+0x4f>
mov    -0x10(%rbp),%rax
mov    %eax,-0x14(%rbp)
jmp    116d <machdep_sys_ftruncate+0x5d>
mov    -0x10(%rbp),%rax
mov    $0x20,%ecx
sar    %cl,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<machdep_sys_ftruncate>:
mov    %esi,%ecx
mov    %edi,%esi
mov    0x2ec5(%rip),%rax
mov    (%rax),%rdi
xor    %edx,%edx
jmp    1030 <__syscall@plt>

LLVM IR (-O0):
@SYS_ftruncate = global i64 0
@BYTE_ORDER = global i64 0
@LITTLE_ENDIAN = global i64 0
define i32 @machdep_sys_ftruncate(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i64, i64* @SYS_ftruncate
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i64 @__syscall(i64 %7, i32 %8, i32 0, i32 %9)
store i64 %10, i64* %5
%11 = load i64, i64* @BYTE_ORDER
%12 = load i64, i64* @LITTLE_ENDIAN
%13 = icmp eq i64 %11, %12
br i1 %13, label %14, label %17
14: ; preds = %2
%15 = load i64, i64* %5
%16 = trunc i64 %15 to i32
store i32 %16, i32* %6
br label %21
17: ; preds = %2
%18 = load i64, i64* %5
%19 = trunc i64 %18 to i32
%20 = ashr i32 %19, 32
store i32 %20, i32* %6
br label %21
21: ; preds = %17, %14
%22 = load i32, i32* %6
ret i32 %22
}

LLVM IR (-O2):
@SYS_ftruncate = global i64 0
@BYTE_ORDER = global i64 0
@LITTLE_ENDIAN = global i64 0
define i32 @machdep_sys_ftruncate(i32 %0, i32 %1) {
%3 = load i64, i64* @SYS_ftruncate
%4 = tail call i64 @__syscall(i64 %3, i32 %0, i32 0, i32 %1)
%5 = trunc i64 %4 to i32
ret i32 %5
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *, char *);
int main(int argc, char const *argv[]) {
  char *y = "Hello!";
  printf("%s\n", y);
  return EXIT_SUCCESS;
}


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)
lea    0xed3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [7 x i8] c"Hello!\00"
@.str.1 = [4 x i8] c"%s\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
int test_imm_D8uint64_midword_mem(unsigned long long *val) {
  return ((*val >> 16) & (0xD8 << 0)) ? -20 : -40;
}


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

x86 assembly (clang, -O2):
<test_imm_D8uint64_midword_mem>:
testb  $0xd8,0x2(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_D8uint64_midword_mem(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = load i64, i64* %3
%5 = lshr i64 %4, 16
%6 = and i64 %5, 216
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i64
%9 = select i1 %7, i32 -20, i32 -40
ret i32 %9
}

LLVM IR (-O2):
define i32 @test_imm_D8uint64_midword_mem(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = and i64 %2, 14155776
%4 = icmp eq i64 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
void uint16ToBuf(uint16_t val, uint8_t *buf) {
  buf[0] = (val >> 8) & 0xff;
  buf[1] = (val >> 0) & 0xff;
}


x86 assembly (clang, -O0):
<uint16ToBuf>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0x8,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x0,%ecx
and    $0xff,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x4(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint16ToBuf>:
mov    %edi,%eax
movzbl %ah,%ecx
mov    %ecx,(%rsi)
movzbl %al,%eax
mov    %eax,0x4(%rsi)
ret

LLVM IR (-O0):
define void @uint16ToBuf(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 = ashr i32 %5, 8
%7 = and i32 %6, 255
%8 = load i32*, i32** %4
%9 = getelementptr inbounds i32, i32* %8, i64 0
store i32 %7, i32* %9
%10 = load i32, i32* %3
%11 = ashr i32 %10, 0
%12 = and i32 %11, 255
%13 = load i32*, i32** %4
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 %12, i32* %14
ret void
}

LLVM IR (-O2):
define void @uint16ToBuf(i32 %0, i32* nocapture writeonly %1) {
%3 = lshr i32 %0, 8
%4 = and i32 %3, 255
store i32 %4, i32* %1
%5 = and i32 %0, 255
%6 = getelementptr inbounds i32, i32* %1, i64 1
store i32 %5, i32* %6
ret void
}
void horribly_unsafe_function(void) {
  int i;
  char buf[128];
  for (i = 0; i < 1024; ++i)
    buf[i] = 0xff;
}


x86 assembly (clang, -O0):
<horribly_unsafe_function>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x400,-0x4(%rbp)
jge    1136 <horribly_unsafe_function+0x36>
movslq -0x4(%rbp),%rax
movb   $0xff,-0x90(%rbp,%rax,1)
ff
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    110f <horribly_unsafe_function+0xf>
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @horribly_unsafe_function() {
%1 = alloca i32
%2 = alloca [128 x i8]
store i32 0, i32* %1
br label %3
3: ; preds = %10, %0
%4 = load i32, i32* %1
%5 = icmp slt i32 %4, 1024
br i1 %5, label %6, label %13
6: ; preds = %3
%7 = load i32, i32* %1
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 %8
store i8 -1, i8* %9
br label %10
10: ; preds = %6
%11 = load i32, i32* %1
%12 = add nsw i32 %11, 1
store i32 %12, i32* %1
br label %3
13: ; preds = %3
ret void
}

LLVM IR (-O2):
define void @horribly_unsafe_function() {
ret void
}
double sin(double x) { return __builtin_sin(x); }


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

x86 assembly (clang, -O2):
<sin>:
ucomisd 0xef8(%rip),%xmm0
jae    1120 <sin+0x20>
movsd  0xef6(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    1120 <sin+0x20>
ret
nopl   0x0(%rax)
jmp    1120 <sin+0x20>

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

LLVM IR (-O2):
define double @sin(double %0) {
%2 = fcmp oeq double %0, 0xFFF0000000000000
%3 = fcmp oeq double %0, 0x7FF0000000000000
%4 = or i1 %3, %2
br i1 %4, label %5, label %6
5: ; preds = %1, %5
br label %5
6: ; preds = %1
ret double undef
}