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


x86 assembly (clang, -O0):
<csca>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
mov    %rdi,-0x30(%rbp)
mov    %rsi,-0x38(%rbp)
mov    %rdx,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
call   1040 <my_atan2@plt>
call   1030 <mod2pi@plt>
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm1
mulsd  -0x50(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x18(%rbp),%xmm0
mov    -0x30(%rbp),%rax
subsd  (%rax),%xmm0
call   1030 <mod2pi@plt>
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x40(%rbp),%rax
addsd  (%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csca>:
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
subsd  %xmm3,%xmm2
movsd  %xmm2,0x10(%rsp)
addsd  %xmm4,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm1,%xmm0
movapd %xmm2,%xmm1
call   1040 <my_atan2@plt>
call   1030 <mod2pi@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
mulsd  %xmm0,%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movapd %xmm1,%xmm0
jb     11a2 <csca+0x72>
sqrtsd %xmm0,%xmm0
jmp    11a7 <csca+0x77>
call   1050 <sqrt@plt>
movsd  %xmm0,(%r14)
movsd  0x18(%rsp),%xmm0
subsd  (%rbx),%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 @csca(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
store double %0, double* %9
store double %1, double* %10
store double %2, double* %11
store double %3, double* %12
store double %4, double* %13
store double* %5, double** %14
store double* %6, double** %15
store double* %7, double** %16
%20 = load double, double* %9
%21 = load double, double* %12
%22 = fsub double %20, %21
store double %22, 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* %18
%27 = load double, double* %17
%28 = call double @my_atan2(double %26, double %27)
%29 = call double @mod2pi(double %28)
%30 = load double*, double** %14
store double %29, double* %30
%31 = load double, double* %17
%32 = load double, double* %17
%33 = load double, double* %18
%34 = load double, double* %18
%35 = fmul double %33, %34
%36 = call double @llvm.fmuladd.f64(double %31, double %32, double %35)
%37 = call double @sqrt(double %36)
%38 = load double*, double** %15
store double %37, double* %38
%39 = load double, double* %11
%40 = load double*, double** %14
%41 = load double, double* %40
%42 = fsub double %39, %41
%43 = call double @mod2pi(double %42)
%44 = load double*, double** %16
store double %43, double* %44
%45 = load double*, double** %14
%46 = load double, double* %45
%47 = load double*, double** %16
%48 = load double, double* %47
%49 = fadd double %46, %48
%50 = load double*, double** %15
%51 = load double, double* %50
%52 = call double @llvm.fmuladd.f64(double 1.000000e+00, double %49, double %51)
store double %52, double* %19
%53 = load double, double* %19
ret double %53
}

LLVM IR (-O2):
define double @csca(double %0, double %1, double %2, double %3, double %4, double* nocapture %5, double* nocapture %6, double* nocapture writeonly %7) {
%9 = fsub double %0, %3
%10 = fadd double %1, %4
%11 = tail call double @my_atan2(double %10, double %9)
%12 = tail call double @mod2pi(double %11)
store double %12, double* %5
%13 = fmul double %10, %10
%14 = tail call double @llvm.fmuladd.f64(double %9, double %9, double %13)
%15 = tail call double @sqrt(double %14)
store double %15, double* %6
%16 = load double, double* %5
%17 = fsub double %2, %16
%18 = tail call double @mod2pi(double %17)
store double %18, double* %7
%19 = load double, double* %5
%20 = fadd double %18, %19
%21 = load double, double* %6
%22 = fadd double %20, %21
ret double %22
}