int g_to_k(double h[4], double UB[9], double ax[19], double pre[9], double wvln,
           double g[3], double k[3], double tth_calc[10], double eta_calc[10],
           double omega_calc[10]) {
  double gr[3], modg, modg2, ka[3], b, c, t;
  double gao[3], kao[3];
  int i, j;
  (g)[0] = (UB)[0] * (h)[0] + (UB)[1] * (h)[1] + (UB)[2] * (h)[2];
  (g)[1] = (UB)[3] * (h)[0] + (UB)[4] * (h)[1] + (UB)[5] * (h)[2];
  (g)[2] = (UB)[6] * (h)[0] + (UB)[7] * (h)[1] + (UB)[8] * (h)[2];
  ;
  modg = norm3(g);
  t = wvln * modg / 2.0;
  tth_calc[0] = 180.0 / 3.14159265358979323846 * asin(t);
  c = 180.0 / 3.14159265358979323846 * wvln / (2.0 * modg * sqrt(1 - t * t));
  for (i = 0; i < 3; i++)
    for (j = 0; j < 3; j++)
      tth_calc[i * 3 + j + 1] = c * g[i] * h[j];
  (gr)[0] = (pre)[0] * (g)[0] + (pre)[1] * (g)[1] + (pre)[2] * (g)[2];
  (gr)[1] = (pre)[3] * (g)[0] + (pre)[4] * (g)[1] + (pre)[5] * (g)[2];
  (gr)[2] = (pre)[6] * (g)[0] + (pre)[7] * (g)[1] + (pre)[8] * (g)[2];
  ;
  gr[0] = gr[0] * wvln;
  gr[1] = gr[1] * wvln;
  gr[2] = gr[2] * wvln;
  modg2 = gr[0] * gr[0] + gr[1] * gr[1] + gr[2] * gr[2];
  ka[0] = gr[0] * ax[0] + gr[1] * ax[1] + gr[2] * ax[2];
  ka[1] = -modg2 / 2.;
  c = ka[0] * ka[0] + ka[1] * ka[1] - modg2;
  b = 2 * ka[0] * ka[1] * ax[9];
  t = b * b - c * 4.;
  if (t >= 0.0) {
    ka[2] = -b + h[3] * sqrt(t) / 2.;
  } else {
    printf("Cannot find it!\n");
    return 1;
  }
  (k)[0] =
      (&ax[10])[0] * (ka)[0] + (&ax[10])[1] * (ka)[1] + (&ax[10])[2] * (ka)[2];
  (k)[1] =
      (&ax[10])[3] * (ka)[0] + (&ax[10])[4] * (ka)[1] + (&ax[10])[5] * (ka)[2];
  (k)[2] =
      (&ax[10])[6] * (ka)[0] + (&ax[10])[7] * (ka)[1] + (&ax[10])[8] * (ka)[2];
  ;
  k[0] = k[0] / wvln;
  k[1] = k[1] / wvln;
  k[2] = k[2] / wvln;
  eta_calc[0] = 180.0 / 3.14159265358979323846 * atan2(-k[1], k[2]);
  kao[0] = ka[0];
  gao[0] = ka[0];
  kao[1] = ka[1] * (1 - ax[9]);
  kao[2] = ka[2];
  gao[1] = ax[3] * gr[0] + ax[4] * gr[1] + ax[5] * gr[2];
  gao[2] = ax[6] * gr[0] + ax[7] * gr[1] + ax[8] * gr[2];
  omega_calc[0] = 180.0 / 3.14159265358979323846 *
                  atan2(kao[1] * gao[2] - kao[2] * gao[1],
                        kao[1] * gao[1] - kao[2] * gao[2]);
  return 0;
}


