#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 */
int /*<<< orphan*/ JacobiElliptic_complex(double, double, double, double *,
                                          double *, double *, double *,
                                          double *, double *);
int atan(int /*<<< orphan*/);
double atan2(double, double);
int /*<<< orphan*/ hypot(double, double);
void PeirceQuincuncial(double x, double y, double *phi, double *theta) {
  double cnr, cni, dum;
  double z[2] = {0.5 * (x - y) + 1., 0.5 * (x + y)};
  z[0] *= 1.8540746773013719184;
  z[1] *= 1.8540746773013719184;
  JacobiElliptic_complex(z[0], z[1], 0.5, &cnr, &cni, &dum, &dum, &dum, &dum);
  *theta = atan2(cni, cnr);
  *phi = 2 * atan(hypot(cnr, cni));
}


x86 assembly (clang, -O0):
<PeirceQuincuncial>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xe94(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe98(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xe6d(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe64(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe52(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm1
movsd  0xe2e(%rip),%xmm2
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x38(%rbp),%r9
mov    %r9,%rdx
mov    %r9,%rcx
mov    %r9,%r8
call   1030 <JacobiElliptic_complex@plt>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
call   1040 <atan2@plt>
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x28(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
call   1060 <hypot@plt>
mov    %eax,%edi
call   1050 <atan@plt>
shl    $0x1,%eax
cvtsi2sd %eax,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PeirceQuincuncial>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movapd %xmm0,%xmm3
subsd  %xmm1,%xmm3
movsd  0xea3(%rip),%xmm2
mulsd  %xmm2,%xmm3
addsd  0xe9f(%rip),%xmm3
addsd  %xmm0,%xmm1
mulsd  %xmm2,%xmm1
movsd  0xe97(%rip),%xmm0
mulsd  %xmm0,%xmm3
mulsd  %xmm0,%xmm1
lea    0x8(%rsp),%rdi
mov    %rsp,%rsi
lea    0x10(%rsp),%rcx
movapd %xmm3,%xmm0
mov    %rcx,%rdx
mov    %rcx,%r8
mov    %rcx,%r9
call   1030 <JacobiElliptic_complex@plt>
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
call   1040 <atan2@plt>
movsd  %xmm0,(%rbx)
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1060 <hypot@plt>
mov    %eax,%edi
call   1050 <atan@plt>
add    %eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,(%r14)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @PeirceQuincuncial(double %0, double %1, double* %2, double* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double*
%8 = alloca double*
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca [2 x double]
store double %0, double* %5
store double %1, double* %6
store double* %2, double** %7
store double* %3, double** %8
%13 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%14 = load double, double* %5
%15 = load double, double* %6
%16 = fsub double %14, %15
%17 = call double @llvm.fmuladd.f64(double 5.000000e-01, double %16, double 1.000000e+00)
store double %17, double* %13
%18 = getelementptr inbounds double, double* %13, i64 1
%19 = load double, double* %5
%20 = load double, double* %6
%21 = fadd double %19, %20
%22 = fmul double 5.000000e-01, %21
store double %22, double* %18
%23 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%24 = load double, double* %23
%25 = fmul double %24, 0x3FFDAA4A35759E4B
store double %25, double* %23
%26 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 1
%27 = load double, double* %26
%28 = fmul double %27, 0x3FFDAA4A35759E4B
store double %28, double* %26
%29 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 0
%30 = load double, double* %29
%31 = getelementptr inbounds [2 x double], [2 x double]* %12, i64 0, i64 1
%32 = load double, double* %31
%33 = call i32 @JacobiElliptic_complex(double %30, double %32, double 5.000000e-01, double* %9, double* %10, double* %11, double* %11, double* %11, double* %11)
%34 = load double, double* %10
%35 = load double, double* %9
%36 = call double @atan2(double %34, double %35)
%37 = load double*, double** %8
store double %36, double* %37
%38 = load double, double* %9
%39 = load double, double* %10
%40 = call i32 @hypot(double %38, double %39)
%41 = call i32 @atan(i32 %40)
%42 = mul nsw i32 2, %41
%43 = sitofp i32 %42 to double
%44 = load double*, double** %7
store double %43, double* %44
ret void
}

LLVM IR (-O2):
define void @PeirceQuincuncial(double %0, double %1, double* nocapture writeonly %2, double* nocapture writeonly %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = bitcast double* %5 to i8*
%9 = bitcast double* %6 to i8*
%10 = bitcast double* %7 to i8*
%11 = fsub double %0, %1
%12 = tail call double @llvm.fmuladd.f64(double %11, double 5.000000e-01, double 1.000000e+00)
%13 = fadd double %0, %1
%14 = fmul double %13, 5.000000e-01
%15 = fmul double %12, 0x3FFDAA4A35759E4B
%16 = fmul double %14, 0x3FFDAA4A35759E4B
%17 = call i32 @JacobiElliptic_complex(double %15, double %16, double 5.000000e-01, double* %5, double* %6, double* %7, double* %7, double* %7, double* %7)
%18 = load double, double* %6
%19 = load double, double* %5
%20 = call double @atan2(double %18, double %19)
store double %20, double* %3
%21 = load double, double* %5
%22 = load double, double* %6
%23 = call i32 @hypot(double %21, double %22)
%24 = call i32 @atan(i32 %23)
%25 = shl nsw i32 %24, 1
%26 = sitofp i32 %25 to double
store double %26, double* %2
ret void
}