#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double asin(double);
double cos(double);
double sin(double);
double sqrt(double);
int rfitr(double l2, double s2, double l1, double s1) {
  double t;
  if (l2 < s2) {
    t = l2;
    l2 = s2;
    s2 = t;
  };
  if (l1 < s1) {
    t = l1;
    l1 = s1;
    s1 = t;
  };
  if (s1 > 1e-8 + s2)
    return 0;
  if (l1 < 1e-8 + l2)
    return 1;
  t = sqrt(l1 * l1 + s1 * s1);
  t = asin(l2 / t) - asin(s1 / t);
  t = l1 * cos(t) + s1 * sin(t);
  if (t < 1e-8 + s2)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<rfitr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    118e <rfitr+0x4e>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11c0 <rfitr+0x80>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xe33(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jbe    11e8 <rfitr+0xa8>
movl   $0x0,-0x4(%rbp)
jmp    12e9 <rfitr+0x1a9>
movsd  -0x20(%rbp),%xmm1
movsd  0xe0b(%rip),%xmm0
addsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1210 <rfitr+0xd0>
movl   $0x1,-0x4(%rbp)
jmp    12e9 <rfitr+0x1a9>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm1
mulsd  -0x28(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1040 <asin@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
call   1040 <asin@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x38(%rbp),%xmm0
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  0xd39(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    12e2 <rfitr+0x1a2>
movl   $0x1,-0x4(%rbp)
jmp    12e9 <rfitr+0x1a9>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rfitr>:
sub    $0x28,%rsp
movapd %xmm0,%xmm5
minsd  %xmm1,%xmm5
movapd %xmm2,%xmm4
addsd  0xea8(%rip),%xmm5
minsd  %xmm3,%xmm4
xor    %eax,%eax
ucomisd %xmm5,%xmm4
ja     1245 <rfitr+0x105>
maxsd  %xmm0,%xmm1
maxsd  %xmm2,%xmm3
movsd  0xe88(%rip),%xmm0
addsd  %xmm1,%xmm0
mov    $0x1,%eax
ucomisd %xmm3,%xmm0
ja     1245 <rfitr+0x105>
movsd  %xmm5,0x18(%rsp)
movsd  %xmm4,0x10(%rsp)
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm3,0x20(%rsp)
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     11c1 <rfitr+0x81>
sqrtsd %xmm0,%xmm0
jmp    11d0 <rfitr+0x90>
movsd  %xmm1,(%rsp)
call   1060 <sqrt@plt>
movsd  (%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <asin@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
divsd  0x8(%rsp),%xmm0
call   1040 <asin@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm1,%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
xor    %eax,%eax
movsd  0x18(%rsp),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
add    $0x28,%rsp
ret

LLVM IR (-O0):
define i32 @rfitr(double %0, double %1, double %2, double %3) {
%5 = alloca i32
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
%11 = load double, double* %6
%12 = load double, double* %7
%13 = fcmp olt double %11, %12
br i1 %13, label %14, label %18
14: ; preds = %4
%15 = load double, double* %6
store double %15, double* %10
%16 = load double, double* %7
store double %16, double* %6
%17 = load double, double* %10
store double %17, double* %7
br label %18
18: ; preds = %14, %4
%19 = load double, double* %8
%20 = load double, double* %9
%21 = fcmp olt double %19, %20
br i1 %21, label %22, label %26
22: ; preds = %18
%23 = load double, double* %8
store double %23, double* %10
%24 = load double, double* %9
store double %24, double* %8
%25 = load double, double* %10
store double %25, double* %9
br label %26
26: ; preds = %22, %18
%27 = load double, double* %9
%28 = load double, double* %7
%29 = fadd double 1.000000e-08, %28
%30 = fcmp ogt double %27, %29
br i1 %30, label %31, label %32
31: ; preds = %26
store i32 0, i32* %5
br label %69
32: ; preds = %26
%33 = load double, double* %8
%34 = load double, double* %6
%35 = fadd double 1.000000e-08, %34
%36 = fcmp olt double %33, %35
br i1 %36, label %37, label %38
37: ; preds = %32
store i32 1, i32* %5
br label %69
38: ; preds = %32
%39 = load double, double* %8
%40 = load double, double* %8
%41 = load double, double* %9
%42 = load double, double* %9
%43 = fmul double %41, %42
%44 = call double @llvm.fmuladd.f64(double %39, double %40, double %43)
%45 = call double @sqrt(double %44)
store double %45, double* %10
%46 = load double, double* %6
%47 = load double, double* %10
%48 = fdiv double %46, %47
%49 = call double @asin(double %48)
%50 = load double, double* %9
%51 = load double, double* %10
%52 = fdiv double %50, %51
%53 = call double @asin(double %52)
%54 = fsub double %49, %53
store double %54, double* %10
%55 = load double, double* %8
%56 = load double, double* %10
%57 = call double @cos(double %56)
%58 = load double, double* %9
%59 = load double, double* %10
%60 = call double @sin(double %59)
%61 = fmul double %58, %60
%62 = call double @llvm.fmuladd.f64(double %55, double %57, double %61)
store double %62, double* %10
%63 = load double, double* %10
%64 = load double, double* %7
%65 = fadd double 1.000000e-08, %64
%66 = fcmp olt double %63, %65
br i1 %66, label %67, label %68
67: ; preds = %38
store i32 1, i32* %5
br label %69
68: ; preds = %38
store i32 0, i32* %5
br label %69
69: ; preds = %68, %67, %37, %31
%70 = load i32, i32* %5
ret i32 %70
}

LLVM IR (-O2):
define i32 @rfitr(double %0, double %1, double %2, double %3) {
%5 = fcmp olt double %0, %1
%6 = select i1 %5, double %1, double %0
%7 = select i1 %5, double %0, double %1
%8 = fcmp olt double %2, %3
%9 = select i1 %8, double %3, double %2
%10 = select i1 %8, double %2, double %3
%11 = fadd double %7, 1.000000e-08
%12 = fcmp ogt double %10, %11
br i1 %12, label %31, label %13
13: ; preds = %4
%14 = fadd double %6, 1.000000e-08
%15 = fcmp olt double %9, %14
br i1 %15, label %31, label %16
16: ; preds = %13
%17 = fmul double %10, %10
%18 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %17)
%19 = tail call double @sqrt(double %18)
%20 = fdiv double %6, %19
%21 = tail call double @asin(double %20)
%22 = fdiv double %10, %19
%23 = tail call double @asin(double %22)
%24 = fsub double %21, %23
%25 = tail call double @cos(double %24)
%26 = tail call double @sin(double %24)
%27 = fmul double %10, %26
%28 = tail call double @llvm.fmuladd.f64(double %9, double %25, double %27)
%29 = fcmp olt double %28, %11
%30 = zext i1 %29 to i32
br label %31
31: ; preds = %16, %13, %4
%32 = phi i32 [ 0, %4 ], [ 1, %13 ], [ %30, %16 ]
ret i32 %32
}