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


x86 assembly (clang, -O0):
<csc2_cb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%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  0xe57(%rip),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    11c6 <csc2_cb+0x96>
movsd  0xe54(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1275 <csc2_cb+0x145>
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1040 <my_atan2@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
movsd  0xe07(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xddc(%rip),%xmm1
subsd  %xmm1,%xmm0
addsd  -0x20(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  0xdba(%rip),%xmm0
addsd  (%rax),%xmm0
mov    -0x48(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csc2_cb>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
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 <csc2_cb+0x4b>
xorps  %xmm3,%xmm3
sqrtsd %xmm0,%xmm3
jmp    119c <csc2_cb+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 <csc2_cb+0x84>
movsd  0xe4e(%rip),%xmm0
jmp    1218 <csc2_cb+0xe8>
movapd %xmm1,%xmm0
movapd %xmm2,%xmm1
movsd  %xmm3,0x8(%rsp)
call   1040 <my_atan2@plt>
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
addsd  0xe32(%rip),%xmm0
movsd  %xmm0,(%r15)
movsd  0xe2d(%rip),%xmm0
subsd  (%rbx),%xmm0
addsd  0x18(%rsp),%xmm0
call   1030 <mod2pi@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,(%r14)
movsd  (%rbx),%xmm0
addsd  0xe11(%rip),%xmm0
addsd  %xmm1,%xmm0
addsd  (%r15),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @csc2_cb(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
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
%23 = load double, double* %10
%24 = load double, double* %13
%25 = fadd double %23, %24
store double %25, double* %18
%26 = load double, double* %11
%27 = load double, double* %14
%28 = fsub double %26, %27
store double %28, double* %19
%29 = load double, double* %18
%30 = load double, double* %18
%31 = load double, double* %19
%32 = load double, double* %19
%33 = fmul double %31, %32
%34 = call double @llvm.fmuladd.f64(double %29, double %30, double %33)
%35 = call double @sqrt(double %34)
store double %35, double* %20
%36 = load double, double* %20
%37 = fcmp olt double %36, 2.000000e+00
br i1 %37, label %38, label %39
38: ; preds = %8
store double 1.000000e+04, double* %9
br label %67
39: ; preds = %8
%40 = load double, double* %19
%41 = load double, double* %18
%42 = call double @my_atan2(double %40, double %41)
store double %42, double* %21
%43 = load double, double* %21
%44 = call double @mod2pi(double %43)
%45 = load double*, double** %15
store double %44, double* %45
%46 = load double, double* %20
%47 = fsub double %46, 2.000000e+00
%48 = load double*, double** %16
store double %47, double* %48
%49 = load double*, double** %15
%50 = load double, double* %49
%51 = fneg double %50
%52 = fsub double %51, 0x3FF921FB544486E0
%53 = load double, double* %12
%54 = fadd double %52, %53
%55 = call double @mod2pi(double %54)
%56 = load double*, double** %17
store double %55, double* %56
%57 = load double*, double** %15
%58 = load double, double* %57
%59 = fadd double %58, 0x3FF921FB544486E0
%60 = load double*, double** %17
%61 = load double, double* %60
%62 = fadd double %59, %61
%63 = load double*, double** %16
%64 = load double, double* %63
%65 = call double @llvm.fmuladd.f64(double 1.000000e+00, double %62, double %64)
store double %65, double* %22
%66 = load double, double* %22
store double %66, double* %9
br label %67
67: ; preds = %39, %38
%68 = load double, double* %9
ret double %68
}

LLVM IR (-O2):
define double @csc2_cb(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 %28, label %15
15: ; preds = %8
%16 = tail call double @my_atan2(double %10, double %9)
%17 = tail call double @mod2pi(double %16)
store double %17, double* %5
%18 = fadd double %13, -2.000000e+00
store double %18, double* %6
%19 = load double, double* %5
%20 = fsub double 0xBFF921FB544486E0, %19
%21 = fadd double %20, %2
%22 = tail call double @mod2pi(double %21)
store double %22, double* %7
%23 = load double, double* %5
%24 = fadd double %23, 0x3FF921FB544486E0
%25 = fadd double %22, %24
%26 = load double, double* %6
%27 = fadd double %26, %25
br label %28
28: ; preds = %8, %15
%29 = phi double [ %27, %15 ], [ 1.000000e+04, %8 ]
ret double %29
}