#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 cos(double);
double fabs(double);
double sin(double);
double sqrt(double);
void transform_mag(const double mag[3], double pitch, double roll,
                   double mag_corr[3]) {
  double c;
  double s;
  double b_c;
  double b_s;
  double c_c[9];
  double dv0[9];
  int k;
  static const signed char iv0[3] = {0, 1, 0};
  static const signed char iv1[3] = {1, 0, 0};
  double d_c[9];
  int i0;
  int i1;
  double y;
  double dv1[3];
  c = cos(pitch);
  s = sin(pitch);
  b_c = cos(roll);
  b_s = sin(roll);
  c_c[0] = c;
  c_c[3] = 0.0;
  c_c[6] = s;
  for (k = 0; k < 3; k++) {
    c_c[1 + 3 * k] = iv0[k];
    dv0[3 * k] = iv1[k];
  }
  c_c[2] = -s;
  c_c[5] = 0.0;
  c_c[8] = c;
  dv0[1] = 0.0;
  dv0[4] = b_c;
  dv0[7] = -b_s;
  dv0[2] = 0.0;
  dv0[5] = b_s;
  dv0[8] = b_c;
  for (k = 0; k < 3; k++) {
    for (i0 = 0; i0 < 3; i0++) {
      d_c[k + 3 * i0] = 0.0;
      for (i1 = 0; i1 < 3; i1++) {
        d_c[k + 3 * i0] += c_c[k + 3 * i1] * dv0[i1 + 3 * i0];
      }
    }
    mag_corr[k] = 0.0;
    for (i0 = 0; i0 < 3; i0++) {
      mag_corr[k] += d_c[k + 3 * i0] * mag[i0];
    }
  }
  mag_corr[2] = 0.0;
  y = 0.0;
  c = 2.2250738585072014E-308;
  for (k = 0; k < 3; k++) {
    s = fabs(mag_corr[k]);
    if (s > c) {
      b_c = c / s;
      y = 1.0 + y * b_c * b_c;
      c = s;
    } else {
      b_c = s / c;
      y += b_c * b_c;
    }
  }
  y = c * sqrt(y);
  c = cos(roll);
  s = sin(roll);
  b_c = cos(pitch);
  b_s = sin(pitch);
  for (k = 0; k < 3; k++) {
    dv0[k] = iv1[k];
    mag_corr[k] /= y;
  }
  dv0[3] = 0.0;
  dv0[4] = c;
  dv0[5] = -s;
  dv0[6] = 0.0;
  dv0[7] = s;
  dv0[8] = c;
  c_c[0] = b_c;
  c_c[1] = 0.0;
  c_c[2] = b_s;
  for (k = 0; k < 3; k++) {
    c_c[3 + k] = iv0[k];
  }
  c_c[6] = -b_s;
  c_c[7] = 0.0;
  c_c[8] = b_c;
  for (k = 0; k < 3; k++) {
    for (i0 = 0; i0 < 3; i0++) {
      d_c[k + 3 * i0] = 0.0;
      for (i1 = 0; i1 < 3; i1++) {
        d_c[k + 3 * i0] += dv0[k + 3 * i1] * c_c[i1 + 3 * i0];
      }
    }
    dv1[k] = 0.0;
    for (i0 = 0; i0 < 3; i0++) {
      dv1[k] += d_c[k + 3 * i0] * mag_corr[i0];
    }
  }
  for (k = 0; k < 3; k++) {
    mag_corr[k] = dv1[k];
  }
}