x86 assembly (clang, -O0):
<g_to_k>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movsd  %xmm0,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x18(%rbp),%rax
movsd  0x30(%rax),%xmm1
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x18(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x18(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x38(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x38(%rbp),%rdi
mov    $0x0,%al
call   1060 <norm3@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  0xd76(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
call   1050 <asin@plt>
movaps %xmm0,%xmm1
movsd  0xd5a(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  0xd46(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xf0(%rbp)
ff
movsd  0xd29(%rip),%xmm0
mulsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0xf8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm1
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xce1(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1070 <sqrt@plt>
movsd  -0xf8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xf0(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x0,-0xe4(%rbp)
cmpl   $0x3,-0xe4(%rbp)
jge    13ea <g_to_k+0x29a>
movl   $0x0,-0xe8(%rbp)
cmpl   $0x3,-0xe8(%rbp)
jge    13d1 <g_to_k+0x281>
movsd  -0xa0(%rbp),%xmm0
ff
mov    -0x38(%rbp),%rax
movslq -0xe4(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    -0x10(%rbp),%rax
movslq -0xe8(%rbp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x10(%rbp),%rax
imul   $0x3,-0xe4(%rbp),%ecx
add    -0xe8(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0xe8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe8(%rbp)
jmp    136c <g_to_k+0x21c>
jmp    13d6 <g_to_k+0x286>
mov    -0xe4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe4(%rbp)
jmp    1355 <g_to_k+0x205>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x38(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x28(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x18(%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x20(%rax),%xmm0
mov    -0x38(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x28(%rbp),%rax
movsd  0x28(%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x28(%rbp),%rax
movsd  0x30(%rax),%xmm1
mov    -0x38(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x28(%rbp),%rax
movsd  0x38(%rax),%xmm0
mov    -0x38(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x28(%rbp),%rax
movsd  0x40(%rax),%xmm0
mov    -0x38(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x60(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x60(%rbp),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm2
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
mulsd  0x8(%rax),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xa7c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x88(%rbp),%xmm1
ff
mulsd  -0x88(%rbp),%xmm1
ff
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xa33(%rip),%xmm0
mulsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rax
mulsd  0x48(%rax),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x98(%rbp),%xmm2
ff
movsd  0xa0a(%rip),%xmm1
mulsd  -0xa0(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     16c8 <g_to_k+0x578>
movsd  -0x98(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x100(%rbp)
ff
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x108(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
call   1070 <sqrt@plt>
movsd  -0x108(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x100(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
movsd  0x952(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    16e2 <g_to_k+0x592>
lea    0x951(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    19c4 <g_to_k+0x874>
mov    -0x20(%rbp),%rax
movsd  0x50(%rax),%xmm1
movsd  -0x90(%rbp),%xmm2
ff
mov    -0x20(%rbp),%rax
movsd  0x58(%rax),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x60(%rax),%xmm0
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0x68(%rax),%xmm1
movsd  -0x90(%rbp),%xmm2
ff
mov    -0x20(%rbp),%rax
movsd  0x70(%rax),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x78(%rax),%xmm0
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x20(%rbp),%rax
movsd  0x80(%rax),%xmm1
movsd  -0x90(%rbp),%xmm2
ff
mov    -0x20(%rbp),%rax
movsd  0x88(%rax),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x90(%rax),%xmm0
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x40(%rbp),%rax
movsd  (%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,0x8(%rax)
mov    -0x40(%rbp),%rax
movsd  0x10(%rax),%xmm0
divsd  -0x30(%rbp),%xmm0
mov    -0x40(%rbp),%rax
movsd  %xmm0,0x10(%rax)
mov    -0x40(%rbp),%rax
movsd  0x8(%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mov    -0x40(%rbp),%rax
movsd  0x10(%rax),%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0x7cf(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mov    -0x20(%rbp),%rax
movsd  0x77f(%rip),%xmm1
subsd  0x48(%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm1
movsd  -0x60(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x20(%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x28(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x30(%rax),%xmm1
movsd  -0x60(%rbp),%xmm2
mov    -0x20(%rbp),%rax
movsd  0x38(%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x20(%rbp),%rax
movsd  0x40(%rax),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xd8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm2
ff
movsd  -0xd0(%rbp),%xmm1
ff
mulsd  -0xb8(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0xd8(%rbp),%xmm1
ff
movsd  -0xb8(%rbp),%xmm3
ff
movsd  -0xd0(%rbp),%xmm2
ff
mulsd  -0xb0(%rbp),%xmm2
ff
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
call   1030 <atan2@plt>
movaps %xmm0,%xmm1
movsd  0x65f(%rip),%xmm0
mulsd  %xmm1,%xmm0
mov    0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<g_to_k>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %r9,%r14
mov    %r8,%rbx
movaps %xmm0,0x20(%rsp)
mov    %rcx,%r12
mov    %rdx,%r15
mov    %rdi,%r13
mov    0xc0(%rsp),%rbp
movsd  (%rsi),%xmm0
movsd  0x8(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x10(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,(%r8)
movsd  0x18(%rsi),%xmm0
movsd  0x20(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x28(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%r8)
movsd  0x30(%rsi),%xmm0
movsd  0x38(%rsi),%xmm1
mulsd  0x8(%rdi),%xmm1
mulsd  (%rdi),%xmm0
addsd  %xmm1,%xmm0
movsd  0x40(%rsi),%xmm1
mulsd  0x10(%rdi),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%r8)
mov    %r8,%rdi
xor    %eax,%eax
call   1060 <norm3@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
mulsd  0x20(%rsp),%xmm0
mulsd  0xddf(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
call   1050 <asin@plt>
movsd  0xdd4(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%rbp)
movapd 0x20(%rsp),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x8(%rsp),%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  0xda7(%rip),%xmm0
subsd  %xmm1,%xmm0
xorpd  %xmm8,%xmm8
ucomisd %xmm8,%xmm0
jb     127f <g_to_k+0x12f>
sqrtsd %xmm0,%xmm0
jmp    1295 <g_to_k+0x145>
movapd %xmm2,0x10(%rsp)
call   1070 <sqrt@plt>
movapd 0x10(%rsp),%xmm2
xorpd  %xmm8,%xmm8
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
divsd  %xmm1,%xmm2
movsd  (%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x0(%r13),%xmm0
movsd  %xmm0,0x8(%rbp)
movsd  (%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x8(%r13),%xmm0
movsd  %xmm0,0x10(%rbp)
movsd  (%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x10(%r13),%xmm0
movsd  %xmm0,0x18(%rbp)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x0(%r13),%xmm0
movsd  %xmm0,0x20(%rbp)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x8(%r13),%xmm0
movsd  %xmm0,0x28(%rbp)
movsd  0x8(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x10(%r13),%xmm0
movsd  %xmm0,0x30(%rbp)
movsd  0x10(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x0(%r13),%xmm0
movsd  %xmm0,0x38(%rbp)
movsd  0x10(%rbx),%xmm0
mulsd  %xmm2,%xmm0
mulsd  0x8(%r13),%xmm0
movsd  %xmm0,0x40(%rbp)
mulsd  0x10(%rbx),%xmm2
mulsd  0x10(%r13),%xmm2
movsd  %xmm2,0x48(%rbp)
movsd  (%rbx),%xmm0
movsd  0x8(%rbx),%xmm1
movsd  0x8(%r12),%xmm2
mulsd  %xmm1,%xmm2
movsd  (%r12),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  0x10(%rbx),%xmm4
movsd  0x10(%r12),%xmm5
mulsd  %xmm4,%xmm5
addsd  %xmm3,%xmm5
movsd  0x20(%r12),%xmm2
mulsd  %xmm1,%xmm2
movsd  0x18(%r12),%xmm3
mulsd  %xmm0,%xmm3
addsd  %xmm2,%xmm3
movsd  0x28(%r12),%xmm6
mulsd  %xmm4,%xmm6
addsd  %xmm3,%xmm6
mulsd  0x38(%r12),%xmm1
mulsd  0x30(%r12),%xmm0
mulsd  0x40(%r12),%xmm4
addsd  %xmm1,%xmm0
addsd  %xmm0,%xmm4
movapd 0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm5
mulsd  %xmm0,%xmm6
mulsd  %xmm0,%xmm4
movapd %xmm6,%xmm0
unpcklpd %xmm6,%xmm0
movapd %xmm6,%xmm1
movhpd 0x8(%r15),%xmm1
mulpd  %xmm0,%xmm1
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
movapd %xmm5,%xmm2
movhpd (%r15),%xmm2
mulpd  %xmm0,%xmm2
addpd  %xmm1,%xmm2
movapd %xmm4,%xmm0
movapd %xmm4,%xmm1
movhpd 0x10(%r15),%xmm1
unpcklpd %xmm4,%xmm0
mulpd  %xmm0,%xmm1
addpd  %xmm2,%xmm1
movapd 0xbf1(%rip),%xmm7
mulpd  %xmm1,%xmm7
movapd %xmm7,%xmm0
mulsd  %xmm7,%xmm0
movapd %xmm1,%xmm9
unpckhpd %xmm1,%xmm9
movapd %xmm9,%xmm2
mulsd  %xmm9,%xmm2
addsd  %xmm0,%xmm2
subsd  %xmm1,%xmm2
movapd %xmm7,%xmm3
unpckhpd %xmm7,%xmm3
mulsd  %xmm7,%xmm3
mulsd  0x48(%r15),%xmm3
mulsd  0xba7(%rip),%xmm2
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
ucomisd %xmm8,%xmm0
jae    149a <g_to_k+0x34a>
lea    0xbb5(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
jmp    1693 <g_to_k+0x543>
movapd %xmm6,0x50(%rsp)
movapd %xmm5,0x60(%rsp)
movapd %xmm4,0x70(%rsp)
mov    0xd0(%rsp),%rbx
mov    0xc8(%rsp),%rbp
movsd  0x18(%r13),%xmm1
movsd  %xmm1,0x8(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
movapd %xmm7,0x10(%rsp)
jb     14de <g_to_k+0x38e>
sqrtsd %xmm0,%xmm0
jmp    1503 <g_to_k+0x3b3>
movapd %xmm9,0x40(%rsp)
movapd %xmm3,0x30(%rsp)
call   1070 <sqrt@plt>
movapd 0x30(%rsp),%xmm3
movapd 0x40(%rsp),%xmm9
movapd 0x10(%rsp),%xmm7
movsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xaeb(%rip),%xmm1
subsd  %xmm3,%xmm1
movapd %xmm1,%xmm2
movsd  0x58(%r15),%xmm0
mulsd  %xmm7,%xmm0
movsd  0x50(%r15),%xmm1
mulsd  %xmm9,%xmm1
addsd  %xmm0,%xmm1
movsd  0x60(%r15),%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm4
movsd  %xmm2,0x8(%rsp)
addsd  %xmm1,%xmm0
movsd  %xmm0,(%r14)
movsd  0x70(%r15),%xmm1
mulsd  %xmm7,%xmm1
movsd  0x68(%r15),%xmm2
mulsd  %xmm9,%xmm2
addsd  %xmm1,%xmm2
movsd  0x78(%r15),%xmm3
mulsd  %xmm4,%xmm3
addsd  %xmm2,%xmm3
movsd  %xmm3,0x8(%r14)
movsd  0x88(%r15),%xmm1
mulsd  %xmm7,%xmm1
mulsd  0x80(%r15),%xmm9
addsd  %xmm1,%xmm9
movsd  0x90(%r15),%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm9,%xmm1
unpcklpd %xmm3,%xmm0
movapd 0x20(%rsp),%xmm2
divsd  %xmm2,%xmm1
unpcklpd %xmm2,%xmm2
divpd  %xmm2,%xmm0
movupd %xmm0,(%r14)
movsd  %xmm1,0x10(%r14)
unpckhpd %xmm0,%xmm0
xorpd  0xa56(%rip),%xmm0
call   1040 <atan2@plt>
movsd  0xa21(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,0x0(%rbp)
movsd  0xa18(%rip),%xmm0
subsd  0x48(%r15),%xmm0
movapd 0x10(%rsp),%xmm6
mulsd  %xmm0,%xmm6
movsd  0x20(%r15),%xmm0
movapd 0x50(%rsp),%xmm5
mulsd  %xmm5,%xmm0
movsd  0x18(%r15),%xmm2
movapd 0x60(%rsp),%xmm4
mulsd  %xmm4,%xmm2
addsd  %xmm0,%xmm2
movsd  0x28(%r15),%xmm1
movapd 0x70(%rsp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  0x38(%r15),%xmm5
mulsd  0x30(%r15),%xmm4
mulsd  0x40(%r15),%xmm3
addsd  %xmm5,%xmm4
addsd  %xmm4,%xmm3
movapd %xmm1,%xmm2
movsd  0x8(%rsp),%xmm4
mulsd  %xmm4,%xmm2
movapd %xmm6,%xmm0
mulsd  %xmm3,%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm4,%xmm3
mulsd  %xmm6,%xmm1
subsd  %xmm3,%xmm1
call   1040 <atan2@plt>
mulsd  0x97b(%rip),%xmm0
movsd  %xmm0,(%rbx)
xor    %eax,%eax
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Cannot find it!\0A\00"
define i32 @g_to_k(double* %0, double* %1, double* %2, double* %3, double %4, double* %5, double* %6, double* %7, double* %8, double* %9) {
%11 = alloca i32
%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 [3 x double]
%23 = alloca double
%24 = alloca double
%25 = alloca [3 x double]
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca [3 x double]
%30 = alloca [3 x double]
%31 = alloca i32
%32 = alloca i32
store double* %0, double** %12
store double* %1, double** %13
store double* %2, double** %14
store double* %3, double** %15
store double %4, double* %16
store double* %5, double** %17
store double* %6, double** %18
store double* %7, double** %19
store double* %8, double** %20
store double* %9, double** %21
%33 = load double*, double** %13
%34 = getelementptr inbounds double, double* %33, i64 0
%35 = load double, double* %34
%36 = load double*, double** %12
%37 = getelementptr inbounds double, double* %36, i64 0
%38 = load double, double* %37
%39 = load double*, double** %13
%40 = getelementptr inbounds double, double* %39, i64 1
%41 = load double, double* %40
%42 = load double*, double** %12
%43 = getelementptr inbounds double, double* %42, i64 1
%44 = load double, double* %43
%45 = fmul double %41, %44
%46 = call double @llvm.fmuladd.f64(double %35, double %38, double %45)
%47 = load double*, double** %13
%48 = getelementptr inbounds double, double* %47, i64 2
%49 = load double, double* %48
%50 = load double*, double** %12
%51 = getelementptr inbounds double, double* %50, i64 2
%52 = load double, double* %51
%53 = call double @llvm.fmuladd.f64(double %49, double %52, double %46)
%54 = load double*, double** %17
%55 = getelementptr inbounds double, double* %54, i64 0
store double %53, double* %55
%56 = load double*, double** %13
%57 = getelementptr inbounds double, double* %56, i64 3
%58 = load double, double* %57
%59 = load double*, double** %12
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = load double*, double** %13
%63 = getelementptr inbounds double, double* %62, i64 4
%64 = load double, double* %63
%65 = load double*, double** %12
%66 = getelementptr inbounds double, double* %65, i64 1
%67 = load double, double* %66
%68 = fmul double %64, %67
%69 = call double @llvm.fmuladd.f64(double %58, double %61, double %68)
%70 = load double*, double** %13
%71 = getelementptr inbounds double, double* %70, i64 5
%72 = load double, double* %71
%73 = load double*, double** %12
%74 = getelementptr inbounds double, double* %73, i64 2
%75 = load double, double* %74
%76 = call double @llvm.fmuladd.f64(double %72, double %75, double %69)
%77 = load double*, double** %17
%78 = getelementptr inbounds double, double* %77, i64 1
store double %76, double* %78
%79 = load double*, double** %13
%80 = getelementptr inbounds double, double* %79, i64 6
%81 = load double, double* %80
%82 = load double*, double** %12
%83 = getelementptr inbounds double, double* %82, i64 0
%84 = load double, double* %83
%85 = load double*, double** %13
%86 = getelementptr inbounds double, double* %85, i64 7
%87 = load double, double* %86
%88 = load double*, double** %12
%89 = getelementptr inbounds double, double* %88, i64 1
%90 = load double, double* %89
%91 = fmul double %87, %90
%92 = call double @llvm.fmuladd.f64(double %81, double %84, double %91)
%93 = load double*, double** %13
%94 = getelementptr inbounds double, double* %93, i64 8
%95 = load double, double* %94
%96 = load double*, double** %12
%97 = getelementptr inbounds double, double* %96, i64 2
%98 = load double, double* %97
%99 = call double @llvm.fmuladd.f64(double %95, double %98, double %92)
%100 = load double*, double** %17
%101 = getelementptr inbounds double, double* %100, i64 2
store double %99, double* %101
%102 = load double*, double** %17
%103 = call i32 (double*, ...) bitcast (i32 (...)* @norm3 to i32 (double*, ...)*)(double* %102)
%104 = sitofp i32 %103 to double
store double %104, double* %23
%105 = load double, double* %16
%106 = load double, double* %23
%107 = fmul double %105, %106
%108 = fdiv double %107, 2.000000e+00
store double %108, double* %28
%109 = load double, double* %28
%110 = call double @asin(double %109)
%111 = fmul double 0x404CA5DC1A63C1F8, %110
%112 = load double*, double** %19
%113 = getelementptr inbounds double, double* %112, i64 0
store double %111, double* %113
%114 = load double, double* %16
%115 = fmul double 0x404CA5DC1A63C1F8, %114
%116 = load double, double* %23
%117 = fmul double 2.000000e+00, %116
%118 = load double, double* %28
%119 = load double, double* %28
%120 = fneg double %118
%121 = call double @llvm.fmuladd.f64(double %120, double %119, double 1.000000e+00)
%122 = call double @sqrt(double %121)
%123 = fmul double %117, %122
%124 = fdiv double %115, %123
store double %124, double* %27
store i32 0, i32* %31
br label %125
125: ; preds = %158, %10
%126 = load i32, i32* %31
%127 = icmp slt i32 %126, 3
br i1 %127, label %128, label %161
128: ; preds = %125
store i32 0, i32* %32
br label %129
129: ; preds = %154, %128
%130 = load i32, i32* %32
%131 = icmp slt i32 %130, 3
br i1 %131, label %132, label %157
132: ; preds = %129
%133 = load double, double* %27
%134 = load double*, double** %17
%135 = load i32, i32* %31
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds double, double* %134, i64 %136
%138 = load double, double* %137
%139 = fmul double %133, %138
%140 = load double*, double** %12
%141 = load i32, i32* %32
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = fmul double %139, %144
%146 = load double*, double** %19
%147 = load i32, i32* %31
%148 = mul nsw i32 %147, 3
%149 = load i32, i32* %32
%150 = add nsw i32 %148, %149
%151 = add nsw i32 %150, 1
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %146, i64 %152
store double %145, double* %153
br label %154
154: ; preds = %132
%155 = load i32, i32* %32
%156 = add nsw i32 %155, 1
store i32 %156, i32* %32
br label %129
157: ; preds = %129
br label %158
158: ; preds = %157
%159 = load i32, i32* %31
%160 = add nsw i32 %159, 1
store i32 %160, i32* %31
br label %125
161: ; preds = %125
%162 = load double*, double** %15
%163 = getelementptr inbounds double, double* %162, i64 0
%164 = load double, double* %163
%165 = load double*, double** %17
%166 = getelementptr inbounds double, double* %165, i64 0
%167 = load double, double* %166
%168 = load double*, double** %15
%169 = getelementptr inbounds double, double* %168, i64 1
%170 = load double, double* %169
%171 = load double*, double** %17
%172 = getelementptr inbounds double, double* %171, i64 1
%173 = load double, double* %172
%174 = fmul double %170, %173
%175 = call double @llvm.fmuladd.f64(double %164, double %167, double %174)
%176 = load double*, double** %15
%177 = getelementptr inbounds double, double* %176, i64 2
%178 = load double, double* %177
%179 = load double*, double** %17
%180 = getelementptr inbounds double, double* %179, i64 2
%181 = load double, double* %180
%182 = call double @llvm.fmuladd.f64(double %178, double %181, double %175)
%183 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double %182, double* %183
%184 = load double*, double** %15
%185 = getelementptr inbounds double, double* %184, i64 3
%186 = load double, double* %185
%187 = load double*, double** %17
%188 = getelementptr inbounds double, double* %187, i64 0
%189 = load double, double* %188
%190 = load double*, double** %15
%191 = getelementptr inbounds double, double* %190, i64 4
%192 = load double, double* %191
%193 = load double*, double** %17
%194 = getelementptr inbounds double, double* %193, i64 1
%195 = load double, double* %194
%196 = fmul double %192, %195
%197 = call double @llvm.fmuladd.f64(double %186, double %189, double %196)
%198 = load double*, double** %15
%199 = getelementptr inbounds double, double* %198, i64 5
%200 = load double, double* %199
%201 = load double*, double** %17
%202 = getelementptr inbounds double, double* %201, i64 2
%203 = load double, double* %202
%204 = call double @llvm.fmuladd.f64(double %200, double %203, double %197)
%205 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %204, double* %205
%206 = load double*, double** %15
%207 = getelementptr inbounds double, double* %206, i64 6
%208 = load double, double* %207
%209 = load double*, double** %17
%210 = getelementptr inbounds double, double* %209, i64 0
%211 = load double, double* %210
%212 = load double*, double** %15
%213 = getelementptr inbounds double, double* %212, i64 7
%214 = load double, double* %213
%215 = load double*, double** %17
%216 = getelementptr inbounds double, double* %215, i64 1
%217 = load double, double* %216
%218 = fmul double %214, %217
%219 = call double @llvm.fmuladd.f64(double %208, double %211, double %218)
%220 = load double*, double** %15
%221 = getelementptr inbounds double, double* %220, i64 8
%222 = load double, double* %221
%223 = load double*, double** %17
%224 = getelementptr inbounds double, double* %223, i64 2
%225 = load double, double* %224
%226 = call double @llvm.fmuladd.f64(double %222, double %225, double %219)
%227 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %226, double* %227
%228 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%229 = load double, double* %228
%230 = load double, double* %16
%231 = fmul double %229, %230
%232 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
store double %231, double* %232
%233 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%234 = load double, double* %233
%235 = load double, double* %16
%236 = fmul double %234, %235
%237 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
store double %236, double* %237
%238 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%239 = load double, double* %238
%240 = load double, double* %16
%241 = fmul double %239, %240
%242 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
store double %241, double* %242
%243 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%244 = load double, double* %243
%245 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%246 = load double, double* %245
%247 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%248 = load double, double* %247
%249 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%250 = load double, double* %249
%251 = fmul double %248, %250
%252 = call double @llvm.fmuladd.f64(double %244, double %246, double %251)
%253 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%254 = load double, double* %253
%255 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%256 = load double, double* %255
%257 = call double @llvm.fmuladd.f64(double %254, double %256, double %252)
store double %257, double* %24
%258 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%259 = load double, double* %258
%260 = load double*, double** %14
%261 = getelementptr inbounds double, double* %260, i64 0
%262 = load double, double* %261
%263 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%264 = load double, double* %263
%265 = load double*, double** %14
%266 = getelementptr inbounds double, double* %265, i64 1
%267 = load double, double* %266
%268 = fmul double %264, %267
%269 = call double @llvm.fmuladd.f64(double %259, double %262, double %268)
%270 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%271 = load double, double* %270
%272 = load double*, double** %14
%273 = getelementptr inbounds double, double* %272, i64 2
%274 = load double, double* %273
%275 = call double @llvm.fmuladd.f64(double %271, double %274, double %269)
%276 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
store double %275, double* %276
%277 = load double, double* %24
%278 = fneg double %277
%279 = fdiv double %278, 2.000000e+00
%280 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
store double %279, double* %280
%281 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%282 = load double, double* %281
%283 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%284 = load double, double* %283
%285 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%286 = load double, double* %285
%287 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%288 = load double, double* %287
%289 = fmul double %286, %288
%290 = call double @llvm.fmuladd.f64(double %282, double %284, double %289)
%291 = load double, double* %24
%292 = fsub double %290, %291
store double %292, double* %27
%293 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%294 = load double, double* %293
%295 = fmul double 2.000000e+00, %294
%296 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%297 = load double, double* %296
%298 = fmul double %295, %297
%299 = load double*, double** %14
%300 = getelementptr inbounds double, double* %299, i64 9
%301 = load double, double* %300
%302 = fmul double %298, %301
store double %302, double* %26
%303 = load double, double* %26
%304 = load double, double* %26
%305 = load double, double* %27
%306 = fmul double %305, 4.000000e+00
%307 = fneg double %306
%308 = call double @llvm.fmuladd.f64(double %303, double %304, double %307)
store double %308, double* %28
%309 = load double, double* %28
%310 = fcmp oge double %309, 0.000000e+00
br i1 %310, label %311, label %323
311: ; preds = %161
%312 = load double, double* %26
%313 = fneg double %312
%314 = load double*, double** %12
%315 = getelementptr inbounds double, double* %314, i64 3
%316 = load double, double* %315
%317 = load double, double* %28
%318 = call double @sqrt(double %317)
%319 = fmul double %316, %318
%320 = fdiv double %319, 2.000000e+00
%321 = fadd double %313, %320
%322 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 2
store double %321, double* %322
br label %325
323: ; preds = %161
%324 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %11
br label %508
325: ; preds = %311
%326 = load double*, double** %14
%327 = getelementptr inbounds double, double* %326, i64 10
%328 = getelementptr inbounds double, double* %327, i64 0
%329 = load double, double* %328
%330 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%331 = load double, double* %330
%332 = load double*, double** %14
%333 = getelementptr inbounds double, double* %332, i64 10
%334 = getelementptr inbounds double, double* %333, i64 1
%335 = load double, double* %334
%336 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%337 = load double, double* %336
%338 = fmul double %335, %337
%339 = call double @llvm.fmuladd.f64(double %329, double %331, double %338)
%340 = load double*, double** %14
%341 = getelementptr inbounds double, double* %340, i64 10
%342 = getelementptr inbounds double, double* %341, i64 2
%343 = load double, double* %342
%344 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 2
%345 = load double, double* %344
%346 = call double @llvm.fmuladd.f64(double %343, double %345, double %339)
%347 = load double*, double** %18
%348 = getelementptr inbounds double, double* %347, i64 0
store double %346, double* %348
%349 = load double*, double** %14
%350 = getelementptr inbounds double, double* %349, i64 10
%351 = getelementptr inbounds double, double* %350, i64 3
%352 = load double, double* %351
%353 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%354 = load double, double* %353
%355 = load double*, double** %14
%356 = getelementptr inbounds double, double* %355, i64 10
%357 = getelementptr inbounds double, double* %356, i64 4
%358 = load double, double* %357
%359 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%360 = load double, double* %359
%361 = fmul double %358, %360
%362 = call double @llvm.fmuladd.f64(double %352, double %354, double %361)
%363 = load double*, double** %14
%364 = getelementptr inbounds double, double* %363, i64 10
%365 = getelementptr inbounds double, double* %364, i64 5
%366 = load double, double* %365
%367 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 2
%368 = load double, double* %367
%369 = call double @llvm.fmuladd.f64(double %366, double %368, double %362)
%370 = load double*, double** %18
%371 = getelementptr inbounds double, double* %370, i64 1
store double %369, double* %371
%372 = load double*, double** %14
%373 = getelementptr inbounds double, double* %372, i64 10
%374 = getelementptr inbounds double, double* %373, i64 6
%375 = load double, double* %374
%376 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%377 = load double, double* %376
%378 = load double*, double** %14
%379 = getelementptr inbounds double, double* %378, i64 10
%380 = getelementptr inbounds double, double* %379, i64 7
%381 = load double, double* %380
%382 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%383 = load double, double* %382
%384 = fmul double %381, %383
%385 = call double @llvm.fmuladd.f64(double %375, double %377, double %384)
%386 = load double*, double** %14
%387 = getelementptr inbounds double, double* %386, i64 10
%388 = getelementptr inbounds double, double* %387, i64 8
%389 = load double, double* %388
%390 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 2
%391 = load double, double* %390
%392 = call double @llvm.fmuladd.f64(double %389, double %391, double %385)
%393 = load double*, double** %18
%394 = getelementptr inbounds double, double* %393, i64 2
store double %392, double* %394
%395 = load double*, double** %18
%396 = getelementptr inbounds double, double* %395, i64 0
%397 = load double, double* %396
%398 = load double, double* %16
%399 = fdiv double %397, %398
%400 = load double*, double** %18
%401 = getelementptr inbounds double, double* %400, i64 0
store double %399, double* %401
%402 = load double*, double** %18
%403 = getelementptr inbounds double, double* %402, i64 1
%404 = load double, double* %403
%405 = load double, double* %16
%406 = fdiv double %404, %405
%407 = load double*, double** %18
%408 = getelementptr inbounds double, double* %407, i64 1
store double %406, double* %408
%409 = load double*, double** %18
%410 = getelementptr inbounds double, double* %409, i64 2
%411 = load double, double* %410
%412 = load double, double* %16
%413 = fdiv double %411, %412
%414 = load double*, double** %18
%415 = getelementptr inbounds double, double* %414, i64 2
store double %413, double* %415
%416 = load double*, double** %18
%417 = getelementptr inbounds double, double* %416, i64 1
%418 = load double, double* %417
%419 = fneg double %418
%420 = load double*, double** %18
%421 = getelementptr inbounds double, double* %420, i64 2
%422 = load double, double* %421
%423 = call double @atan2(double %419, double %422)
%424 = fmul double 0x404CA5DC1A63C1F8, %423
%425 = load double*, double** %20
%426 = getelementptr inbounds double, double* %425, i64 0
store double %424, double* %426
%427 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%428 = load double, double* %427
%429 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 0
store double %428, double* %429
%430 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 0
%431 = load double, double* %430
%432 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 0
store double %431, double* %432
%433 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 1
%434 = load double, double* %433
%435 = load double*, double** %14
%436 = getelementptr inbounds double, double* %435, i64 9
%437 = load double, double* %436
%438 = fsub double 1.000000e+00, %437
%439 = fmul double %434, %438
%440 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 1
store double %439, double* %440
%441 = getelementptr inbounds [3 x double], [3 x double]* %25, i64 0, i64 2
%442 = load double, double* %441
%443 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 2
store double %442, double* %443
%444 = load double*, double** %14
%445 = getelementptr inbounds double, double* %444, i64 3
%446 = load double, double* %445
%447 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%448 = load double, double* %447
%449 = load double*, double** %14
%450 = getelementptr inbounds double, double* %449, i64 4
%451 = load double, double* %450
%452 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%453 = load double, double* %452
%454 = fmul double %451, %453
%455 = call double @llvm.fmuladd.f64(double %446, double %448, double %454)
%456 = load double*, double** %14
%457 = getelementptr inbounds double, double* %456, i64 5
%458 = load double, double* %457
%459 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%460 = load double, double* %459
%461 = call double @llvm.fmuladd.f64(double %458, double %460, double %455)
%462 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 1
store double %461, double* %462
%463 = load double*, double** %14
%464 = getelementptr inbounds double, double* %463, i64 6
%465 = load double, double* %464
%466 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 0
%467 = load double, double* %466
%468 = load double*, double** %14
%469 = getelementptr inbounds double, double* %468, i64 7
%470 = load double, double* %469
%471 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 1
%472 = load double, double* %471
%473 = fmul double %470, %472
%474 = call double @llvm.fmuladd.f64(double %465, double %467, double %473)
%475 = load double*, double** %14
%476 = getelementptr inbounds double, double* %475, i64 8
%477 = load double, double* %476
%478 = getelementptr inbounds [3 x double], [3 x double]* %22, i64 0, i64 2
%479 = load double, double* %478
%480 = call double @llvm.fmuladd.f64(double %477, double %479, double %474)
%481 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 2
store double %480, double* %481
%482 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 1
%483 = load double, double* %482
%484 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 2
%485 = load double, double* %484
%486 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 2
%487 = load double, double* %486
%488 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 1
%489 = load double, double* %488
%490 = fmul double %487, %489
%491 = fneg double %490
%492 = call double @llvm.fmuladd.f64(double %483, double %485, double %491)
%493 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 1
%494 = load double, double* %493
%495 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 1
%496 = load double, double* %495
%497 = getelementptr inbounds [3 x double], [3 x double]* %30, i64 0, i64 2
%498 = load double, double* %497
%499 = getelementptr inbounds [3 x double], [3 x double]* %29, i64 0, i64 2
%500 = load double, double* %499
%501 = fmul double %498, %500
%502 = fneg double %501
%503 = call double @llvm.fmuladd.f64(double %494, double %496, double %502)
%504 = call double @atan2(double %492, double %503)
%505 = fmul double 0x404CA5DC1A63C1F8, %504
%506 = load double*, double** %21
%507 = getelementptr inbounds double, double* %506, i64 0
store double %505, double* %507
store i32 0, i32* %11
br label %508
508: ; preds = %325, %323
%509 = load i32, i32* %11
ret i32 %509
}

LLVM IR (-O2):
@str = [16 x i8] c"Cannot find it!\00"
define i32 @g_to_k(double* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double %4, double* %5, double* nocapture %6, double* nocapture writeonly %7, double* nocapture writeonly %8, double* nocapture writeonly %9) {
%11 = load double, double* %1
%12 = load double, double* %0
%13 = getelementptr inbounds double, double* %1, i64 1
%14 = load double, double* %13
%15 = getelementptr inbounds double, double* %0, i64 1
%16 = load double, double* %15
%17 = fmul double %14, %16
%18 = tail call double @llvm.fmuladd.f64(double %11, double %12, double %17)
%19 = getelementptr inbounds double, double* %1, i64 2
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %0, i64 2
%22 = load double, double* %21
%23 = tail call double @llvm.fmuladd.f64(double %20, double %22, double %18)
store double %23, double* %5
%24 = getelementptr inbounds double, double* %1, i64 3
%25 = load double, double* %24
%26 = load double, double* %0
%27 = getelementptr inbounds double, double* %1, i64 4
%28 = load double, double* %27
%29 = load double, double* %15
%30 = fmul double %28, %29
%31 = tail call double @llvm.fmuladd.f64(double %25, double %26, double %30)
%32 = getelementptr inbounds double, double* %1, i64 5
%33 = load double, double* %32
%34 = load double, double* %21
%35 = tail call double @llvm.fmuladd.f64(double %33, double %34, double %31)
%36 = getelementptr inbounds double, double* %5, i64 1
store double %35, double* %36
%37 = getelementptr inbounds double, double* %1, i64 6
%38 = load double, double* %37
%39 = load double, double* %0
%40 = getelementptr inbounds double, double* %1, i64 7
%41 = load double, double* %40
%42 = load double, double* %15
%43 = fmul double %41, %42
%44 = tail call double @llvm.fmuladd.f64(double %38, double %39, double %43)
%45 = getelementptr inbounds double, double* %1, i64 8
%46 = load double, double* %45
%47 = load double, double* %21
%48 = tail call double @llvm.fmuladd.f64(double %46, double %47, double %44)
%49 = getelementptr inbounds double, double* %5, i64 2
store double %48, double* %49
%50 = tail call i32 (double*, ...) bitcast (i32 (...)* @norm3 to i32 (double*, ...)*)(double* %5)
%51 = sitofp i32 %50 to double
%52 = fmul double %51, %4
%53 = fmul double %52, 5.000000e-01
%54 = tail call double @asin(double %53)
%55 = fmul double %54, 0x404CA5DC1A63C1F8
store double %55, double* %7
%56 = fmul double %4, 0x404CA5DC1A63C1F8
%57 = fmul double %51, 2.000000e+00
%58 = fneg double %53
%59 = tail call double @llvm.fmuladd.f64(double %58, double %53, double 1.000000e+00)
%60 = tail call double @sqrt(double %59)
%61 = fmul double %57, %60
%62 = fdiv double %56, %61
%63 = load double, double* %5
%64 = fmul double %62, %63
%65 = load double, double* %0
%66 = fmul double %64, %65
%67 = getelementptr inbounds double, double* %7, i64 1
store double %66, double* %67
%68 = load double, double* %5
%69 = fmul double %62, %68
%70 = load double, double* %15
%71 = fmul double %69, %70
%72 = getelementptr inbounds double, double* %7, i64 2
store double %71, double* %72
%73 = load double, double* %5
%74 = fmul double %62, %73
%75 = load double, double* %21
%76 = fmul double %74, %75
%77 = getelementptr inbounds double, double* %7, i64 3
store double %76, double* %77
%78 = load double, double* %36
%79 = fmul double %62, %78
%80 = load double, double* %0
%81 = fmul double %79, %80
%82 = getelementptr inbounds double, double* %7, i64 4
store double %81, double* %82
%83 = load double, double* %36
%84 = fmul double %62, %83
%85 = load double, double* %15
%86 = fmul double %84, %85
%87 = getelementptr inbounds double, double* %7, i64 5
store double %86, double* %87
%88 = load double, double* %36
%89 = fmul double %62, %88
%90 = load double, double* %21
%91 = fmul double %89, %90
%92 = getelementptr inbounds double, double* %7, i64 6
store double %91, double* %92
%93 = load double, double* %49
%94 = fmul double %62, %93
%95 = load double, double* %0
%96 = fmul double %94, %95
%97 = getelementptr inbounds double, double* %7, i64 7
store double %96, double* %97
%98 = load double, double* %49
%99 = fmul double %62, %98
%100 = load double, double* %15
%101 = fmul double %99, %100
%102 = getelementptr inbounds double, double* %7, i64 8
store double %101, double* %102
%103 = load double, double* %49
%104 = fmul double %62, %103
%105 = load double, double* %21
%106 = fmul double %104, %105
%107 = getelementptr inbounds double, double* %7, i64 9
store double %106, double* %107
%108 = load double, double* %3
%109 = load double, double* %5
%110 = getelementptr inbounds double, double* %3, i64 1
%111 = load double, double* %110
%112 = load double, double* %36
%113 = fmul double %111, %112
%114 = tail call double @llvm.fmuladd.f64(double %108, double %109, double %113)
%115 = getelementptr inbounds double, double* %3, i64 2
%116 = load double, double* %115
%117 = load double, double* %49
%118 = tail call double @llvm.fmuladd.f64(double %116, double %117, double %114)
%119 = getelementptr inbounds double, double* %3, i64 3
%120 = load double, double* %119
%121 = getelementptr inbounds double, double* %3, i64 4
%122 = load double, double* %121
%123 = fmul double %112, %122
%124 = tail call double @llvm.fmuladd.f64(double %120, double %109, double %123)
%125 = getelementptr inbounds double, double* %3, i64 5
%126 = load double, double* %125
%127 = tail call double @llvm.fmuladd.f64(double %126, double %117, double %124)
%128 = getelementptr inbounds double, double* %3, i64 6
%129 = load double, double* %128
%130 = getelementptr inbounds double, double* %3, i64 7
%131 = load double, double* %130
%132 = fmul double %112, %131
%133 = tail call double @llvm.fmuladd.f64(double %129, double %109, double %132)
%134 = getelementptr inbounds double, double* %3, i64 8
%135 = load double, double* %134
%136 = tail call double @llvm.fmuladd.f64(double %135, double %117, double %133)
%137 = fmul double %118, %4
%138 = fmul double %127, %4
%139 = fmul double %136, %4
%140 = load double, double* %2
%141 = getelementptr inbounds double, double* %2, i64 1
%142 = load double, double* %141
%143 = insertelement <2 x double> poison, double %138, i64 0
%144 = shufflevector <2 x double> %143, <2 x double> poison, <2 x i32> zeroinitializer
%145 = insertelement <2 x double> %143, double %142, i64 1
%146 = fmul <2 x double> %144, %145
%147 = insertelement <2 x double> poison, double %137, i64 0
%148 = shufflevector <2 x double> %147, <2 x double> poison, <2 x i32> zeroinitializer
%149 = insertelement <2 x double> %147, double %140, i64 1
%150 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %148, <2 x double> %149, <2 x double> %146)
%151 = getelementptr inbounds double, double* %2, i64 2
%152 = load double, double* %151
%153 = insertelement <2 x double> poison, double %139, i64 0
%154 = shufflevector <2 x double> %153, <2 x double> poison, <2 x i32> zeroinitializer
%155 = insertelement <2 x double> %153, double %152, i64 1
%156 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %154, <2 x double> %155, <2 x double> %150)
%157 = fmul <2 x double> %156, <double -5.000000e-01, double 2.000000e+00>
%158 = extractelement <2 x double> %157, i64 0
%159 = fmul <2 x double> %157, %157
%160 = extractelement <2 x double> %159, i64 0
%161 = extractelement <2 x double> %156, i64 1
%162 = tail call double @llvm.fmuladd.f64(double %161, double %161, double %160)
%163 = extractelement <2 x double> %156, i64 0
%164 = fsub double %162, %163
%165 = shufflevector <2 x double> %157, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%166 = fmul <2 x double> %157, %165
%167 = extractelement <2 x double> %166, i64 0
%168 = getelementptr inbounds double, double* %2, i64 9
%169 = load double, double* %168
%170 = fmul double %169, %167
%171 = fmul double %164, -4.000000e+00
%172 = tail call double @llvm.fmuladd.f64(double %170, double %170, double %171)
%173 = fcmp ult double %172, 0.000000e+00
br i1 %173, label %249, label %174
174: ; preds = %10
%175 = getelementptr inbounds double, double* %0, i64 3
%176 = load double, double* %175
%177 = tail call double @sqrt(double %172)
%178 = fmul double %176, %177
%179 = fmul double %178, 5.000000e-01
%180 = fsub double %179, %170
%181 = getelementptr inbounds double, double* %2, i64 10
%182 = load double, double* %181
%183 = getelementptr inbounds double, double* %2, i64 11
%184 = load double, double* %183
%185 = fmul double %158, %184
%186 = tail call double @llvm.fmuladd.f64(double %182, double %161, double %185)
%187 = getelementptr inbounds double, double* %2, i64 12
%188 = load double, double* %187
%189 = tail call double @llvm.fmuladd.f64(double %188, double %180, double %186)
store double %189, double* %6
%190 = getelementptr inbounds double, double* %2, i64 13
%191 = load double, double* %190
%192 = getelementptr inbounds double, double* %2, i64 14
%193 = load double, double* %192
%194 = fmul double %158, %193
%195 = tail call double @llvm.fmuladd.f64(double %191, double %161, double %194)
%196 = getelementptr inbounds double, double* %2, i64 15
%197 = load double, double* %196
%198 = tail call double @llvm.fmuladd.f64(double %197, double %180, double %195)
%199 = getelementptr inbounds double, double* %6, i64 1
store double %198, double* %199
%200 = getelementptr inbounds double, double* %2, i64 16
%201 = load double, double* %200
%202 = getelementptr inbounds double, double* %2, i64 17
%203 = load double, double* %202
%204 = fmul double %158, %203
%205 = tail call double @llvm.fmuladd.f64(double %201, double %161, double %204)
%206 = getelementptr inbounds double, double* %2, i64 18
%207 = load double, double* %206
%208 = tail call double @llvm.fmuladd.f64(double %207, double %180, double %205)
%209 = getelementptr inbounds double, double* %6, i64 2
%210 = insertelement <2 x double> poison, double %189, i64 0
%211 = insertelement <2 x double> %210, double %198, i64 1
%212 = insertelement <2 x double> poison, double %4, i64 0
%213 = shufflevector <2 x double> %212, <2 x double> poison, <2 x i32> zeroinitializer
%214 = fdiv <2 x double> %211, %213
%215 = bitcast double* %6 to <2 x double>*
store <2 x double> %214, <2 x double>* %215
%216 = fdiv double %208, %4
store double %216, double* %209
%217 = extractelement <2 x double> %214, i64 1
%218 = fneg double %217
%219 = tail call double @atan2(double %218, double %216)
%220 = fmul double %219, 0x404CA5DC1A63C1F8
store double %220, double* %8
%221 = load double, double* %168
%222 = fsub double 1.000000e+00, %221
%223 = fmul double %158, %222
%224 = getelementptr inbounds double, double* %2, i64 3
%225 = load double, double* %224
%226 = getelementptr inbounds double, double* %2, i64 4
%227 = load double, double* %226
%228 = fmul double %138, %227
%229 = tail call double @llvm.fmuladd.f64(double %225, double %137, double %228)
%230 = getelementptr inbounds double, double* %2, i64 5
%231 = load double, double* %230
%232 = tail call double @llvm.fmuladd.f64(double %231, double %139, double %229)
%233 = getelementptr inbounds double, double* %2, i64 6
%234 = load double, double* %233
%235 = getelementptr inbounds double, double* %2, i64 7
%236 = load double, double* %235
%237 = fmul double %138, %236
%238 = tail call double @llvm.fmuladd.f64(double %234, double %137, double %237)
%239 = getelementptr inbounds double, double* %2, i64 8
%240 = load double, double* %239
%241 = tail call double @llvm.fmuladd.f64(double %240, double %139, double %238)
%242 = fneg double %180
%243 = fmul double %232, %242
%244 = tail call double @llvm.fmuladd.f64(double %223, double %241, double %243)
%245 = fmul double %241, %242
%246 = tail call double @llvm.fmuladd.f64(double %223, double %232, double %245)
%247 = tail call double @atan2(double %244, double %246)
%248 = fmul double %247, 0x404CA5DC1A63C1F8
store double %248, double* %9
br label %251
249: ; preds = %10
%250 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
br label %251
251: ; preds = %174, %249
%252 = phi i32 [ 0, %174 ], [ 1, %249 ]
ret i32 %252
}