#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 acos(double);
double fabs(double);
double mod2pi(double);
double my_atan2(double, double);
double sqrt(double);
double ccu_cuc(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;
  if ((fabs(a) < 1.0e-12) && (fabs(b) < 1.0e-12))
    return (10000);
  u1 = sqrt(a * a + b * b);
  if (u1 > (4 * (1.0)))
    return (10000);
  theta = my_atan2(b, a);
  if (u1 > (2 * (1.0))) {
    alpha = acos((u1 / 2 - (1.0)) / (2 * (1.0)));
    *t = mod2pi(1.5707963268 + theta - alpha);
    *u = mod2pi(3.1415926536 - alpha);
    *v = mod2pi(phi - *t + 2 * (*u));
  } else {
    alpha = acos((u1 / 2 + (1.0)) / ((2 * (1.0))));
    *t = mod2pi(1.5707963268 + theta + alpha);
    *u = mod2pi(alpha);
    *v = mod2pi(phi - *t + 2 * (*u));
  }
  length_rs = (1.0) * (2 * (*u) + *t + *v);
  return (length_rs);
}


x86 assembly (clang, -O0):
<ccu_cuc>:
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),%xmm1
movaps 0xea6(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe5a(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e4 <ccu_cuc+0xa4>
movsd  -0x58(%rbp),%xmm1
movaps 0xe84(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe38(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    11e4 <ccu_cuc+0xa4>
movsd  0xe56(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13c2 <ccu_cuc+0x282>
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1060 <sqrt@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdf1(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1233 <ccu_cuc+0xf3>
movsd  0xe07(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13c2 <ccu_cuc+0x282>
movsd  -0x58(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
call   1050 <my_atan2@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  0xdbc(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12f9 <ccu_cuc+0x1b9>
movsd  -0x60(%rbp),%xmm0
movsd  0xda5(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xda9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  0xd8d(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0xd7f(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd70(%rip),%xmm0
subsd  -0x70(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm1
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
jmp    1387 <ccu_cuc+0x247>
movsd  -0x60(%rbp),%xmm0
movsd  0xd0a(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  0xd0e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xcf2(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  0xce4(%rip),%xmm0
addsd  -0x68(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x70(%rbp),%xmm0
call   1030 <mod2pi@plt>
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x20(%rbp),%xmm1
mov    -0x38(%rbp),%rax
subsd  (%rax),%xmm1
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm0
addsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
mov    -0x48(%rbp),%rax
addsd  (%rax),%xmm1
movsd  0xc71(%rip),%xmm0
mulsd  %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):
<ccu_cuc>:
push   %r15
push   %r14
push   %rbx
sub    $0x30,%rsp
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
movapd %xmm0,%xmm5
addsd  %xmm3,%xmm5
subsd  %xmm4,%xmm1
movapd 0xe9a(%rip),%xmm0
movapd %xmm5,%xmm3
andpd  %xmm0,%xmm3
movsd  0xe9a(%rip),%xmm4
ucomisd %xmm3,%xmm4
movsd  0xe96(%rip),%xmm6
jbe    1192 <ccu_cuc+0x52>
andpd  %xmm1,%xmm0
ucomisd %xmm0,%xmm4
ja     12f1 <ccu_cuc+0x1b1>
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
addsd  %xmm3,%xmm0
xorpd  %xmm3,%xmm3
ucomisd %xmm3,%xmm0
movsd  %xmm2,0x28(%rsp)
jb     11cc <ccu_cuc+0x8c>
xorps  %xmm2,%xmm2
sqrtsd %xmm0,%xmm2
ucomisd 0xe5b(%rip),%xmm2
jbe    1201 <ccu_cuc+0xc1>
jmp    12f1 <ccu_cuc+0x1b1>
movapd %xmm5,(%rsp)
movapd %xmm1,0x10(%rsp)
call   1060 <sqrt@plt>
movsd  0xe34(%rip),%xmm6
movapd 0x10(%rsp),%xmm1
movapd (%rsp),%xmm5
movapd %xmm0,%xmm2
ucomisd 0xe25(%rip),%xmm2
ja     12f1 <ccu_cuc+0x1b1>
movapd %xmm1,%xmm0
movapd %xmm5,%xmm1
movsd  %xmm2,(%rsp)
call   1050 <my_atan2@plt>
movsd  (%rsp),%xmm1
ucomisd 0xe08(%rip),%xmm1
movsd  %xmm0,0x10(%rsp)
mulsd  0xe02(%rip),%xmm1
jbe    127c <ccu_cuc+0x13c>
addsd  0xe10(%rip),%xmm1
mulsd  0xdf0(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <acos@plt>
movapd %xmm0,%xmm1
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm0
addsd  0xde0(%rip),%xmm0
subsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
movsd  0xddb(%rip),%xmm0
subsd  (%rsp),%xmm0
jmp    12ba <ccu_cuc+0x17a>
addsd  0xdb4(%rip),%xmm1
mulsd  0xda4(%rip),%xmm1
movapd %xmm1,%xmm0
call   1040 <acos@plt>
movsd  %xmm0,(%rsp)
movsd  0x10(%rsp),%xmm1
addsd  0xd98(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
movsd  (%rsp),%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%r14)
movsd  0x28(%rsp),%xmm1
subsd  (%rbx),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
call   1030 <mod2pi@plt>
movsd  %xmm0,(%r15)
movsd  (%r14),%xmm6
addsd  %xmm6,%xmm6
addsd  (%rbx),%xmm6
addsd  %xmm0,%xmm6
movapd %xmm6,%xmm0
add    $0x30,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @ccu_cuc(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 = call double @llvm.fabs.f64(double %30)
%32 = fcmp olt double %31, 0x3D719799812DEA11
br i1 %32, label %33, label %38
33: ; preds = %8
%34 = load double, double* %19
%35 = call double @llvm.fabs.f64(double %34)
%36 = fcmp olt double %35, 0x3D719799812DEA11
br i1 %36, label %37, label %38
37: ; preds = %33
store double 1.000000e+04, double* %9
br label %115
38: ; preds = %33, %8
%39 = load double, double* %18
%40 = load double, double* %18
%41 = load double, double* %19
%42 = load double, double* %19
%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* %20
%46 = load double, double* %20
%47 = fcmp ogt double %46, 4.000000e+00
br i1 %47, label %48, label %49
48: ; preds = %38
store double 1.000000e+04, double* %9
br label %115
49: ; preds = %38
%50 = load double, double* %19
%51 = load double, double* %18
%52 = call double @my_atan2(double %50, double %51)
store double %52, double* %21
%53 = load double, double* %20
%54 = fcmp ogt double %53, 2.000000e+00
br i1 %54, label %55, label %80
55: ; preds = %49
%56 = load double, double* %20
%57 = fdiv double %56, 2.000000e+00
%58 = fsub double %57, 1.000000e+00
%59 = fdiv double %58, 2.000000e+00
%60 = call double @acos(double %59)
store double %60, double* %22
%61 = load double, double* %21
%62 = fadd double 0x3FF921FB544486E0, %61
%63 = load double, double* %22
%64 = fsub double %62, %63
%65 = call double @mod2pi(double %64)
%66 = load double*, double** %15
store double %65, double* %66
%67 = load double, double* %22
%68 = fsub double 0x400921FB544486E0, %67
%69 = call double @mod2pi(double %68)
%70 = load double*, double** %16
store double %69, double* %70
%71 = load double, double* %12
%72 = load double*, double** %15
%73 = load double, double* %72
%74 = fsub double %71, %73
%75 = load double*, double** %16
%76 = load double, double* %75
%77 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %76, double %74)
%78 = call double @mod2pi(double %77)
%79 = load double*, double** %17
store double %78, double* %79
br label %104
80: ; preds = %49
%81 = load double, double* %20
%82 = fdiv double %81, 2.000000e+00
%83 = fadd double %82, 1.000000e+00
%84 = fdiv double %83, 2.000000e+00
%85 = call double @acos(double %84)
store double %85, double* %22
%86 = load double, double* %21
%87 = fadd double 0x3FF921FB544486E0, %86
%88 = load double, double* %22
%89 = fadd double %87, %88
%90 = call double @mod2pi(double %89)
%91 = load double*, double** %15
store double %90, double* %91
%92 = load double, double* %22
%93 = call double @mod2pi(double %92)
%94 = load double*, double** %16
store double %93, double* %94
%95 = load double, double* %12
%96 = load double*, double** %15
%97 = load double, double* %96
%98 = fsub double %95, %97
%99 = load double*, double** %16
%100 = load double, double* %99
%101 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %100, double %98)
%102 = call double @mod2pi(double %101)
%103 = load double*, double** %17
store double %102, double* %103
br label %104
104: ; preds = %80, %55
%105 = load double*, double** %16
%106 = load double, double* %105
%107 = load double*, double** %15
%108 = load double, double* %107
%109 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %106, double %108)
%110 = load double*, double** %17
%111 = load double, double* %110
%112 = fadd double %109, %111
%113 = fmul double 1.000000e+00, %112
store double %113, double* %23
%114 = load double, double* %23
store double %114, double* %9
br label %115
115: ; preds = %104, %48, %37
%116 = load double, double* %9
ret double %116
}

LLVM IR (-O2):
define double @ccu_cuc(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 = tail call double @llvm.fabs.f64(double %9)
%12 = fcmp olt double %11, 0x3D719799812DEA11
%13 = tail call double @llvm.fabs.f64(double %10)
%14 = fcmp olt double %13, 0x3D719799812DEA11
%15 = select i1 %12, i1 %14, i1 false
br i1 %15, label %51, label %16
16: ; preds = %8
%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 = fcmp ogt double %19, 4.000000e+00
br i1 %20, label %51, label %21
21: ; preds = %16
%22 = tail call double @my_atan2(double %10, double %9)
%23 = fcmp ogt double %19, 2.000000e+00
%24 = fmul double %19, 5.000000e-01
br i1 %23, label %25, label %33
25: ; preds = %21
%26 = fadd double %24, -1.000000e+00
%27 = fmul double %26, 5.000000e-01
%28 = tail call double @acos(double %27)
%29 = fadd double %22, 0x3FF921FB544486E0
%30 = fsub double %29, %28
%31 = tail call double @mod2pi(double %30)
store double %31, double* %5
%32 = fsub double 0x400921FB544486E0, %28
br label %40
33: ; preds = %21
%34 = fadd double %24, 1.000000e+00
%35 = fmul double %34, 5.000000e-01
%36 = tail call double @acos(double %35)
%37 = fadd double %22, 0x3FF921FB544486E0
%38 = fadd double %37, %36
%39 = tail call double @mod2pi(double %38)
store double %39, double* %5
br label %40
40: ; preds = %33, %25
%41 = phi double [ %36, %33 ], [ %32, %25 ]
%42 = tail call double @mod2pi(double %41)
store double %42, double* %6
%43 = load double, double* %5
%44 = fsub double %2, %43
%45 = tail call double @llvm.fmuladd.f64(double %42, double 2.000000e+00, double %44)
%46 = tail call double @mod2pi(double %45)
store double %46, double* %7
%47 = load double, double* %6
%48 = load double, double* %5
%49 = tail call double @llvm.fmuladd.f64(double %47, double 2.000000e+00, double %48)
%50 = fadd double %46, %49
br label %51
51: ; preds = %16, %8, %40
%52 = phi double [ %50, %40 ], [ 1.000000e+04, %8 ], [ 1.000000e+04, %16 ]
ret double %52
}