#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 */
int acos(int);
int pow(double, int);
int sqrt(double);
double prekryv(double r1, double r2, double dist) {
  if (r1 > r2)
    return pow(r2, 2) * acos((pow(dist, 2) + pow(r2, 2) - pow(r1, 2)) /
                             (2 * dist * r2)) +
           pow(r1, 2) * acos((pow(dist, 2) + pow(r1, 2) - pow(r2, 2)) /
                             (2 * dist * r1)) -
           sqrt((-dist + r1 + r2) * (dist + r2 - r1) * (dist - r2 + r1) *
                (dist + r1 + r2)) /
               2;
  else
    return pow(r1, 2) * acos((pow(dist, 2) + pow(r1, 2) - pow(r2, 2)) /
                             (2 * dist * r1)) +
           pow(r2, 2) * acos((pow(dist, 2) + pow(r2, 2) - pow(r1, 2)) /
                             (2 * dist * r2)) -
           sqrt((-dist + r1 + r2) * (dist + r1 - r2) * (dist - r1 + r2) *
                (dist + r1 + r2)) /
               2;
}


x86 assembly (clang, -O0):
<prekryv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    12df <prekryv+0x1af>
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xe4a(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x2c(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x34(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xdc9(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    -0x2c(%rbp),%ecx
mov    %eax,%edx
mov    -0x28(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1462 <prekryv+0x332>
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x58(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x60(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x5c(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xcc2(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    %eax,%ecx
mov    -0x58(%rbp),%eax
imul   %ecx,%eax
mov    %eax,-0x48(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x4c(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x54(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x54(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  0xc41(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    -0x4c(%rbp),%ecx
mov    %eax,%edx
mov    -0x48(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
mov    %eax,-0x44(%rbp)
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
addsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
subsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
subsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x20(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
addsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x44(%rbp),%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prekryv>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
movsd  %xmm2,0x18(%rsp)
ucomisd %xmm1,%xmm0
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
jbe    128b <prekryv+0x15b>
movapd %xmm1,%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%r14d
movsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebp
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    %eax,%r15d
imul   %r14d,%r15d
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%r14d
movsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebx
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x8(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm2
mov    %eax,%ebx
imul   %r14d,%ebx
add    %r15d,%ebx
movapd %xmm0,%xmm3
movsd  0x18(%rsp),%xmm4
subsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm2,%xmm1
addsd  %xmm4,%xmm1
subsd  %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm4,%xmm3
subsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm0
jmp    13b7 <prekryv+0x287>
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%r14d
movsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebp
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebx
add    %ebp,%ebx
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
sub    %eax,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
mulsd  0x8(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
mov    %eax,%r15d
imul   %r14d,%r15d
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%r14d
movsd  0x18(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebx
movsd  0x10(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,%ebp
add    %ebx,%ebp
movsd  0x8(%rsp),%xmm0
mov    $0x2,%edi
call   1040 <pow@plt>
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  0x10(%rsp),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <acos@plt>
movsd  0x10(%rsp),%xmm2
mov    %eax,%ebx
imul   %r14d,%ebx
add    %r15d,%ebx
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm3
movsd  0x18(%rsp),%xmm4
subsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movapd %xmm0,%xmm1
addsd  %xmm4,%xmm1
subsd  %xmm0,%xmm4
movapd %xmm1,%xmm0
subsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm4
mulsd  %xmm1,%xmm4
movapd %xmm4,%xmm3
addsd  %xmm2,%xmm0
mulsd  %xmm3,%xmm0
call   1050 <sqrt@plt>
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
sub    %ecx,%ebx
xorps  %xmm0,%xmm0
cvtsi2sd %ebx,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @prekryv(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fcmp ogt double %8, %9
br i1 %10, label %11, label %79
11: ; preds = %3
%12 = load double, double* %6
%13 = call i32 @pow(double %12, i32 2)
%14 = load double, double* %7
%15 = call i32 @pow(double %14, i32 2)
%16 = load double, double* %6
%17 = call i32 @pow(double %16, i32 2)
%18 = add nsw i32 %15, %17
%19 = load double, double* %5
%20 = call i32 @pow(double %19, i32 2)
%21 = sub nsw i32 %18, %20
%22 = sitofp i32 %21 to double
%23 = load double, double* %7
%24 = fmul double 2.000000e+00, %23
%25 = load double, double* %6
%26 = fmul double %24, %25
%27 = fdiv double %22, %26
%28 = fptosi double %27 to i32
%29 = call i32 @acos(i32 %28)
%30 = mul nsw i32 %13, %29
%31 = load double, double* %5
%32 = call i32 @pow(double %31, i32 2)
%33 = load double, double* %7
%34 = call i32 @pow(double %33, i32 2)
%35 = load double, double* %5
%36 = call i32 @pow(double %35, i32 2)
%37 = add nsw i32 %34, %36
%38 = load double, double* %6
%39 = call i32 @pow(double %38, i32 2)
%40 = sub nsw i32 %37, %39
%41 = sitofp i32 %40 to double
%42 = load double, double* %7
%43 = fmul double 2.000000e+00, %42
%44 = load double, double* %5
%45 = fmul double %43, %44
%46 = fdiv double %41, %45
%47 = fptosi double %46 to i32
%48 = call i32 @acos(i32 %47)
%49 = mul nsw i32 %32, %48
%50 = add nsw i32 %30, %49
%51 = load double, double* %7
%52 = fneg double %51
%53 = load double, double* %5
%54 = fadd double %52, %53
%55 = load double, double* %6
%56 = fadd double %54, %55
%57 = load double, double* %7
%58 = load double, double* %6
%59 = fadd double %57, %58
%60 = load double, double* %5
%61 = fsub double %59, %60
%62 = fmul double %56, %61
%63 = load double, double* %7
%64 = load double, double* %6
%65 = fsub double %63, %64
%66 = load double, double* %5
%67 = fadd double %65, %66
%68 = fmul double %62, %67
%69 = load double, double* %7
%70 = load double, double* %5
%71 = fadd double %69, %70
%72 = load double, double* %6
%73 = fadd double %71, %72
%74 = fmul double %68, %73
%75 = call i32 @sqrt(double %74)
%76 = sdiv i32 %75, 2
%77 = sub nsw i32 %50, %76
%78 = sitofp i32 %77 to double
store double %78, double* %4
br label %147
79: ; preds = %3
%80 = load double, double* %5
%81 = call i32 @pow(double %80, i32 2)
%82 = load double, double* %7
%83 = call i32 @pow(double %82, i32 2)
%84 = load double, double* %5
%85 = call i32 @pow(double %84, i32 2)
%86 = add nsw i32 %83, %85
%87 = load double, double* %6
%88 = call i32 @pow(double %87, i32 2)
%89 = sub nsw i32 %86, %88
%90 = sitofp i32 %89 to double
%91 = load double, double* %7
%92 = fmul double 2.000000e+00, %91
%93 = load double, double* %5
%94 = fmul double %92, %93
%95 = fdiv double %90, %94
%96 = fptosi double %95 to i32
%97 = call i32 @acos(i32 %96)
%98 = mul nsw i32 %81, %97
%99 = load double, double* %6
%100 = call i32 @pow(double %99, i32 2)
%101 = load double, double* %7
%102 = call i32 @pow(double %101, i32 2)
%103 = load double, double* %6
%104 = call i32 @pow(double %103, i32 2)
%105 = add nsw i32 %102, %104
%106 = load double, double* %5
%107 = call i32 @pow(double %106, i32 2)
%108 = sub nsw i32 %105, %107
%109 = sitofp i32 %108 to double
%110 = load double, double* %7
%111 = fmul double 2.000000e+00, %110
%112 = load double, double* %6
%113 = fmul double %111, %112
%114 = fdiv double %109, %113
%115 = fptosi double %114 to i32
%116 = call i32 @acos(i32 %115)
%117 = mul nsw i32 %100, %116
%118 = add nsw i32 %98, %117
%119 = load double, double* %7
%120 = fneg double %119
%121 = load double, double* %5
%122 = fadd double %120, %121
%123 = load double, double* %6
%124 = fadd double %122, %123
%125 = load double, double* %7
%126 = load double, double* %5
%127 = fadd double %125, %126
%128 = load double, double* %6
%129 = fsub double %127, %128
%130 = fmul double %124, %129
%131 = load double, double* %7
%132 = load double, double* %5
%133 = fsub double %131, %132
%134 = load double, double* %6
%135 = fadd double %133, %134
%136 = fmul double %130, %135
%137 = load double, double* %7
%138 = load double, double* %5
%139 = fadd double %137, %138
%140 = load double, double* %6
%141 = fadd double %139, %140
%142 = fmul double %136, %141
%143 = call i32 @sqrt(double %142)
%144 = sdiv i32 %143, 2
%145 = sub nsw i32 %118, %144
%146 = sitofp i32 %145 to double
store double %146, double* %4
br label %147
147: ; preds = %79, %11
%148 = load double, double* %4
ret double %148
}

LLVM IR (-O2):
define double @prekryv(double %0, double %1, double %2) {
%4 = fcmp ogt double %0, %1
br i1 %4, label %5, label %41
5: ; preds = %3
%6 = tail call i32 @pow(double %1, i32 2)
%7 = tail call i32 @pow(double %2, i32 2)
%8 = tail call i32 @pow(double %1, i32 2)
%9 = add nsw i32 %8, %7
%10 = tail call i32 @pow(double %0, i32 2)
%11 = sub i32 %9, %10
%12 = sitofp i32 %11 to double
%13 = fmul double %2, 2.000000e+00
%14 = fmul double %13, %1
%15 = fdiv double %12, %14
%16 = fptosi double %15 to i32
%17 = tail call i32 @acos(i32 %16)
%18 = mul nsw i32 %17, %6
%19 = tail call i32 @pow(double %0, i32 2)
%20 = tail call i32 @pow(double %2, i32 2)
%21 = tail call i32 @pow(double %0, i32 2)
%22 = add nsw i32 %21, %20
%23 = tail call i32 @pow(double %1, i32 2)
%24 = sub i32 %22, %23
%25 = sitofp i32 %24 to double
%26 = fmul double %13, %0
%27 = fdiv double %25, %26
%28 = fptosi double %27 to i32
%29 = tail call i32 @acos(i32 %28)
%30 = mul nsw i32 %29, %19
%31 = add nsw i32 %30, %18
%32 = fsub double %0, %2
%33 = fadd double %32, %1
%34 = fadd double %1, %2
%35 = fsub double %34, %0
%36 = fmul double %33, %35
%37 = fsub double %2, %1
%38 = fadd double %37, %0
%39 = fmul double %38, %36
%40 = fadd double %0, %2
br label %76
41: ; preds = %3
%42 = tail call i32 @pow(double %0, i32 2)
%43 = tail call i32 @pow(double %2, i32 2)
%44 = tail call i32 @pow(double %0, i32 2)
%45 = add nsw i32 %44, %43
%46 = tail call i32 @pow(double %1, i32 2)
%47 = sub i32 %45, %46
%48 = sitofp i32 %47 to double
%49 = fmul double %2, 2.000000e+00
%50 = fmul double %49, %0
%51 = fdiv double %48, %50
%52 = fptosi double %51 to i32
%53 = tail call i32 @acos(i32 %52)
%54 = mul nsw i32 %53, %42
%55 = tail call i32 @pow(double %1, i32 2)
%56 = tail call i32 @pow(double %2, i32 2)
%57 = tail call i32 @pow(double %1, i32 2)
%58 = add nsw i32 %57, %56
%59 = tail call i32 @pow(double %0, i32 2)
%60 = sub i32 %58, %59
%61 = sitofp i32 %60 to double
%62 = fmul double %49, %1
%63 = fdiv double %61, %62
%64 = fptosi double %63 to i32
%65 = tail call i32 @acos(i32 %64)
%66 = mul nsw i32 %65, %55
%67 = add nsw i32 %66, %54
%68 = fsub double %0, %2
%69 = fadd double %68, %1
%70 = fadd double %0, %2
%71 = fsub double %70, %1
%72 = fmul double %69, %71
%73 = fsub double %2, %0
%74 = fadd double %73, %1
%75 = fmul double %74, %72
br label %76
76: ; preds = %41, %5
%77 = phi double [ %70, %41 ], [ %40, %5 ]
%78 = phi double [ %75, %41 ], [ %39, %5 ]
%79 = phi i32 [ %67, %41 ], [ %31, %5 ]
%80 = fadd double %77, %1
%81 = fmul double %80, %78
%82 = tail call i32 @sqrt(double %81)
%83 = sdiv i32 %82, -2
%84 = add i32 %79, %83
%85 = sitofp i32 %84 to double
ret double %85
}