xunge/DecIR huggingface dataset:
int main() {
  int cookie;
  char buf[80];
  printf("buf: %08x cookie: %08x\n", &buf, &cookie);
  gets(buf);
  if (cookie == 0x41424344)
    printf("you win!\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x8(%rbp),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1040 <gets@plt>
cmpl   $0x41424344,-0x8(%rbp)
jne    116b <main+0x4b>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x60,%rsp
lea    0xec4(%rip),%rdi
lea    0x10(%rsp),%rbx
lea    0xc(%rsp),%rdx
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <gets@plt>
cmpl   $0x41424344,0xc(%rsp)
41
jne    1170 <main+0x40>
lea    0xead(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [24 x i8] c"buf: %08x cookie: %08x\0A\00"
@.str.1 = [10 x i8] c"you win!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [80 x i8]
store i32 0, i32* %1
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), [80 x i8]* %3, i32* %2)
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %5)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 1094861636
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [24 x i8] c"buf: %08x cookie: %08x\0A\00"
@str = [9 x i8] c"you win!\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [80 x i8]
%3 = bitcast i32* %1 to i8*
%4 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), [80 x i8]* %2, i32* %1)
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @gets to i32 (i8*, ...)*)(i8* %4)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 1094861636
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %0
ret i32 0
}
/* Variables and functions */
int send(int, char const *, size_t, int);
int xsend(int s, const void *buf, size_t len, int flags) {
  return send(s, (const char *)buf, len, flags) != (int)len;
}