x86 assembly (clang, -O0):
<transform_mag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    1223 <transform_mag+0xf3>
movslq -0xe4(%rbp),%rax
mov    %eax,%ecx
lea    0xe51(%rip),%rdx
movsbl (%rax,%rdx,1),%eax
cvtsi2sd %eax,%xmm0
mov    %ecx,%eax
lea    (%rax,%rax,2),%eax
cltq
movsd  %xmm0,-0x88(%rbp,%rax,8)
ff ff
movslq -0xe4(%rbp),%rax
lea    0xe2e(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
imul   $0x3,-0xe4(%rbp),%eax
cltq
movsd  %xmm0,-0xe0(%rbp,%rax,8)
ff ff
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    11b2 <transform_mag+0x82>
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x80(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    1443 <transform_mag+0x313>
movl   $0x0,-0x134(%rbp)
cmpl   $0x3,-0x134(%rbp)
jge    13a5 <transform_mag+0x275>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x130(%rbp,%rax,8)
movl   $0x0,-0x138(%rbp)
cmpl   $0x3,-0x138(%rbp)
jge    138c <transform_mag+0x25c>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x138(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x90(%rbp,%rax,8),%xmm0
ff ff
mov    -0x138(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0xe0(%rbp,%rax,8),%xmm2
ff ff
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x130(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x138(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138(%rbp)
jmp    130c <transform_mag+0x1dc>
jmp    1391 <transform_mag+0x261>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    12d8 <transform_mag+0x1a8>
mov    -0x20(%rbp),%rax
movslq -0xe4(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
movl   $0x0,-0x134(%rbp)
cmpl   $0x3,-0x134(%rbp)
jge    142a <transform_mag+0x2fa>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
mov    -0x8(%rbp),%rax
movslq -0x134(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x20(%rbp),%rax
movslq -0xe4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    13c2 <transform_mag+0x292>
jmp    142f <transform_mag+0x2ff>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    12c1 <transform_mag+0x191>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,0x10(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
movsd  0xb9e(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    1540 <transform_mag+0x410>
mov    -0x20(%rbp),%rax
movslq -0xe4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movaps 0xb7b(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    14f6 <transform_mag+0x3c6>
movsd  -0x28(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x140(%rbp),%xmm0
ff
mulsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xb2d(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1527 <transform_mag+0x3f7>
movsd  -0x30(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm2
movsd  -0x140(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
jmp    152c <transform_mag+0x3fc>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1471 <transform_mag+0x341>
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movsd  -0x140(%rbp),%xmm0
ff
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x168(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x140(%rbp)
ff
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <sin@plt>
movsd  %xmm0,-0x40(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    161f <transform_mag+0x4ef>
movslq -0xe4(%rbp),%rax
lea    0xa51(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
movslq -0xe4(%rbp),%rax
movsd  %xmm0,-0xe0(%rbp,%rax,8)
ff ff
movsd  -0x140(%rbp),%xmm1
ff
mov    -0x20(%rbp),%rax
movslq -0xe4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    15b7 <transform_mag+0x487>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    16f7 <transform_mag+0x5c7>
movslq -0xe4(%rbp),%rax
lea    0x959(%rip),%rcx
movsbl (%rax,%rcx,1),%eax
cvtsi2sd %eax,%xmm0
mov    -0xe4(%rbp),%eax
add    $0x3,%eax
cltq
movsd  %xmm0,-0x90(%rbp,%rax,8)
ff ff
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    16ac <transform_mag+0x57c>
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x60(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    18ba <transform_mag+0x78a>
movl   $0x0,-0x134(%rbp)
cmpl   $0x3,-0x134(%rbp)
jge    1818 <transform_mag+0x6e8>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
movl   $0x0,-0x138(%rbp)
cmpl   $0x3,-0x138(%rbp)
jge    17ff <transform_mag+0x6cf>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x138(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0xe0(%rbp,%rax,8),%xmm0
ff ff
mov    -0x138(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x90(%rbp,%rax,8),%xmm2
ff ff
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x130(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x130(%rbp,%rax,8)
ff ff
mov    -0x138(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x138(%rbp)
jmp    177f <transform_mag+0x64f>
jmp    1804 <transform_mag+0x6d4>
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    174b <transform_mag+0x61b>
movslq -0xe4(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x160(%rbp,%rax,8)
ff ff
movl   $0x0,-0x134(%rbp)
cmpl   $0x3,-0x134(%rbp)
jge    18a1 <transform_mag+0x771>
mov    -0xe4(%rbp),%eax
imul   $0x3,-0x134(%rbp),%ecx
add    %ecx,%eax
cltq
movsd  -0x130(%rbp,%rax,8),%xmm0
ff ff
mov    -0x20(%rbp),%rax
movslq -0x134(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movslq -0xe4(%rbp),%rax
movsd  -0x160(%rbp,%rax,8),%xmm1
ff ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x160(%rbp,%rax,8)
ff ff
mov    -0x134(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x134(%rbp)
jmp    1835 <transform_mag+0x705>
jmp    18a6 <transform_mag+0x776>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1734 <transform_mag+0x604>
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    1905 <transform_mag+0x7d5>
movslq -0xe4(%rbp),%rax
movsd  -0x160(%rbp,%rax,8),%xmm0
ff ff
mov    -0x20(%rbp),%rax
movslq -0xe4(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    18c4 <transform_mag+0x794>
add    $0x170,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<transform_mag>:
push   %r14
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%r14
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x8(%rsp)
mov    %rdi,%rbx
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x30(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movsd  0x28(%rsp),%xmm3
movsd  %xmm3,0xb0(%rsp)
movapd 0x10(%rsp),%xmm8
movsd  %xmm8,0xe0(%rsp)
movq   $0x0,0xb8(%rsp)
movabs $0x3ff0000000000000,%rax
mov    %rax,0x60(%rsp)
xorps  %xmm1,%xmm1
movhps 0xe3b(%rip),%xmm1
movups %xmm1,0xc8(%rsp)
movq   $0x0,0x78(%rsp)
movq   $0x0,0xe8(%rsp)
movapd 0xe36(%rip),%xmm1
xorpd  %xmm8,%xmm1
movlpd %xmm1,0xc0(%rsp)
movq   $0x0,0xd8(%rsp)
movsd  %xmm3,0xf0(%rsp)
xorpd  %xmm1,%xmm1
movapd %xmm3,%xmm2
movapd %xmm3,%xmm5
addsd  %xmm1,%xmm2
movsd  0xc8(%rsp),%xmm3
movapd %xmm3,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm2,%xmm4
movapd %xmm8,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm4,%xmm2
movapd %xmm5,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm6
movapd %xmm3,%xmm4
movsd  0x30(%rsp),%xmm9
mulsd  %xmm9,%xmm4
addsd  %xmm6,%xmm4
movapd %xmm8,%xmm5
mulsd  %xmm0,%xmm5
addsd  %xmm4,%xmm5
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm6
mulsd  %xmm9,%xmm8
addsd  %xmm6,%xmm8
movq   $0x0,(%r14)
mulsd  (%rbx),%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,(%r14)
mulsd  0x8(%rbx),%xmm5
addsd  %xmm2,%xmm5
movsd  %xmm5,(%r14)
mulsd  0x10(%rbx),%xmm8
addsd  %xmm5,%xmm8
movsd  %xmm8,(%r14)
movsd  0xb8(%rsp),%xmm4
movsd  0xd0(%rsp),%xmm5
movapd %xmm4,%xmm2
addsd  %xmm1,%xmm2
movapd %xmm5,%xmm6
mulsd  %xmm1,%xmm6
addsd  %xmm2,%xmm6
movsd  0xe8(%rsp),%xmm2
movapd %xmm2,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm6,%xmm3
mulsd  %xmm1,%xmm4
addsd  %xmm1,%xmm4
movapd %xmm5,%xmm6
mulsd  %xmm9,%xmm6
addsd  %xmm4,%xmm6
movapd %xmm2,%xmm7
mulsd  %xmm0,%xmm7
addsd  %xmm6,%xmm7
mulsd  %xmm0,%xmm5
subsd  %xmm5,%xmm4
movapd %xmm8,%xmm5
mulsd  %xmm9,%xmm2
addsd  %xmm4,%xmm2
movq   $0x0,0x8(%r14)
mulsd  (%rbx),%xmm3
addsd  %xmm1,%xmm3
movsd  %xmm3,0x8(%r14)
mulsd  0x8(%rbx),%xmm7
addsd  %xmm3,%xmm7
movsd  %xmm7,0x8(%r14)
mulsd  0x10(%rbx),%xmm2
addsd  %xmm7,%xmm2
movsd  %xmm2,0x8(%r14)
andpd  0xcce(%rip),%xmm5
movq   $0x0,0x10(%r14)
ucomisd 0xc96(%rip),%xmm5
jbe    1392 <transform_mag+0x262>
movsd  0xc8c(%rip),%xmm0
divsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
addsd  0xc70(%rip),%xmm1
jmp    13ae <transform_mag+0x27e>
movsd  0xc76(%rip),%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm0,%xmm1
movsd  0xc5a(%rip),%xmm5
movsd  0x8(%r14),%xmm2
andpd  0xc74(%rip),%xmm2
ucomisd %xmm5,%xmm2
jbe    13e0 <transform_mag+0x2b0>
divsd  %xmm2,%xmm5
mulsd  %xmm5,%xmm1
mulsd  %xmm5,%xmm1
addsd  0xc2a(%rip),%xmm1
movapd %xmm2,%xmm5
movapd %xmm1,%xmm2
jmp    13ec <transform_mag+0x2bc>
divsd  %xmm5,%xmm2
mulsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
xorpd  %xmm1,%xmm1
xorpd  %xmm0,%xmm0
divsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     140c <transform_mag+0x2dc>
sqrtsd %xmm0,%xmm0
jmp    141d <transform_mag+0x2ed>
movapd %xmm5,0x10(%rsp)
call   1050 <sqrt@plt>
movapd 0x10(%rsp),%xmm5
mulsd  %xmm0,%xmm5
movapd %xmm5,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x28(%rsp)
movsd  (%rsp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,0x30(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0xb97(%rip),%xmm1
movaps %xmm1,0x60(%rsp)
movupd (%r14),%xmm12
movapd 0x10(%rsp),%xmm2
movapd %xmm2,%xmm1
unpcklpd %xmm2,%xmm1
divpd  %xmm1,%xmm12
movupd %xmm12,(%r14)
movsd  0x10(%r14),%xmm1
divsd  %xmm2,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  %xmm1,0x10(%r14)
xorpd  %xmm1,%xmm1
movapd %xmm1,0x70(%rsp)
movsd  0x28(%rsp),%xmm1
movsd  %xmm1,0x80(%rsp)
movapd 0xb5e(%rip),%xmm4
movapd 0x30(%rsp),%xmm2
xorpd  %xmm2,%xmm4
movlpd %xmm4,0x88(%rsp)
movq   $0x0,0x90(%rsp)
movsd  %xmm2,0x98(%rsp)
movapd %xmm2,%xmm6
movsd  %xmm1,0xa0(%rsp)
movapd %xmm1,%xmm3
movsd  (%rsp),%xmm10
xorpd  %xmm11,%xmm11
addsd  %xmm11,%xmm10
movsd  0x78(%rsp),%xmm15
movapd %xmm15,%xmm9
mulsd  %xmm11,%xmm9
addsd  %xmm9,%xmm10
xorpd  %xmm13,%xmm13
subsd  %xmm0,%xmm13
movsd  0x68(%rsp),%xmm1
movapd %xmm1,%xmm5
mulsd  %xmm0,%xmm6
movapd %xmm1,%xmm14
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movapd %xmm3,%xmm1
mulsd  %xmm0,%xmm3
movsd  0x70(%rsp),%xmm8
movapd %xmm8,%xmm2
movapd %xmm8,%xmm7
mulsd  %xmm0,%xmm8
mulsd  %xmm11,%xmm0
addsd  %xmm10,%xmm0
addsd  %xmm9,%xmm13
movsd  (%rsp),%xmm10
movapd %xmm10,%xmm9
mulsd  %xmm11,%xmm9
addsd  %xmm13,%xmm9
mulsd  %xmm10,%xmm5
movapd %xmm10,%xmm13
addsd  %xmm11,%xmm5
movapd %xmm1,%xmm10
mulsd  %xmm11,%xmm10
addsd  %xmm10,%xmm5
addsd  %xmm5,%xmm6
mulsd  %xmm13,%xmm2
addsd  %xmm11,%xmm2
mulsd  %xmm11,%xmm4
movapd %xmm4,0x100(%rsp)
addsd  %xmm4,%xmm2
addsd  %xmm2,%xmm3
addsd  %xmm11,%xmm15
addsd  %xmm11,%xmm15
mulsd  %xmm12,%xmm0
addsd  %xmm11,%xmm0
mulsd  %xmm12,%xmm6
mulsd  %xmm12,%xmm3
unpckhpd %xmm12,%xmm12
mulsd  %xmm12,%xmm15
addsd  %xmm0,%xmm15
movsd  0x10(%rsp),%xmm4
mulsd  %xmm4,%xmm9
addsd  %xmm15,%xmm9
movsd  %xmm9,0x40(%rsp)
mulsd  %xmm11,%xmm14
addsd  %xmm11,%xmm14
movapd %xmm1,%xmm9
addsd  %xmm1,%xmm14
movapd 0x30(%rsp),%xmm5
movapd %xmm5,%xmm0
mulsd  %xmm11,%xmm0
addsd  %xmm14,%xmm0
xorpd  %xmm1,%xmm1
subsd  0x8(%rsp),%xmm1
addsd  %xmm10,%xmm1
movapd %xmm5,%xmm2
mulsd  %xmm13,%xmm2
addsd  %xmm1,%xmm2
addsd  %xmm11,%xmm6
mulsd  %xmm12,%xmm0
addsd  %xmm6,%xmm0
mulsd  %xmm4,%xmm2
addsd  %xmm0,%xmm2
movsd  %xmm2,0x48(%rsp)
mulsd  %xmm11,%xmm7
addsd  %xmm11,%xmm7
subsd  %xmm5,%xmm7
addsd  %xmm10,%xmm7
xorpd  %xmm0,%xmm0
subsd  %xmm8,%xmm0
addsd  0x100(%rsp),%xmm0
movapd %xmm9,%xmm1
mulsd  %xmm13,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm11,%xmm3
mulsd  %xmm12,%xmm7
addsd  %xmm3,%xmm7
mulsd  %xmm4,%xmm1
addsd  %xmm7,%xmm1
movsd  %xmm1,0x50(%rsp)
movaps 0x40(%rsp),%xmm0
movups %xmm0,(%r14)
mov    0x50(%rsp),%rax
mov    %rax,0x10(%r14)
add    $0x118,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@transform_mag.iv0 = internal constant [3 x i8] c"\00\01\00"
@transform_mag.iv1 = internal constant [3 x i8] c"\01\00\00"
define void @transform_mag(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 double
%13 = alloca [9 x double]
%14 = alloca [9 x double]
%15 = alloca i32
%16 = alloca [9 x double]
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca [3 x double]
store double* %0, double** %5
store double %1, double* %6
store double %2, double* %7
store double* %3, double** %8
%21 = load double, double* %6
%22 = call double @cos(double %21)
store double %22, double* %9
%23 = load double, double* %6
%24 = call double @sin(double %23)
store double %24, double* %10
%25 = load double, double* %7
%26 = call double @cos(double %25)
store double %26, double* %11
%27 = load double, double* %7
%28 = call double @sin(double %27)
store double %28, double* %12
%29 = load double, double* %9
%30 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 0
store double %29, double* %30
%31 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 3
store double 0.000000e+00, double* %31
%32 = load double, double* %10
%33 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 6
store double %32, double* %33
store i32 0, i32* %15
br label %34
34: ; preds = %57, %4
%35 = load i32, i32* %15
%36 = icmp slt i32 %35, 3
br i1 %36, label %37, label %60
37: ; preds = %34
%38 = load i32, i32* %15
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [3 x i8], [3 x i8]* @transform_mag.iv0, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sitofp i8 %41 to double
%43 = load i32, i32* %15
%44 = mul nsw i32 3, %43
%45 = add nsw i32 1, %44
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 %46
store double %42, double* %47
%48 = load i32, i32* %15
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [3 x i8], [3 x i8]* @transform_mag.iv1, i64 0, i64 %49
%51 = load i8, i8* %50
%52 = sitofp i8 %51 to double
%53 = load i32, i32* %15
%54 = mul nsw i32 3, %53
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 %55
store double %52, double* %56
br label %57
57: ; preds = %37
%58 = load i32, i32* %15
%59 = add nsw i32 %58, 1
store i32 %59, i32* %15
br label %34
60: ; preds = %34
%61 = load double, double* %10
%62 = fneg double %61
%63 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 2
store double %62, double* %63
%64 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 5
store double 0.000000e+00, double* %64
%65 = load double, double* %9
%66 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 8
store double %65, double* %66
%67 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 1
store double 0.000000e+00, double* %67
%68 = load double, double* %11
%69 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 4
store double %68, double* %69
%70 = load double, double* %12
%71 = fneg double %70
%72 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 7
store double %71, double* %72
%73 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 2
store double 0.000000e+00, double* %73
%74 = load double, double* %12
%75 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 5
store double %74, double* %75
%76 = load double, double* %11
%77 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 8
store double %76, double* %77
store i32 0, i32* %15
br label %78
78: ; preds = %156, %60
%79 = load i32, i32* %15
%80 = icmp slt i32 %79, 3
br i1 %80, label %81, label %159
81: ; preds = %78
store i32 0, i32* %17
br label %82
82: ; preds = %122, %81
%83 = load i32, i32* %17
%84 = icmp slt i32 %83, 3
br i1 %84, label %85, label %125
85: ; preds = %82
%86 = load i32, i32* %15
%87 = load i32, i32* %17
%88 = mul nsw i32 3, %87
%89 = add nsw i32 %86, %88
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %90
store double 0.000000e+00, double* %91
store i32 0, i32* %18
br label %92
92: ; preds = %118, %85
%93 = load i32, i32* %18
%94 = icmp slt i32 %93, 3
br i1 %94, label %95, label %121
95: ; preds = %92
%96 = load i32, i32* %15
%97 = load i32, i32* %18
%98 = mul nsw i32 3, %97
%99 = add nsw i32 %96, %98
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 %100
%102 = load double, double* %101
%103 = load i32, i32* %18
%104 = load i32, i32* %17
%105 = mul nsw i32 3, %104
%106 = add nsw i32 %103, %105
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 %107
%109 = load double, double* %108
%110 = load i32, i32* %15
%111 = load i32, i32* %17
%112 = mul nsw i32 3, %111
%113 = add nsw i32 %110, %112
%114 = sext i32 %113 to i64
%115 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %114
%116 = load double, double* %115
%117 = call double @llvm.fmuladd.f64(double %102, double %109, double %116)
store double %117, double* %115
br label %118
118: ; preds = %95
%119 = load i32, i32* %18
%120 = add nsw i32 %119, 1
store i32 %120, i32* %18
br label %92
121: ; preds = %92
br label %122
122: ; preds = %121
%123 = load i32, i32* %17
%124 = add nsw i32 %123, 1
store i32 %124, i32* %17
br label %82
125: ; preds = %82
%126 = load double*, double** %8
%127 = load i32, i32* %15
%128 = sext i32 %127 to i64
%129 = getelementptr inbounds double, double* %126, i64 %128
store double 0.000000e+00, double* %129
store i32 0, i32* %17
br label %130
130: ; preds = %152, %125
%131 = load i32, i32* %17
%132 = icmp slt i32 %131, 3
br i1 %132, label %133, label %155
133: ; preds = %130
%134 = load i32, i32* %15
%135 = load i32, i32* %17
%136 = mul nsw i32 3, %135
%137 = add nsw i32 %134, %136
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %138
%140 = load double, double* %139
%141 = load double*, double** %5
%142 = load i32, i32* %17
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = load double*, double** %8
%147 = load i32, i32* %15
%148 = sext i32 %147 to i64
%149 = getelementptr inbounds double, double* %146, i64 %148
%150 = load double, double* %149
%151 = call double @llvm.fmuladd.f64(double %140, double %145, double %150)
store double %151, double* %149
br label %152
152: ; preds = %133
%153 = load i32, i32* %17
%154 = add nsw i32 %153, 1
store i32 %154, i32* %17
br label %130
155: ; preds = %130
br label %156
156: ; preds = %155
%157 = load i32, i32* %15
%158 = add nsw i32 %157, 1
store i32 %158, i32* %15
br label %78
159: ; preds = %78
%160 = load double*, double** %8
%161 = getelementptr inbounds double, double* %160, i64 2
store double 0.000000e+00, double* %161
store double 0.000000e+00, double* %19
store double 0x10000000000000, double* %9
store i32 0, i32* %15
br label %162
162: ; preds = %194, %159
%163 = load i32, i32* %15
%164 = icmp slt i32 %163, 3
br i1 %164, label %165, label %197
165: ; preds = %162
%166 = load double*, double** %8
%167 = load i32, i32* %15
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds double, double* %166, i64 %168
%170 = load double, double* %169
%171 = call double @llvm.fabs.f64(double %170)
store double %171, double* %10
%172 = load double, double* %10
%173 = load double, double* %9
%174 = fcmp ogt double %172, %173
br i1 %174, label %175, label %185
175: ; preds = %165
%176 = load double, double* %9
%177 = load double, double* %10
%178 = fdiv double %176, %177
store double %178, double* %11
%179 = load double, double* %19
%180 = load double, double* %11
%181 = fmul double %179, %180
%182 = load double, double* %11
%183 = call double @llvm.fmuladd.f64(double %181, double %182, double 1.000000e+00)
store double %183, double* %19
%184 = load double, double* %10
store double %184, double* %9
br label %193
185: ; preds = %165
%186 = load double, double* %10
%187 = load double, double* %9
%188 = fdiv double %186, %187
store double %188, double* %11
%189 = load double, double* %11
%190 = load double, double* %11
%191 = load double, double* %19
%192 = call double @llvm.fmuladd.f64(double %189, double %190, double %191)
store double %192, double* %19
br label %193
193: ; preds = %185, %175
br label %194
194: ; preds = %193
%195 = load i32, i32* %15
%196 = add nsw i32 %195, 1
store i32 %196, i32* %15
br label %162
197: ; preds = %162
%198 = load double, double* %9
%199 = load double, double* %19
%200 = call double @sqrt(double %199)
%201 = fmul double %198, %200
store double %201, double* %19
%202 = load double, double* %7
%203 = call double @cos(double %202)
store double %203, double* %9
%204 = load double, double* %7
%205 = call double @sin(double %204)
store double %205, double* %10
%206 = load double, double* %6
%207 = call double @cos(double %206)
store double %207, double* %11
%208 = load double, double* %6
%209 = call double @sin(double %208)
store double %209, double* %12
store i32 0, i32* %15
br label %210
210: ; preds = %229, %197
%211 = load i32, i32* %15
%212 = icmp slt i32 %211, 3
br i1 %212, label %213, label %232
213: ; preds = %210
%214 = load i32, i32* %15
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds [3 x i8], [3 x i8]* @transform_mag.iv1, i64 0, i64 %215
%217 = load i8, i8* %216
%218 = sitofp i8 %217 to double
%219 = load i32, i32* %15
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 %220
store double %218, double* %221
%222 = load double, double* %19
%223 = load double*, double** %8
%224 = load i32, i32* %15
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds double, double* %223, i64 %225
%227 = load double, double* %226
%228 = fdiv double %227, %222
store double %228, double* %226
br label %229
229: ; preds = %213
%230 = load i32, i32* %15
%231 = add nsw i32 %230, 1
store i32 %231, i32* %15
br label %210
232: ; preds = %210
%233 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 3
store double 0.000000e+00, double* %233
%234 = load double, double* %9
%235 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 4
store double %234, double* %235
%236 = load double, double* %10
%237 = fneg double %236
%238 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 5
store double %237, double* %238
%239 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 6
store double 0.000000e+00, double* %239
%240 = load double, double* %10
%241 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 7
store double %240, double* %241
%242 = load double, double* %9
%243 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 8
store double %242, double* %243
%244 = load double, double* %11
%245 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 0
store double %244, double* %245
%246 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 1
store double 0.000000e+00, double* %246
%247 = load double, double* %12
%248 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 2
store double %247, double* %248
store i32 0, i32* %15
br label %249
249: ; preds = %262, %232
%250 = load i32, i32* %15
%251 = icmp slt i32 %250, 3
br i1 %251, label %252, label %265
252: ; preds = %249
%253 = load i32, i32* %15
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds [3 x i8], [3 x i8]* @transform_mag.iv0, i64 0, i64 %254
%256 = load i8, i8* %255
%257 = sitofp i8 %256 to double
%258 = load i32, i32* %15
%259 = add nsw i32 3, %258
%260 = sext i32 %259 to i64
%261 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 %260
store double %257, double* %261
br label %262
262: ; preds = %252
%263 = load i32, i32* %15
%264 = add nsw i32 %263, 1
store i32 %264, i32* %15
br label %249
265: ; preds = %249
%266 = load double, double* %12
%267 = fneg double %266
%268 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 6
store double %267, double* %268
%269 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 7
store double 0.000000e+00, double* %269
%270 = load double, double* %11
%271 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 8
store double %270, double* %271
store i32 0, i32* %15
br label %272
272: ; preds = %348, %265
%273 = load i32, i32* %15
%274 = icmp slt i32 %273, 3
br i1 %274, label %275, label %351
275: ; preds = %272
store i32 0, i32* %17
br label %276
276: ; preds = %316, %275
%277 = load i32, i32* %17
%278 = icmp slt i32 %277, 3
br i1 %278, label %279, label %319
279: ; preds = %276
%280 = load i32, i32* %15
%281 = load i32, i32* %17
%282 = mul nsw i32 3, %281
%283 = add nsw i32 %280, %282
%284 = sext i32 %283 to i64
%285 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %284
store double 0.000000e+00, double* %285
store i32 0, i32* %18
br label %286
286: ; preds = %312, %279
%287 = load i32, i32* %18
%288 = icmp slt i32 %287, 3
br i1 %288, label %289, label %315
289: ; preds = %286
%290 = load i32, i32* %15
%291 = load i32, i32* %18
%292 = mul nsw i32 3, %291
%293 = add nsw i32 %290, %292
%294 = sext i32 %293 to i64
%295 = getelementptr inbounds [9 x double], [9 x double]* %14, i64 0, i64 %294
%296 = load double, double* %295
%297 = load i32, i32* %18
%298 = load i32, i32* %17
%299 = mul nsw i32 3, %298
%300 = add nsw i32 %297, %299
%301 = sext i32 %300 to i64
%302 = getelementptr inbounds [9 x double], [9 x double]* %13, i64 0, i64 %301
%303 = load double, double* %302
%304 = load i32, i32* %15
%305 = load i32, i32* %17
%306 = mul nsw i32 3, %305
%307 = add nsw i32 %304, %306
%308 = sext i32 %307 to i64
%309 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %308
%310 = load double, double* %309
%311 = call double @llvm.fmuladd.f64(double %296, double %303, double %310)
store double %311, double* %309
br label %312
312: ; preds = %289
%313 = load i32, i32* %18
%314 = add nsw i32 %313, 1
store i32 %314, i32* %18
br label %286
315: ; preds = %286
br label %316
316: ; preds = %315
%317 = load i32, i32* %17
%318 = add nsw i32 %317, 1
store i32 %318, i32* %17
br label %276
319: ; preds = %276
%320 = load i32, i32* %15
%321 = sext i32 %320 to i64
%322 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %321
store double 0.000000e+00, double* %322
store i32 0, i32* %17
br label %323
323: ; preds = %344, %319
%324 = load i32, i32* %17
%325 = icmp slt i32 %324, 3
br i1 %325, label %326, label %347
326: ; preds = %323
%327 = load i32, i32* %15
%328 = load i32, i32* %17
%329 = mul nsw i32 3, %328
%330 = add nsw i32 %327, %329
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds [9 x double], [9 x double]* %16, i64 0, i64 %331
%333 = load double, double* %332
%334 = load double*, double** %8
%335 = load i32, i32* %17
%336 = sext i32 %335 to i64
%337 = getelementptr inbounds double, double* %334, i64 %336
%338 = load double, double* %337
%339 = load i32, i32* %15
%340 = sext i32 %339 to i64
%341 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %340
%342 = load double, double* %341
%343 = call double @llvm.fmuladd.f64(double %333, double %338, double %342)
store double %343, double* %341
br label %344
344: ; preds = %326
%345 = load i32, i32* %17
%346 = add nsw i32 %345, 1
store i32 %346, i32* %17
br label %323
347: ; preds = %323
br label %348
348: ; preds = %347
%349 = load i32, i32* %15
%350 = add nsw i32 %349, 1
store i32 %350, i32* %15
br label %272
351: ; preds = %272
store i32 0, i32* %15
br label %352
352: ; preds = %364, %351
%353 = load i32, i32* %15
%354 = icmp slt i32 %353, 3
br i1 %354, label %355, label %367
355: ; preds = %352
%356 = load i32, i32* %15
%357 = sext i32 %356 to i64
%358 = getelementptr inbounds [3 x double], [3 x double]* %20, i64 0, i64 %357
%359 = load double, double* %358
%360 = load double*, double** %8
%361 = load i32, i32* %15
%362 = sext i32 %361 to i64
%363 = getelementptr inbounds double, double* %360, i64 %362
store double %359, double* %363
br label %364
364: ; preds = %355
%365 = load i32, i32* %15
%366 = add nsw i32 %365, 1
store i32 %366, i32* %15
br label %352
367: ; preds = %352
ret void
}

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