xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ panic(char *);
int pmm_next_free();
int /*<<< orphan*/ pmm_reserve_block(int);
int pmm_reserve_next_free() {
  int free = pmm_next_free();
  if (free == -1) {
    panic("Failed to reserve more memory blocks.");
  }
  pmm_reserve_block(free);
  return free;
}


x86 assembly (clang, -O0):
<pmm_reserve_next_free>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <pmm_next_free@plt>
mov    %eax,-0x4(%rbp)
cmpl   $0xffffffff,-0x4(%rbp)
jne    1158 <pmm_reserve_next_free+0x28>
lea    0xead(%rip),%rdi
call   1030 <panic@plt>
mov    -0x4(%rbp),%edi
call   1040 <pmm_reserve_block@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmm_reserve_next_free>:
push   %rbx
xor    %eax,%eax
call   1050 <pmm_next_free@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    114b <pmm_reserve_next_free+0x1b>
lea    0xeba(%rip),%rdi
call   1030 <panic@plt>
mov    %ebx,%edi
call   1040 <pmm_reserve_block@plt>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Failed to reserve more memory blocks.\00"
define i32 @pmm_reserve_next_free() {
%1 = alloca i32
%2 = call i32 (...) @pmm_next_free()
store i32 %2, i32* %1
%3 = load i32, i32* %1
%4 = icmp eq i32 %3, -1
br i1 %4, label %5, label %7
5: ; preds = %0
%6 = call i32 @panic(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %0
%8 = load i32, i32* %1
%9 = call i32 @pmm_reserve_block(i32 %8)
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
@.str = [38 x i8] c"Failed to reserve more memory blocks.\00"
define i32 @pmm_reserve_next_free() {
%1 = tail call i32 (...) @pmm_next_free()
%2 = icmp eq i32 %1, -1
br i1 %2, label %3, label %5
3: ; preds = %0
%4 = tail call i32 @panic(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
br label %5
5: ; preds = %3, %0
%6 = tail call i32 @pmm_reserve_block(i32 %1)
ret i32 %1
}
/* Variables and functions */
int func(int);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = 5;
  printf("%d", func(x));
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
define i32 @main() {
%1 = tail call i32 @func(i32 5)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
char r4n00m_1h4r();
int h45h(const int length, char *restrict hash) {
  int iter;
  for (iter = (length - 1); iter <= 0; iter--) {
    hash[iter] = r4n00m_1h4r();
  }
  return 1;
}


x86 assembly (clang, -O0):
<h45h>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jg     1154 <h45h+0x44>
mov    $0x0,%al
call   1030 <r4n00m_1h4r@plt>
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1128 <h45h+0x18>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<h45h>:
push   %rbx
cmp    $0x1,%edi
jg     113f <h45h+0x2f>
movslq %edi,%rax
lea    (%rax,%rsi,1),%rbx
add    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <r4n00m_1h4r@plt>
mov    %al,(%rbx)
add    $0xffffffffffffffff,%rbx
jmp    1130 <h45h+0x20>
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @h45h(i32 %0, i8* noalias nocapture writeonly %1) {
%3 = icmp slt i32 %0, 2
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = sext i32 %0 to i64
br label %6
6: ; preds = %6, %4
%7 = phi i64 [ %5, %4 ], [ %8, %6 ]
%8 = add i64 %7, -1
%9 = tail call signext i8 (...) @r4n00m_1h4r()
%10 = getelementptr inbounds i8, i8* %1, i64 %8
store i8 %9, i8* %10
br label %6
11: ; preds = %2
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
void display_machine_message(char *message) { printf("MSG: %s\n", message); }


x86 assembly (clang, -O0):
<display_machine_message>:
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):
<display_machine_message>:
mov    %rdi,%rsi
lea    0xee6(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"MSG: %s\0A\00"
define void @display_machine_message(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"MSG: %s\0A\00"
define void @display_machine_message(i8* %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int test_absVal(int x) { return (x < 0) ? -x : x; }


x86 assembly (clang, -O0):
<test_absVal>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    111e <test_absVal+0x1e>
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    1124 <test_absVal+0x24>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_absVal>:
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
ret

LLVM IR (-O0):
define i32 @test_absVal(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = sub nsw i32 0, %6
br label %10
8: ; preds = %1
%9 = load i32, i32* %2
br label %10
10: ; preds = %8, %5
%11 = phi i32 [ %7, %5 ], [ %9, %8 ]
ret i32 %11
}

LLVM IR (-O2):
define i32 @test_absVal(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
__attribute__((no)) unsigned int foo4(int x) { return x; }


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

x86 assembly (clang, -O2):
<foo4>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @foo4(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ f(int);
int main() {
  f(1);
  f(2);
  assert(0);
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 1)
%2 = tail call i32 @f(i32 2)
%3 = tail call i32 @assert(i32 0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, double);
int /*<<< orphan*/ scanf(char *, double *);
int main(void) {
  double quarts;
  scanf("%lf", &quarts);
  printf("%g\n", quarts * 950 / 3.0e-23);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movsd  0xec1(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  0xeac(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xeb5(%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    %rsp,%rsi
call   1040 <scanf@plt>
movsd  (%rsp),%xmm0
mulsd  0xec3(%rip),%xmm0
divsd  0xec3(%rip),%xmm0
lea    0xec8(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
store i32 0, i32* %1
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %2)
%4 = load double, double* %2
%5 = fmul double %4, 9.500000e+02
%6 = fdiv double %5, 3.000000e-23
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %6)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, 9.500000e+02
%6 = fdiv double %5, 3.000000e-23
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %6)
ret i32 0
}
/* Variables and functions */
int core11_swap(char *, int);
int U_EMRPAINTRGN_swap(char *record, int torev) {
  return (core11_swap(record, torev));
}


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

x86 assembly (clang, -O2):
<U_EMRPAINTRGN_swap>:
jmp    1030 <core11_swap@plt>

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

LLVM IR (-O2):
define i32 @U_EMRPAINTRGN_swap(i8* %0, i32 %1) {
%3 = tail call i32 @core11_swap(i8* %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int max(int, int);
int g(int x, int y) { return max(~x, ~y); }


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

x86 assembly (clang, -O2):
<g>:
not    %edi
not    %esi
jmp    1030 <max@plt>

LLVM IR (-O0):
define i32 @g(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 = xor i32 %5, -1
%7 = load i32, i32* %4
%8 = xor i32 %7, -1
%9 = call i32 @max(i32 %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @g(i32 %0, i32 %1) {
%3 = xor i32 %0, -1
%4 = xor i32 %1, -1
%5 = tail call i32 @max(i32 %3, i32 %4)
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ devide(int, int);
void main() { devide(1, 2); }


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

x86 assembly (clang, -O2):
<main>:
mov    $0x1,%edi
mov    $0x2,%esi
jmp    1030 <devide@plt>

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

LLVM IR (-O2):
define void @main() {
%1 = tail call i32 @devide(i32 1, i32 2)
ret void
}
int __attribute((fastcall)) fastcall(int x, int y, int z) { return x + y + z; }


x86 assembly (clang, -O0):
<fastcall>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x4(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fastcall>:
lea    (%rdi,%rsi,1),%eax
add    %edx,%eax
ret

LLVM IR (-O0):
define i32 @fastcall(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = add nsw i32 %7, %8
%10 = load i32, i32* %6
%11 = add nsw i32 %9, %10
ret i32 %11
}

LLVM IR (-O2):
define i32 @fastcall(i32 %0, i32 %1, i32 %2) {
%4 = add nsw i32 %1, %0
%5 = add nsw i32 %4, %2
ret i32 %5
}
int StringLength(char *String) {
  int i;
  i = 0;
  while (String[i] != '\0')
    i++;
  return i;
}


x86 assembly (clang, -O0):
<StringLength>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1132 <StringLength+0x32>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    110f <StringLength+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<StringLength>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpb   $0x0,(%rdi)
lea    0x1(%rdi),%rdi
jne    1110 <StringLength+0x10>
ret

LLVM IR (-O0):
define i32 @StringLength(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %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 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @StringLength(i8* nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %7, %2 ], [ 0, %1 ]
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
%6 = icmp eq i8 %5, 0
%7 = add nuw i64 %3, 1
br i1 %6, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %3 to i32
ret i32 %9
}
/* Variables and functions */
char *ft_itoa(int);
int /*<<< orphan*/ ft_putstr_fd(char *, int);
int /*<<< orphan*/ ft_strdel(char **);
void ft_putnbr_fd(int n, int fd) {
  char *str;
  str = ft_itoa(n);
  ft_putstr_fd(str, fd);
  ft_strdel(&str);
}


x86 assembly (clang, -O0):
<ft_putnbr_fd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <ft_itoa@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <ft_putstr_fd@plt>
lea    -0x10(%rbp),%rdi
call   1040 <ft_strdel@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_putnbr_fd>:
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
call   1030 <ft_itoa@plt>
mov    %rax,0x8(%rsp)
mov    %rax,%rdi
mov    %ebx,%esi
call   1050 <ft_putstr_fd@plt>
lea    0x8(%rsp),%rdi
call   1040 <ft_strdel@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = call i8* @ft_itoa(i32 %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = load i32, i32* %4
%10 = call i32 @ft_putstr_fd(i8* %8, i32 %9)
%11 = call i32 @ft_strdel(i8** %5)
ret void
}

LLVM IR (-O2):
define void @ft_putnbr_fd(i32 %0, i32 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
%5 = tail call i8* @ft_itoa(i32 %0)
store i8* %5, i8** %3
%6 = tail call i32 @ft_putstr_fd(i8* %5, i32 %1)
%7 = call i32 @ft_strdel(i8** %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void print_footer(void) { printf("\n"); }


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

x86 assembly (clang, -O2):
<print_footer>:
mov    $0xa,%edi
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print_footer() {
%1 = tail call i32 @putchar(i32 10)
ret void
}
/* Variables and functions */
unsigned short **__ctype_b_loc();
int /*<<< orphan*/ __softboundmpx_store_return_metadata(void *, void *);
__attribute__((__weak__, __always___)) unsigned short const **
softboundmpx___ctype_b_loc(void) {
  unsigned short const **ret_ptr = __ctype_b_loc();
  __softboundmpx_store_return_metadata(
      (void *)ret_ptr, (void *)((char *)ret_ptr + sizeof(int *)));
  return ret_ptr;
}


x86 assembly (clang, -O0):
<softboundmpx___ctype_b_loc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <__ctype_b_loc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
add    $0x8,%rsi
call   1030 <__softboundmpx_store_return_metadata@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<softboundmpx___ctype_b_loc>:
push   %rbx
xor    %eax,%eax
call   1040 <__ctype_b_loc@plt>
mov    %rax,%rbx
lea    0x8(%rax),%rsi
mov    %rax,%rdi
call   1030 <__softboundmpx_store_return_metadata@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define weak i16** @softboundmpx___ctype_b_loc() {
%1 = alloca i16**
%2 = call i16** (...) @__ctype_b_loc()
store i16** %2, i16*** %1
%3 = load i16**, i16*** %1
%4 = bitcast i16** %3 to i8*
%5 = load i16**, i16*** %1
%6 = bitcast i16** %5 to i8*
%7 = getelementptr inbounds i8, i8* %6, i64 8
%8 = call i32 @__softboundmpx_store_return_metadata(i8* %4, i8* %7)
%9 = load i16**, i16*** %1
ret i16** %9
}

LLVM IR (-O2):
define weak i16** @softboundmpx___ctype_b_loc() {
%1 = tail call i16** (...) @__ctype_b_loc()
%2 = bitcast i16** %1 to i8*
%3 = getelementptr inbounds i16*, i16** %1, i64 1
%4 = bitcast i16** %3 to i8*
%5 = tail call i32 @__softboundmpx_store_return_metadata(i8* %2, i8* %4)
ret i16** %1
}
/* Type definitions */
struct timeval {
  int tv_usec;
  int tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
int /*<<< orphan*/ srand(int);
int /*<<< orphan*/ usleep(int);
void init_seed_srand(void) {
  struct timeval t;
  usleep(10);
  gettimeofday(&t, NULL);
  srand(t.tv_usec * t.tv_sec);
}


x86 assembly (clang, -O0):
<init_seed_srand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0xa,%edi
call   1050 <usleep@plt>
lea    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
mov    -0x8(%rbp),%edi
imul   -0x4(%rbp),%edi
call   1040 <srand@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_seed_srand>:
push   %rax
mov    $0xa,%edi
call   1050 <usleep@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
mov    0x4(%rsp),%edi
imul   (%rsp),%edi
pop    %rax
jmp    1040 <srand@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define void @init_seed_srand() {
%1 = alloca %struct.timeval
%2 = call i32 @usleep(i32 10)
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%7 = load i32, i32* %6
%8 = mul nsw i32 %5, %7
%9 = call i32 @srand(i32 %8)
ret void
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define void @init_seed_srand() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = tail call i32 @usleep(i32 10)
%4 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%5 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%6 = load i32, i32* %5
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = mul nsw i32 %8, %6
%10 = tail call i32 @srand(i32 %9)
ret void
}
/* Variables and functions */
unsigned long long getReverse(unsigned long long);
unsigned long long int createReverseCompliment(unsigned long long int kmer) {
  unsigned long long int reverse;
  unsigned long long int reverseCompliment;
  reverse = getReverse(kmer);
  reverseCompliment = ~(reverse);
  return reverseCompliment << 2;
}


x86 assembly (clang, -O0):
<createReverseCompliment>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <getReverse@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
xor    $0xffffffffffffffff,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
shl    $0x2,%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createReverseCompliment>:
push   %rax
call   1030 <getReverse@plt>
not    %rax
shl    $0x2,%rax
pop    %rcx
ret

LLVM IR (-O0):
define i64 @createReverseCompliment(i64 %0) {
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call i64 @getReverse(i64 %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = xor i64 %7, -1
store i64 %8, i64* %4
%9 = load i64, i64* %4
%10 = shl i64 %9, 2
ret i64 %10
}

LLVM IR (-O2):
define i64 @createReverseCompliment(i64 %0) {
%2 = tail call i64 @getReverse(i64 %0)
%3 = xor i64 %2, -1
%4 = shl i64 %3, 2
ret i64 %4
}
void freeFileArgs(char **args) {
  char **a;
  for (a = args; *a; a++)
    free(*a);
  free(args);
}


x86 assembly (clang, -O0):
<freeFileArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     114f <freeFileArgs+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x10(%rbp)
jmp    1124 <freeFileArgs+0x14>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<freeFileArgs>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rdi
test   %rdi,%rdi
je     1141 <freeFileArgs+0x31>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1130 <freeFileArgs+0x20>
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @freeFileArgs(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = icmp eq i8* %2, null
br i1 %3, label %10, label %4
4: ; preds = %1, %4
%5 = phi i8* [ %8, %4 ], [ %2, %1 ]
%6 = phi i8** [ %7, %4 ], [ %0, %1 ]
tail call void @free(i8* %5)
%7 = getelementptr inbounds i8*, i8** %6, i64 1
%8 = load i8*, i8** %7
%9 = icmp eq i8* %8, null
br i1 %9, label %10, label %4
10: ; preds = %4, %1
%11 = bitcast i8** %0 to i8*
tail call void @free(i8* %11)
ret void
}
int g(a) {
  int x;
  a = 55;
  if (a > 0)
    x = a + 22;
  else
    x = a - 22;
  return x;
}


x86 assembly (clang, -O0):
<g>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x37,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jle    1126 <g+0x26>
mov    -0x4(%rbp),%eax
add    $0x16,%eax
mov    %eax,-0x8(%rbp)
jmp    112f <g+0x2f>
mov    -0x4(%rbp),%eax
sub    $0x16,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @g(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 55, i32* %2
%4 = load i32, i32* %2
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i32, i32* %2
%8 = add nsw i32 %7, 22
store i32 %8, i32* %3
br label %12
9: ; preds = %1
%10 = load i32, i32* %2
%11 = sub nsw i32 %10, 22
store i32 %11, i32* %3
br label %12
12: ; preds = %9, %6
%13 = load i32, i32* %3
ret i32 %13
}

LLVM IR (-O2):
define i32 @g(i32 %0) {
ret i32 77
}
void buzzer_init(void) {
  (*(volatile unsigned *)0x56000010) &= ~3;
  (*(volatile unsigned *)0x56000010) |= 1;
  (*(volatile unsigned *)0x56000014) &= ~1;
}


x86 assembly (clang, -O0):
<buzzer_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x56000010,%eax
mov    (%rax),%ecx
and    $0xfffffffc,%ecx
mov    $0x56000010,%eax
mov    %ecx,(%rax)
mov    $0x56000010,%eax
mov    (%rax),%ecx
or     $0x1,%ecx
mov    $0x56000010,%eax
mov    %ecx,(%rax)
mov    $0x56000014,%eax
mov    (%rax),%ecx
and    $0xfffffffe,%ecx
mov    $0x56000014,%eax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<buzzer_init>:
andl   $0xfffffffc,0x56000010
fc
orl    $0x1,0x56000010
01
andl   $0xfffffffe,0x56000014
fe
ret

LLVM IR (-O0):
define void @buzzer_init() {
%1 = load volatile i32, i32* inttoptr (i64 1442840592 to i32*)
%2 = and i32 %1, -4
store volatile i32 %2, i32* inttoptr (i64 1442840592 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 1442840592 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 1442840592 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 1442840596 to i32*)
%6 = and i32 %5, -2
store volatile i32 %6, i32* inttoptr (i64 1442840596 to i32*)
ret void
}

LLVM IR (-O2):
define void @buzzer_init() {
%1 = load volatile i32, i32* inttoptr (i64 1442840592 to i32*)
%2 = and i32 %1, -4
store volatile i32 %2, i32* inttoptr (i64 1442840592 to i32*)
%3 = load volatile i32, i32* inttoptr (i64 1442840592 to i32*)
%4 = or i32 %3, 1
store volatile i32 %4, i32* inttoptr (i64 1442840592 to i32*)
%5 = load volatile i32, i32* inttoptr (i64 1442840596 to i32*)
%6 = and i32 %5, -2
store volatile i32 %6, i32* inttoptr (i64 1442840596 to i32*)
ret void
}
/* Variables and functions */
int add_zero(int);
int two_unspec();
int fib(int fib_num) {
  if (fib_num > 3)
    return fib(fib_num - 2) + add_zero(fib(fib_num - 1));
  else if (fib_num == 3)
    return two_unspec();
  else
    return 1;
}


x86 assembly (clang, -O0):
<fib>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jle    1174 <fib+0x44>
mov    -0x8(%rbp),%edi
sub    $0x2,%edi
call   1050 <fib@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
sub    $0x1,%edi
call   1050 <fib@plt>
mov    %eax,%edi
call   1040 <add_zero@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1194 <fib+0x64>
cmpl   $0x3,-0x8(%rbp)
jne    118d <fib+0x5d>
mov    $0x0,%al
call   1030 <two_unspec@plt>
mov    %eax,-0x4(%rbp)
jmp    1194 <fib+0x64>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fib>:
cmp    $0x3,%edi
jle    115f <fib+0x2f>
push   %rbp
push   %rbx
push   %rax
mov    %edi,%ebx
lea    -0x2(%rbx),%edi
call   1050 <fib@plt>
mov    %eax,%ebp
add    $0xffffffff,%ebx
mov    %ebx,%edi
call   1050 <fib@plt>
mov    %eax,%edi
call   1040 <add_zero@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    116d <fib+0x3d>
mov    $0x1,%eax
jne    116d <fib+0x3d>
xor    %eax,%eax
jmp    1030 <two_unspec@plt>
ret

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

LLVM IR (-O2):
define i32 @fib(i32 %0) {
%2 = icmp sgt i32 %0, 3
br i1 %2, label %5, label %12
3: ; preds = %14, %12, %5
%4 = phi i32 [ %11, %5 ], [ %15, %14 ], [ 1, %12 ]
ret i32 %4
5: ; preds = %1
%6 = add nsw i32 %0, -2
%7 = tail call i32 @fib(i32 %6)
%8 = add nsw i32 %0, -1
%9 = tail call i32 @fib(i32 %8)
%10 = tail call i32 @add_zero(i32 %9)
%11 = add nsw i32 %10, %7
br label %3
12: ; preds = %1
%13 = icmp eq i32 %0, 3
br i1 %13, label %14, label %3
14: ; preds = %12
%15 = tail call i32 (...) @two_unspec()
br label %3
}
/* Type definitions */
struct timeval {
  int tv_sec;
  scalar_t__ tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long long currtime_usec(void) {
  struct timeval tv;
  long long usec;
  gettimeofday(&tv, NULL);
  usec = tv.tv_sec * 1000000;
  usec += tv.tv_usec;
  return usec;
}


x86 assembly (clang, -O0):
<currtime_usec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x10(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <gettimeofday@plt>
imul   $0xf4240,-0x10(%rbp),%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<currtime_usec>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq 0x8(%rsp),%rax
imul   $0xf4240,%rax,%rax
add    0x10(%rsp),%rax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i64 }
define i64 @currtime_usec() {
%1 = alloca %struct.timeval
%2 = alloca i64
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
store i64 %7, i64* %2
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%9 = load i64, i64* %8
%10 = load i64, i64* %2
%11 = add nsw i64 %10, %9
store i64 %11, i64* %2
%12 = load i64, i64* %2
ret i64 %12
}

LLVM IR (-O2):
%struct.timeval = type { i32, i64 }
define i64 @currtime_usec() {
%1 = alloca %struct.timeval
%2 = bitcast %struct.timeval* %1 to i8*
%3 = call i32 @gettimeofday(%struct.timeval* %1, i32* null)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000000
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%9 = load i64, i64* %8
%10 = add nsw i64 %9, %7
ret i64 %10
}
int ft_iscntrl(int c) { return ((0 <= c && c < ' ') || (c == 127)); }


x86 assembly (clang, -O0):
<ft_iscntrl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmp    -0x4(%rbp),%eax
jg     1121 <ft_iscntrl+0x21>
mov    $0x1,%al
cmpl   $0x20,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     112b <ft_iscntrl+0x2b>
cmpl   $0x7f,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_iscntrl>:
cmp    $0x20,%edi
setb   %al
cmp    $0x7f,%edi
sete   %cl
or     %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @ft_iscntrl(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 0, %3
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 32
br i1 %7, label %11, label %8
8: ; preds = %5, %1
%9 = load i32, i32* %2
%10 = icmp eq i32 %9, 127
br label %11
11: ; preds = %8, %5
%12 = phi i1 [ true, %5 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @ft_iscntrl(i32 %0) {
%2 = icmp ult i32 %0, 32
%3 = icmp eq i32 %0, 127
%4 = or i1 %2, %3
%5 = zext i1 %4 to i32
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int print_version(void) {
  printf("serdi "
         "0.18.2"
         " <http://drobilla.net/software/serd>\n");
  printf("Copyright 2011-2012 David Robillard <http://drobilla.net>.\n"
         "License: <http://www.opensource.org/licenses/isc>\n"
         "This is free software; you are free to change and redistribute it."
         "\nThere is NO WARRANTY, to the extent permitted by law.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [50 x i8] c"serdi 0.18.2 <http://drobilla.net/software/serd>\0A\00"
@.str.1 = [231 x i8] c"Copyright 2011-2012 David Robillard <http://drobilla.net>.\0ALicense: <http://www.opensource.org/licenses/isc>\0AThis is free software; you are free to change and redistribute it.\0AThere is NO WARRANTY, to the extent permitted by law.\0A\00"
define i32 @print_version() {
%1 = call i32 @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([231 x i8], [231 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [49 x i8] c"serdi 0.18.2 <http://drobilla.net/software/serd>\00"
@str.2 = [230 x i8] c"Copyright 2011-2012 David Robillard <http://drobilla.net>.\0ALicense: <http://www.opensource.org/licenses/isc>\0AThis is free software; you are free to change and redistribute it.\0AThere is NO WARRANTY, to the extent permitted by law.\00"
define i32 @print_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([230 x i8], [230 x i8]* @str.2, i64 0, i64 0))
ret i32 0
}
char TestG() {
  char r;
  __asm__("cmp $0, %1" : "=@ccg"(r) : "r"(1));
  if (r) {
    __asm__("cmp $2, %1" : "=@ccng"(r) : "r"(1));
    if (r) {
      __asm__("cmp $1, %1" : "=@ccng"(r) : "r"(1));
      if (r)
        return 1;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<TestG>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%eax
cmp    $0x0,%eax
setg   %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     115f <TestG+0x5f>
mov    $0x1,%eax
cmp    $0x2,%eax
setle  %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     115a <TestG+0x5a>
mov    $0x1,%eax
cmp    $0x1,%eax
setle  %al
mov    %al,-0x2(%rbp)
cmpb   $0x0,-0x2(%rbp)
je     1155 <TestG+0x55>
movb   $0x1,-0x1(%rbp)
jmp    1163 <TestG+0x63>
jmp    115a <TestG+0x5a>
jmp    115f <TestG+0x5f>
movb   $0x0,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<TestG>:
mov    $0x1,%eax
cmp    $0x0,%eax
jle    111c <TestG+0x1c>
cmp    $0x2,%eax
jg     111c <TestG+0x1c>
mov    $0x1,%eax
cmp    $0x1,%eax
mov    $0x1,%al
jg     111c <TestG+0x1c>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define signext i8 @TestG() {
%1 = alloca i8
%2 = alloca i8
%3 = call i8 asm "cmp $$0, $1", "={@ccg},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %3, i8* %2
%4 = load i8, i8* %2
%5 = icmp ne i8 %4, 0
br i1 %5, label %6, label %17
6: ; preds = %0
%7 = call i8 asm "cmp $$2, $1", "={@ccng},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %7, i8* %2
%8 = load i8, i8* %2
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %16
10: ; preds = %6
%11 = call i8 asm "cmp $$1, $1", "={@ccng},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
store i8 %11, i8* %2
%12 = load i8, i8* %2
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i8 1, i8* %1
br label %18
15: ; preds = %10
br label %16
16: ; preds = %15, %6
br label %17
17: ; preds = %16, %0
store i8 0, i8* %1
br label %18
18: ; preds = %17, %14
%19 = load i8, i8* %1
ret i8 %19
}

LLVM IR (-O2):
define signext i8 @TestG() {
%1 = tail call i8 asm "cmp $$0, $1", "={@ccg},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%2 = icmp eq i8 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i8 asm "cmp $$2, $1", "={@ccng},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%5 = icmp eq i8 %4, 0
br i1 %5, label %9, label %6
6: ; preds = %3
%7 = tail call i8 asm "cmp $$1, $1", "={@ccng},r,~{dirflag},~{fpsr},~{flags}"(i32 1)
%8 = icmp eq i8 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %3, %6, %0
br label %10
10: ; preds = %6, %9
%11 = phi i8 [ 0, %9 ], [ 1, %6 ]
ret i8 %11
}
void clkid_decode(int clkid, int *cmu, int *reg, int *off) {
  *cmu = (((clkid) >> 10) & 0xf);
  *reg = (((clkid) >> 3) & 0x3f);
  *off = ((clkid)&0x7);
}


x86 assembly (clang, -O0):
<clkid_decode>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%ecx
sar    $0xa,%ecx
and    $0xf,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
sar    $0x3,%ecx
and    $0x3f,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x4(%rbp),%ecx
and    $0x7,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clkid_decode>:
mov    %edi,%eax
shr    $0xa,%eax
and    $0xf,%eax
mov    %eax,(%rsi)
mov    %edi,%eax
shr    $0x3,%eax
and    $0x3f,%eax
mov    %eax,(%rdx)
and    $0x7,%edi
mov    %edi,(%rcx)
ret

LLVM IR (-O0):
define void @clkid_decode(i32 %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = ashr i32 %9, 10
%11 = and i32 %10, 15
%12 = load i32*, i32** %6
store i32 %11, i32* %12
%13 = load i32, i32* %5
%14 = ashr i32 %13, 3
%15 = and i32 %14, 63
%16 = load i32*, i32** %7
store i32 %15, i32* %16
%17 = load i32, i32* %5
%18 = and i32 %17, 7
%19 = load i32*, i32** %8
store i32 %18, i32* %19
ret void
}

LLVM IR (-O2):
define void @clkid_decode(i32 %0, i32* nocapture writeonly %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = lshr i32 %0, 10
%6 = and i32 %5, 15
store i32 %6, i32* %1
%7 = lshr i32 %0, 3
%8 = and i32 %7, 63
store i32 %8, i32* %2
%9 = and i32 %0, 7
store i32 %9, i32* %3
ret void
}
__attribute__((no, noclone, used)) void _ITM_commitTransaction() { asm(""); }


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

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

LLVM IR (-O0):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ITM_commitTransaction to i8*)], section "llvm.metadata"
define void @_ITM_commitTransaction() {
ret void
}

LLVM IR (-O2):
@llvm.compiler.used = appending global [1 x i8*] [i8* bitcast (void ()* @_ITM_commitTransaction to i8*)], section "llvm.metadata"
define void @_ITM_commitTransaction() {
tail call void asm sideeffect "", "~{dirflag},~{fpsr},~{flags}"()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void handle_failure() { abort(); }


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

x86 assembly (clang, -O2):
<handle_failure>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @handle_failure() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @handle_failure() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Type definitions */
typedef int /*<<< orphan*/ ulong;
typedef int /*<<< orphan*/ uint;

/* Variables and functions */
ulong id(ulong x) { return (uint)x; }


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

x86 assembly (clang, -O2):
<id>:
mov    %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @id(i32 returned %0) {
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ memcpy(float *, float *, int);
float **new_matrix2f(int, int);
float **new_matrix2f_data(int n, int m, float *data) {
  float **X = new_matrix2f(n, m);
  memcpy(X[0], data, n * m * sizeof(float));
  return X;
}


x86 assembly (clang, -O0):
<new_matrix2f_data>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <new_matrix2f@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x4(%rbp),%eax
imul   -0x8(%rbp),%eax
cltq
shl    $0x2,%rax
mov    %eax,%edx
call   1040 <memcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<new_matrix2f_data>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %esi,%ebp
mov    %edi,%ebx
call   1030 <new_matrix2f@plt>
mov    %rax,%r15
mov    (%rax),%rdi
imul   %ebp,%ebx
shl    $0x2,%ebx
mov    %r14,%rsi
mov    %ebx,%edx
call   1040 <memcpy@plt>
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define float** @new_matrix2f_data(i32 %0, i32 %1, float* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float*
%7 = alloca float**
store i32 %0, i32* %4
store i32 %1, i32* %5
store float* %2, float** %6
%8 = load i32, i32* %4
%9 = load i32, i32* %5
%10 = call float** @new_matrix2f(i32 %8, i32 %9)
store float** %10, float*** %7
%11 = load float**, float*** %7
%12 = getelementptr inbounds float*, float** %11, i64 0
%13 = load float*, float** %12
%14 = load float*, float** %6
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = mul nsw i32 %15, %16
%18 = sext i32 %17 to i64
%19 = mul i64 %18, 4
%20 = trunc i64 %19 to i32
%21 = call i32 @memcpy(float* %13, float* %14, i32 %20)
%22 = load float**, float*** %7
ret float** %22
}

LLVM IR (-O2):
define float** @new_matrix2f_data(i32 %0, i32 %1, float* %2) {
%4 = tail call float** @new_matrix2f(i32 %0, i32 %1)
%5 = load float*, float** %4
%6 = shl i32 %0, 2
%7 = mul i32 %6, %1
%8 = tail call i32 @memcpy(float* %5, float* %2, i32 %7)
ret float** %4
}
int Get_grid_origin(void *self, int grid, double *origin) {
  if (grid == 0) {
    origin[0] = 0.0;
    origin[1] = 0.0;
  }
  return (0);
}


x86 assembly (clang, -O0):
<Get_grid_origin>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1130 <Get_grid_origin+0x30>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x8(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<Get_grid_origin>:
test   %esi,%esi
je     1107 <Get_grid_origin+0x7>
xor    %eax,%eax
ret
xorps  %xmm0,%xmm0
movups %xmm0,(%rdx)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @Get_grid_origin(i8* %0, i32 %1, double* %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca double*
store i8* %0, i8** %4
store i32 %1, i32* %5
store double* %2, double** %6
%7 = load i32, i32* %5
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %3
%10 = load double*, double** %6
%11 = getelementptr inbounds double, double* %10, i64 0
store double 0.000000e+00, double* %11
%12 = load double*, double** %6
%13 = getelementptr inbounds double, double* %12, i64 1
store double 0.000000e+00, double* %13
br label %14
14: ; preds = %9, %3
ret i32 0
}

LLVM IR (-O2):
define i32 @Get_grid_origin(i8* nocapture readnone %0, i32 %1, double* nocapture writeonly %2) {
%4 = icmp eq i32 %1, 0
br i1 %4, label %5, label %7
5: ; preds = %3
%6 = bitcast double* %2 to i8*
br label %7
7: ; preds = %5, %3
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
main() {
  int b[] = {10, 20, 30, 40, 50};
  int i;
  for (i = 0; i <= 4; i++)
    printf("\n%d", *(b + i));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x4,-0x24(%rbp)
jg     1171 <main+0x61>
movslq -0x24(%rbp),%rax
mov    -0x20(%rbp,%rax,4),%esi
lea    0xeb6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1145 <main+0x35>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"\0A%d\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 10)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 20)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 30)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 40)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 50)
ret i32 0
}
void RTGetOptPrintError(void) {}


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

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

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

LLVM IR (-O2):
define void @RTGetOptPrintError() {
ret void
}