#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 atan2(double, double);
double cos(double);
double fabs(double);
double sin(double);
double lamrot_to_lam(double phirot, double lamrot, double polphi, double pollam,
                     double polgam) {
  double zsinpol, zcospol, zlampol;
  double zphirot, zlamrot, zarg1, zarg2;
  double zgam;
  double result = 0;
  zsinpol = sin((3.14159265358979323846 / 180.) * polphi);
  zcospol = cos((3.14159265358979323846 / 180.) * polphi);
  zlampol = (3.14159265358979323846 / 180.) * pollam;
  zphirot = (3.14159265358979323846 / 180.) * phirot;
  if (lamrot > 180.0)
    lamrot -= 360.0;
  zlamrot = (3.14159265358979323846 / 180.) * lamrot;
  if (polgam > 0) {
    zgam = (3.14159265358979323846 / 180.) * polgam;
    zarg1 = sin(zlampol) *
                (-zsinpol * cos(zphirot) *
                     (cos(zlamrot) * cos(zgam) - sin(zlamrot) * sin(zgam)) +
                 zcospol * sin(zphirot)) -
            cos(zlampol) * cos(zphirot) *
                (sin(zlamrot) * cos(zgam) + cos(zlamrot) * sin(zgam));
    zarg2 = cos(zlampol) *
                (-zsinpol * cos(zphirot) *
                     (cos(zlamrot) * cos(zgam) - sin(zlamrot) * sin(zgam)) +
                 zcospol * sin(zphirot)) +
            sin(zlampol) * cos(zphirot) *
                (sin(zlamrot) * cos(zgam) + cos(zlamrot) * sin(zgam));
  } else {
    zarg1 = sin(zlampol) * (-zsinpol * cos(zlamrot) * cos(zphirot) +
                            zcospol * sin(zphirot)) -
            cos(zlampol) * sin(zlamrot) * cos(zphirot);
    zarg2 = cos(zlampol) * (-zsinpol * cos(zlamrot) * cos(zphirot) +
                            zcospol * sin(zphirot)) +
            sin(zlampol) * sin(zlamrot) * cos(zphirot);
  }
  if (fabs(zarg2) > 0)
    result = (180. / 3.14159265358979323846) * atan2(zarg1, zarg2);
  if (fabs(result) < 9.e-14)
    result = 0;
  return (result);
}


