xunge/DecIR huggingface dataset:
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  uint32_t a = 1;
  printf("this is a github!,%d\n", a);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xed0(%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    $0x1,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [22 x i8] c"this is a github!,%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
int *element_smaller_threads(int N, int threads) {
  if (N < threads) {
    printf("\nERROR: N must be greater then threads\n\n");
    exit(-1);
  }
}


x86 assembly (clang, -O0):
<element_smaller_threads>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1150 <element_smaller_threads+0x30>
lea    0xebf(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<element_smaller_threads>:
cmp    %esi,%edi
jl     1125 <element_smaller_threads+0x5>
ret
push   %rax
lea    0xed3(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"\0AERROR: N must be greater then threads\0A\0A\00"
define i32* @element_smaller_threads(i32 %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = load i32, i32* %5
%8 = icmp slt i32 %6, %7
br i1 %8, label %9, label %12
9: ; preds = %2
%10 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = load i32*, i32** %3
ret i32* %13
}

LLVM IR (-O2):
@str = [40 x i8] c"\0AERROR: N must be greater then threads\0A\00"
define noalias i32* @element_smaller_threads(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
br i1 %3, label %4, label %7
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 @exit(i32 -1)
unreachable
7: ; preds = %2
ret i32* undef
}
/* Variables and functions */
int /*<<< orphan*/ GyrCon(int);
int /*<<< orphan*/ SrvCon(int, int);
void OisEnaLin(void) {
  SrvCon(0x00, 0x01);
  SrvCon(0x01, 0x01);
  GyrCon(0x02);
}


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

x86 assembly (clang, -O2):
<OisEnaLin>:
push   %rax
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   1030 <SrvCon@plt>
mov    $0x2,%edi
pop    %rax
jmp    1040 <GyrCon@plt>

LLVM IR (-O0):
define void @OisEnaLin() {
%1 = call i32 @SrvCon(i32 0, i32 1)
%2 = call i32 @SrvCon(i32 1, i32 1)
%3 = call i32 @GyrCon(i32 2)
ret void
}

LLVM IR (-O2):
define void @OisEnaLin() {
%1 = tail call i32 @SrvCon(i32 0, i32 1)
%2 = tail call i32 @SrvCon(i32 1, i32 1)
%3 = tail call i32 @GyrCon(i32 2)
ret void
}
store(lval) int *lval;
{
  if (lval[1] == 0)
    putmem(lval[0]);
  else
    putstk(lval[1]);
}


x86 assembly (clang, -O0):
<store>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x0,0x4(%rax)
jne    114c <store+0x2c>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    $0x0,%al
call   1040 <putmem@plt>
jmp    115a <store+0x3a>
mov    -0x10(%rbp),%rax
mov    0x4(%rax),%edi
mov    $0x0,%al
call   1030 <putstk@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<store>:
push   %rax
mov    %rdi,%rax
mov    0x4(%rdi),%edi
test   %edi,%edi
je     1134 <store+0x14>
xor    %eax,%eax
call   1030 <putstk@plt>
pop    %rcx
ret
mov    (%rax),%edi
xor    %eax,%eax
call   1040 <putmem@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @store(i32* %0) {
%2 = alloca i32
%3 = alloca i32*
store i32* %0, i32** %3
%4 = load i32*, i32** %3
%5 = getelementptr inbounds i32, i32* %4, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %1
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = call i32 (i32, ...) bitcast (i32 (...)* @putmem to i32 (i32, ...)*)(i32 %11)
br label %18
13: ; preds = %1
%14 = load i32*, i32** %3
%15 = getelementptr inbounds i32, i32* %14, i64 1
%16 = load i32, i32* %15
%17 = call i32 (i32, ...) bitcast (i32 (...)* @putstk to i32 (i32, ...)*)(i32 %16)
br label %18
18: ; preds = %13, %8
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
define i32 @store(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 1
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %0
%7 = tail call i32 (i32, ...) bitcast (i32 (...)* @putmem to i32 (i32, ...)*)(i32 %6)
br label %10
8: ; preds = %1
%9 = tail call i32 (i32, ...) bitcast (i32 (...)* @putstk to i32 (i32, ...)*)(i32 %3)
br label %10
10: ; preds = %8, %5
ret i32 undef
}
int cpu_is_msm8930(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @cpu_is_msm8930() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ add_event_entry(double, int);
void add_event_stop(double dcycs) { add_event_entry(dcycs, 2); }


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

x86 assembly (clang, -O2):
<add_event_stop>:
mov    $0x2,%edi
jmp    1030 <add_event_entry@plt>

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

LLVM IR (-O2):
define void @add_event_stop(double %0) {
%2 = tail call i32 @add_event_entry(double %0, i32 2)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *);
int /*<<< orphan*/ stderr;
void print_help(const char *name) {
  fprintf(stderr, "usage: %s timeout pid\n", name);
}


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

x86 assembly (clang, -O2):
<print_help>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s timeout pid\0A\00"
define void @print_help(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"usage: %s timeout pid\0A\00"
define void @print_help(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
int ft_isdigit(int c) {
  if (c > 47 && c < 58)
    return ((int)c);
  return (-1);
}


x86 assembly (clang, -O0):
<ft_isdigit>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x2f,-0x8(%rbp)
jle    1126 <ft_isdigit+0x26>
cmpl   $0x3a,-0x8(%rbp)
jge    1126 <ft_isdigit+0x26>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    112d <ft_isdigit+0x2d>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_isdigit>:
lea    -0x30(%rdi),%eax
cmp    $0xa,%eax
mov    $0xffffffff,%eax
cmovb  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @ft_isdigit(i32 %0) {
%2 = add i32 %0, -48
%3 = icmp ult i32 %2, 10
%4 = select i1 %3, i32 %0, i32 -1
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ test_mapping_table_1();
int main(int argc, char **argv) { test_mapping_table_1(); }


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

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

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 (...) @test_mapping_table_1()
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @test_mapping_table_1()
ret i32 0
}
int goesIntoNum(int large, int small, int offset) {
  int i;
  for (i = 0; i + small + offset <= large; i += small)
    ;
  return i / small;
}


x86 assembly (clang, -O0):
<goesIntoNum>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     1139 <goesIntoNum+0x39>
jmp    112b <goesIntoNum+0x2b>
mov    -0x8(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1114 <goesIntoNum+0x14>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<goesIntoNum>:
mov    %esi,%eax
neg    %eax
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    %esi,%eax
add    %esi,%edx
cmp    %edi,%edx
jle    1110 <goesIntoNum+0x10>
cltd
idiv   %esi
ret

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

LLVM IR (-O2):
define i32 @goesIntoNum(i32 %0, i32 %1, i32 %2) {
br label %4
4: ; preds = %4, %3
%5 = phi i32 [ 0, %3 ], [ %6, %4 ]
%6 = add nsw i32 %5, %1
%7 = add nsw i32 %6, %2
%8 = icmp sgt i32 %7, %0
br i1 %8, label %9, label %4
9: ; preds = %4
%10 = sdiv i32 %5, %1
ret i32 %10
}
printk(fmt, args) char *fmt;
{ doprnt(fmt, &args); }


x86 assembly (clang, -O0):
<printk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x14(%rbp),%rsi
mov    $0x0,%al
call   1030 <doprnt@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printk>:
push   %rax
mov    %esi,0x4(%rsp)
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1030 <doprnt@plt>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @printk(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
%6 = load i8*, i8** %4
%7 = call i32 (i8*, i32*, ...) bitcast (i32 (...)* @doprnt to i32 (i8*, i32*, ...)*)(i8* %6, i32* %5)
%8 = load i32, i32* %3
ret i32 %8
}

LLVM IR (-O2):
define i32 @printk(i8* %0, i32 %1) {
%3 = alloca i32
store i32 %1, i32* %3
%4 = call i32 (i8*, i32*, ...) bitcast (i32 (...)* @doprnt to i32 (i8*, i32*, ...)*)(i8* %0, i32* %3)
ret i32 undef
}
/* Variables and functions */
int access(char *, int);
int file_exists(char *progname) { return (access(progname, 1) != -1); }


x86 assembly (clang, -O0):
<file_exists>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <access@plt>
cmp    $0xffffffff,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_exists>:
push   %rax
mov    $0x1,%esi
call   1030 <access@plt>
xor    %ecx,%ecx
cmp    $0xffffffff,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
define i32 @file_exists(i8* nocapture %0) {
%2 = tail call i32 @access(i8* %0, i32 1)
%3 = icmp ne i32 %2, -1
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
void VLAPtrAssign(int size) {
  int array[1][2][3][size][4][5];
  int(*p)[2][3][size][4][5] = array;
  int(*p2)[2][3][size][4][6] = array;
  int(*p3)[20][3][size][4][5] = array;
  int(*p4)[2][size][3][4][5] = array;
}


x86 assembly (clang, -O0):
<VLAPtrAssign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
imul   $0x1e0,%rcx,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x18(%rbp)
mov    %rax,-0x20(%rbp)
mov    %rax,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,-0x30(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @VLAPtrAssign(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [4 x [5 x i32]]*
%6 = alloca [4 x [6 x i32]]*
%7 = alloca [4 x [5 x i32]]*
%8 = alloca [3 x [4 x [5 x i32]]]*
store i32 %0, i32* %2
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %3
%12 = mul nuw i64 6, %10
%13 = alloca [4 x [5 x i32]], i64 %12
store i64 %10, i64* %4
%14 = load i32, i32* %2
%15 = zext i32 %14 to i64
store [4 x [5 x i32]]* %13, [4 x [5 x i32]]** %5
%16 = load i32, i32* %2
%17 = zext i32 %16 to i64
%18 = bitcast [4 x [5 x i32]]* %13 to [4 x [6 x i32]]*
store [4 x [6 x i32]]* %18, [4 x [6 x i32]]** %6
%19 = load i32, i32* %2
%20 = zext i32 %19 to i64
store [4 x [5 x i32]]* %13, [4 x [5 x i32]]** %7
%21 = load i32, i32* %2
%22 = zext i32 %21 to i64
%23 = bitcast [4 x [5 x i32]]* %13 to [3 x [4 x [5 x i32]]]*
store [3 x [4 x [5 x i32]]]* %23, [3 x [4 x [5 x i32]]]** %8
%24 = load i8*, i8** %3
ret void
}

LLVM IR (-O2):
define void @VLAPtrAssign(i32 %0) {
ret void
}
void __attribute__((visibility("default"))) test1(struct Test1 *v) {}


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

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

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

LLVM IR (-O2):
%struct.Test1 = type opaque
define void @test1(%struct.Test1* nocapture %0) {
ret void
}
/* Variables and functions */
int errno;
int socket_error() { return errno; }


x86 assembly (clang, -O0):
<socket_error>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ed5(%rip),%rax
mov    (%rax),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
@errno = global i32 0
define i32 @socket_error() {
%1 = load i32, i32* @errno
ret i32 %1
}

LLVM IR (-O2):
@errno = global i32 0
define i32 @socket_error() {
%1 = load i32, i32* @errno
ret i32 %1
}
double testdf(double *p) {
  if (*p > 4.1234)
    return 2.1234;
  else
    return 3.1234;
}


x86 assembly (clang, -O0):
<testdf>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  0xee8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1134 <testdf+0x34>
movsd  0xee6(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1141 <testdf+0x41>
movsd  0xecc(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<testdf>:
movsd  (%rdi),%xmm0
xor    %eax,%eax
ucomisd 0xef2(%rip),%xmm0
seta   %al
lea    0xef0(%rip),%rcx
movsd  (%rcx,%rax,8),%xmm0
ret

LLVM IR (-O0):
define double @testdf(double* %0) {
%2 = alloca double
%3 = alloca double*
store double* %0, double** %3
%4 = load double*, double** %3
%5 = load double, double* %4
%6 = fcmp ogt double %5, 4.123400e+00
br i1 %6, label %7, label %8
7: ; preds = %1
store double 2.123400e+00, double* %2
br label %9
8: ; preds = %1
store double 3.123400e+00, double* %2
br label %9
9: ; preds = %8, %7
%10 = load double, double* %2
ret double %10
}

LLVM IR (-O2):
define double @testdf(double* nocapture %0) {
%2 = load double, double* %0
%3 = fcmp ogt double %2, 4.123400e+00
%4 = select i1 %3, double 2.123400e+00, double 3.123400e+00
ret double %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_rwlockattr_t;

/* Variables and functions */
int /*<<< orphan*/ *malloc(int);
int pthread_rwlockattr_init(int /*<<< orphan*/ *);
int my_pthread_rwlockattr_init(pthread_rwlockattr_t *__attr) {
  pthread_rwlockattr_t *realattr;
  realattr = malloc(sizeof(pthread_rwlockattr_t));
  *((unsigned int *)__attr) = (unsigned int)realattr;
  return pthread_rwlockattr_init(realattr);
}


x86 assembly (clang, -O0):
<my_pthread_rwlockattr_init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <pthread_rwlockattr_init@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_pthread_rwlockattr_init>:
push   %rbx
mov    %rdi,%rbx
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %eax,(%rbx)
mov    %rax,%rdi
pop    %rbx
jmp    1030 <pthread_rwlockattr_init@plt>

LLVM IR (-O0):
define i32 @my_pthread_rwlockattr_init(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = call i32* @malloc(i32 4)
store i32* %4, i32** %3
%5 = load i32*, i32** %3
%6 = ptrtoint i32* %5 to i32
%7 = load i32*, i32** %2
store i32 %6, i32* %7
%8 = load i32*, i32** %3
%9 = call i32 @pthread_rwlockattr_init(i32* %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @my_pthread_rwlockattr_init(i32* nocapture writeonly %0) {
%2 = tail call i32* @malloc(i32 4)
%3 = ptrtoint i32* %2 to i64
%4 = trunc i64 %3 to i32
store i32 %4, i32* %0
%5 = tail call i32 @pthread_rwlockattr_init(i32* %2)
ret i32 %5
}
/* Type definitions */
typedef scalar_t__ uint8_t;
typedef int uint16_t;

/* Variables and functions */
uint16_t le_to_h_u16(const uint8_t *buf) {
  return (uint16_t)((uint16_t)buf[0] | (uint16_t)buf[1] << 8);
}


x86 assembly (clang, -O0):
<le_to_h_u16>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x8(%rbp),%rcx
mov    0x8(%rcx),%rcx
shl    $0x8,%ecx
or     %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<le_to_h_u16>:
mov    0x8(%rdi),%eax
shl    $0x8,%eax
or     (%rdi),%eax
ret

LLVM IR (-O0):
define i32 @le_to_h_u16(i64* %0) {
%2 = alloca i64*
store i64* %0, i64** %2
%3 = load i64*, i64** %2
%4 = getelementptr inbounds i64, i64* %3, i64 0
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = load i64*, i64** %2
%8 = getelementptr inbounds i64, i64* %7, i64 1
%9 = load i64, i64* %8
%10 = trunc i64 %9 to i32
%11 = shl i32 %10, 8
%12 = or i32 %6, %11
ret i32 %12
}

LLVM IR (-O2):
define i32 @le_to_h_u16(i64* nocapture %0) {
%2 = load i64, i64* %0
%3 = trunc i64 %2 to i32
%4 = getelementptr inbounds i64, i64* %0, i64 1
%5 = load i64, i64* %4
%6 = trunc i64 %5 to i32
%7 = shl i32 %6, 8
%8 = or i32 %7, %3
ret i32 %8
}
void rubysdl_quit_TTF(void) {}


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

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

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

LLVM IR (-O2):
define void @rubysdl_quit_TTF() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Exit();
void Abort(void) { Exit(); }


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

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

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

LLVM IR (-O2):
define void @Abort() {
%1 = tail call i32 (...) @Exit()
ret void
}
void clientHandle(void *params) {}


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

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

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

LLVM IR (-O2):
define void @clientHandle(i8* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ green(char *, char, double);
void move_motor(int nusteps) {
  if (nusteps == 0)
    return;
  int dir = 1;
  if (nusteps < 0) {
    dir = -1;
    nusteps = -nusteps;
  }
  do {
  } while (0);
  green("Move motor to %c%g steps\n", (dir > 0) ? '+' : '-',
        (double)nusteps / (8.));
}


x86 assembly (clang, -O0):
<move_motor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    112a <move_motor+0x1a>
jmp    1187 <move_motor+0x77>
movl   $0x1,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    114a <move_motor+0x3a>
movl   $0xffffffff,-0x8(%rbp)
xor    %eax,%eax
sub    -0x4(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <move_motor+0x3f>
jmp    1154 <move_motor+0x44>
mov    -0x8(%rbp),%edx
mov    $0x2d,%eax
mov    $0x2b,%ecx
cmp    $0x0,%edx
cmovg  %ecx,%eax
cvtsi2sdl -0x4(%rbp),%xmm0
movsd  0xe8c(%rip),%xmm1
divsd  %xmm1,%xmm0
lea    0xe89(%rip),%rdi
movsbl %al,%esi
call   1030 <green@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<move_motor>:
test   %edi,%edi
je     113c <move_motor+0x2c>
mov    %edi,%eax
neg    %eax
cmovs  %edi,%eax
cvtsi2sd %eax,%xmm0
mulsd  0xed9(%rip),%xmm0
shr    $0x1f,%edi
lea    (%rdi,%rdi,1),%esi
add    $0x2b,%esi
lea    0xed1(%rip),%rdi
jmp    1030 <green@plt>
ret

LLVM IR (-O0):
@.str = [26 x i8] c"Move motor to %c%g steps\0A\00"
define void @move_motor(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
br label %25
7: ; preds = %1
store i32 1, i32* %3
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
store i32 -1, i32* %3
%11 = load i32, i32* %2
%12 = sub nsw i32 0, %11
store i32 %12, i32* %2
br label %13
13: ; preds = %10, %7
br label %14
14: ; preds = %13
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
%17 = icmp sgt i32 %16, 0
%18 = zext i1 %17 to i64
%19 = select i1 %17, i32 43, i32 45
%20 = trunc i32 %19 to i8
%21 = load i32, i32* %2
%22 = sitofp i32 %21 to double
%23 = fdiv double %22, 8.000000e+00
%24 = call i32 @green(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8 signext %20, double %23)
br label %25
25: ; preds = %15, %6
ret void
}

LLVM IR (-O2):
@.str = [26 x i8] c"Move motor to %c%g steps\0A\00"
define void @move_motor(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = icmp slt i32 %0, 0
%5 = sub nsw i32 0, %0
%6 = select i1 %4, i8 45, i8 43
%7 = select i1 %4, i32 %5, i32 %0
%8 = sitofp i32 %7 to double
%9 = fmul double %8, 1.250000e-01
%10 = tail call i32 @green(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0), i8 signext %6, double %9)
br label %11
11: ; preds = %1, %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ askForMenuNumber(int *, int);
int /*<<< orphan*/ printMenuOptions(char **, int);
int /*<<< orphan*/ printTitle(char *);
int /*<<< orphan*/ printf(char *);
void menuSelection(int *choice, char *title, char *options[],
                   int numberOfOptions) {
  printTitle(title);
  printMenuOptions(options, numberOfOptions);
  printf("   |                                                                 "
         "       |\n");
  askForMenuNumber(choice, numberOfOptions);
}


x86 assembly (clang, -O0):
<menuSelection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <printTitle@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1060 <printMenuOptions@plt>
lea    0xe8d(%rip),%rdi
call   1040 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1050 <askForMenuNumber@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<menuSelection>:
push   %r15
push   %r14
push   %rbx
mov    %ecx,%ebx
mov    %rdx,%r14
mov    %rdi,%r15
mov    %rsi,%rdi
call   1030 <printTitle@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1060 <printMenuOptions@plt>
lea    0xe9a(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1050 <askForMenuNumber@plt>

LLVM IR (-O0):
@.str = [79 x i8] c" | |\0A\00"
define void @menuSelection(i32* %0, i8* %1, i8** %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i32
store i32* %0, i32** %5
store i8* %1, i8** %6
store i8** %2, i8*** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %6
%10 = call i32 @printTitle(i8* %9)
%11 = load i8**, i8*** %7
%12 = load i32, i32* %8
%13 = call i32 @printMenuOptions(i8** %11, i32 %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str, i64 0, i64 0))
%15 = load i32*, i32** %5
%16 = load i32, i32* %8
%17 = call i32 @askForMenuNumber(i32* %15, i32 %16)
ret void
}

LLVM IR (-O2):
@str = [78 x i8] c" | |\00"
define void @menuSelection(i32* %0, i8* %1, i8** %2, i32 %3) {
%5 = tail call i32 @printTitle(i8* %1)
%6 = tail call i32 @printMenuOptions(i8** %2, i32 %3)
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @askForMenuNumber(i32* %0, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void show_version() {
  printf("serialtrigger 0.5\n");
  exit(0);
}


x86 assembly (clang, -O0):
<show_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<show_version>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

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

LLVM IR (-O2):
@str = [18 x i8] c"serialtrigger 0.5\00"
define void @show_version() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
int isupper(int ch) { return (unsigned)ch - 'A' < 26; }


x86 assembly (clang, -O0):
<isupper>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x41,%eax
cmp    $0x1a,%eax
setb   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isupper>:
add    $0xffffffbf,%edi
xor    %eax,%eax
cmp    $0x1a,%edi
setb   %al
ret

LLVM IR (-O0):
define i32 @isupper(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = sub i32 %3, 65
%5 = icmp ult i32 %4, 26
%6 = zext i1 %5 to i32
ret i32 %6
}

LLVM IR (-O2):
define i32 @isupper(i32 %0) {
%2 = add i32 %0, -65
%3 = icmp ult i32 %2, 26
%4 = zext i1 %3 to i32
ret i32 %4
}
void ARGB4444ToUVRow_Any_NEON() {}


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

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

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

LLVM IR (-O2):
define void @ARGB4444ToUVRow_Any_NEON() {
ret void
}
/* Type definitions */
typedef scalar_t__ uint16_t;

/* Variables and functions */
scalar_t__ registers_read_word(int, int);
uint16_t timer_delta(uint16_t time_stamp) {
  uint16_t delta_time;
  uint16_t current_time = registers_read_word(0x06, 0x07);
  if (current_time > time_stamp)
    delta_time = current_time - time_stamp;
  else
    delta_time = 0xffff - (time_stamp - current_time) + 1;
  return delta_time;
}


x86 assembly (clang, -O0):
<timer_delta>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x6,%edi
mov    $0x7,%esi
call   1030 <registers_read_word@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x8(%rbp),%rax
jle    114e <timer_delta+0x3e>
mov    -0x18(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    1166 <timer_delta+0x56>
mov    -0x8(%rbp),%rcx
sub    -0x18(%rbp),%rcx
mov    $0xffff,%eax
sub    %rcx,%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timer_delta>:
push   %rbx
mov    %rdi,%rbx
mov    $0x6,%edi
mov    $0x7,%esi
call   1030 <registers_read_word@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
add    $0x10000,%rcx
sub    %rbx,%rax
cmovle %rcx,%rax
pop    %rbx
ret

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

LLVM IR (-O2):
define i64 @timer_delta(i64 %0) {
%2 = tail call i64 @registers_read_word(i32 6, i32 7)
%3 = icmp sgt i64 %2, %0
%4 = sub i64 %2, %0
%5 = add i64 %4, 65536
%6 = select i1 %3, i64 %4, i64 %5
ret i64 %6
}
void TextShutdown(void) {}


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

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

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

LLVM IR (-O2):
define void @TextShutdown() {
ret void
}
void e(int x) { int z = x; }


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

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

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

LLVM IR (-O2):
define void @e(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void bad(void) {
  fprintf(stderr, "minbzcat: data error in bz2 file\n");
  exit(EXIT_FAILURE);
}


x86 assembly (clang, -O0):
<bad>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e98(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<bad>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
call   1030 <fprintf@plt>
mov    0x2e9b(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [34 x i8] c"minbzcat: data error in bz2 file\0A\00"
@EXIT_FAILURE = global i32 0
define void @bad() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = call i32 @exit(i32 %3)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [34 x i8] c"minbzcat: data error in bz2 file\0A\00"
@EXIT_FAILURE = global i32 0
define void @bad() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_FAILURE
%4 = tail call i32 @exit(i32 %3)
unreachable
}
int getexp(unsigned int size) {
  if (size < (1 << 8)) {
    return -1;
  }
  int shift = 8;
  while (shift < 32) {
    if ((1 << shift) > size)
      break;
    shift += 1;
  }
  return shift - 1;
}


x86 assembly (clang, -O0):
<getexp>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x100,-0x8(%rbp)
jae    1120 <getexp+0x20>
movl   $0xffffffff,-0x4(%rbp)
jmp    1160 <getexp+0x60>
movl   $0x8,-0xc(%rbp)
cmpl   $0x20,-0xc(%rbp)
jge    1157 <getexp+0x57>
mov    -0xc(%rbp),%ecx
mov    $0x1,%eax
shl    %cl,%eax
cmp    -0x8(%rbp),%eax
jbe    1149 <getexp+0x49>
jmp    1157 <getexp+0x57>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <getexp+0x27>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getexp>:
mov    $0xffffffff,%eax
cmp    $0x100,%edi
jb     1133 <getexp+0x33>
mov    $0x6,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x2(%rax),%ecx
mov    %edi,%edx
shr    %cl,%edx
add    $0x1,%eax
cmp    $0x1f,%ecx
ja     1133 <getexp+0x33>
test   %edx,%edx
jne    1120 <getexp+0x20>
ret

LLVM IR (-O0):
define i32 @getexp(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = icmp ult i32 %5, 256
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 -1, i32* %2
br label %24
8: ; preds = %1
store i32 8, i32* %4
br label %9
9: ; preds = %18, %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %21
12: ; preds = %9
%13 = load i32, i32* %4
%14 = shl i32 1, %13
%15 = load i32, i32* %3
%16 = icmp ugt i32 %14, %15
br i1 %16, label %17, label %18
17: ; preds = %12
br label %21
18: ; preds = %12
%19 = load i32, i32* %4
%20 = add nsw i32 %19, 1
store i32 %20, i32* %4
br label %9
21: ; preds = %17, %9
%22 = load i32, i32* %4
%23 = sub nsw i32 %22, 1
store i32 %23, i32* %2
br label %24
24: ; preds = %21, %7
%25 = load i32, i32* %2
ret i32 %25
}

LLVM IR (-O2):
define i32 @getexp(i32 %0) {
%2 = icmp ult i32 %0, 256
br i1 %2, label %12, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %9, %3 ], [ 8, %1 ]
%5 = icmp ugt i32 %4, 31
%6 = lshr i32 %0, %4
%7 = icmp eq i32 %6, 0
%8 = select i1 %5, i1 true, i1 %7
%9 = add nuw nsw i32 %4, 1
br i1 %8, label %10, label %3
10: ; preds = %3
%11 = add nsw i32 %4, -1
br label %12
12: ; preds = %1, %10
%13 = phi i32 [ %11, %10 ], [ -1, %1 ]
ret i32 %13
}
/* Variables and functions */
int partition(int *, int, int);
void quicksort_internal(int data[], int l, int r) {
  if (r <= l) {
    return;
  }
  int i = partition(data, l, r);
  quicksort_internal(data, l, i - 1);
  quicksort_internal(data, i + 1, r);
}


x86 assembly (clang, -O0):
<quicksort_internal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1143 <quicksort_internal+0x23>
jmp    1179 <quicksort_internal+0x59>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1040 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1030 <quicksort_internal@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1030 <quicksort_internal@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<quicksort_internal>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %esi,%edx
jle    1166 <quicksort_internal+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1040 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <quicksort_internal@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <quicksort_internal+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @quicksort_internal(i32* %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %2, %1
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @quicksort_internal(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
/* Variables and functions */
int func10();
int func11() { return func10() + 1; }


x86 assembly (clang, -O0):
<func11>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <func10@plt>
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<func11>:
push   %rax
xor    %eax,%eax
call   1030 <func10@plt>
add    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @func11() {
%1 = call i32 (...) @func10()
%2 = add nsw i32 %1, 1
ret i32 %2
}

LLVM IR (-O2):
define i32 @func11() {
%1 = tail call i32 (...) @func10()
%2 = add nsw i32 %1, 1
ret i32 %2
}
void handle_loop(void) {
  static int n;
  n += 1;
}


x86 assembly (clang, -O0):
<handle_loop>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f1a(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2f11(%rip)
pop    %rbp
ret

x86 assembly (clang, -O2):
<handle_loop>:
addl   $0x1,0x2f1d(%rip)
ret

LLVM IR (-O0):
@handle_loop.n = internal global i32 0
define void @handle_loop() {
%1 = load i32, i32* @handle_loop.n
%2 = add nsw i32 %1, 1
store i32 %2, i32* @handle_loop.n
ret void
}

LLVM IR (-O2):
@handle_loop.n = internal unnamed_addr global i32 0
define void @handle_loop() {
%1 = load i32, i32* @handle_loop.n
%2 = add nsw i32 %1, 1
store i32 %2, i32* @handle_loop.n
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void main() {
  printf("AR 6 ~~");
  printf("test 2 ");
}


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

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

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

LLVM IR (-O2):
@.str = [8 x i8] c"AR 6 ~~\00"
@.str.1 = [8 x i8] c"test 2 \00"
define void @main() {
%1 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ iowrite32(unsigned int, void *);
int /*<<< orphan*/ mb();
void COM_WriteReg32(unsigned long addr, unsigned int Val) {
  iowrite32(Val, (void *)addr);
  mb();
}


x86 assembly (clang, -O0):
<COM_WriteReg32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x8(%rbp),%rsi
call   1040 <iowrite32@plt>
mov    $0x0,%al
call   1030 <mb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<COM_WriteReg32>:
push   %rax
mov    %rdi,%rax
mov    %esi,%edi
mov    %rax,%rsi
call   1040 <iowrite32@plt>
xor    %eax,%eax
pop    %rcx
jmp    1030 <mb@plt>

LLVM IR (-O0):
define void @COM_WriteReg32(i64 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
store i64 %0, i64* %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i64, i64* %3
%7 = inttoptr i64 %6 to i8*
%8 = call i32 @iowrite32(i32 %5, i8* %7)
%9 = call i32 (...) @mb()
ret void
}

LLVM IR (-O2):
define void @COM_WriteReg32(i64 %0, i32 %1) {
%3 = inttoptr i64 %0 to i8*
%4 = tail call i32 @iowrite32(i32 %1, i8* %3)
%5 = tail call i32 (...) @mb()
ret void
}
/* Variables and functions */
scalar_t__ EOF;
scalar_t__ getchar();
int /*<<< orphan*/ printf(char *, long);
main() {
  long nc = 0;
  while (getchar() != EOF) {
    ++nc;
  }
  printf("%ld\n", nc);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    0x2ea3(%rip),%rcx
cmp    (%rcx),%rax
je     115f <main+0x3f>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1137 <main+0x17>
mov    -0x10(%rbp),%rsi
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0xffffffffffffffff,%rbx
mov    0x2eb6(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
add    $0x1,%rbx
cmp    (%r14),%rax
jne    1140 <main+0x20>
lea    0xea9(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@EOF = global i64 0
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi i64 [ 0, %0 ], [ %6, %1 ]
%3 = tail call i64 (...) @getchar()
%4 = load i64, i64* @EOF
%5 = icmp eq i64 %3, %4
%6 = add nuw nsw i64 %2, 1
br i1 %5, label %7, label %1
7: ; preds = %1
%8 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
ret i32 0
}
/* Type definitions */
struct string {
  int dummy;
};

/* Variables and functions */
struct string *string_init(char *data, int len) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.string = type { i32 }
define %struct.string* @string_init(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
ret %struct.string* null
}

LLVM IR (-O2):
%struct.string = type { i32 }
define noalias %struct.string* @string_init(i8* nocapture readnone %0, i32 %1) {
ret %struct.string* null
}
unsigned int fmt_2digits(char *dest, int i) {
  dest[0] = (char)((i / 10) + '0');
  dest[1] = (char)((i % 10) + '0');
  return 2;
}


x86 assembly (clang, -O0):
<fmt_2digits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fmt_2digits>:
movslq %esi,%rax
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rcx
add    %edx,%ecx
lea    0x30(%rcx),%edx
mov    %dl,(%rdi)
add    %ecx,%ecx
lea    (%rcx,%rcx,4),%ecx
sub    %ecx,%eax
add    $0x30,%al
mov    %al,0x1(%rdi)
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @fmt_2digits(i8* %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 = sdiv i32 %5, 10
%7 = add nsw i32 %6, 48
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = srem i32 %11, 10
%13 = add nsw i32 %12, 48
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %3
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret i32 2
}

LLVM IR (-O2):
define i32 @fmt_2digits(i8* nocapture writeonly %0, i32 %1) {
%3 = sdiv i32 %1, 10
%4 = trunc i32 %3 to i8
%5 = add i8 %4, 48
store i8 %5, i8* %0
%6 = srem i32 %1, 10
%7 = trunc i32 %6 to i8
%8 = add nsw i8 %7, 48
%9 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %8, i8* %9
ret i32 2
}
/* Variables and functions */
int _plat__PhysicalPresenceAsserted() { return true; }


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

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

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

LLVM IR (-O2):
define i32 @_plat__PhysicalPresenceAsserted() {
ret i32 1
}
/* Variables and functions */
int cpass();
int /*<<< orphan*/ lpcanon(int);
lpwrite() {
  register int c;
  while ((c = cpass()) >= 0)
    lpcanon(c);
}


x86 assembly (clang, -O0):
<lpwrite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <cpass@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
jl     1148 <lpwrite+0x28>
mov    -0x8(%rbp),%edi
call   1040 <lpcanon@plt>
jmp    1128 <lpwrite+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lpwrite>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <cpass@plt>
test   %eax,%eax
js     1144 <lpwrite+0x24>
mov    %eax,%edi
call   1040 <lpcanon@plt>
jmp    1130 <lpwrite+0x10>
pop    %rcx
ret

LLVM IR (-O0):
define i32 @lpwrite() {
%1 = alloca i32
%2 = alloca i32
br label %3
3: ; preds = %6, %0
%4 = call i32 (...) @cpass()
store i32 %4, i32* %2
%5 = icmp sge i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @lpcanon(i32 %7)
br label %3
9: ; preds = %3
%10 = load i32, i32* %1
ret i32 %10
}

LLVM IR (-O2):
define i32 @lpwrite() {
%1 = tail call i32 (...) @cpass()
%2 = icmp sgt i32 %1, -1
br i1 %2, label %3, label %8
3: ; preds = %0, %3
%4 = phi i32 [ %6, %3 ], [ %1, %0 ]
%5 = tail call i32 @lpcanon(i32 %4)
%6 = tail call i32 (...) @cpass()
%7 = icmp sgt i32 %6, -1
br i1 %7, label %3, label %8
8: ; preds = %3, %0
ret i32 undef
}