#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 mod2pi(double);
double my_atan2(int, double);
double sqrt(double);
double cscb(double x, double y, double phi, double rs, double rc, double *t,
            double *u, double *v) {
  double a, b, u1, theta, alpha, length_rs;
  a = x + rs;
  b = y - rc;
  u1 = sqrt(a * a + b * b);
  if (u1 < (2 * (1.0)))
    return (10000);
  theta = my_atan2(b, a);
  *u = sqrt(u1 * u1 - (4 * (1.0) * (1.0)));
  alpha = my_atan2((2 * (1.0)), *u);
  *t = mod2pi(theta + alpha);
  *v = mod2pi(*t - phi);
  length_rs = (1.0) * (*t + *v) + *u;
  return (length_rs);
}


x86 assembly (clang, -O0):
<cscb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
mov    %rdi,-0x38(%rbp)
mov    %rsi,-0x40(%rbp)
mov    %rdx,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
subsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  0xe54(%rip),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    11c9 <cscb+0x99>
movsd  0xe51(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1277 <cscb+0x147>
cvttsd2si -0x58(%rbp),%edi
movsd  -0x50(%rbp),%xmm0
call   1040 <my_atan2@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe15(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
mov    $0x2,%edi
call   1040 <my_atan2@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x68(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
subsd  -0x20(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cscb>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movsd  %xmm2,0x18(%rsp)
movapd %xmm0,%xmm2
addsd  %xmm3,%xmm2
subsd  %xmm4,%xmm1
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
jb     117b <cscb+0x4b>
xorps  %xmm3,%xmm3
sqrtsd %xmm0,%xmm3
jmp    119c <cscb+0x6c>
movsd  %xmm2,0x8(%rsp)
movsd  %xmm1,0x10(%rsp)
call   1050 <sqrt@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
movapd %xmm0,%xmm3
movsd  0xe64(%rip),%xmm0
ucomisd %xmm3,%xmm0
jbe    11b4 <cscb+0x84>
movsd  0xe4e(%rip),%xmm0
jmp    1232 <cscb+0x102>
cvttsd2si %xmm1,%edi
movapd %xmm2,%xmm0
movsd  %xmm3,0x8(%rsp)
call   1040 <my_atan2@plt>
movsd  0x8(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  0xe37(%rip),%xmm1
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jb     11f2 <cscb+0xc2>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    11fb <cscb+0xcb>
movapd %xmm1,%xmm0
call   1050 <sqrt@plt>
movsd  %xmm0,(%r14)
mov    $0x2,%edi
call   1040 <my_atan2@plt>
addsd  0x8(%rsp),%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
subsd  0x18(%rsp),%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%r15)
addsd  (%rbx),%xmm0
addsd  (%r14),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define double @cscb(double %0, double %1, double %2, double %3, double %4, double* nocapture %5, double* nocapture %6, double* nocapture writeonly %7) {
%9 = fadd double %0, %3
%10 = fsub double %1, %4
%11 = fmul double %10, %10
%12 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %11)
%13 = tail call double @sqrt(double %12)
%14 = fcmp olt double %13, 2.000000e+00
br i1 %14, label %29, label %15
15: ; preds = %8
%16 = fptosi double %10 to i32
%17 = tail call double @my_atan2(i32 %16, double %9)
%18 = tail call double @llvm.fmuladd.f64(double %13, double %13, double -4.000000e+00)
%19 = tail call double @sqrt(double %18)
store double %19, double* %6
%20 = tail call double @my_atan2(i32 2, double %19)
%21 = fadd double %17, %20
%22 = tail call double @mod2pi(double %21)
store double %22, double* %5
%23 = fsub double %22, %2
%24 = tail call double @mod2pi(double %23)
store double %24, double* %7
%25 = load double, double* %5
%26 = fadd double %24, %25
%27 = load double, double* %6
%28 = fadd double %26, %27
br label %29
29: ; preds = %8, %15
%30 = phi double [ %28, %15 ], [ 1.000000e+04, %8 ]
ret double %30
}