x86 assembly (clang, -O0):
<lamrot_to_lam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  0xea4(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  0xe8d(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  0xe76(%rip),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe64(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xe45(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11db <lamrot_to_lam+0xab>
movsd  -0x10(%rbp),%xmm0
movsd  0xe3e(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe25(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    15ed <lamrot_to_lam+0x4bd>
movsd  0xe01(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x150(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x150(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x120(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x138(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x148(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x148(%rbp),%xmm1
ff
movsd  -0x140(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x138(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x128(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x130(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x130(%rbp),%xmm1
ff
movsd  -0x128(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x120(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x118(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x118(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x100(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x110(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x110(%rbp),%xmm4
ff
movsd  -0x108(%rbp),%xmm3
ff
movsd  -0x100(%rbp),%xmm5
ff
movsd  -0xf8(%rbp),%xmm1
ff
movsd  -0xf0(%rbp),%xmm2
ff
movaps %xmm0,%xmm6
movsd  -0xe8(%rbp),%xmm0
ff
mulsd  %xmm6,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xe0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xd0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xc8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xc0(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0xb0(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0xa0(%rbp),%xmm4
ff
movsd  -0x98(%rbp),%xmm3
ff
movsd  -0x90(%rbp),%xmm5
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm2
movaps %xmm0,%xmm6
movsd  -0x78(%rbp),%xmm0
mulsd  %xmm6,%xmm4
mulsd  %xmm5,%xmm3
addsd  %xmm4,%xmm3
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1834 <lamrot_to_lam+0x704>
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x198(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x1d0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x1d0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x1b8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x1c0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x1c8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x1c8(%rbp),%xmm1
ff
movsd  -0x1c0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x1b8(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x1a0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x1b0(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x1b0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x1a8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x1a8(%rbp),%xmm1
ff
movsd  -0x1a0(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x198(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x158(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x190(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x190(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x180(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x188(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x188(%rbp),%xmm1
ff
movsd  -0x180(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x178(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x160(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
call   1040 <sin@plt>
movsd  %xmm0,-0x170(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0x170(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1050 <cos@plt>
movsd  -0x168(%rbp),%xmm1
ff
movsd  -0x160(%rbp),%xmm2
ff
movaps %xmm0,%xmm3
movsd  -0x158(%rbp),%xmm0
ff
mulsd  %xmm3,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movaps 0x7f0(%rip),%xmm1
pand   %xmm1,%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    1875 <lamrot_to_lam+0x745>
movsd  -0x58(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
call   1030 <atan2@plt>
cvtsi2sd %eax,%xmm1
movsd  0x7ac(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm1
movaps 0x7af(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0x793(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    189f <lamrot_to_lam+0x76f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lamrot_to_lam>:
sub    $0x168,%rsp
movsd  %xmm4,(%rsp)
movsd  %xmm3,0x30(%rsp)
movaps %xmm1,0x10(%rsp)
movsd  %xmm0,0x20(%rsp)
movapd %xmm2,%xmm0
mulsd  0xea7(%rip),%xmm0
movsd  %xmm0,0x40(%rsp)
call   1040 <sin@plt>
movapd %xmm0,0x50(%rsp)
movsd  0x40(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0xd0(%rsp)
movsd  0xe7b(%rip),%xmm0
movsd  0x30(%rsp),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x20(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x20(%rsp)
movapd %xmm0,%xmm3
movsd  0xe5d(%rip),%xmm0
movapd 0x10(%rsp),%xmm4
addsd  %xmm4,%xmm0
movsd  0xe53(%rip),%xmm1
cmpltsd %xmm4,%xmm1
andpd  %xmm1,%xmm0
andnpd %xmm4,%xmm1
orpd   %xmm0,%xmm1
mulsd  %xmm3,%xmm1
movapd %xmm1,0x10(%rsp)
xorpd  %xmm0,%xmm0
movsd  (%rsp),%xmm3
ucomisd %xmm0,%xmm3
movsd  %xmm2,0x30(%rsp)
jbe    14ed <lamrot_to_lam+0x3bd>
movapd %xmm3,%xmm1
mulsd  0xe03(%rip),%xmm1
movsd  %xmm1,(%rsp)
movapd %xmm2,%xmm0
call   1040 <sin@plt>
movapd %xmm0,0xc0(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x90(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x120(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x70(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x110(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x100(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x80(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x130(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0xb0(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0xa0(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x150(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x140(%rsp)
movaps 0x40(%rsp),%xmm0
xorps  0xd3a(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x60(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movapd 0x90(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x50(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x90(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0xf0(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0xe0(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movapd 0x110(%rsp),%xmm2
unpcklpd 0xe0(%rsp),%xmm2
movapd 0x100(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
movapd 0x120(%rsp),%xmm1
unpcklpd 0x90(%rsp),%xmm1
movapd 0x70(%rsp),%xmm0
unpcklpd 0xf0(%rsp),%xmm0
mulpd  %xmm1,%xmm0
subpd  %xmm2,%xmm0
mulpd  0x50(%rsp),%xmm0
movapd %xmm0,0x70(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movapd 0xd0(%rsp),%xmm1
unpcklpd %xmm1,%xmm1
movapd 0x80(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
subpd  0x70(%rsp),%xmm2
movapd %xmm2,0x80(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movapd 0x130(%rsp),%xmm2
unpcklpd 0x30(%rsp),%xmm2
movapd 0x40(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,0x40(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x20(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x30(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
movapd 0x140(%rsp),%xmm2
unpcklpd 0x10(%rsp),%xmm2
movapd 0x150(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xc0(%rsp),%xmm0
mulpd  %xmm2,%xmm1
movapd %xmm1,%xmm3
movapd 0xb0(%rsp),%xmm2
unpcklpd 0x20(%rsp),%xmm2
movapd 0xa0(%rsp),%xmm1
unpcklpd 0x30(%rsp),%xmm1
mulpd  %xmm2,%xmm1
addpd  %xmm3,%xmm1
mulpd  0x40(%rsp),%xmm1
unpcklpd 0x60(%rsp),%xmm0
mulpd  0x80(%rsp),%xmm0
jmp    1670 <lamrot_to_lam+0x540>
movapd %xmm2,%xmm0
call   1040 <sin@plt>
movapd %xmm0,0xc0(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x60(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0xa0(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x40(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0xb0(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x80(%rsp)
movaps (%rsp),%xmm0
xorps  0xac0(%rip),%xmm0
movaps %xmm0,(%rsp)
movsd  0x30(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x70(%rsp)
movapd 0x10(%rsp),%xmm0
call   1050 <cos@plt>
movapd 0x60(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0x50(%rsp),%xmm0
unpcklpd %xmm0,%xmm0
mulpd  %xmm1,%xmm0
movapd %xmm0,0x50(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movaps %xmm0,0x60(%rsp)
movsd  0x20(%rsp),%xmm0
call   1040 <sin@plt>
movapd 0xd0(%rsp),%xmm1
unpcklpd %xmm1,%xmm1
movapd 0x40(%rsp),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm1,%xmm2
movapd 0xa0(%rsp),%xmm0
unpcklpd 0x60(%rsp),%xmm0
mulpd  0x50(%rsp),%xmm0
subpd  %xmm0,%xmm2
movapd %xmm2,0x40(%rsp)
movsd  0x30(%rsp),%xmm0
call   1040 <sin@plt>
movaps %xmm0,0x30(%rsp)
movapd 0x10(%rsp),%xmm0
call   1040 <sin@plt>
movapd 0xb0(%rsp),%xmm2
unpcklpd 0x30(%rsp),%xmm2
movapd (%rsp),%xmm1
unpcklpd %xmm0,%xmm1
mulpd  %xmm2,%xmm1
movapd %xmm1,(%rsp)
movsd  0x20(%rsp),%xmm0
call   1050 <cos@plt>
movapd 0x80(%rsp),%xmm1
unpcklpd %xmm0,%xmm1
movapd 0xc0(%rsp),%xmm0
mulpd  (%rsp),%xmm1
unpcklpd 0x70(%rsp),%xmm0
mulpd  0x40(%rsp),%xmm0
addpd  %xmm1,%xmm0
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm1
je     169a <lamrot_to_lam+0x56a>
call   1030 <atan2@plt>
xorps  %xmm2,%xmm2
cvtsi2sd %eax,%xmm2
mulsd  0x97e(%rip),%xmm2
movapd 0x99e(%rip),%xmm0
andpd  %xmm2,%xmm0
cmpltsd 0x971(%rip),%xmm0
andnpd %xmm2,%xmm0
add    $0x168,%rsp
ret

LLVM IR (-O0):
define double @lamrot_to_lam(double %0, double %1, double %2, double %3, double %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%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* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
store double 0.000000e+00, double* %19
%20 = load double, double* %8
%21 = fmul double 0x3F91DF46A2529D39, %20
%22 = call double @sin(double %21)
store double %22, double* %11
%23 = load double, double* %8
%24 = fmul double 0x3F91DF46A2529D39, %23
%25 = call double @cos(double %24)
store double %25, double* %12
%26 = load double, double* %9
%27 = fmul double 0x3F91DF46A2529D39, %26
store double %27, double* %13
%28 = load double, double* %6
%29 = fmul double 0x3F91DF46A2529D39, %28
store double %29, double* %14
%30 = load double, double* %7
%31 = fcmp ogt double %30, 1.800000e+02
br i1 %31, label %32, label %35
32: ; preds = %5
%33 = load double, double* %7
%34 = fsub double %33, 3.600000e+02
store double %34, double* %7
br label %35
35: ; preds = %32, %5
%36 = load double, double* %7
%37 = fmul double 0x3F91DF46A2529D39, %36
store double %37, double* %15
%38 = load double, double* %10
%39 = fcmp ogt double %38, 0.000000e+00
br i1 %39, label %40, label %124
40: ; preds = %35
%41 = load double, double* %10
%42 = fmul double 0x3F91DF46A2529D39, %41
store double %42, double* %18
%43 = load double, double* %13
%44 = call double @sin(double %43)
%45 = load double, double* %11
%46 = fneg double %45
%47 = load double, double* %14
%48 = call double @cos(double %47)
%49 = fmul double %46, %48
%50 = load double, double* %15
%51 = call double @cos(double %50)
%52 = load double, double* %18
%53 = call double @cos(double %52)
%54 = load double, double* %15
%55 = call double @sin(double %54)
%56 = load double, double* %18
%57 = call double @sin(double %56)
%58 = fmul double %55, %57
%59 = fneg double %58
%60 = call double @llvm.fmuladd.f64(double %51, double %53, double %59)
%61 = load double, double* %12
%62 = load double, double* %14
%63 = call double @sin(double %62)
%64 = fmul double %61, %63
%65 = call double @llvm.fmuladd.f64(double %49, double %60, double %64)
%66 = load double, double* %13
%67 = call double @cos(double %66)
%68 = load double, double* %14
%69 = call double @cos(double %68)
%70 = fmul double %67, %69
%71 = load double, double* %15
%72 = call double @sin(double %71)
%73 = load double, double* %18
%74 = call double @cos(double %73)
%75 = load double, double* %15
%76 = call double @cos(double %75)
%77 = load double, double* %18
%78 = call double @sin(double %77)
%79 = fmul double %76, %78
%80 = call double @llvm.fmuladd.f64(double %72, double %74, double %79)
%81 = fmul double %70, %80
%82 = fneg double %81
%83 = call double @llvm.fmuladd.f64(double %44, double %65, double %82)
store double %83, double* %16
%84 = load double, double* %13
%85 = call double @cos(double %84)
%86 = load double, double* %11
%87 = fneg double %86
%88 = load double, double* %14
%89 = call double @cos(double %88)
%90 = fmul double %87, %89
%91 = load double, double* %15
%92 = call double @cos(double %91)
%93 = load double, double* %18
%94 = call double @cos(double %93)
%95 = load double, double* %15
%96 = call double @sin(double %95)
%97 = load double, double* %18
%98 = call double @sin(double %97)
%99 = fmul double %96, %98
%100 = fneg double %99
%101 = call double @llvm.fmuladd.f64(double %92, double %94, double %100)
%102 = load double, double* %12
%103 = load double, double* %14
%104 = call double @sin(double %103)
%105 = fmul double %102, %104
%106 = call double @llvm.fmuladd.f64(double %90, double %101, double %105)
%107 = load double, double* %13
%108 = call double @sin(double %107)
%109 = load double, double* %14
%110 = call double @cos(double %109)
%111 = fmul double %108, %110
%112 = load double, double* %15
%113 = call double @sin(double %112)
%114 = load double, double* %18
%115 = call double @cos(double %114)
%116 = load double, double* %15
%117 = call double @cos(double %116)
%118 = load double, double* %18
%119 = call double @sin(double %118)
%120 = fmul double %117, %119
%121 = call double @llvm.fmuladd.f64(double %113, double %115, double %120)
%122 = fmul double %111, %121
%123 = call double @llvm.fmuladd.f64(double %85, double %106, double %122)
store double %123, double* %17
br label %172
124: ; preds = %35
%125 = load double, double* %13
%126 = call double @sin(double %125)
%127 = load double, double* %11
%128 = fneg double %127
%129 = load double, double* %15
%130 = call double @cos(double %129)
%131 = fmul double %128, %130
%132 = load double, double* %14
%133 = call double @cos(double %132)
%134 = load double, double* %12
%135 = load double, double* %14
%136 = call double @sin(double %135)
%137 = fmul double %134, %136
%138 = call double @llvm.fmuladd.f64(double %131, double %133, double %137)
%139 = load double, double* %13
%140 = call double @cos(double %139)
%141 = load double, double* %15
%142 = call double @sin(double %141)
%143 = fmul double %140, %142
%144 = load double, double* %14
%145 = call double @cos(double %144)
%146 = fmul double %143, %145
%147 = fneg double %146
%148 = call double @llvm.fmuladd.f64(double %126, double %138, double %147)
store double %148, double* %16
%149 = load double, double* %13
%150 = call double @cos(double %149)
%151 = load double, double* %11
%152 = fneg double %151
%153 = load double, double* %15
%154 = call double @cos(double %153)
%155 = fmul double %152, %154
%156 = load double, double* %14
%157 = call double @cos(double %156)
%158 = load double, double* %12
%159 = load double, double* %14
%160 = call double @sin(double %159)
%161 = fmul double %158, %160
%162 = call double @llvm.fmuladd.f64(double %155, double %157, double %161)
%163 = load double, double* %13
%164 = call double @sin(double %163)
%165 = load double, double* %15
%166 = call double @sin(double %165)
%167 = fmul double %164, %166
%168 = load double, double* %14
%169 = call double @cos(double %168)
%170 = fmul double %167, %169
%171 = call double @llvm.fmuladd.f64(double %150, double %162, double %170)
store double %171, double* %17
br label %172
172: ; preds = %124, %40
%173 = load double, double* %17
%174 = call double @llvm.fabs.f64(double %173)
%175 = fcmp ogt double %174, 0.000000e+00
br i1 %175, label %176, label %182
176: ; preds = %172
%177 = load double, double* %16
%178 = load double, double* %17
%179 = call i32 @atan2(double %177, double %178)
%180 = sitofp i32 %179 to double
%181 = fmul double 0x404CA5DC1A63C1F8, %180
store double %181, double* %19
br label %182
182: ; preds = %176, %172
%183 = load double, double* %19
%184 = call double @llvm.fabs.f64(double %183)
%185 = fcmp olt double %184, 0x3D39552EF775510E
br i1 %185, label %186, label %187
186: ; preds = %182
store double 0.000000e+00, double* %19
br label %187
187: ; preds = %186, %182
%188 = load double, double* %19
ret double %188
}

LLVM IR (-O2):
define double @lamrot_to_lam(double %0, double %1, double %2, double %3, double %4) {
%6 = fmul double %2, 0x3F91DF46A2529D39
%7 = tail call double @sin(double %6)
%8 = tail call double @cos(double %6)
%9 = fmul double %3, 0x3F91DF46A2529D39
%10 = fmul double %0, 0x3F91DF46A2529D39
%11 = fcmp ogt double %1, 1.800000e+02
%12 = fadd double %1, -3.600000e+02
%13 = select i1 %11, double %12, double %1
%14 = fmul double %13, 0x3F91DF46A2529D39
%15 = fcmp ogt double %4, 0.000000e+00
br i1 %15, label %16, label %87
16: ; preds = %5
%17 = fmul double %4, 0x3F91DF46A2529D39
%18 = tail call double @sin(double %9)
%19 = fneg double %7
%20 = tail call double @cos(double %10)
%21 = tail call double @cos(double %14)
%22 = tail call double @cos(double %17)
%23 = tail call double @sin(double %14)
%24 = tail call double @sin(double %17)
%25 = tail call double @sin(double %10)
%26 = tail call double @cos(double %9)
%27 = tail call double @cos(double %10)
%28 = tail call double @sin(double %14)
%29 = tail call double @cos(double %17)
%30 = tail call double @cos(double %14)
%31 = tail call double @sin(double %17)
%32 = fneg double %26
%33 = tail call double @cos(double %9)
%34 = tail call double @cos(double %10)
%35 = insertelement <2 x double> poison, double %20, i64 0
%36 = insertelement <2 x double> %35, double %34, i64 1
%37 = insertelement <2 x double> poison, double %19, i64 0
%38 = shufflevector <2 x double> %37, <2 x double> poison, <2 x i32> zeroinitializer
%39 = fmul <2 x double> %36, %38
%40 = tail call double @cos(double %14)
%41 = tail call double @cos(double %17)
%42 = tail call double @sin(double %14)
%43 = tail call double @sin(double %17)
%44 = insertelement <2 x double> poison, double %23, i64 0
%45 = insertelement <2 x double> %44, double %42, i64 1
%46 = fneg <2 x double> %45
%47 = insertelement <2 x double> poison, double %24, i64 0
%48 = insertelement <2 x double> %47, double %43, i64 1
%49 = fmul <2 x double> %48, %46
%50 = insertelement <2 x double> poison, double %21, i64 0
%51 = insertelement <2 x double> %50, double %40, i64 1
%52 = insertelement <2 x double> poison, double %22, i64 0
%53 = insertelement <2 x double> %52, double %41, i64 1
%54 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %51, <2 x double> %53, <2 x double> %49)
%55 = tail call double @sin(double %10)
%56 = insertelement <2 x double> poison, double %8, i64 0
%57 = shufflevector <2 x double> %56, <2 x double> poison, <2 x i32> zeroinitializer
%58 = insertelement <2 x double> poison, double %25, i64 0
%59 = insertelement <2 x double> %58, double %55, i64 1
%60 = fmul <2 x double> %57, %59
%61 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %39, <2 x double> %54, <2 x double> %60)
%62 = tail call double @sin(double %9)
%63 = tail call double @cos(double %10)
%64 = insertelement <2 x double> poison, double %27, i64 0
%65 = insertelement <2 x double> %64, double %62, i64 1
%66 = insertelement <2 x double> poison, double %32, i64 0
%67 = insertelement <2 x double> %66, double %63, i64 1
%68 = fmul <2 x double> %65, %67
%69 = tail call double @sin(double %14)
%70 = tail call double @cos(double %17)
%71 = tail call double @cos(double %14)
%72 = tail call double @sin(double %17)
%73 = insertelement <2 x double> poison, double %31, i64 0
%74 = insertelement <2 x double> %73, double %71, i64 1
%75 = insertelement <2 x double> poison, double %30, i64 0
%76 = insertelement <2 x double> %75, double %72, i64 1
%77 = fmul <2 x double> %74, %76
%78 = insertelement <2 x double> poison, double %28, i64 0
%79 = insertelement <2 x double> %78, double %69, i64 1
%80 = insertelement <2 x double> poison, double %29, i64 0
%81 = insertelement <2 x double> %80, double %70, i64 1
%82 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %79, <2 x double> %81, <2 x double> %77)
%83 = fmul <2 x double> %68, %82
%84 = insertelement <2 x double> poison, double %18, i64 0
%85 = insertelement <2 x double> %84, double %33, i64 1
%86 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %85, <2 x double> %61, <2 x double> %83)
br label %128
87: ; preds = %5
%88 = tail call double @sin(double %9)
%89 = fneg double %7
%90 = tail call double @cos(double %14)
%91 = tail call double @cos(double %10)
%92 = tail call double @sin(double %10)
%93 = tail call double @cos(double %9)
%94 = tail call double @sin(double %14)
%95 = tail call double @cos(double %10)
%96 = fneg double %93
%97 = tail call double @cos(double %9)
%98 = tail call double @cos(double %14)
%99 = insertelement <2 x double> poison, double %90, i64 0
%100 = insertelement <2 x double> %99, double %98, i64 1
%101 = insertelement <2 x double> poison, double %89, i64 0
%102 = shufflevector <2 x double> %101, <2 x double> poison, <2 x i32> zeroinitializer
%103 = fmul <2 x double> %100, %102
%104 = tail call double @cos(double %10)
%105 = tail call double @sin(double %10)
%106 = insertelement <2 x double> poison, double %8, i64 0
%107 = shufflevector <2 x double> %106, <2 x double> poison, <2 x i32> zeroinitializer
%108 = insertelement <2 x double> poison, double %92, i64 0
%109 = insertelement <2 x double> %108, double %105, i64 1
%110 = fmul <2 x double> %107, %109
%111 = insertelement <2 x double> poison, double %91, i64 0
%112 = insertelement <2 x double> %111, double %104, i64 1
%113 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %103, <2 x double> %112, <2 x double> %110)
%114 = tail call double @sin(double %9)
%115 = tail call double @sin(double %14)
%116 = insertelement <2 x double> poison, double %94, i64 0
%117 = insertelement <2 x double> %116, double %114, i64 1
%118 = insertelement <2 x double> poison, double %96, i64 0
%119 = insertelement <2 x double> %118, double %115, i64 1
%120 = fmul <2 x double> %117, %119
%121 = tail call double @cos(double %10)
%122 = insertelement <2 x double> poison, double %95, i64 0
%123 = insertelement <2 x double> %122, double %121, i64 1
%124 = fmul <2 x double> %120, %123
%125 = insertelement <2 x double> poison, double %88, i64 0
%126 = insertelement <2 x double> %125, double %97, i64 1
%127 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %126, <2 x double> %113, <2 x double> %124)
br label %128
128: ; preds = %87, %16
%129 = phi <2 x double> [ %86, %16 ], [ %127, %87 ]
%130 = extractelement <2 x double> %129, i64 1
%131 = fcmp ueq double %130, 0.000000e+00
br i1 %131, label %137, label %132
132: ; preds = %128
%133 = extractelement <2 x double> %129, i64 0
%134 = tail call i32 @atan2(double %133, double %130)
%135 = sitofp i32 %134 to double
%136 = fmul double %135, 0x404CA5DC1A63C1F8
br label %137
137: ; preds = %132, %128
%138 = phi double [ %136, %132 ], [ 0.000000e+00, %128 ]
%139 = tail call double @llvm.fabs.f64(double %138)
%140 = fcmp olt double %139, 0x3D39552EF775510E
%141 = select i1 %140, double 0.000000e+00, double %138
ret double %141
}