xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
int main(void) {
  printf("#include test\n");
  printf("b\n");
  printf("g\n");
  printf("i\n");
  printf("p\n");
  printf("r\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
call   1030 <printf@plt>
lea    0xed4(%rip),%rdi
call   1030 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%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
call   1030 <puts@plt>
lea    0xeea(%rip),%rdi
call   1030 <puts@plt>
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
lea    0xed6(%rip),%rdi
call   1030 <puts@plt>
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xec2(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [15 x i8] c"#include test\0A\00"
@.str.1 = [3 x i8] c"b\0A\00"
@.str.2 = [3 x i8] c"g\0A\00"
@.str.3 = [3 x i8] c"i\0A\00"
@.str.4 = [3 x i8] c"p\0A\00"
@.str.5 = [3 x i8] c"r\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%5 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%6 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%7 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@str = [14 x i8] c"#include test\00"
@str.6 = [2 x i8] c"b\00"
@str.7 = [2 x i8] c"g\00"
@str.8 = [2 x i8] c"i\00"
@str.9 = [2 x i8] c"p\00"
@str.10 = [2 x i8] c"r\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.6, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.7, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.8, i64 0, i64 0))
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.9, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.10, i64 0, i64 0))
ret i32 0
}
void set_tbh_size(unsigned char buf[], int size) {
  buf[1] = (unsigned char)(size & 0xff);
  buf[0] = (unsigned char)((size >> 8) & 0xff);
  return;
}


x86 assembly (clang, -O0):
<set_tbh_size>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
sar    $0x8,%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_tbh_size>:
rol    $0x8,%si
mov    %si,(%rdi)
ret

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

LLVM IR (-O2):
define void @set_tbh_size(i8* nocapture writeonly %0, i32 %1) {
%3 = trunc i32 %1 to i8
%4 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %3, i8* %4
%5 = lshr i32 %1, 8
%6 = trunc i32 %5 to i8
store i8 %6, i8* %0
ret void
}
int mat_Nint(const double a) {
  if (a < 0.0)
    return (int)(a - 0.5);
  else
    return (int)(a + 0.5);
}


