xunge/DecIR huggingface dataset:
long unsigned int gcd(long unsigned int a, long unsigned int b) {
  while (a != b) {
    if (a > b)
      a = a - b;
    else
      b = b - a;
  }
  return a;
}


x86 assembly (clang, -O0):
<gcd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
je     114a <gcd+0x4a>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jbe    1139 <gcd+0x39>
mov    -0x8(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    1145 <gcd+0x45>
mov    -0x10(%rbp),%rax
sub    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    110c <gcd+0xc>
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<gcd>:
mov    %rdi,%rax
cmp    %rsi,%rdi
je     112e <gcd+0x2e>
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
cmp    %rax,%rsi
mov    $0x0,%edx
cmovb  %rsi,%rdx
mov    %rax,%rdi
cmovb  %rcx,%rdi
sub    %rdx,%rax
sub    %rdi,%rsi
cmp    %rsi,%rax
jne    1110 <gcd+0x10>
ret

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

LLVM IR (-O2):
define i64 @gcd(i64 %0, i64 %1) {
%3 = icmp eq i64 %0, %1
br i1 %3, label %13, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %11, %4 ], [ %1, %2 ]
%6 = phi i64 [ %9, %4 ], [ %0, %2 ]
%7 = icmp ult i64 %5, %6
%8 = select i1 %7, i64 %5, i64 0
%9 = sub i64 %6, %8
%10 = select i1 %7, i64 0, i64 %6
%11 = sub i64 %5, %10
%12 = icmp eq i64 %9, %11
br i1 %12, label %13, label %4
13: ; preds = %4, %2
%14 = phi i64 [ %0, %2 ], [ %9, %4 ]
ret i64 %14
}
/* Variables and functions */
int /*<<< orphan*/ dev_write(int, unsigned char *, int);
void display_bar(int fd, int on) {
  unsigned char data[5];
  if (on == 1)
    data[0] = 0xff;
  else if (on == 0)
    data[0] = 0x00;
  dev_write(fd, data, 1);
}


x86 assembly (clang, -O0):
<display_bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    1131 <display_bar+0x21>
movb   $0xff,-0xd(%rbp)
jmp    1144 <display_bar+0x34>
cmpl   $0x0,-0x8(%rbp)
jne    113f <display_bar+0x2f>
movb   $0x0,-0xd(%rbp)
jmp    1144 <display_bar+0x34>
mov    -0x4(%rbp),%edi
lea    -0xd(%rbp),%rsi
mov    $0x1,%edx
call   1030 <dev_write@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_bar>:
push   %rax
test   %esi,%esi
je     1121 <display_bar+0x11>
cmp    $0x1,%esi
jne    1126 <display_bar+0x16>
movb   $0xff,0x3(%rsp)
jmp    1126 <display_bar+0x16>
movb   $0x0,0x3(%rsp)
lea    0x3(%rsp),%rsi
mov    $0x1,%edx
call   1030 <dev_write@plt>
pop    %rax
ret

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

LLVM IR (-O2):
define void @display_bar(i32 %0, i32 %1) {
%3 = alloca [5 x i8]
%4 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
switch i32 %1, label %7 [
i32 1, label %5
i32 0, label %6
]
5: ; preds = %2
store i8 -1, i8* %4
br label %7
6: ; preds = %2
store i8 0, i8* %4
br label %7
7: ; preds = %2, %6, %5
%8 = call i32 @dev_write(i32 %0, i8* %4, i32 1)
ret void
}
/* Variables and functions */
long double floor(long double x) {
  long double rgv;
  if (x < 0)
    rgv = (int)x - 1;
  else
    rgv = (int)x;
  return rgv;
}


