#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 c_c2scb(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(1.5707963268 + theta);
  *u = u1 - (2 * (1.0));
  *v = mod2pi(phi - *t - 1.5707963268);
  length_rs = (1.0) * (*t + 1.5707963268 + *v) + *u;
  return (length_rs);
}


x86 assembly (clang, -O0):
<c_c2scb>:
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 <c_c2scb+0x96>
movsd  0xe54(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1266 <c_c2scb+0x136>
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1040 <my_atan2@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  0xe26(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
movsd  0xdff(%rip),%xmm1
subsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm0
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm0
movsd  0xde6(%rip),%xmm1
subsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x38(%rbp),%rax
movsd  0xdc9(%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):
<c_c2scb>:
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 <c_c2scb+0x4b>
xorps  %xmm3,%xmm3
sqrtsd %xmm0,%xmm3
jmp    119c <c_c2scb+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 <c_c2scb+0x84>
movsd  0xe4e(%rip),%xmm0
jmp    1220 <c_c2scb+0xf0>
movapd %xmm1,%xmm0
movapd %xmm2,%xmm1
movsd  %xmm3,0x8(%rsp)
call   1040 <my_atan2@plt>
addsd  0xe41(%rip),%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
addsd  0xe32(%rip),%xmm0
movsd  %xmm0,(%r14)
movsd  0x18(%rsp),%xmm0
subsd  (%rbx),%xmm0
addsd  0xe23(%rip),%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%r15)
movsd  0xe01(%rip),%xmm1
addsd  (%rbx),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
addsd  (%r14),%xmm0
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @c_c2scb(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 = fadd double 0x3FF921FB544486E0, %43
%45 = call double @mod2pi(double %44)
%46 = load double*, double** %15
store double %45, double* %46
%47 = load double, double* %20
%48 = fsub double %47, 2.000000e+00
%49 = load double*, double** %16
store double %48, double* %49
%50 = load double, double* %12
%51 = load double*, double** %15
%52 = load double, double* %51
%53 = fsub double %50, %52
%54 = fsub double %53, 0x3FF921FB544486E0
%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 @c_c2scb(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 = tail call double @my_atan2(double %10, double %9)
%17 = fadd double %16, 0x3FF921FB544486E0
%18 = tail call double @mod2pi(double %17)
store double %18, double* %5
%19 = fadd double %13, -2.000000e+00
store double %19, double* %6
%20 = load double, double* %5
%21 = fsub double %2, %20
%22 = fadd double %21, 0xBFF921FB544486E0
%23 = tail call double @mod2pi(double %22)
store double %23, double* %7
%24 = load double, double* %5
%25 = fadd double %24, 0x3FF921FB544486E0
%26 = fadd double %23, %25
%27 = load double, double* %6
%28 = fadd double %27, %26
br label %29
29: ; preds = %8, %15
%30 = phi double [ %28, %15 ], [ 1.000000e+04, %8 ]
ret double %30
}