x86 assembly (clang, -O0):
<mat_Nint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1134 <mat_Nint+0x34>
movsd  -0x10(%rbp),%xmm0
movsd  0xedc(%rip),%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
jmp    1148 <mat_Nint+0x48>
movsd  0xec4(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
cvttsd2si %xmm0,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<mat_Nint>:
xorpd  %xmm1,%xmm1
xor    %eax,%eax
ucomisd %xmm0,%xmm1
seta   %al
lea    0xeec(%rip),%rcx
addsd  (%rcx,%rax,8),%xmm0
cvttsd2si %xmm0,%eax
ret

LLVM IR (-O0):
define i32 @mat_Nint(double %0) {
%2 = alloca i32
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 0.000000e+00
br i1 %5, label %6, label %10
6: ; preds = %1
%7 = load double, double* %3
%8 = fsub double %7, 5.000000e-01
%9 = fptosi double %8 to i32
store i32 %9, i32* %2
br label %14
10: ; preds = %1
%11 = load double, double* %3
%12 = fadd double %11, 5.000000e-01
%13 = fptosi double %12 to i32
store i32 %13, i32* %2
br label %14
14: ; preds = %10, %6
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
define i32 @mat_Nint(double %0) {
%2 = fcmp olt double %0, 0.000000e+00
%3 = select i1 %2, double -5.000000e-01, double 5.000000e-01
%4 = fadd double %3, %0
%5 = fptosi double %4 to i32
ret i32 %5
}
/* Type definitions */
struct stat {
  int st_mode;
};

/* Variables and functions */
int S_IRUSR;
scalar_t__ stat(char const *, struct stat *);
int exist_file(const char *local) {
  struct stat buff;
  if (stat(local, &buff))
    return 0;
  return buff.st_mode & S_IRUSR;
}


x86 assembly (clang, -O0):
<exist_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <exist_file+0x2f>
movl   $0x0,-0x4(%rbp)
jmp    114e <exist_file+0x3e>
mov    -0x18(%rbp),%eax
mov    0x2e97(%rip),%rcx
and    (%rcx),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exist_file>:
push   %rax
mov    %rsp,%rsi
call   1030 <stat@plt>
mov    0x2ec0(%rip),%rcx
mov    (%rcx),%edx
and    (%rsp),%edx
xor    %ecx,%ecx
test   %rax,%rax
cmove  %edx,%ecx
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@S_IRUSR = global i32 0
define i32 @exist_file(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca %struct.stat
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @stat(i8* %5, %struct.stat* %4)
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %14
9: ; preds = %1
%10 = getelementptr inbounds %struct.stat, %struct.stat* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = load i32, i32* @S_IRUSR
%13 = and i32 %11, %12
store i32 %13, i32* %2
br label %14
14: ; preds = %9, %8
%15 = load i32, i32* %2
ret i32 %15
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@S_IRUSR = global i32 0
define i32 @exist_file(i8* %0) {
%2 = alloca %struct.stat
%3 = bitcast %struct.stat* %2 to i8*
%4 = call i64 @stat(i8* %0, %struct.stat* %2)
%5 = icmp eq i64 %4, 0
%6 = getelementptr inbounds %struct.stat, %struct.stat* %2, i64 0, i32 0
%7 = load i32, i32* %6
%8 = load i32, i32* @S_IRUSR
%9 = and i32 %8, %7
%10 = select i1 %5, i32 %9, i32 0
ret i32 %10
}
/* Variables and functions */
scalar_t__ strncmp(char *, char *, int);
int nb_to_read(char *buf) {
  if (strncmp(buf, "regf", 4) == 0)
    return 4096;
  else if (strncmp(buf, "hbin", 4) == 0)
    return 32;
  return 0;
}


x86 assembly (clang, -O0):
<nb_to_read>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1147 <nb_to_read+0x37>
movl   $0x1000,-0x4(%rbp)
jmp    117e <nb_to_read+0x6e>
mov    -0x10(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1172 <nb_to_read+0x62>
movl   $0x20,-0x4(%rbp)
jmp    117e <nb_to_read+0x6e>
jmp    1177 <nb_to_read+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nb_to_read>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     114e <nb_to_read+0x3e>
lea    0xed4(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1030 <strncmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
shl    $0x5,%eax
pop    %rbx
ret
mov    $0x1000,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"regf\00"
@.str.1 = [5 x i8] c"hbin\00"
define i32 @nb_to_read(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = call i64 @strncmp(i8* %4, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %1
store i32 4096, i32* %2
br label %15
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 32, i32* %2
br label %15
13: ; preds = %8
br label %14
14: ; preds = %13
store i32 0, i32* %2
br label %15
15: ; preds = %14, %12, %7
%16 = load i32, i32* %2
ret i32 %16
}

LLVM IR (-O2):
@.str = [5 x i8] c"regf\00"
@.str.1 = [5 x i8] c"hbin\00"
define i32 @nb_to_read(i8* %0) {
%2 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 4)
%3 = icmp eq i64 %2, 0
br i1 %3, label %8, label %4
4: ; preds = %1
%5 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 4)
%6 = icmp eq i64 %5, 0
%7 = select i1 %6, i32 32, i32 0
br label %8
8: ; preds = %4, %1
%9 = phi i32 [ 4096, %1 ], [ %7, %4 ]
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ Mm(int);
int main() {
  int i;
  for (i = 0; i < 5000; i++)
    Mm(i);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x1388,-0x8(%rbp)
jge    1149 <main+0x39>
mov    -0x8(%rbp),%edi
call   1030 <Mm@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %ebx,%edi
call   1030 <Mm@plt>
add    $0x1,%ebx
cmp    $0x1388,%ebx
jne    1120 <main+0x10>
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi i32 [ 0, %0 ], [ %4, %1 ]
%3 = tail call i32 @Mm(i32 %2)
%4 = add nuw nsw i32 %2, 1
%5 = icmp eq i32 %4, 5000
br i1 %5, label %6, label %1
6: ; preds = %1
ret i32 0
}
/* Type definitions */
struct KIrand {
  int dummy;
};

/* Variables and functions */
int KIrand_genrand_int32(struct KIrand *);
long KIrand_genrand_int31(struct KIrand *r) {
  return (long)(KIrand_genrand_int32(r) >> 1);
}


x86 assembly (clang, -O0):
<KIrand_genrand_int31>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <KIrand_genrand_int32@plt>
sar    $0x1,%eax
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<KIrand_genrand_int31>:
push   %rax
call   1030 <KIrand_genrand_int32@plt>
sar    %eax
cltq
pop    %rcx
ret

LLVM IR (-O0):
%struct.KIrand = type { i32 }
define i64 @KIrand_genrand_int31(%struct.KIrand* %0) {
%2 = alloca %struct.KIrand*
store %struct.KIrand* %0, %struct.KIrand** %2
%3 = load %struct.KIrand*, %struct.KIrand** %2
%4 = call i32 @KIrand_genrand_int32(%struct.KIrand* %3)
%5 = ashr i32 %4, 1
%6 = sext i32 %5 to i64
ret i64 %6
}

LLVM IR (-O2):
%struct.KIrand = type { i32 }
define i64 @KIrand_genrand_int31(%struct.KIrand* %0) {
%2 = tail call i32 @KIrand_genrand_int32(%struct.KIrand* %0)
%3 = ashr i32 %2, 1
%4 = sext i32 %3 to i64
ret i64 %4
}
void __check_printsym_format(const char *fmt, ...) {}


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

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

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

LLVM IR (-O2):
define void @__check_printsym_format(i8* nocapture %0, ...) {
ret void
}
int ap_base64encode_len(int len) { return ((len + 2) / 3 * 4) + 1; }


x86 assembly (clang, -O0):
<ap_base64encode_len>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x2,%eax
mov    $0x3,%ecx
cltd
idiv   %ecx
shl    $0x2,%eax
add    $0x1,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<ap_base64encode_len>:
add    $0x2,%edi
movslq %edi,%rax
imul   $0x55555556,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
lea    0x1(,%rax,4),%eax
ret

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

LLVM IR (-O2):
define i32 @ap_base64encode_len(i32 %0) {
%2 = add nsw i32 %0, 2
%3 = sdiv i32 %2, 3
%4 = shl nsw i32 %3, 2
%5 = or i32 %4, 1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int func2(int a, char *str) {
  printf("Hello from func2 [%s]\n", str);
  printf("INT = %d\n", a);
  return a;
}


x86 assembly (clang, -O0):
<func2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%esi
lea    0xedc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<func2>:
push   %rbx
mov    %edi,%ebx
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [23 x i8] c"Hello from func2 [%s]\0A\00"
@.str.1 = [10 x i8] c"INT = %d\0A\00"
define i32 @func2(i32 returned %0, i8* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i8* %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %0)
ret i32 %0
}
/* Variables and functions */
char *concatenate(char *, char *, int, char const *);
char *get_exit_code_file(const char *pid_file) {
  return concatenate("%s.exitcode", "exit_code_file", 1, pid_file);
}


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

x86 assembly (clang, -O2):
<get_exit_code_file>:
mov    %rdi,%rcx
lea    0xee6(%rip),%rdi
lea    0xeeb(%rip),%rsi
mov    $0x1,%edx
jmp    1030 <concatenate@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"%s.exitcode\00"
@.str.1 = [15 x i8] c"exit_code_file\00"
define i8* @get_exit_code_file(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @concatenate(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* %3)
ret i8* %4
}

LLVM IR (-O2):
@.str = [12 x i8] c"%s.exitcode\00"
@.str.1 = [15 x i8] c"exit_code_file\00"
define i8* @get_exit_code_file(i8* %0) {
%2 = tail call i8* @concatenate(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* %0)
ret i8* %2
}
int sunmodel_is_leap_year(int yr) {
  return (yr % 4 == 0 && yr % 100 != 0) || (yr % 400 == 0);
}


x86 assembly (clang, -O0):
<sunmodel_is_leap_year>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1134 <sunmodel_is_leap_year+0x34>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0x5(%rbp)
jne    1148 <sunmodel_is_leap_year+0x48>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sunmodel_is_leap_year>:
test   $0x3,%dil
jne    112c <sunmodel_is_leap_year+0x2c>
movslq %edi,%rax
imul   $0x51eb851f,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%ecx
mov    %edi,%edx
mov    $0x1,%eax
sub    %ecx,%edx
je     112c <sunmodel_is_leap_year+0x2c>
ret
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
ret

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

LLVM IR (-O2):
define i32 @sunmodel_is_leap_year(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp ne i32 %2, 0
%4 = srem i32 %0, 100
%5 = icmp eq i32 %4, 0
%6 = or i1 %3, %5
br i1 %6, label %7, label %11
7: ; preds = %1
%8 = srem i32 %0, 400
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
br label %11
11: ; preds = %1, %7
%12 = phi i32 [ %10, %7 ], [ 1, %1 ]
ret i32 %12
}
/* Type definitions */
typedef int /*<<< orphan*/ __m64;

/* Variables and functions */
int /*<<< orphan*/ _mm_mullo_pi16(int /*<<< orphan*/, int /*<<< orphan*/);
__m64 test_mm_mullo_pi16(__m64 a, __m64 b) { return _mm_mullo_pi16(a, b); }


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

x86 assembly (clang, -O2):
<test_mm_mullo_pi16>:
jmp    1030 <_mm_mullo_pi16@plt>

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

LLVM IR (-O2):
define i32 @test_mm_mullo_pi16(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_mullo_pi16(i32 %0, i32 %1)
ret i32 %3
}
/* Type definitions */
typedef union bpf_attr {
  int dummy;
} bpf_attr;
typedef enum bpf_cmd { ____Placeholder_bpf_cmd } bpf_cmd;

/* Variables and functions */
int syscall(int, int, union bpf_attr *, unsigned int);
int sys_bpf(enum bpf_cmd cmd, union bpf_attr *attr, unsigned int size) {
  return syscall(321, cmd, attr, size);
}


x86 assembly (clang, -O0):
<sys_bpf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x14(%rbp),%ecx
mov    $0x141,%edi
call   1030 <syscall@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sys_bpf>:
mov    %edx,%ecx
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x141,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%union.bpf_attr = type { i32 }
define i32 @sys_bpf(i32 %0, %union.bpf_attr* %1, i32 %2) {
%4 = alloca i32
%5 = alloca %union.bpf_attr*
%6 = alloca i32
store i32 %0, i32* %4
store %union.bpf_attr* %1, %union.bpf_attr** %5
store i32 %2, i32* %6
%7 = load i32, i32* %4
%8 = load %union.bpf_attr*, %union.bpf_attr** %5
%9 = load i32, i32* %6
%10 = call i32 @syscall(i32 321, i32 %7, %union.bpf_attr* %8, i32 %9)
ret i32 %10
}

LLVM IR (-O2):
%union.bpf_attr = type { i32 }
define i32 @sys_bpf(i32 %0, %union.bpf_attr* %1, i32 %2) {
%4 = tail call i32 @syscall(i32 321, i32 %0, %union.bpf_attr* %1, i32 %2)
ret i32 %4
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ exit(int);
char *get_sys_time_string();
int /*<<< orphan*/ printf(char *, char *);
scalar_t__ stat(char *, struct stat *);
void check_stop(void) {
  struct stat statbuf;
  if (stat("./__stop__", &statbuf) == 0) {
    printf("Exiting due to __stop__ file.  Time:  %s", get_sys_time_string());
    exit(1);
  }
}


x86 assembly (clang, -O0):
<check_stop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xeb1(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <stat@plt>
cmp    $0x0,%rax
jne    1182 <check_stop+0x42>
mov    $0x0,%al
call   1030 <get_sys_time_string@plt>
mov    %rax,%rsi
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_stop>:
push   %rax
lea    0xeb8(%rip),%rdi
mov    %rsp,%rsi
call   1050 <stat@plt>
test   %rax,%rax
je     1157 <check_stop+0x17>
pop    %rax
ret
xor    %eax,%eax
call   1030 <get_sys_time_string@plt>
lea    0xea6(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [11 x i8] c"./__stop__\00"
@.str.1 = [41 x i8] c"Exiting due to __stop__ file. Time: %s\00"
define void @check_stop() {
%1 = alloca %struct.stat
%2 = call i64 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %0
%5 = call i8* (...) @get_sys_time_string()
%6 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%7 = call i32 @exit(i32 1)
unreachable
8: ; preds = %0
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [11 x i8] c"./__stop__\00"
@.str.1 = [41 x i8] c"Exiting due to __stop__ file. Time: %s\00"
define void @check_stop() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @stat(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %0
%6 = call i8* (...) @get_sys_time_string()
%7 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
ret void
}
/* Variables and functions */
long milli_kelvin_to_millicelsius(long);
long deci_kelvin_to_millicelsius(long t) {
  return milli_kelvin_to_millicelsius(t * 100);
}


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

x86 assembly (clang, -O2):
<deci_kelvin_to_millicelsius>:
imul   $0x64,%rdi,%rdi
jmp    1030 <milli_kelvin_to_millicelsius@plt>

LLVM IR (-O0):
define i64 @deci_kelvin_to_millicelsius(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = mul nsw i64 %3, 100
%5 = call i64 @milli_kelvin_to_millicelsius(i64 %4)
ret i64 %5
}

LLVM IR (-O2):
define i64 @deci_kelvin_to_millicelsius(i64 %0) {
%2 = mul nsw i64 %0, 100
%3 = tail call i64 @milli_kelvin_to_millicelsius(i64 %2)
ret i64 %3
}
void bar(struct foo *f) {}


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

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

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

LLVM IR (-O2):
%struct.foo = type opaque
define void @bar(%struct.foo* nocapture %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ bar(int, int);
__attribute__((no, noclone)) void f2(int x) {
  if (x == 2 || x == 3 || x == 10 || x == 11 || x == 17 || x == 18 || x == 23)
    bar(x, 2);
}


x86 assembly (clang, -O0):
<f2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x2,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0x3,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0xa,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0xb,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0x11,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0x12,-0x4(%rbp)
je     1161 <f2+0x51>
cmpl   $0x17,-0x4(%rbp)
jne    116e <f2+0x5e>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <bar@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f2>:
cmp    $0x17,%edi
ja     1129 <f2+0x19>
mov    $0x860c0c,%eax
bt     %edi,%eax
jae    1129 <f2+0x19>
mov    $0x2,%esi
jmp    1030 <bar@plt>
ret

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

LLVM IR (-O2):
define void @f2(i32 %0) {
switch i32 %0, label %4 [
i32 23, label %2
i32 18, label %2
i32 17, label %2
i32 11, label %2
i32 10, label %2
i32 3, label %2
i32 2, label %2
]
2: ; preds = %1, %1, %1, %1, %1, %1, %1
%3 = tail call i32 @bar(i32 %0, i32 2)
br label %4
4: ; preds = %1, %2
ret void
}
void write_le16(unsigned short in, unsigned char *out) {
  out[0] = in & 0xFF;
  out[1] = in & 0xFF >> 8;
}


x86 assembly (clang, -O0):
<write_le16>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%eax
and    $0xff,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movzwl -0x2(%rbp),%eax
and    $0x0,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<write_le16>:
mov    %dil,(%rsi)
movb   $0x0,0x1(%rsi)
ret

LLVM IR (-O0):
define void @write_le16(i16 zeroext %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
store i16 %0, i16* %3
store i8* %1, i8** %4
%5 = load i16, i16* %3
%6 = zext i16 %5 to i32
%7 = and i32 %6, 255
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i16, i16* %3
%12 = zext i16 %11 to i32
%13 = and i32 %12, 0
%14 = trunc i32 %13 to i8
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 1
store i8 %14, i8* %16
ret void
}

LLVM IR (-O2):
define void @write_le16(i16 zeroext %0, i8* nocapture writeonly %1) {
%3 = trunc i16 %0 to i8
store i8 %3, i8* %1
%4 = getelementptr inbounds i8, i8* %1, i64 1
store i8 0, i8* %4
ret void
}
/* Variables and functions */
int *get_refcnt(unsigned char *);
int Cyc_Core_refptr_count(unsigned char *ptr) {
  int *cnt = get_refcnt(ptr);
  if (cnt != NULL)
    return *cnt;
  else
    return 0;
}


x86 assembly (clang, -O0):
<Cyc_Core_refptr_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <get_refcnt@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1142 <Cyc_Core_refptr_count+0x32>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1149 <Cyc_Core_refptr_count+0x39>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Cyc_Core_refptr_count>:
push   %rax
call   1030 <get_refcnt@plt>
test   %rax,%rax
je     111f <Cyc_Core_refptr_count+0xf>
mov    (%rax),%eax
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @Cyc_Core_refptr_count(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32* @get_refcnt(i8* %5)
store i32* %6, i32** %4
%7 = load i32*, i32** %4
%8 = icmp ne i32* %7, null
br i1 %8, label %9, label %12
9: ; preds = %1
%10 = load i32*, i32** %4
%11 = load i32, i32* %10
store i32 %11, i32* %2
br label %13
12: ; preds = %1
store i32 0, i32* %2
br label %13
13: ; preds = %12, %9
%14 = load i32, i32* %2
ret i32 %14
}

LLVM IR (-O2):
define i32 @Cyc_Core_refptr_count(i8* %0) {
%2 = tail call i32* @get_refcnt(i8* %0)
%3 = icmp eq i32* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = load i32, i32* %2
br label %6
6: ; preds = %1, %4
%7 = phi i32 [ %5, %4 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void dstring_free(void *data, void *ptr) { free(ptr); }


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

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

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

LLVM IR (-O2):
define void @dstring_free(i8* nocapture readnone %0, i8* nocapture %1) {
%3 = tail call i32 @free(i8* %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void fsp(char *seq, int i) {
  char c;
  c = seq[i];
  seq[i] = 0;
  fprintf(stderr, "%s ", seq);
  seq[i] = c;
}


x86 assembly (clang, -O0):
<fsp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0xd(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    0x2ea0(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0xd(%rbp),%dl
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fsp>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
movslq %esi,%r14
mov    (%rdi,%r14,1),%bpl
movb   $0x0,(%rdi,%r14,1)
mov    0x2eb6(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
mov    %rbx,%rdx
call   1030 <fprintf@plt>
mov    %bpl,(%rbx,%r14,1)
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s \00"
define void @fsp(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
store i8 %10, i8* %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
store i8 0, i8* %14
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %3
%17 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = load i8, i8* %5
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s \00"
define void @fsp(i8* %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8, i8* %0, i64 %3
%5 = load i8, i8* %4
store i8 0, i8* %4
%6 = load i32, i32* @stderr
%7 = tail call i32 @fprintf(i32 %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
store i8 %5, i8* %4
ret void
}
void SystemInit_ExtMemCtl_Dummy(void) {}


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

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

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

LLVM IR (-O2):
define void @SystemInit_ExtMemCtl_Dummy() {
ret void
}
/* Variables and functions */
scalar_t__ COND_GT();
int /*<<< orphan*/ EA_AY_DI_8();
int /*<<< orphan*/ m68ki_write_8(int /*<<< orphan*/, int);
void m68k_op_sgt_8_di(void) {
  m68ki_write_8(EA_AY_DI_8(), COND_GT() ? 0xff : 0);
}


x86 assembly (clang, -O0):
<m68k_op_sgt_8_di>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <EA_AY_DI_8@plt>
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <COND_GT@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rcx
xor    %esi,%esi
mov    $0xff,%eax
cmp    $0x0,%rcx
cmovne %eax,%esi
call   1050 <m68ki_write_8@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<m68k_op_sgt_8_di>:
push   %rbp
push   %rbx
push   %rax
xor    %ebp,%ebp
xor    %eax,%eax
call   1040 <EA_AY_DI_8@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1030 <COND_GT@plt>
test   %rax,%rax
mov    $0xff,%esi
cmove  %ebp,%esi
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <m68ki_write_8@plt>

LLVM IR (-O0):
define void @m68k_op_sgt_8_di() {
%1 = call i32 (...) @EA_AY_DI_8()
%2 = call i64 (...) @COND_GT()
%3 = icmp ne i64 %2, 0
%4 = zext i1 %3 to i64
%5 = select i1 %3, i32 255, i32 0
%6 = call i32 @m68ki_write_8(i32 %1, i32 %5)
ret void
}

LLVM IR (-O2):
define void @m68k_op_sgt_8_di() {
%1 = tail call i32 (...) @EA_AY_DI_8()
%2 = tail call i64 (...) @COND_GT()
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 0, i32 255
%5 = tail call i32 @m68ki_write_8(i32 %1, i32 %4)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ sigset_t;

/* Variables and functions */
int /*<<< orphan*/ SIG_UNBLOCK;
int /*<<< orphan*/ sigaddset(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sigemptyset(int /*<<< orphan*/ *);
int /*<<< orphan*/ sigprocmask(int /*<<< orphan*/, int /*<<< orphan*/ *,
                               int /*<<< orphan*/);
void sig_unblock(int sig) {
  sigset_t ss;
  sigemptyset(&ss);
  sigaddset(&ss, sig);
  sigprocmask(SIG_UNBLOCK, &ss, 0);
}


x86 assembly (clang, -O0):
<sig_unblock>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <sigemptyset@plt>
mov    -0x4(%rbp),%esi
lea    -0x8(%rbp),%rdi
call   1050 <sigaddset@plt>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sig_unblock>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <sigemptyset@plt>
mov    %r14,%rdi
mov    %ebx,%esi
call   1050 <sigaddset@plt>
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %edx,%edx
call   1030 <sigprocmask@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@SIG_UNBLOCK = global i32 0
define void @sig_unblock(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @sigemptyset(i32* %3)
%5 = load i32, i32* %2
%6 = call i32 @sigaddset(i32* %3, i32 %5)
%7 = load i32, i32* @SIG_UNBLOCK
%8 = call i32 @sigprocmask(i32 %7, i32* %3, i32 0)
ret void
}

LLVM IR (-O2):
@SIG_UNBLOCK = global i32 0
define void @sig_unblock(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @sigemptyset(i32* %2)
%5 = call i32 @sigaddset(i32* %2, i32 %0)
%6 = load i32, i32* @SIG_UNBLOCK
%7 = call i32 @sigprocmask(i32 %6, i32* %2, i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
void error_d(int errCode, char *errDesc, char *msg) {
  printf("Status: %d %s\n", errCode, errDesc);
  printf("Content-Type: text/html; charset=UTF-8;\nExpires: 0\r\n\r\n");
  printf("%s", msg);
  exit(errCode);
}


x86 assembly (clang, -O0):
<error_d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xee5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error_d>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %rsi,%rdx
mov    %edi,%ebp
lea    0xebe(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebp,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"Status: %d %s\0A\00"
@.str.1 = [55 x i8] c"Content-Type: text/html; charset=UTF-8;\0AExpires: 0\0D\0A\0D\0A\00"
@.str.2 = [3 x i8] c"%s\00"
define void @error_d(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* %4
%8 = load i8*, i8** %5
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %8)
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0))
%11 = load i8*, i8** %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = load i32, i32* %4
%14 = call i32 @exit(i32 %13)
unreachable
}

LLVM IR (-O2):
@.str = [15 x i8] c"Status: %d %s\0A\00"
@.str.2 = [3 x i8] c"%s\00"
@str = [54 x i8] c"Content-Type: text/html; charset=UTF-8;\0AExpires: 0\0D\0A\0D\00"
define void @error_d(i32 %0, i8* %1, i8* %2) {
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %0, i8* %1)
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @str, i64 0, i64 0))
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %2)
%7 = tail call i32 @exit(i32 %0)
unreachable
}
int isalink(s)
char *s;
{ return (0); }


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

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

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

LLVM IR (-O2):
define i32 @isalink(i8* nocapture readnone %0) {
ret i32 0
}
void Hal_hook_wr_sgndrecfield(void) {}


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

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

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

LLVM IR (-O2):
define void @Hal_hook_wr_sgndrecfield() {
ret void
}
unsigned long packets_counter(unsigned long file_size) {
  return (file_size / 100) + 1;
}


x86 assembly (clang, -O0):
<packets_counter>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    $0x64,%ecx
xor    %edx,%edx
div    %rcx
add    $0x1,%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<packets_counter>:
mov    %rdi,%rax
shr    $0x2,%rax
movabs $0x28f5c28f5c28f5c3,%rcx
c2 f5 28
mul    %rcx
shr    $0x2,%rdx
lea    0x1(%rdx),%rax
ret

LLVM IR (-O0):
define i64 @packets_counter(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = udiv i64 %3, 100
%5 = add i64 %4, 1
ret i64 %5
}

LLVM IR (-O2):
define i64 @packets_counter(i64 %0) {
%2 = udiv i64 %0, 100
%3 = add nuw nsw i64 %2, 1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ sio_write(char *, int);
int putch(int c) {
  char buf;
  buf = c;
  sio_write(&buf, 1);
  return c;
}


x86 assembly (clang, -O0):
<putch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0x5(%rbp)
lea    -0x5(%rbp),%rdi
mov    $0x1,%esi
call   1030 <sio_write@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putch>:
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebx
mov    %bl,0xf(%rsp)
lea    0xf(%rsp),%rdi
mov    $0x1,%esi
call   1030 <sio_write@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @putch(i32 returned %0) {
%2 = alloca i8
%3 = trunc i32 %0 to i8
store i8 %3, i8* %2
%4 = call i32 @sio_write(i8* %2, i32 1)
ret i32 %0
}
/* Type definitions */
struct timeb {
  unsigned int millitm;
};

/* Variables and functions */
int /*<<< orphan*/ ftime(struct timeb *);
unsigned int getseed(void *buf) {
  struct timeb tm;
  ftime(&tm);
  return (unsigned int)buf * tm.millitm;
}


x86 assembly (clang, -O0):
<getseed>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x10(%rbp),%rdi
call   1030 <ftime@plt>
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getseed>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0x8(%rsp),%rdi
call   1030 <ftime@plt>
imul   0x8(%rsp),%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeb = type { i32 }
define i32 @getseed(i8* %0) {
%2 = alloca i8*
%3 = alloca %struct.timeb
store i8* %0, i8** %2
%4 = call i32 @ftime(%struct.timeb* %3)
%5 = load i8*, i8** %2
%6 = ptrtoint i8* %5 to i32
%7 = getelementptr inbounds %struct.timeb, %struct.timeb* %3, i32 0, i32 0
%8 = load i32, i32* %7
%9 = mul i32 %6, %8
ret i32 %9
}

LLVM IR (-O2):
%struct.timeb = type { i32 }
define i32 @getseed(i8* %0) {
%2 = alloca %struct.timeb
%3 = bitcast %struct.timeb* %2 to i8*
%4 = call i32 @ftime(%struct.timeb* %2)
%5 = ptrtoint i8* %0 to i64
%6 = trunc i64 %5 to i32
%7 = getelementptr inbounds %struct.timeb, %struct.timeb* %2, i64 0, i32 0
%8 = load i32, i32* %7
%9 = mul i32 %8, %6
ret i32 %9
}
void outl(unsigned int value, unsigned short port) {
  __asm__ __volatile__("out"
                       "l"
                       " %"
                       "0,%"
                       "w"
                       "1"
                       :
                       : "a"(value), "Nd"(port));
}


x86 assembly (clang, -O0):
<outl>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %edi,-0x4(%rbp)
mov    %ax,-0x6(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x6(%rbp),%dx
out    %eax,(%dx)
pop    %rbp
ret

x86 assembly (clang, -O2):
<outl>:
mov    %esi,%edx
mov    %edi,%eax
out    %eax,(%dx)
ret

LLVM IR (-O0):
define void @outl(i32 %0, i16 zeroext %1) {
%3 = alloca i32
%4 = alloca i16
store i32 %0, i32* %3
store i16 %1, i16* %4
%5 = load i32, i32* %3
%6 = load i16, i16* %4
ret void
}

LLVM IR (-O2):
define void @outl(i32 %0, i16 zeroext %1) {
tail call void asm sideeffect "outl $0,${1:w}", "{ax},N{dx},~{dirflag},~{fpsr},~{flags}"(i32 %0, i16 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
int benchmark_finirun() {
  (void)fprintf(stderr, "benchmark_finirun\n");
  return (0);
}


x86 assembly (clang, -O0):
<benchmark_finirun>:
push   %rbp
mov    %rsp,%rbp
mov    0x2ec5(%rip),%rax
mov    (%rax),%edi
lea    0xedc(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<benchmark_finirun>:
push   %rax
mov    0x2ec8(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"benchmark_finirun\0A\00"
define i32 @benchmark_finirun() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"benchmark_finirun\0A\00"
define i32 @benchmark_finirun() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
void g_type_free_instance() {}


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

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

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

LLVM IR (-O2):
define void @g_type_free_instance() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, void volatile *, void *);
int /*<<< orphan*/ stderr;
int testaddr(void *addr, volatile void *want) {
  if (addr != want) {
    fprintf(stderr, "  FAIL: expected si_addr==%p, not %p\n", want, addr);
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<testaddr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     1157 <testaddr+0x47>
mov    0x2eab(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
mov    -0x10(%rbp),%rcx
lea    0xeba(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0x0,-0x4(%rbp)
jmp    115e <testaddr+0x4e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testaddr>:
cmp    %rsi,%rdi
je     1138 <testaddr+0x28>
push   %rax
mov    %rsi,%rdx
mov    %rdi,%rcx
mov    0x2ebd(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret
mov    $0x1,%eax
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [38 x i8] c" FAIL: expected si_addr==%p, not %p\0A\00"
define i32 @testaddr(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 = load i8*, i8** %5
%8 = icmp ne i8* %6, %7
br i1 %8, label %9, label %14
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8*, i8** %5
%12 = load i8*, i8** %4
%13 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %11, i8* %12)
store i32 0, i32* %3
br label %15
14: ; preds = %2
store i32 1, i32* %3
br label %15
15: ; preds = %14, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [38 x i8] c" FAIL: expected si_addr==%p, not %p\0A\00"
define i32 @testaddr(i8* %0, i8* %1) {
%3 = icmp eq i8* %0, %1
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
br label %7
7: ; preds = %2, %4
%8 = phi i32 [ 0, %4 ], [ 1, %2 ]
ret i32 %8
}