x86 assembly (clang, -O0):
<floor>:
push   %rbp
mov    %rsp,%rbp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fldz
fucomip %st(1),%st
fstp   %st(0)
jbe    114e <floor+0x4e>
jmp    111e <floor+0x1e>
fldt   -0x10(%rbp)
fnstcw -0x32(%rbp)
movzwl -0x32(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x34(%rbp)
fldcw  -0x34(%rbp)
fistpl -0x30(%rbp)
fldcw  -0x32(%rbp)
mov    -0x30(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
fildl  -0x2c(%rbp)
fstpt  -0x20(%rbp)
jmp    1176 <floor+0x76>
fldt   -0x10(%rbp)
fnstcw -0x36(%rbp)
movzwl -0x36(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x38(%rbp)
fldcw  -0x38(%rbp)
fistpl -0x28(%rbp)
fldcw  -0x36(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x24(%rbp)
fildl  -0x24(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x20(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<floor>:
fldt   0x8(%rsp)
fldz
xor    %eax,%eax
fucomip %st(1),%st
seta   %al
fnstcw -0xc(%rsp)
movzwl -0xc(%rsp),%ecx
or     $0xc00,%ecx
mov    %cx,-0xa(%rsp)
fldcw  -0xa(%rsp)
fistpl -0x8(%rsp)
fldcw  -0xc(%rsp)
mov    -0x8(%rsp),%ecx
sub    %eax,%ecx
mov    %ecx,-0x4(%rsp)
fildl  -0x4(%rsp)
ret

LLVM IR (-O0):
define x86_fp80 @floor(x86_fp80 %0) {
%2 = alloca x86_fp80
%3 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* %2
%5 = fcmp olt x86_fp80 %4, 0xK00000000000000000000
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load x86_fp80, x86_fp80* %2
%8 = fptosi x86_fp80 %7 to i32
%9 = sub nsw i32 %8, 1
%10 = sitofp i32 %9 to x86_fp80
store x86_fp80 %10, x86_fp80* %3
br label %15
11: ; preds = %1
%12 = load x86_fp80, x86_fp80* %2
%13 = fptosi x86_fp80 %12 to i32
%14 = sitofp i32 %13 to x86_fp80
store x86_fp80 %14, x86_fp80* %3
br label %15
15: ; preds = %11, %6
%16 = load x86_fp80, x86_fp80* %3
ret x86_fp80 %16
}

LLVM IR (-O2):
define x86_fp80 @floor(x86_fp80 %0) {
%2 = fcmp olt x86_fp80 %0, 0xK00000000000000000000
%3 = fptosi x86_fp80 %0 to i32
%4 = sext i1 %2 to i32
%5 = add nsw i32 %4, %3
%6 = sitofp i32 %5 to x86_fp80
ret x86_fp80 %6
}
/* Variables and functions */
int /*<<< orphan*/ chmod(char *, int);
int /*<<< orphan*/ mkdir(char *);
char *popString();
int /*<<< orphan*/ pushNumber(int /*<<< orphan*/);
void basMkDir() {
  char *name;
  name = popString();
  mkdir(name);
  chmod(name, 0777);
  pushNumber(0);
}


x86 assembly (clang, -O0):
<basMkDir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1040 <popString@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <mkdir@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
xor    %edi,%edi
call   1060 <pushNumber@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<basMkDir>:
push   %rbx
xor    %eax,%eax
call   1040 <popString@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <mkdir@plt>
mov    %rbx,%rdi
mov    $0x1ff,%esi
call   1050 <chmod@plt>
xor    %edi,%edi
pop    %rbx
jmp    1060 <pushNumber@plt>

LLVM IR (-O0):
define void @basMkDir() {
%1 = alloca i8*
%2 = call i8* (...) @popString()
store i8* %2, i8** %1
%3 = load i8*, i8** %1
%4 = call i32 @mkdir(i8* %3)
%5 = load i8*, i8** %1
%6 = call i32 @chmod(i8* %5, i32 511)
%7 = call i32 @pushNumber(i32 0)
ret void
}

LLVM IR (-O2):
define void @basMkDir() {
%1 = tail call i8* (...) @popString()
%2 = tail call i32 @mkdir(i8* %1)
%3 = tail call i32 @chmod(i8* %1, i32 511)
%4 = tail call i32 @pushNumber(i32 0)
ret void
}
char *tape_type(int n) {
  if (n == 0)
    return "Random";
  else if ((n & 0700000) == 0700000)
    return "Incremental";
  else
    return "Full";
}


x86 assembly (clang, -O0):
<tape_type>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
jne    1121 <tape_type+0x21>
lea    0xee8(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <tape_type+0x4f>
mov    -0xc(%rbp),%eax
and    $0x38000,%eax
cmp    $0x38000,%eax
jne    1144 <tape_type+0x44>
lea    0xecc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    114f <tape_type+0x4f>
lea    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<tape_type>:
mov    %edi,%eax
not    %eax
test   $0x38000,%eax
lea    0xef7(%rip),%rax
lea    0xefc(%rip),%rcx
cmove  %rax,%rcx
test   %edi,%edi
lea    0xedc(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Random\00"
@.str.1 = [12 x i8] c"Incremental\00"
@.str.2 = [5 x i8] c"Full\00"
define i8* @tape_type(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %7
6: ; preds = %1
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8** %2
br label %13
7: ; preds = %1
%8 = load i32, i32* %3
%9 = and i32 %8, 229376
%10 = icmp eq i32 %9, 229376
br i1 %10, label %11, label %12
11: ; preds = %7
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %13
12: ; preds = %7
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %13
13: ; preds = %12, %11, %6
%14 = load i8*, i8** %2
ret i8* %14
}

LLVM IR (-O2):
@.str = [7 x i8] c"Random\00"
@.str.1 = [12 x i8] c"Incremental\00"
@.str.2 = [5 x i8] c"Full\00"
define i8* @tape_type(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = and i32 %0, 229376
%4 = icmp eq i32 %3, 229376
%5 = select i1 %4, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0)
%6 = select i1 %2, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* %5
ret i8* %6
}
regx0adr1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((p0[x0]) <= (*((short *)11111111)))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<regx0adr1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movswl (%rax,%rcx,2),%eax
mov    $0xa98ac7,%ecx
movswl (%rcx),%ecx
cmp    %ecx,%eax
jg     1147 <regx0adr1+0x47>
movl   $0x1,-0x4(%rbp)
jmp    114e <regx0adr1+0x4e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<regx0adr1>:
movslq %edx,%rax
movzwl (%r8,%rax,2),%ecx
xor    %eax,%eax
cmp    0xa98ac7,%cx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @regx0adr1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture %4, i16* nocapture readnone %5) {
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds i16, i16* %4, i64 %7
%9 = load i16, i16* %8
%10 = load i16, i16* inttoptr (i64 11111111 to i16*)
%11 = icmp sle i16 %9, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
int i_abs(int i) { return i < 0 ? -i : i; }


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

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

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

LLVM IR (-O2):
define i32 @i_abs(i32 %0) {
%2 = tail call i32 @llvm.abs.i32(i32 %0, i1 true)
ret i32 %2
}
/* Variables and functions */
int /*<<< orphan*/ EX_USAGE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ puts(char *);
void usage() {
  puts("maze [-s size] [-r room geometry] [-c corridors]");
  exit(EX_USAGE);
}


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

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

LLVM IR (-O0):
@.str = [49 x i8] c"maze [-s size] [-r room geometry] [-c corridors]\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = call i32 @puts(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EX_USAGE
%3 = call i32 @exit(i32 %2)
unreachable
}

LLVM IR (-O2):
@.str = [49 x i8] c"maze [-s size] [-r room geometry] [-c corridors]\00"
@EX_USAGE = global i32 0
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str, i64 0, i64 0))
%2 = load i32, i32* @EX_USAGE
%3 = tail call i32 @exit(i32 %2)
unreachable
}
double _orbita_models_plummer_Mr(const void *par, const double R) {
  double M = *((double *)par), b = *((double *)par + 1);
  return M * ((R) * (R)) * R / pow(((b) * (b)) + ((R) * (R)), 1.5);
}


x86 assembly (clang, -O0):
<_orbita_models_plummer_Mr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe83(%rip),%xmm1
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_orbita_models_plummer_Mr>:
push   %rax
movapd %xmm0,%xmm3
movsd  0x8(%rdi),%xmm0
movapd %xmm3,%xmm1
mulsd  %xmm3,%xmm1
movsd  (%rdi),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm2,%xmm3
movsd  %xmm3,(%rsp)
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  0xebd(%rip),%xmm1
call   1030 <pow@plt>
movsd  (%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @_orbita_models_plummer_Mr(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i8* %0, i8** %3
store double %1, double* %4
%7 = load i8*, i8** %3
%8 = bitcast i8* %7 to double*
%9 = load double, double* %8
store double %9, double* %5
%10 = load i8*, i8** %3
%11 = bitcast i8* %10 to double*
%12 = getelementptr inbounds double, double* %11, i64 1
%13 = load double, double* %12
store double %13, double* %6
%14 = load double, double* %5
%15 = load double, double* %4
%16 = load double, double* %4
%17 = fmul double %15, %16
%18 = fmul double %14, %17
%19 = load double, double* %4
%20 = fmul double %18, %19
%21 = load double, double* %6
%22 = load double, double* %6
%23 = load double, double* %4
%24 = load double, double* %4
%25 = fmul double %23, %24
%26 = call double @llvm.fmuladd.f64(double %21, double %22, double %25)
%27 = call double @pow(double %26, double 1.500000e+00)
%28 = fdiv double %20, %27
ret double %28
}

LLVM IR (-O2):
define double @_orbita_models_plummer_Mr(i8* nocapture %0, double %1) {
%3 = bitcast i8* %0 to double*
%4 = load double, double* %3
%5 = getelementptr inbounds i8, i8* %0, i64 8
%6 = bitcast i8* %5 to double*
%7 = load double, double* %6
%8 = fmul double %1, %1
%9 = fmul double %8, %4
%10 = fmul double %9, %1
%11 = tail call double @llvm.fmuladd.f64(double %7, double %7, double %8)
%12 = tail call double @pow(double %11, double 1.500000e+00)
%13 = fdiv double %10, %12
ret double %13
}
long double ldmax(long double a, long double b) { return a > b ? a : b; }


x86 assembly (clang, -O0):
<ldmax>:
push   %rbp
mov    %rsp,%rbp
fldt   0x20(%rbp)
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fstpt  -0x20(%rbp)
fldt   -0x10(%rbp)
fldt   -0x20(%rbp)
fxch   %st(1)
fucomip %st(1),%st
fstp   %st(0)
jbe    1132 <ldmax+0x32>
jmp    1127 <ldmax+0x27>
fldt   -0x10(%rbp)
fstpt  -0x2c(%rbp)
jmp    1138 <ldmax+0x38>
fldt   -0x20(%rbp)
fstpt  -0x2c(%rbp)
fldt   -0x2c(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldmax>:
fldt   0x18(%rsp)
fldt   0x8(%rsp)
fucomi %st(1),%st
fxch   %st(1)
fcmovnbe %st(1),%st
fstp   %st(1)
ret

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

LLVM IR (-O2):
define x86_fp80 @ldmax(x86_fp80 %0, x86_fp80 %1) {
%3 = fcmp ogt x86_fp80 %0, %1
%4 = select i1 %3, x86_fp80 %0, x86_fp80 %1
ret x86_fp80 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ wchar_t;

/* Variables and functions */
int /*<<< orphan*/ __chk_fail();
scalar_t__ __glibc_unlikely(int);
int /*<<< orphan*/ *wmemset(int /*<<< orphan*/ *, int /*<<< orphan*/, size_t);
wchar_t *__wmemset_chk(wchar_t *s, wchar_t c, size_t n, size_t dstlen) {
  if (__glibc_unlikely(dstlen < n))
    __chk_fail();
  return wmemset(s, c, n);
}


x86 assembly (clang, -O0):
<__wmemset_chk>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x18(%rbp),%rax
setb   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <__glibc_unlikely@plt>
cmp    $0x0,%rax
je     116d <__wmemset_chk+0x3d>
mov    $0x0,%al
call   1040 <__chk_fail@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
call   1030 <wmemset@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<__wmemset_chk>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
xor    %edi,%edi
cmp    %rdx,%rcx
setb   %dil
call   1050 <__glibc_unlikely@plt>
test   %rax,%rax
je     1157 <__wmemset_chk+0x27>
xor    %eax,%eax
call   1040 <__chk_fail@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
mov    %rbx,%rdx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <wmemset@plt>

LLVM IR (-O0):
define i32* @__wmemset_chk(i32* %0, i32 %1, i64 %2, i64 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i64
%8 = alloca i64
store i32* %0, i32** %5
store i32 %1, i32* %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%9 = load i64, i64* %8
%10 = load i64, i64* %7
%11 = icmp ult i64 %9, %10
%12 = zext i1 %11 to i32
%13 = call i64 @__glibc_unlikely(i32 %12)
%14 = icmp ne i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %4
%16 = call i32 (...) @__chk_fail()
br label %17
17: ; preds = %15, %4
%18 = load i32*, i32** %5
%19 = load i32, i32* %6
%20 = load i64, i64* %7
%21 = call i32* @wmemset(i32* %18, i32 %19, i64 %20)
ret i32* %21
}

LLVM IR (-O2):
define i32* @__wmemset_chk(i32* %0, i32 %1, i64 %2, i64 %3) {
%5 = icmp ult i64 %3, %2
%6 = zext i1 %5 to i32
%7 = tail call i64 @__glibc_unlikely(i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %4
%10 = tail call i32 (...) @__chk_fail()
br label %11
11: ; preds = %9, %4
%12 = tail call i32* @wmemset(i32* %0, i32 %1, i64 %2)
ret i32* %12
}
int test_imm_B7uint8_reg(unsigned char val) {
  return ((val) & (0xB7 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_B7uint8_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%edx
and    $0xb7,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B7uint8_reg>:
test   $0xb7,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_B7uint8_reg(i8 zeroext %0) {
%2 = and i8 %0, -73
%3 = icmp eq i8 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
char *mlr_malloc_or_die(int);
int snprintf(int /*<<< orphan*/ *, int /*<<< orphan*/, char *,
             unsigned long long);
int /*<<< orphan*/ sprintf(char *, char *, long long);
char *mlr_alloc_hexfmt_from_ll(long long value) {
  int n = snprintf(NULL, 0, "0x%llx", (unsigned long long)value);
  char *string = mlr_malloc_or_die(n + 1);
  sprintf(string, "0x%llx", value);
  return string;
}


x86 assembly (clang, -O0):
<mlr_alloc_hexfmt_from_ll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
mov    %eax,%edi
xor    %esi,%esi
lea    0xeb3(%rip),%rdx
call   1030 <snprintf@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1040 <mlr_malloc_or_die@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rdx
lea    0xe8d(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mlr_alloc_hexfmt_from_ll>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r15
lea    0xec1(%rip),%r14
xor    %edi,%edi
xor    %esi,%esi
mov    %r14,%rdx
mov    %r15,%rcx
call   1030 <snprintf@plt>
lea    0x1(%rax),%edi
call   1040 <mlr_malloc_or_die@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1050 <sprintf@plt>
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [7 x i8] c"0x%llx\00"
define i8* @mlr_alloc_hexfmt_from_ll(i64 %0) {
%2 = alloca i64
%3 = alloca i32
%4 = alloca i8*
store i64 %0, i64* %2
%5 = load i64, i64* %2
%6 = call i32 @snprintf(i32* null, i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i8* @mlr_malloc_or_die(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i64, i64* %2
%12 = call i32 @sprintf(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%llx\00"
define i8* @mlr_alloc_hexfmt_from_ll(i64 %0) {
%2 = tail call i32 @snprintf(i32* null, i32 0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @mlr_malloc_or_die(i32 %3)
%5 = tail call i32 @sprintf(i8* dereferenceable(1) %4, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i64 %0)
ret i8* %4
}
void INT_Excep_PERIB_INTB168(void) {}


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

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

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

LLVM IR (-O2):
define void @INT_Excep_PERIB_INTB168() {
ret void
}
unsigned int adreno_iommu_set_pt_generate_cmds(struct adreno_ringbuffer *rb,
                                               unsigned int *cmds,
                                               struct kgsl_pagetable *pt) {
  return 0;
}


x86 assembly (clang, -O0):
<adreno_iommu_set_pt_generate_cmds>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
xor    %eax,%eax
pop    %rbp
ret

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

LLVM IR (-O0):
%struct.adreno_ringbuffer = type opaque
%struct.kgsl_pagetable = type opaque
define i32 @adreno_iommu_set_pt_generate_cmds(%struct.adreno_ringbuffer* %0, i32* %1, %struct.kgsl_pagetable* %2) {
%4 = alloca %struct.adreno_ringbuffer*
%5 = alloca i32*
%6 = alloca %struct.kgsl_pagetable*
store %struct.adreno_ringbuffer* %0, %struct.adreno_ringbuffer** %4
store i32* %1, i32** %5
store %struct.kgsl_pagetable* %2, %struct.kgsl_pagetable** %6
ret i32 0
}

LLVM IR (-O2):
%struct.adreno_ringbuffer = type opaque
%struct.kgsl_pagetable = type opaque
define i32 @adreno_iommu_set_pt_generate_cmds(%struct.adreno_ringbuffer* nocapture readnone %0, i32* nocapture readnone %1, %struct.kgsl_pagetable* nocapture readnone %2) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ Axle_Delete(int /*<<< orphan*/, int);
int /*<<< orphan*/ CarList_Change();
void RemoveAxleByIndex(int index) {
  Axle_Delete(0, index);
  CarList_Change();
}


x86 assembly (clang, -O0):
<RemoveAxleByIndex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
xor    %edi,%edi
call   1030 <Axle_Delete@plt>
mov    $0x0,%al
call   1040 <CarList_Change@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RemoveAxleByIndex>:
push   %rax
mov    %edi,%esi
xor    %edi,%edi
call   1030 <Axle_Delete@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <CarList_Change@plt>

LLVM IR (-O0):
define void @RemoveAxleByIndex(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @Axle_Delete(i32 0, i32 %3)
%5 = call i32 (...) @CarList_Change()
ret void
}

LLVM IR (-O2):
define void @RemoveAxleByIndex(i32 %0) {
%2 = tail call i32 @Axle_Delete(i32 0, i32 %0)
%3 = tail call i32 (...) @CarList_Change()
ret void
}
const char *protobuf_c_version(void) { return "1.3.2"; }


x86 assembly (clang, -O0):
<protobuf_c_version>:
push   %rbp
mov    %rsp,%rbp
lea    0xef5(%rip),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<protobuf_c_version>:
lea    0xef9(%rip),%rax
ret

LLVM IR (-O0):
@.str = [6 x i8] c"1.3.2\00"
define i8* @protobuf_c_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}

LLVM IR (-O2):
@.str = [6 x i8] c"1.3.2\00"
define i8* @protobuf_c_version() {
ret i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
}
/* Variables and functions */
int /*<<< orphan*/ uart_clear_int_pend(int);
void uint_pending(int n) { uart_clear_int_pend(n); }


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

x86 assembly (clang, -O2):
<uint_pending>:
jmp    1030 <uart_clear_int_pend@plt>

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

LLVM IR (-O2):
define void @uint_pending(i32 %0) {
%2 = tail call i32 @uart_clear_int_pend(i32 %0)
ret void
}
/* Variables and functions */
char *rindex(char *, char);
char *my_basename(char *devname) {
  char *s = rindex(devname, '/');
  return s ? s + 1 : devname;
}


x86 assembly (clang, -O0):
<my_basename>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x2f,%esi
call   1030 <rindex@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     114a <my_basename+0x3a>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1152 <my_basename+0x42>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<my_basename>:
push   %rbx
mov    %rdi,%rbx
mov    $0x2f,%esi
call   1030 <rindex@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    %rcx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i8* @my_basename(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @rindex(i8* %4, i8 signext 47)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 1
br label %13
11: ; preds = %1
%12 = load i8*, i8** %2
br label %13
13: ; preds = %11, %8
%14 = phi i8* [ %10, %8 ], [ %12, %11 ]
ret i8* %14
}

LLVM IR (-O2):
define i8* @my_basename(i8* %0) {
%2 = tail call i8* @rindex(i8* %0, i8 signext 47)
%3 = icmp eq i8* %2, null
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = select i1 %3, i8* %0, i8* %4
ret i8* %5
}
/* Type definitions */
struct stat {
  size_t st_size;
};

/* Variables and functions */
scalar_t__ stat(char *, struct stat *);
size_t file_size(void) {
  struct stat st;
  if (stat("/tmp/speed.tdb", &st) != 0)
    return -1;
  return st.st_size;
}


x86 assembly (clang, -O0):
<file_size>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <stat@plt>
cmp    $0x0,%rax
je     113f <file_size+0x2f>
movq   $0xffffffffffffffff,-0x8(%rbp)
ff
jmp    1147 <file_size+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_size>:
push   %rax
lea    0xee8(%rip),%rdi
mov    %rsp,%rsi
call   1030 <stat@plt>
neg    %rax
sbb    %rax,%rax
or     (%rsp),%rax
pop    %rcx
ret

LLVM IR (-O0):
%struct.stat = type { i64 }
@.str = [15 x i8] c"/tmp/speed.tdb\00"
define i64 @file_size() {
%1 = alloca i64
%2 = alloca %struct.stat
%3 = call i64 @stat(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.stat* %2)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %0
store i64 -1, i64* %1
br label %9
6: ; preds = %0
%7 = getelementptr inbounds %struct.stat, %struct.stat* %2, i32 0, i32 0
%8 = load i64, i64* %7
store i64 %8, i64* %1
br label %9
9: ; preds = %6, %5
%10 = load i64, i64* %1
ret i64 %10
}

LLVM IR (-O2):
%struct.stat = type { i64 }
@.str = [15 x i8] c"/tmp/speed.tdb\00"
define i64 @file_size() {
%1 = alloca %struct.stat
%2 = bitcast %struct.stat* %1 to i8*
%3 = call i64 @stat(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), %struct.stat* %1)
%4 = icmp eq i64 %3, 0
%5 = getelementptr inbounds %struct.stat, %struct.stat* %1, i64 0, i32 0
%6 = load i64, i64* %5
%7 = select i1 %4, i64 %6, i64 -1
ret i64 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
void caml_gr_lineto() { exit(1); }


x86 assembly (clang, -O0):
<caml_gr_lineto>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <exit@plt>

x86 assembly (clang, -O2):
<caml_gr_lineto>:
push   %rax
mov    $0x1,%edi
call   1030 <exit@plt>

LLVM IR (-O0):
define void @caml_gr_lineto() {
%1 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
define void @caml_gr_lineto() {
%1 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ my_fatal(char *, char *, int);
int file_to_char(int file) {
  {
    if (!(file >= 0 && file < 8))
      my_fatal("file \"%s\", line %d, assertion \""
               "file>=0&&file<8"
               "\" failed\n",
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/"
               "master/square.c",
               182);
  };
  return 'a' + file;
}


x86 assembly (clang, -O0):
<file_to_char>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     112f <file_to_char+0x1f>
cmpl   $0x8,-0x4(%rbp)
jl     1147 <file_to_char+0x37>
lea    0xeca(%rip),%rdi
lea    0xefb(%rip),%rsi
mov    $0xb6,%edx
call   1030 <my_fatal@plt>
mov    -0x4(%rbp),%eax
add    $0x61,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<file_to_char>:
push   %rbx
mov    %edi,%ebx
cmp    $0x8,%edi
jb     1130 <file_to_char+0x20>
lea    0xee1(%rip),%rdi
lea    0xf12(%rip),%rsi
mov    $0xb6,%edx
call   1030 <my_fatal@plt>
add    $0x61,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"file \22%s\22, line %d, assertion \22file>=0&&file<8\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @file_to_char(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sge i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 8
br i1 %7, label %10, label %8
8: ; preds = %5, %1
%9 = call i32 @my_fatal(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 182)
br label %10
10: ; preds = %8, %5
%11 = load i32, i32* %2
%12 = add nsw i32 97, %11
ret i32 %12
}

LLVM IR (-O2):
@.str = [56 x i8] c"file \22%s\22, line %d, assertion \22file>=0&&file<8\22 failed\0A\00"
@.str.1 = [135 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/ddugovic/polyglot/refs/heads/master/square.c\00"
define i32 @file_to_char(i32 %0) {
%2 = icmp ult i32 %0, 8
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @my_fatal(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([135 x i8], [135 x i8]* @.str.1, i64 0, i64 0), i32 182)
br label %5
5: ; preds = %1, %3
%6 = add nsw i32 %0, 97
ret i32 %6
}
void jtag_pre_init(void) {}


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

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

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

LLVM IR (-O2):
define void @jtag_pre_init() {
ret void
}
/* Variables and functions */
int mkfifo(char const *, int);
int fifo_make(const char *fn, int mode) { return mkfifo(fn, mode); }


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

x86 assembly (clang, -O2):
<fifo_make>:
jmp    1030 <mkfifo@plt>

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

LLVM IR (-O2):
define i32 @fifo_make(i8* %0, i32 %1) {
%3 = tail call i32 @mkfifo(i8* %0, i32 %1)
ret i32 %3
}
double Double_from_MINUS_long(long x) { return (double)x; }


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

x86 assembly (clang, -O2):
<Double_from_MINUS_long>:
cvtsi2sd %rdi,%xmm0
ret

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

LLVM IR (-O2):
define double @Double_from_MINUS_long(i64 %0) {
%2 = sitofp i64 %0 to double
ret double %2
}
/* Variables and functions */
void *_talloc_realloc(void const *, void *, size_t, char const *);
void *_talloc_realloc_array(const void *ctx, void *ptr, size_t el_size,
                            unsigned count, const char *name) {
  if (count >= 0x10000000 / el_size) {
    return NULL;
  }
  return _talloc_realloc(ctx, ptr, el_size * count, name);
}


x86 assembly (clang, -O0):
<_talloc_realloc_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8,-0x30(%rbp)
mov    -0x24(%rbp),%eax
mov    %rax,-0x38(%rbp)
mov    $0x10000000,%eax
xor    %ecx,%ecx
mov    %ecx,%edx
divq   -0x20(%rbp)
mov    %rax,%rcx
mov    -0x38(%rbp),%rax
cmp    %rcx,%rax
jb     115c <_talloc_realloc_array+0x4c>
movq   $0x0,-0x8(%rbp)
jmp    117c <_talloc_realloc_array+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%eax
imul   %rax,%rdx
mov    -0x30(%rbp),%rcx
call   1030 <_talloc_realloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_talloc_realloc_array>:
mov    %rdx,%r9
mov    %ecx,%ecx
cmp    $0x10000000,%rdx
ja     1130 <_talloc_realloc_array+0x20>
mov    $0x10000000,%eax
xor    %edx,%edx
div    %r9d
cmp    %rcx,%rax
ja     1137 <_talloc_realloc_array+0x27>
xor    %eax,%eax
ret
xor    %eax,%eax
cmp    %rcx,%rax
jbe    112d <_talloc_realloc_array+0x1d>
imul   %r9,%rcx
mov    %rcx,%rdx
mov    %r8,%rcx
jmp    1030 <_talloc_realloc@plt>

LLVM IR (-O0):
define i8* @_talloc_realloc_array(i8* %0, i8* %1, i64 %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i64 %2, i64* %9
store i32 %3, i32* %10
store i8* %4, i8** %11
%12 = load i32, i32* %10
%13 = zext i32 %12 to i64
%14 = load i64, i64* %9
%15 = udiv i64 268435456, %14
%16 = icmp uge i64 %13, %15
br i1 %16, label %17, label %18
17: ; preds = %5
store i8* null, i8** %6
br label %27
18: ; preds = %5
%19 = load i8*, i8** %7
%20 = load i8*, i8** %8
%21 = load i64, i64* %9
%22 = load i32, i32* %10
%23 = zext i32 %22 to i64
%24 = mul i64 %21, %23
%25 = load i8*, i8** %11
%26 = call i8* @_talloc_realloc(i8* %19, i8* %20, i64 %24, i8* %25)
store i8* %26, i8** %6
br label %27
27: ; preds = %18, %17
%28 = load i8*, i8** %6
ret i8* %28
}

LLVM IR (-O2):
define i8* @_talloc_realloc_array(i8* %0, i8* %1, i64 %2, i32 %3, i8* %4) {
%6 = zext i32 %3 to i64
%7 = udiv i64 268435456, %2
%8 = icmp ugt i64 %7, %6
br i1 %8, label %9, label %12
9: ; preds = %5
%10 = mul i64 %6, %2
%11 = tail call i8* @_talloc_realloc(i8* %0, i8* %1, i64 %10, i8* %4)
br label %12
12: ; preds = %5, %9
%13 = phi i8* [ %11, %9 ], [ null, %5 ]
ret i8* %13
}
/* Variables and functions */
int ebbrt_newlib_execve(char *, char **, char **);
int execve(char *name, char **argv, char **env) {
  return ebbrt_newlib_execve(name, argv, env);
}


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

x86 assembly (clang, -O2):
<execve>:
jmp    1030 <ebbrt_newlib_execve@plt>

LLVM IR (-O0):
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i8**
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i8** %2, i8*** %6
%7 = load i8*, i8** %4
%8 = load i8**, i8*** %5
%9 = load i8**, i8*** %6
%10 = call i32 @ebbrt_newlib_execve(i8* %7, i8** %8, i8** %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @execve(i8* %0, i8** %1, i8** %2) {
%4 = tail call i32 @ebbrt_newlib_execve(i8* %0, i8** %1, i8** %2)
ret i32 %4
}
int check(int to_check[], int answer[], int size) {
  int i;
  for (i = 0; i < size; i++)
    if (to_check[i] != answer[i])
      return -1;
  return 0;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    115d <check+0x5d>
mov    -0x10(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x18(%rbp),%rcx
movslq -0x20(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
je     114a <check+0x4a>
movl   $0xffffffff,-0x4(%rbp)
jmp    1164 <check+0x64>
jmp    114f <check+0x4f>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1116 <check+0x16>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
test   %edx,%edx
jle    1121 <check+0x21>
mov    %edx,%eax
xor    %ecx,%ecx
nopl   0x0(%rax,%rax,1)
mov    (%rdi,%rcx,4),%edx
cmp    (%rsi,%rcx,4),%edx
jne    1124 <check+0x24>
add    $0x1,%rcx
cmp    %rcx,%rax
jne    1110 <check+0x10>
xor    %eax,%eax
ret
mov    $0xffffffff,%eax
ret

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

LLVM IR (-O2):
define i32 @check(i32* nocapture %0, i32* nocapture %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %17
5: ; preds = %3
%6 = zext i32 %2 to i64
br label %9
7: ; preds = %9
%8 = icmp eq i64 %16, %6
br i1 %8, label %17, label %9
9: ; preds = %5, %7
%10 = phi i64 [ 0, %5 ], [ %16, %7 ]
%11 = getelementptr inbounds i32, i32* %0, i64 %10
%12 = load i32, i32* %11
%13 = getelementptr inbounds i32, i32* %1, i64 %10
%14 = load i32, i32* %13
%15 = icmp eq i32 %12, %14
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %7, label %17
17: ; preds = %9, %7, %3
%18 = phi i32 [ 0, %3 ], [ 0, %7 ], [ -1, %9 ]
ret i32 %18
}
unsigned dtz_to_wdl(int cnt50, int dtz) {
  int wdl = 0;
  if (dtz > 0)
    wdl = (dtz + cnt50 <= 100 ? 2 : 1);
  else if (dtz < 0)
    wdl = (-dtz + cnt50 <= 100 ? -2 : -1);
  return wdl + 2;
}


x86 assembly (clang, -O0):
<dtz_to_wdl>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    1139 <dtz_to_wdl+0x39>
mov    -0x8(%rbp),%edx
add    -0x4(%rbp),%edx
mov    $0x1,%eax
mov    $0x2,%ecx
cmp    $0x64,%edx
cmovle %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <dtz_to_wdl+0x63>
cmpl   $0x0,-0x8(%rbp)
jge    115e <dtz_to_wdl+0x5e>
xor    %edx,%edx
sub    -0x8(%rbp),%edx
add    -0x4(%rbp),%edx
mov    $0xffffffff,%eax
mov    $0xfffffffe,%ecx
cmp    $0x64,%edx
cmovle %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1163 <dtz_to_wdl+0x63>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<dtz_to_wdl>:
test   %esi,%esi
jle    1115 <dtz_to_wdl+0x15>
add    %edi,%esi
xor    %eax,%eax
cmp    $0x65,%esi
setl   %al
add    $0x1,%eax
add    $0x2,%eax
ret
xor    %eax,%eax
test   %esi,%esi
js     111f <dtz_to_wdl+0x1f>
add    $0x2,%eax
ret
sub    %esi,%edi
xor    %eax,%eax
cmp    $0x65,%edi
setl   %al
not    %eax
add    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @dtz_to_wdl(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
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i32, i32* %4
%10 = load i32, i32* %3
%11 = add nsw i32 %9, %10
%12 = icmp sle i32 %11, 100
%13 = zext i1 %12 to i64
%14 = select i1 %12, i32 2, i32 1
store i32 %14, i32* %5
br label %27
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i32, i32* %4
%20 = sub nsw i32 0, %19
%21 = load i32, i32* %3
%22 = add nsw i32 %20, %21
%23 = icmp sle i32 %22, 100
%24 = zext i1 %23 to i64
%25 = select i1 %23, i32 -2, i32 -1
store i32 %25, i32* %5
br label %26
26: ; preds = %18, %15
br label %27
27: ; preds = %26, %8
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 2
ret i32 %29
}

LLVM IR (-O2):
define i32 @dtz_to_wdl(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = add nsw i32 %1, %0
%6 = icmp slt i32 %5, 101
%7 = select i1 %6, i32 2, i32 1
br label %14
8: ; preds = %2
%9 = icmp slt i32 %1, 0
br i1 %9, label %10, label %14
10: ; preds = %8
%11 = sub i32 %0, %1
%12 = icmp slt i32 %11, 101
%13 = select i1 %12, i32 -2, i32 -1
br label %14
14: ; preds = %8, %10, %4
%15 = phi i32 [ %7, %4 ], [ %13, %10 ], [ 0, %8 ]
%16 = add nsw i32 %15, 2
ret i32 %16
}
float linear_interp(float x_min, float x_max, float y_min, float y_max,
                    float x_inter) {
  float m;
  float y_inter;
  m = (y_max - y_min) / (x_max - x_min);
  y_inter = y_min + m * (x_inter - x_min);
  return y_inter;
}


x86 assembly (clang, -O0):
<linear_interp>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0xc(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
subss  -0x4(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movss  -0x14(%rbp),%xmm2
subss  -0x4(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<linear_interp>:
subss  %xmm2,%xmm3
subss  %xmm0,%xmm1
divss  %xmm1,%xmm3
subss  %xmm0,%xmm4
mulss  %xmm3,%xmm4
addss  %xmm2,%xmm4
movaps %xmm4,%xmm0
ret

LLVM IR (-O0):
define float @linear_interp(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%13 = load float, float* %9
%14 = load float, float* %8
%15 = fsub float %13, %14
%16 = load float, float* %7
%17 = load float, float* %6
%18 = fsub float %16, %17
%19 = fdiv float %15, %18
store float %19, float* %11
%20 = load float, float* %8
%21 = load float, float* %11
%22 = load float, float* %10
%23 = load float, float* %6
%24 = fsub float %22, %23
%25 = call float @llvm.fmuladd.f32(float %21, float %24, float %20)
store float %25, float* %12
%26 = load float, float* %12
ret float %26
}

LLVM IR (-O2):
define float @linear_interp(float %0, float %1, float %2, float %3, float %4) {
%6 = fsub float %3, %2
%7 = fsub float %1, %0
%8 = fdiv float %6, %7
%9 = fsub float %4, %0
%10 = tail call float @llvm.fmuladd.f32(float %8, float %9, float %2)
ret float %10
}