x86 assembly (clang, -O0):
<xsend>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <send@plt>
mov    -0x18(%rbp),%rcx
cmp    %ecx,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xsend>:
push   %rbx
mov    %rdx,%rbx
call   1030 <send@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setne  %cl
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @xsend(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32
store i32 %0, i32* %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i32 %3, i32* %8
%9 = load i32, i32* %5
%10 = load i8*, i8** %6
%11 = load i64, i64* %7
%12 = load i32, i32* %8
%13 = call i32 @send(i32 %9, i8* %10, i64 %11, i32 %12)
%14 = load i64, i64* %7
%15 = trunc i64 %14 to i32
%16 = icmp ne i32 %13, %15
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @xsend(i32 %0, i8* %1, i64 %2, i32 %3) {
%5 = tail call i32 @send(i32 %0, i8* %1, i64 %2, i32 %3)
%6 = trunc i64 %2 to i32
%7 = icmp ne i32 %5, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ output(char *);
void returning_child() { output("hello from the child! returning...\n"); }


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

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

LLVM IR (-O0):
@.str = [36 x i8] c"hello from the child! returning...\0A\00"
define void @returning_child() {
%1 = call i32 @output(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [36 x i8] c"hello from the child! returning...\0A\00"
define void @returning_child() {
%1 = tail call i32 @output(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
scalar_t__ isalnum(int);
int is_symbol_char(int ch) {
  return isalnum(ch) || ch == '-' || ch == '_' || ch == '!';
}


x86 assembly (clang, -O0):
<is_symbol_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x5(%rbp)
jne    115d <is_symbol_char+0x4d>
mov    $0x1,%al
cmpl   $0x2d,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115d <is_symbol_char+0x4d>
mov    $0x1,%al
cmpl   $0x5f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
je     115d <is_symbol_char+0x4d>
cmpl   $0x21,-0x4(%rbp)
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_symbol_char>:
push   %rbx
mov    %edi,%ebx
call   1030 <isalnum@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
je     1127 <is_symbol_char+0x17>
pop    %rbx
ret
cmp    $0x2d,%ebx
je     1125 <is_symbol_char+0x15>
cmp    $0x5f,%ebx
je     1125 <is_symbol_char+0x15>
xor    %eax,%eax
cmp    $0x21,%ebx
sete   %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @is_symbol_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i64 @isalnum(i32 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 45
br i1 %8, label %15, label %9
9: ; preds = %6
%10 = load i32, i32* %2
%11 = icmp eq i32 %10, 95
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp eq i32 %13, 33
br label %15
15: ; preds = %12, %9, %6, %1
%16 = phi i1 [ true, %9 ], [ true, %6 ], [ true, %1 ], [ %14, %12 ]
%17 = zext i1 %16 to i32
ret i32 %17
}

LLVM IR (-O2):
define i32 @is_symbol_char(i32 %0) {
%2 = tail call i64 @isalnum(i32 %0)
%3 = freeze i64 %2
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %1
switch i32 %0, label %6 [
i32 95, label %9
i32 45, label %9
]
6: ; preds = %5
%7 = icmp eq i32 %0, 33
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %5, %5, %1, %6
%10 = phi i32 [ 1, %5 ], [ %8, %6 ], [ 1, %1 ], [ 1, %5 ]
ret i32 %10
}
/* Variables and functions */
double ceil(double);
double floor(double);
double trunc(double x) {
  if (x >= 0.0)
    return floor(x);
  else
    return ceil(x);
}


x86 assembly (clang, -O0):
<trunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     1153 <trunc+0x33>
movsd  -0x10(%rbp),%xmm0
call   1040 <floor@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    1162 <trunc+0x42>
movsd  -0x10(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trunc>:
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    112f <trunc+0xf>
jmp    1030 <ceil@plt>
jmp    1040 <floor@plt>

LLVM IR (-O0):
define double @trunc(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp oge double %4, 0.000000e+00
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load double, double* %3
%8 = call double @llvm.floor.f64(double %7)
store double %8, double* %2
br label %12
9: ; preds = %1
%10 = load double, double* %3
%11 = call double @llvm.ceil.f64(double %10)
store double %11, double* %2
br label %12
12: ; preds = %9, %6
%13 = load double, double* %2
ret double %13
}

LLVM IR (-O2):
define double @trunc(double %0) {
%2 = fcmp ult double %0, 0.000000e+00
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call double @llvm.floor.f64(double %0)
br label %7
5: ; preds = %1
%6 = tail call double @llvm.ceil.f64(double %0)
br label %7
7: ; preds = %5, %3
%8 = phi double [ %4, %3 ], [ %6, %5 ]
ret double %8
}
/* Variables and functions */
int strcmp(char const *, char const *);
int cmp_strings(const char *a, const char *b) {
  if (a && b) {
    return strcmp(a, b);
  } else if (a)
    return -1;
  else if (b)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<cmp_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114b <cmp_strings+0x3b>
cmpq   $0x0,-0x18(%rbp)
je     114b <cmp_strings+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <strcmp@plt>
mov    %eax,-0x4(%rbp)
jmp    1180 <cmp_strings+0x70>
cmpq   $0x0,-0x10(%rbp)
je     1162 <cmp_strings+0x52>
movl   $0xffffffff,-0x4(%rbp)
jmp    1180 <cmp_strings+0x70>
cmpq   $0x0,-0x18(%rbp)
je     1179 <cmp_strings+0x69>
movl   $0x1,-0x4(%rbp)
jmp    1180 <cmp_strings+0x70>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmp_strings>:
test   %rdi,%rdi
je     111f <cmp_strings+0xf>
test   %rsi,%rsi
je     111f <cmp_strings+0xf>
jmp    1030 <strcmp@plt>
xor    %ecx,%ecx
test   %rsi,%rsi
setne  %cl
neg    %rdi
sbb    %eax,%eax
or     %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @cmp_strings(i8* %0, i8* %1) {
%3 = icmp ne i8* %0, null
%4 = icmp ne i8* %1, null
%5 = and i1 %3, %4
br i1 %5, label %6, label %8
6: ; preds = %2
%7 = tail call i32 @strcmp(i8* %0, i8* %1)
br label %11
8: ; preds = %2
%9 = zext i1 %4 to i32
%10 = select i1 %3, i32 -1, i32 %9
br label %11
11: ; preds = %8, %6
%12 = phi i32 [ %7, %6 ], [ %10, %8 ]
ret i32 %12
}
void gentest() {}


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

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

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

LLVM IR (-O2):
define void @gentest() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ writeDiagonalMatrixInPetscFormat(char *);
int main(int argc, char **args) {
  char *petsc_full_filename = "Mat1.petsc";
  printf("starting processing %s --->\n", petsc_full_filename);
  writeDiagonalMatrixInPetscFormat(petsc_full_filename);
  printf("finished writing to: %s\n", petsc_full_filename);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
lea    0xebf(%rip),%rdi
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <writeDiagonalMatrixInPetscFormat@plt>
mov    -0x18(%rbp),%rsi
lea    0xec3(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee3(%rip),%rdi
lea    0xed1(%rip),%rbx
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    %rbx,%rdi
call   1030 <writeDiagonalMatrixInPetscFormat@plt>
lea    0xee2(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [11 x i8] c"Mat1.petsc\00"
@.str.1 = [29 x i8] c"starting processing %s --->\0A\00"
@.str.2 = [25 x i8] c"finished writing to: %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %6
%8 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* %7)
%9 = load i8*, i8** %6
%10 = call i32 @writeDiagonalMatrixInPetscFormat(i8* %9)
%11 = load i8*, i8** %6
%12 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"Mat1.petsc\00"
@.str.1 = [29 x i8] c"starting processing %s --->\0A\00"
@.str.2 = [25 x i8] c"finished writing to: %s\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 @writeDiagonalMatrixInPetscFormat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int main() {
  char src[] = "Copy me!";
  char dst[] = "..............";
  strncpy(dst, src, 10);
  printf("Final string: '%s'\n", dst);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0xd(%rbp)
mov    0xec8(%rip),%al
mov    %al,-0x5(%rbp)
mov    0xebf(%rip),%rax
mov    %rax,-0x1c(%rbp)
mov    0xebd(%rip),%eax
mov    %eax,-0x14(%rbp)
mov    0xeb7(%rip),%ax
mov    %ax,-0x10(%rbp)
mov    0xeaf(%rip),%al
mov    %al,-0xe(%rbp)
lea    -0x1c(%rbp),%rdi
lea    -0xd(%rbp),%rsi
mov    $0xa,%edx
call   1030 <strncpy@plt>
lea    -0x1c(%rbp),%rsi
lea    0xe90(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x21656d2079706f43,%rax
6d 65 21
mov    %rax,(%rsp)
movb   $0x0,0x8(%rsp)
movabs $0x2e2e2e2e2e2e2e,%rax
mov    %rax,0x17(%rsp)
movabs $0x2e2e2e2e2e2e2e2e,%rax
2e 2e 2e
mov    %rax,0x10(%rsp)
lea    0x10(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0xa,%edx
call   1030 <strncpy@plt>
lea    0xea6(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.src = [9 x i8] c"Copy me!\00"
@__const.main.dst = [15 x i8] c"..............\00"
@.str = [20 x i8] c"Final string: '%s'\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [9 x i8]
%3 = alloca [15 x i8]
store i32 0, i32* %1
%4 = bitcast [9 x i8]* %2 to i8*
%5 = bitcast [15 x i8]* %3 to i8*
%6 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [9 x i8], [9 x i8]* %2, i64 0, i64 0
%8 = call i32 @strncpy(i8* %6, i8* %7, i32 10)
%9 = getelementptr inbounds [15 x i8], [15 x i8]* %3, i64 0, i64 0
%10 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %9)
ret i32 0
}

LLVM IR (-O2):
@__const.main.src = [9 x i8] c"Copy me!\00"
@__const.main.dst = [15 x i8] c"..............\00"
@.str = [20 x i8] c"Final string: '%s'\0A\00"
define i32 @main() {
%1 = alloca [9 x i8]
%2 = alloca [15 x i8]
%3 = getelementptr inbounds [9 x i8], [9 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [15 x i8], [15 x i8]* %2, i64 0, i64 0
%5 = call i32 @strncpy(i8* %4, i8* %3, i32 10)
%6 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %4)
ret i32 0
}
/* Type definitions */
struct i8x_object {
  int dummy;
};
struct i8x_ctx {
  int dummy;
};

/* Variables and functions */
scalar_t__ i8x_ob_ref(struct i8x_object *);
struct i8x_ctx *__attribute__((always_)) i8x_ctx_ref(struct i8x_ctx *x) {
  return (struct i8x_ctx *)i8x_ob_ref((struct i8x_object *)x);
}


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

x86 assembly (clang, -O2):
<i8x_ctx_ref>:
jmp    1030 <i8x_ob_ref@plt>

LLVM IR (-O0):
%struct.i8x_ctx = type { i32 }
%struct.i8x_object = type { i32 }
define %struct.i8x_ctx* @i8x_ctx_ref(%struct.i8x_ctx* %0) {
%2 = alloca %struct.i8x_ctx*
store %struct.i8x_ctx* %0, %struct.i8x_ctx** %2
%3 = load %struct.i8x_ctx*, %struct.i8x_ctx** %2
%4 = bitcast %struct.i8x_ctx* %3 to %struct.i8x_object*
%5 = call i64 @i8x_ob_ref(%struct.i8x_object* %4)
%6 = inttoptr i64 %5 to %struct.i8x_ctx*
ret %struct.i8x_ctx* %6
}

LLVM IR (-O2):
%struct.i8x_ctx = type { i32 }
%struct.i8x_object = type { i32 }
define %struct.i8x_ctx* @i8x_ctx_ref(%struct.i8x_ctx* %0) {
%2 = bitcast %struct.i8x_ctx* %0 to %struct.i8x_object*
%3 = tail call i64 @i8x_ob_ref(%struct.i8x_object* %2)
%4 = inttoptr i64 %3 to %struct.i8x_ctx*
ret %struct.i8x_ctx* %4
}
void set_low(unsigned char *ptr, unsigned int address, unsigned int value) {
  unsigned int opcode;
  opcode = *(unsigned int *)(ptr + address);
  opcode = (opcode & 0xffff0000) | (value & 0xffff);
  *(unsigned int *)(ptr + address) = opcode;
}


x86 assembly (clang, -O0):
<set_low>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    (%rax,%rcx,1),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
and    $0xffff0000,%eax
mov    -0x10(%rbp),%ecx
and    $0xffff,%ecx
or     %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
mov    %edx,(%rax,%rcx,1)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_low>:
mov    %esi,%eax
mov    %dx,(%rdi,%rax,1)
ret

LLVM IR (-O0):
define void @set_low(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i8*, i8** %4
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = bitcast i8* %11 to i32*
%13 = load i32, i32* %12
store i32 %13, i32* %7
%14 = load i32, i32* %7
%15 = and i32 %14, -65536
%16 = load i32, i32* %6
%17 = and i32 %16, 65535
%18 = or i32 %15, %17
store i32 %18, i32* %7
%19 = load i32, i32* %7
%20 = load i8*, i8** %4
%21 = load i32, i32* %5
%22 = zext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = bitcast i8* %23 to i32*
store i32 %19, i32* %24
ret void
}

LLVM IR (-O2):
define void @set_low(i8* nocapture %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = getelementptr inbounds i8, i8* %0, i64 %4
%6 = bitcast i8* %5 to i32*
%7 = load i32, i32* %6
%8 = and i32 %7, -65536
%9 = and i32 %2, 65535
%10 = or i32 %8, %9
store i32 %10, i32* %6
ret void
}
hexdump_min(int a, int b) { return (a < b) ? a : b; }


x86 assembly (clang, -O0):
<hexdump_min>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1121 <hexdump_min+0x21>
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1127 <hexdump_min+0x27>
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<hexdump_min>:
mov    %esi,%eax
cmp    %esi,%edi
cmovl  %edi,%eax
ret

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

LLVM IR (-O2):
define i32 @hexdump_min(i32 %0, i32 %1) {
%3 = icmp slt i32 %0, %1
%4 = select i1 %3, i32 %0, i32 %1
ret i32 %4
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ ipr(int, char *, ...);
int main(void) {
  ipr(1, "foo %i", 42);
  ipr(2, "bar %u", 23, 666);
  ipr(3, "baz %s");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x1,%edi
lea    0xed5(%rip),%rsi
mov    $0x2a,%edx
mov    $0x0,%al
call   1030 <ipr@plt>
mov    $0x2,%edi
lea    0xec4(%rip),%rsi
mov    $0x17,%edx
mov    $0x29a,%ecx
mov    $0x0,%al
call   1030 <ipr@plt>
mov    $0x3,%edi
lea    0xeae(%rip),%rsi
mov    $0x0,%al
call   1030 <ipr@plt>
mov    0x2e72(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rsi
mov    $0x1,%edi
mov    $0x2a,%edx
xor    %eax,%eax
call   1030 <ipr@plt>
lea    0xed7(%rip),%rsi
mov    $0x2,%edi
mov    $0x17,%edx
mov    $0x29a,%ecx
xor    %eax,%eax
call   1030 <ipr@plt>
lea    0xec1(%rip),%rsi
mov    $0x3,%edi
xor    %eax,%eax
call   1030 <ipr@plt>
mov    0x2e80(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"foo %i\00"
@.str.1 = [7 x i8] c"bar %u\00"
@.str.2 = [7 x i8] c"baz %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (i32, i8*, ...) @ipr(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 42)
%3 = call i32 (i32, i8*, ...) @ipr(i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 23, i32 666)
%4 = call i32 (i32, i8*, ...) @ipr(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%5 = load i32, i32* @EXIT_SUCCESS
ret i32 %5
}

LLVM IR (-O2):
@.str = [7 x i8] c"foo %i\00"
@.str.1 = [7 x i8] c"bar %u\00"
@.str.2 = [7 x i8] c"baz %s\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 (i32, i8*, ...) @ipr(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 42)
%2 = tail call i32 (i32, i8*, ...) @ipr(i32 2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 23, i32 666)
%3 = tail call i32 (i32, i8*, ...) @ipr(i32 3, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%4 = load i32, i32* @EXIT_SUCCESS
ret i32 %4
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, int /*<<< orphan*/ *);
long getTickCount() {
  struct timeval tv;
  gettimeofday(&tv, NULL);
  return (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
}


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

x86 assembly (clang, -O2):
<getTickCount>:
push   %rax
mov    %rsp,%rdi
xor    %esi,%esi
call   1030 <gettimeofday@plt>
movslq (%rsp),%rax
imul   $0x3e8,%rax,%rcx
movslq 0x4(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
cltq
add    %rcx,%rax
pop    %rcx
ret

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

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
define i64 @getTickCount() {
%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, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %9, %6
%11 = sext i32 %10 to i64
ret i64 %11
}
/* Variables and functions */
char *get_ver();
int /*<<< orphan*/ printf(char *, char *);
int main(void) { printf("ver: %s\n", get_ver()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <get_ver@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [9 x i8] c"ver: %s\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @get_ver()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
float erfc(x)
float x;
{
  float gammp(), gammq();
  return x < 0.0 ? 1.0 + gammp(0.5, x * x) : gammq(0.5, x * x);
}


x86 assembly (clang, -O0):
<erfc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
xorps  %xmm0,%xmm0
ucomisd %xmm1,%xmm0
jbe    117e <erfc+0x5e>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xea3(%rip),%xmm0
mov    $0x2,%al
call   1040 <gammp@plt>
cvtss2sd %xmm0,%xmm1
movsd  0xe98(%rip),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    11a4 <erfc+0x84>
movss  -0x4(%rbp),%xmm0
mulss  -0x4(%rbp),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe6c(%rip),%xmm0
mov    $0x2,%al
call   1030 <gammq@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<erfc>:
push   %rax
cvtsd2ss %xmm0,%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm0,%xmm1
mulss  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm0,%xmm1
movsd  0xec2(%rip),%xmm0
mov    $0x2,%al
jbe    1155 <erfc+0x35>
call   1040 <gammp@plt>
cvtss2sd %xmm0,%xmm0
addsd  0xeb5(%rip),%xmm0
jmp    115e <erfc+0x3e>
call   1030 <gammq@plt>
cvtss2sd %xmm0,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define float @erfc(double %0) {
%2 = alloca float
%3 = fptrunc double %0 to float
store float %3, float* %2
%4 = load float, float* %2
%5 = fpext float %4 to double
%6 = fcmp olt double %5, 0.000000e+00
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load float, float* %2
%9 = load float, float* %2
%10 = fmul float %8, %9
%11 = fpext float %10 to double
%12 = call float (double, double, ...) bitcast (float (...)* @gammp to float (double, double, ...)*)(double 5.000000e-01, double %11)
%13 = fpext float %12 to double
%14 = fadd double 1.000000e+00, %13
br label %22
15: ; preds = %1
%16 = load float, float* %2
%17 = load float, float* %2
%18 = fmul float %16, %17
%19 = fpext float %18 to double
%20 = call float (double, double, ...) bitcast (float (...)* @gammq to float (double, double, ...)*)(double 5.000000e-01, double %19)
%21 = fpext float %20 to double
br label %22
22: ; preds = %15, %7
%23 = phi double [ %14, %7 ], [ %21, %15 ]
%24 = fptrunc double %23 to float
ret float %24
}

LLVM IR (-O2):
define float @erfc(double %0) {
%2 = fptrunc double %0 to float
%3 = fcmp olt float %2, 0.000000e+00
%4 = fmul float %2, %2
%5 = fpext float %4 to double
br i1 %3, label %6, label %10
6: ; preds = %1
%7 = tail call float (double, double, ...) bitcast (float (...)* @gammp to float (double, double, ...)*)(double 5.000000e-01, double %5)
%8 = fpext float %7 to double
%9 = fadd double %8, 1.000000e+00
br label %13
10: ; preds = %1
%11 = tail call float (double, double, ...) bitcast (float (...)* @gammq to float (double, double, ...)*)(double 5.000000e-01, double %5)
%12 = fpext float %11 to double
br label %13
13: ; preds = %10, %6
%14 = phi double [ %9, %6 ], [ %12, %10 ]
%15 = fptrunc double %14 to float
ret float %15
}
/* Variables and functions */
float fabsf(float);
float dloglaplace_logscale(float x, float loc, float sc, float logsc) {
  return fabsf(x - loc) / sc - 1.0;
}


x86 assembly (clang, -O0):
<dloglaplace_logscale>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movaps 0xee7(%rip),%xmm1
pand   %xmm1,%xmm0
divss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xec2(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dloglaplace_logscale>:
subss  %xmm1,%xmm0
andps  0xef5(%rip),%xmm0
divss  %xmm2,%xmm0
addss  0xef9(%rip),%xmm0
ret

LLVM IR (-O0):
define float @dloglaplace_logscale(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %6
%11 = fsub float %9, %10
%12 = call float @llvm.fabs.f32(float %11)
%13 = load float, float* %7
%14 = fdiv float %12, %13
%15 = fpext float %14 to double
%16 = fsub double %15, 1.000000e+00
%17 = fptrunc double %16 to float
ret float %17
}

LLVM IR (-O2):
define float @dloglaplace_logscale(float %0, float %1, float %2, float %3) {
%5 = fsub float %0, %1
%6 = tail call float @llvm.fabs.f32(float %5)
%7 = fdiv float %6, %2
%8 = fadd float %7, -1.000000e+00
ret float %8
}
/* Type definitions */
struct minix2_inode {
  int dummy;
};

/* Variables and functions */
int mx_read_write_inode(int, int, struct minix2_inode *, int /*<<< orphan*/);
int mx_read_inode(int device, int i, struct minix2_inode *inodeptr) {
  return mx_read_write_inode(device, i, inodeptr, 0);
}


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

x86 assembly (clang, -O2):
<mx_read_inode>:
xor    %ecx,%ecx
jmp    1030 <mx_read_write_inode@plt>

LLVM IR (-O0):
%struct.minix2_inode = type { i32 }
define i32 @mx_read_inode(i32 %0, i32 %1, %struct.minix2_inode* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.minix2_inode*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.minix2_inode* %2, %struct.minix2_inode** %6
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = load %struct.minix2_inode*, %struct.minix2_inode** %6
%10 = call i32 @mx_read_write_inode(i32 %7, i32 %8, %struct.minix2_inode* %9, i32 0)
ret i32 %10
}

LLVM IR (-O2):
%struct.minix2_inode = type { i32 }
define i32 @mx_read_inode(i32 %0, i32 %1, %struct.minix2_inode* %2) {
%4 = tail call i32 @mx_read_write_inode(i32 %0, i32 %1, %struct.minix2_inode* %2, i32 0)
ret i32 %4
}
float max(float a, float b) {
  if (a > b)
    return a;
  return b;
}


x86 assembly (clang, -O0):
<max>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x8(%rbp)
movss  %xmm1,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
ucomiss -0xc(%rbp),%xmm0
jbe    112c <max+0x2c>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
jmp    1136 <max+0x36>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<max>:
maxss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @max(float %0, float %1) {
%3 = alloca float
%4 = alloca float
%5 = alloca float
store float %0, float* %4
store float %1, float* %5
%6 = load float, float* %4
%7 = load float, float* %5
%8 = fcmp ogt float %6, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = load float, float* %4
store float %10, float* %3
br label %13
11: ; preds = %2
%12 = load float, float* %5
store float %12, float* %3
br label %13
13: ; preds = %11, %9
%14 = load float, float* %3
ret float %14
}

LLVM IR (-O2):
define float @max(float %0, float %1) {
%3 = fcmp ogt float %0, %1
%4 = select i1 %3, float %0, float %1
ret float %4
}
int valid_piece(const int pce) { return (pce >= 1 && pce <= 12); }


x86 assembly (clang, -O0):
<valid_piece>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
cmpl   $0x1,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jl     1120 <valid_piece+0x20>
cmpl   $0xc,-0x4(%rbp)
setle  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<valid_piece>:
add    $0xffffffff,%edi
xor    %eax,%eax
cmp    $0xc,%edi
setb   %al
ret

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

LLVM IR (-O2):
define i32 @valid_piece(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 12
%4 = zext i1 %3 to i32
ret i32 %4
}
int test_imm_7Euint16_mem(unsigned short *val) {
  return ((*val) & (0x7E << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_7Euint16_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzwl (%rax),%edx
and    $0x7e,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @test_imm_7Euint16_mem(i16* nocapture %0) {
%2 = load i16, i16* %0
%3 = and i16 %2, 126
%4 = icmp eq i16 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void printRes(unsigned int *res, int n) {
  int i;
  for (i = 0; i < n; i++)
    printf("%d\n", res[i]);
}


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

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

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define void @printRes(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %11, %6 ]
%8 = getelementptr inbounds i32, i32* %0, i64 %7
%9 = load i32, i32* %8
%10 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = add nuw nsw i64 %7, 1
%12 = icmp eq i64 %11, %5
br i1 %12, label %13, label %6
13: ; preds = %6, %2
ret void
}
/* Type definitions */
struct buffer {
  int dummy;
};
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ buffer_read(struct buffer *, long *, int);
long buffer_read_long(struct buffer *__restrict buf) {
  long data;
  buffer_read(buf, &data, sizeof(data));
  return data;
}


x86 assembly (clang, -O0):
<buffer_read_long>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
mov    $0x8,%edx
call   1030 <buffer_read@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<buffer_read_long>:
push   %rax
mov    %rsp,%rsi
mov    $0x8,%edx
call   1030 <buffer_read@plt>
mov    (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.buffer = type { i32 }
define i64 @buffer_read_long(%struct.buffer* noalias %0) {
%2 = alloca %struct.buffer*
%3 = alloca i64
store %struct.buffer* %0, %struct.buffer** %2
%4 = load %struct.buffer*, %struct.buffer** %2
%5 = call i32 @buffer_read(%struct.buffer* %4, i64* %3, i32 8)
%6 = load i64, i64* %3
ret i64 %6
}

LLVM IR (-O2):
%struct.buffer = type { i32 }
define i64 @buffer_read_long(%struct.buffer* noalias %0) {
%2 = alloca i64
%3 = bitcast i64* %2 to i8*
%4 = call i32 @buffer_read(%struct.buffer* %0, i64* %2, i32 8)
%5 = load i64, i64* %2
ret i64 %5
}
/* Variables and functions */
char *calloc(unsigned int, int);
int /*<<< orphan*/ printf(char *, long);
char *intcomma(long int number) {
  char *buffer;
  unsigned int length = 0;
  if (number < 0) {
    ++length;
    number *= -1;
  }
  printf("%li\n", number);
  buffer = calloc(length, sizeof(char));
  return buffer;
}


x86 assembly (clang, -O0):
<intcomma>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x8(%rbp)
jge    1150 <intcomma+0x30>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
imul   $0xffffffffffffffff,-0x8(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea5(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1040 <calloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intcomma>:
push   %rbx
mov    %rdi,%rbx
mov    %rdi,%rsi
neg    %rsi
cmovs  %rdi,%rsi
shr    $0x3f,%rbx
lea    0xec7(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    $0x1,%esi
pop    %rbx
jmp    1040 <calloc@plt>

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

LLVM IR (-O2):
@.str = [5 x i8] c"%li\0A\00"
define noalias i8* @intcomma(i64 %0) {
%2 = tail call i64 @llvm.abs.i64(i64 %0, i1 true)
%3 = lshr i64 %0, 63
%4 = trunc i64 %3 to i32
%5 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 %2)
%6 = tail call i8* @calloc(i32 %4, i32 1)
ret i8* %6
}
/* Type definitions */
struct vars {
  int dummy;
};
struct cvec {
  int dummy;
};

/* Variables and functions */
struct cvec *clearcvec(struct cvec *);
struct cvec *allmcces(struct vars *v, struct cvec *cv) {
  return clearcvec(cv);
}


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

x86 assembly (clang, -O2):
<allmcces>:
mov    %rsi,%rdi
jmp    1030 <clearcvec@plt>

LLVM IR (-O0):
%struct.vars = type { i32 }
%struct.cvec = type { i32 }
define %struct.cvec* @allmcces(%struct.vars* %0, %struct.cvec* %1) {
%3 = alloca %struct.vars*
%4 = alloca %struct.cvec*
store %struct.vars* %0, %struct.vars** %3
store %struct.cvec* %1, %struct.cvec** %4
%5 = load %struct.cvec*, %struct.cvec** %4
%6 = call %struct.cvec* @clearcvec(%struct.cvec* %5)
ret %struct.cvec* %6
}

LLVM IR (-O2):
%struct.vars = type { i32 }
%struct.cvec = type { i32 }
define %struct.cvec* @allmcces(%struct.vars* nocapture readnone %0, %struct.cvec* %1) {
%3 = tail call %struct.cvec* @clearcvec(%struct.cvec* %1)
ret %struct.cvec* %3
}
/* Type definitions */
struct t_config_option {
  int dummy;
};

/* Variables and functions */
int utf8_strlen_screen(char const *);
int config_check_prefix_buffer_align_more(void *data,
                                          struct t_config_option *option,
                                          const char *value) {
  (void)data;
  (void)option;
  return (utf8_strlen_screen(value) == 1) ? 1 : 0;
}


x86 assembly (clang, -O0):
<config_check_prefix_buffer_align_more>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <utf8_strlen_screen@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_check_prefix_buffer_align_more>:
push   %rax
mov    %rdx,%rdi
call   1030 <utf8_strlen_screen@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.t_config_option = type { i32 }
define i32 @config_check_prefix_buffer_align_more(i8* %0, %struct.t_config_option* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca %struct.t_config_option*
%6 = alloca i8*
store i8* %0, i8** %4
store %struct.t_config_option* %1, %struct.t_config_option** %5
store i8* %2, i8** %6
%7 = load i8*, i8** %4
%8 = load %struct.t_config_option*, %struct.t_config_option** %5
%9 = load i8*, i8** %6
%10 = call i32 @utf8_strlen_screen(i8* %9)
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 0
ret i32 %13
}

LLVM IR (-O2):
%struct.t_config_option = type { i32 }
define i32 @config_check_prefix_buffer_align_more(i8* nocapture readnone %0, %struct.t_config_option* nocapture readnone %1, i8* %2) {
%4 = tail call i32 @utf8_strlen_screen(i8* %2)
%5 = icmp eq i32 %4, 1
%6 = zext i1 %5 to i32
ret i32 %6
}
int eval_add(int a1, int a2) { return a1 + a2; }


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

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

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

LLVM IR (-O2):
define i32 @eval_add(i32 %0, i32 %1) {
%3 = add nsw i32 %1, %0
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ uint64_t;

/* Variables and functions */
int EINVAL;
__attribute__((visibility("default"))) int
sd_path_search(uint64_t type, const char *suffix, char ***paths) {
  return -EINVAL;
}


x86 assembly (clang, -O0):
<sd_path_search>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
mov    0x2ec8(%rip),%rcx
sub    (%rcx),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_path_search>:
mov    0x2ed9(%rip),%rcx
xor    %eax,%eax
sub    (%rcx),%eax
ret

LLVM IR (-O0):
@EINVAL = global i32 0
define i32 @sd_path_search(i32 %0, i8* %1, i8*** %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8***
store i32 %0, i32* %4
store i8* %1, i8** %5
store i8*** %2, i8**** %6
%7 = load i32, i32* @EINVAL
%8 = sub nsw i32 0, %7
ret i32 %8
}

LLVM IR (-O2):
@EINVAL = global i32 0
define i32 @sd_path_search(i32 %0, i8* nocapture readnone %1, i8*** nocapture readnone %2) {
%4 = load i32, i32* @EINVAL
%5 = sub nsw i32 0, %4
ret i32 %5
}
/* Variables and functions */
int hex2dec(char);
unsigned char GetByte(char *buffer) {
  return hex2dec(buffer[0]) * 0x10 + hex2dec(buffer[1]);
}


x86 assembly (clang, -O0):
<GetByte>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <hex2dec@plt>
shl    $0x4,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ecx
mov    -0xc(%rbp),%eax
add    %ecx,%eax
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetByte>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <hex2dec@plt>
mov    %eax,%ebp
shl    $0x4,%ebp
movsbl 0x1(%rbx),%edi
call   1030 <hex2dec@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define zeroext i8 @GetByte(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8, i8* %3, i64 0
%5 = load i8, i8* %4
%6 = call i32 @hex2dec(i8 signext %5)
%7 = mul nsw i32 %6, 16
%8 = load i8*, i8** %2
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = load i8, i8* %9
%11 = call i32 @hex2dec(i8 signext %10)
%12 = add nsw i32 %7, %11
%13 = trunc i32 %12 to i8
ret i8 %13
}

LLVM IR (-O2):
define zeroext i8 @GetByte(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @hex2dec(i8 signext %2)
%4 = shl nsw i32 %3, 4
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
%7 = tail call i32 @hex2dec(i8 signext %6)
%8 = add nsw i32 %7, %4
%9 = trunc i32 %8 to i8
ret i8 %9
}
/* Variables and functions */
int /*<<< orphan*/ NoDepZ_func();
int /*<<< orphan*/ OneFunc();
void TwoFunc() {
  OneFunc();
  NoDepZ_func();
}


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

x86 assembly (clang, -O2):
<TwoFunc>:
push   %rax
xor    %eax,%eax
call   1030 <OneFunc@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <NoDepZ_func@plt>

LLVM IR (-O0):
define void @TwoFunc() {
%1 = call i32 (...) @OneFunc()
%2 = call i32 (...) @NoDepZ_func()
ret void
}

LLVM IR (-O2):
define void @TwoFunc() {
%1 = tail call i32 (...) @OneFunc()
%2 = tail call i32 (...) @NoDepZ_func()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(long);
void ikitwin_sleep(long millisecond) {
  usleep((millisecond << 10) - (millisecond << 4) - (millisecond << 3));
}


x86 assembly (clang, -O0):
<ikitwin_sleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
shl    $0xa,%rdi
mov    -0x8(%rbp),%rax
shl    $0x4,%rax
sub    %rax,%rdi
mov    -0x8(%rbp),%rax
shl    $0x3,%rax
sub    %rax,%rdi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ikitwin_sleep>:
imul   $0x3e8,%rdi,%rdi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @ikitwin_sleep(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = shl i64 %3, 10
%5 = load i64, i64* %2
%6 = shl i64 %5, 4
%7 = sub nsw i64 %4, %6
%8 = load i64, i64* %2
%9 = shl i64 %8, 3
%10 = sub nsw i64 %7, %9
%11 = call i32 @usleep(i64 %10)
ret void
}

LLVM IR (-O2):
define void @ikitwin_sleep(i64 %0) {
%2 = mul i64 %0, 1000
%3 = tail call i32 @usleep(i64 %2)
ret void
}