#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(double, double, double *, double *, double *);
void JacobiElliptic_complex(double zr, double zi, double k, double *cnr,
                            double *cni, double *snr, double *sni, double *dnr,
                            double *dni) {
  double kp = 1. - k;
  double cr, sr, dr;
  double ci, si, di;
  double idenom;
  JacobiElliptic(zr, k, &cr, &sr, &dr);
  JacobiElliptic(zi, kp, &ci, &si, &di);
  idenom = 1. / (ci * ci + k * sr * sr * si * si);
  *snr = idenom * (sr * di);
  *sni = idenom * (cr * dr * si * ci);
  *cnr = idenom * (cr * ci);
  *cni = idenom * (-sr * dr * si * di);
  *dnr = idenom * (dr * ci * di);
  *dni = idenom * (-k * sr * cr * si);
}


x86 assembly (clang, -O0):
<JacobiElliptic_complex>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
mov    %rdx,-0x30(%rbp)
mov    %rcx,-0x38(%rbp)
mov    %r8,-0x40(%rbp)
mov    %r9,-0x48(%rbp)
movsd  0xeb6(%rip),%xmm0
subsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    -0x58(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdx
call   1030 <JacobiElliptic@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm1
lea    -0x70(%rbp),%rdi
lea    -0x78(%rbp),%rsi
lea    -0x80(%rbp),%rdx
call   1030 <JacobiElliptic@plt>
movsd  -0x70(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x60(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x60(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x58(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x60(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  -0x68(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x68(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  -0x60(%rbp),%xmm1
mulsd  -0x58(%rbp),%xmm1
mulsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
mov    -0x48(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<JacobiElliptic_complex>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %r9,%r14
mov    %r8,%r15
mov    %rcx,%r13
mov    %rdx,%rbp
mov    %rsi,%r12
mov    %rdi,%rbx
movapd %xmm2,0x40(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  0xebc(%rip),%xmm1
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
lea    0x38(%rsp),%rdi
lea    0x30(%rsp),%rsi
lea    0x28(%rsp),%rdx
movapd %xmm2,%xmm1
call   1030 <JacobiElliptic@plt>
lea    0x20(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
movsd  0x8(%rsp),%xmm0
movsd  (%rsp),%xmm1
call   1030 <JacobiElliptic@plt>
movsd  0x20(%rsp),%xmm0
movsd  0x30(%rsp),%xmm2
movapd %xmm2,%xmm3
movapd 0x40(%rsp),%xmm6
mulsd  %xmm6,%xmm3
mulsd  %xmm2,%xmm3
movsd  0x18(%rsp),%xmm1
mulsd  %xmm1,%xmm3
mulsd  %xmm1,%xmm3
movapd %xmm0,%xmm4
mulsd  %xmm0,%xmm4
addsd  %xmm3,%xmm4
movsd  0xe3c(%rip),%xmm3
divsd  %xmm4,%xmm3
movsd  0x10(%rsp),%xmm9
movapd 0xe38(%rip),%xmm8
movapd %xmm2,%xmm5
movapd %xmm6,%xmm4
xorpd  %xmm8,%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm9,%xmm2
mulsd  %xmm3,%xmm2
movsd  %xmm2,0x0(%rbp)
movsd  0x38(%rsp),%xmm2
movsd  0x28(%rsp),%xmm6
movapd %xmm0,%xmm7
mulsd  %xmm2,%xmm7
mulsd  %xmm2,%xmm4
mulsd  %xmm6,%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm3,%xmm2
movsd  %xmm2,0x0(%r13)
mulsd  %xmm3,%xmm7
movsd  %xmm7,(%rbx)
xorpd  %xmm8,%xmm5
mulsd  %xmm6,%xmm5
mulsd  %xmm1,%xmm5
mulsd  %xmm9,%xmm5
mulsd  %xmm3,%xmm5
movsd  %xmm5,(%r12)
mulsd  %xmm6,%xmm0
mulsd  %xmm9,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%r15)
movapd %xmm4,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm3,%xmm0
movsd  %xmm0,(%r14)
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @JacobiElliptic_complex(double %0, double %1, double %2, double* %3, double* %4, double* %5, double* %6, double* %7, double* %8) {
%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
%24 = alloca double
%25 = alloca double
%26 = 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
store double* %8, double** %18
%27 = load double, double* %12
%28 = fsub double 1.000000e+00, %27
store double %28, double* %19
%29 = load double, double* %10
%30 = load double, double* %12
%31 = call i32 @JacobiElliptic(double %29, double %30, double* %20, double* %21, double* %22)
%32 = load double, double* %11
%33 = load double, double* %19
%34 = call i32 @JacobiElliptic(double %32, double %33, double* %23, double* %24, double* %25)
%35 = load double, double* %23
%36 = load double, double* %23
%37 = load double, double* %12
%38 = load double, double* %21
%39 = fmul double %37, %38
%40 = load double, double* %21
%41 = fmul double %39, %40
%42 = load double, double* %24
%43 = fmul double %41, %42
%44 = load double, double* %24
%45 = fmul double %43, %44
%46 = call double @llvm.fmuladd.f64(double %35, double %36, double %45)
%47 = fdiv double 1.000000e+00, %46
store double %47, double* %26
%48 = load double, double* %26
%49 = load double, double* %21
%50 = load double, double* %25
%51 = fmul double %49, %50
%52 = fmul double %48, %51
%53 = load double*, double** %15
store double %52, double* %53
%54 = load double, double* %26
%55 = load double, double* %20
%56 = load double, double* %22
%57 = fmul double %55, %56
%58 = load double, double* %24
%59 = fmul double %57, %58
%60 = load double, double* %23
%61 = fmul double %59, %60
%62 = fmul double %54, %61
%63 = load double*, double** %16
store double %62, double* %63
%64 = load double, double* %26
%65 = load double, double* %20
%66 = load double, double* %23
%67 = fmul double %65, %66
%68 = fmul double %64, %67
%69 = load double*, double** %13
store double %68, double* %69
%70 = load double, double* %26
%71 = load double, double* %21
%72 = fneg double %71
%73 = load double, double* %22
%74 = fmul double %72, %73
%75 = load double, double* %24
%76 = fmul double %74, %75
%77 = load double, double* %25
%78 = fmul double %76, %77
%79 = fmul double %70, %78
%80 = load double*, double** %14
store double %79, double* %80
%81 = load double, double* %26
%82 = load double, double* %22
%83 = load double, double* %23
%84 = fmul double %82, %83
%85 = load double, double* %25
%86 = fmul double %84, %85
%87 = fmul double %81, %86
%88 = load double*, double** %17
store double %87, double* %88
%89 = load double, double* %26
%90 = load double, double* %12
%91 = fneg double %90
%92 = load double, double* %21
%93 = fmul double %91, %92
%94 = load double, double* %20
%95 = fmul double %93, %94
%96 = load double, double* %24
%97 = fmul double %95, %96
%98 = fmul double %89, %97
%99 = load double*, double** %18
store double %98, double* %99
ret void
}

LLVM IR (-O2):
define void @JacobiElliptic_complex(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4, double* nocapture writeonly %5, double* nocapture writeonly %6, double* nocapture writeonly %7, double* nocapture writeonly %8) {
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = fsub double 1.000000e+00, %2
%17 = bitcast double* %10 to i8*
%18 = bitcast double* %11 to i8*
%19 = bitcast double* %12 to i8*
%20 = bitcast double* %13 to i8*
%21 = bitcast double* %14 to i8*
%22 = bitcast double* %15 to i8*
%23 = call i32 @JacobiElliptic(double %0, double %2, double* %10, double* %11, double* %12)
%24 = call i32 @JacobiElliptic(double %1, double %16, double* %13, double* %14, double* %15)
%25 = load double, double* %13
%26 = load double, double* %11
%27 = fmul double %26, %2
%28 = fmul double %26, %27
%29 = load double, double* %14
%30 = fmul double %29, %28
%31 = fmul double %29, %30
%32 = call double @llvm.fmuladd.f64(double %25, double %25, double %31)
%33 = fdiv double 1.000000e+00, %32
%34 = load double, double* %15
%35 = fmul double %26, %34
%36 = fmul double %35, %33
store double %36, double* %5
%37 = load double, double* %10
%38 = load double, double* %12
%39 = fmul double %37, %38
%40 = fmul double %29, %39
%41 = fmul double %25, %40
%42 = fmul double %33, %41
store double %42, double* %6
%43 = fmul double %25, %37
%44 = fmul double %43, %33
store double %44, double* %3
%45 = fneg double %26
%46 = fmul double %38, %45
%47 = fmul double %29, %46
%48 = fmul double %34, %47
%49 = fmul double %33, %48
store double %49, double* %4
%50 = fmul double %25, %38
%51 = fmul double %34, %50
%52 = fmul double %33, %51
store double %52, double* %7
%53 = fneg double %2
%54 = fmul double %26, %53
%55 = fmul double %54, %37
%56 = fmul double %29, %55
%57 = fmul double %33, %56
store double %57, double* %8
ret void
}