#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 fabs(double);
int find_ij_weights(double plon, double plat, double *restrict src_lats,
                    double *restrict src_lons, double *ig, double *jg) {
  int lfound = 0;
  long iter;
  double iguess, jguess;
  double deli, delj;
  double dth1, dth2, dth3;
  double dph1, dph2, dph3;
  double dthp, dphp;
  double mat1, mat2, mat3, mat4;
  double determinant;
  double converge = 1.e-10;
  extern long remap_max_iter;
  dth1 = src_lats[1] - src_lats[0];
  dth2 = src_lats[3] - src_lats[0];
  dth3 = src_lats[2] - src_lats[1] - dth2;
  dph1 = src_lons[1] - src_lons[0];
  dph2 = src_lons[3] - src_lons[0];
  dph3 = src_lons[2] - src_lons[1];
  if (dph1 > 3.0 * (0.5 * 3.14159265358979323846))
    dph1 -= (2.0 * 3.14159265358979323846);
  if (dph2 > 3.0 * (0.5 * 3.14159265358979323846))
    dph2 -= (2.0 * 3.14159265358979323846);
  if (dph3 > 3.0 * (0.5 * 3.14159265358979323846))
    dph3 -= (2.0 * 3.14159265358979323846);
  if (dph1 < -3.0 * (0.5 * 3.14159265358979323846))
    dph1 += (2.0 * 3.14159265358979323846);
  if (dph2 < -3.0 * (0.5 * 3.14159265358979323846))
    dph2 += (2.0 * 3.14159265358979323846);
  if (dph3 < -3.0 * (0.5 * 3.14159265358979323846))
    dph3 += (2.0 * 3.14159265358979323846);
  dph3 = dph3 - dph2;
  iguess = 0.5;
  jguess = 0.5;
  for (iter = 0; iter < remap_max_iter; ++iter) {
    dthp = plat - src_lats[0] - dth1 * iguess - dth2 * jguess -
           dth3 * iguess * jguess;
    dphp = plon - src_lons[0];
    if (dphp > 3.0 * (0.5 * 3.14159265358979323846))
      dphp -= (2.0 * 3.14159265358979323846);
    if (dphp < -3.0 * (0.5 * 3.14159265358979323846))
      dphp += (2.0 * 3.14159265358979323846);
    dphp = dphp - dph1 * iguess - dph2 * jguess - dph3 * iguess * jguess;
    mat1 = dth1 + dth3 * jguess;
    mat2 = dth2 + dth3 * iguess;
    mat3 = dph1 + dph3 * jguess;
    mat4 = dph2 + dph3 * iguess;
    determinant = mat1 * mat4 - mat2 * mat3;
    deli = (dthp * mat4 - dphp * mat2) / determinant;
    delj = (dphp * mat1 - dthp * mat3) / determinant;
    if (fabs(deli) < converge && fabs(delj) < converge)
      break;
    iguess += deli;
    jguess += delj;
  }
  *ig = iguess;
  *jg = jguess;
  if (iter < remap_max_iter)
    lfound = 1;
  return (lfound);
}


x86 assembly (clang, -O0):
<find_ij_weights>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movsd  0xed7(%rip),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x18(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x18(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x18(%rbp),%rax
subsd  0x8(%rax),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x8(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x20(%rbp),%rax
movsd  0x18(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
mov    -0x20(%rbp),%rax
movsd  0x10(%rax),%xmm0
mov    -0x20(%rbp),%rax
subsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  0xe29(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    11f7 <find_ij_weights+0xf7>
movsd  -0x80(%rbp),%xmm0
movsd  0xe22(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xdf9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    122d <find_ij_weights+0x12d>
movsd  -0x88(%rbp),%xmm0
ff
movsd  0xdef(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xdc3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1263 <find_ij_weights+0x163>
movsd  -0x90(%rbp),%xmm0
ff
movsd  0xdb9(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xdad(%rip),%xmm0
ucomisd -0x80(%rbp),%xmm0
jbe    1288 <find_ij_weights+0x188>
movsd  0xd92(%rip),%xmm0
addsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xd88(%rip),%xmm0
ucomisd -0x88(%rbp),%xmm0
ff
jbe    12b6 <find_ij_weights+0x1b6>
movsd  0xd6a(%rip),%xmm0
addsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xd5a(%rip),%xmm0
ucomisd -0x90(%rbp),%xmm0
ff
jbe    12e4 <find_ij_weights+0x1e4>
movsd  0xd3c(%rip),%xmm0
addsd  -0x90(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
subsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd1c(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xd0f(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
mov    0x2cbf(%rip),%rcx
cmp    (%rcx),%rax
jge    16b2 <find_ij_weights+0x5b2>
movsd  -0x10(%rbp),%xmm1
mov    -0x18(%rbp),%rax
subsd  (%rax),%xmm1
movsd  -0x68(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x78(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
subsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xc14(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1412 <find_ij_weights+0x312>
movsd  -0xa0(%rbp),%xmm0
ff
movsd  0xc0a(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xbfe(%rip),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    1440 <find_ij_weights+0x340>
movsd  0xbe0(%rip),%xmm0
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0xa0(%rbp),%xmm1
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x50(%rbp),%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x90(%rbp),%xmm0
ff
mulsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm0
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x80(%rbp),%xmm1
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x88(%rbp),%xmm1
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x48(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xb0(%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  %xmm0,-0xc8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0xc0(%rbp),%xmm2
ff
movsd  -0xa0(%rbp),%xmm1
ff
mulsd  -0xb0(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  -0xa0(%rbp),%xmm0
ff
movsd  -0xa8(%rbp),%xmm2
ff
movsd  -0x98(%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
divsd  -0xc8(%rbp),%xmm0
ff
movsd  %xmm0,-0x60(%rbp)
movsd  -0x58(%rbp),%xmm1
movaps 0x9ea(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1683 <find_ij_weights+0x583>
movsd  -0x60(%rbp),%xmm1
movaps 0x9c8(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
ucomisd %xmm1,%xmm0
jbe    1683 <find_ij_weights+0x583>
jmp    16b2 <find_ij_weights+0x5b2>
movsd  -0x58(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x60(%rbp),%xmm0
addsd  -0x50(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    131e <find_ij_weights+0x21e>
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x50(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x40(%rbp),%rax
mov    0x2911(%rip),%rcx
cmp    (%rcx),%rax
jge    16e7 <find_ij_weights+0x5e7>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_ij_weights>:
mov    0x2ee1(%rip),%rax
mov    (%rax),%r8
test   %r8,%r8
jle    13e6 <find_ij_weights+0x2e6>
movapd %xmm1,%xmm8
movsd  (%rdi),%xmm2
movsd  %xmm2,-0x8(%rsp)
movsd  0x8(%rdi),%xmm11
movsd  0x18(%rdi),%xmm1
subsd  %xmm2,%xmm1
movsd  0x10(%rdi),%xmm14
subsd  %xmm11,%xmm14
subsd  %xmm2,%xmm11
movsd  (%rsi),%xmm9
movsd  0x8(%rsi),%xmm3
movsd  0x18(%rsi),%xmm5
subsd  %xmm9,%xmm5
movsd  0x10(%rsi),%xmm12
subsd  %xmm3,%xmm12
subsd  %xmm9,%xmm3
movsd  0xe93(%rip),%xmm4
movapd %xmm3,%xmm7
addsd  %xmm4,%xmm7
movsd  0xe8b(%rip),%xmm2
movapd %xmm2,%xmm6
cmpltsd %xmm3,%xmm6
andpd  %xmm6,%xmm7
andnpd %xmm3,%xmm6
orpd   %xmm7,%xmm6
movapd %xmm5,%xmm3
addsd  %xmm4,%xmm3
movapd %xmm2,%xmm7
cmpltsd %xmm5,%xmm7
andpd  %xmm7,%xmm3
andnpd %xmm5,%xmm7
orpd   %xmm3,%xmm7
addsd  %xmm12,%xmm4
movapd %xmm2,%xmm3
cmpltsd %xmm12,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm12,%xmm3
orpd   %xmm4,%xmm3
movsd  0xe3c(%rip),%xmm12
movapd %xmm7,%xmm5
addsd  %xmm12,%xmm5
movsd  0xe32(%rip),%xmm10
movapd %xmm7,%xmm4
cmpltsd %xmm10,%xmm4
andpd  %xmm4,%xmm5
andnpd %xmm7,%xmm4
orpd   %xmm5,%xmm4
movapd %xmm3,%xmm5
addsd  %xmm12,%xmm5
movapd %xmm3,%xmm13
cmpltsd %xmm10,%xmm13
andpd  %xmm13,%xmm5
andnpd %xmm3,%xmm13
orpd   %xmm5,%xmm13
unpcklpd %xmm14,%xmm13
movapd %xmm6,%xmm3
addsd  %xmm12,%xmm3
movapd %xmm6,%xmm15
cmpltsd %xmm10,%xmm15
movapd %xmm10,%xmm5
andpd  %xmm15,%xmm3
andnpd %xmm6,%xmm15
orpd   %xmm3,%xmm15
movapd %xmm15,%xmm14
unpcklpd %xmm11,%xmm14
unpcklpd %xmm4,%xmm11
movapd %xmm4,%xmm10
unpcklpd %xmm1,%xmm10
subpd  %xmm10,%xmm13
subsd  -0x8(%rsp),%xmm8
subsd  %xmm9,%xmm0
movsd  0xd82(%rip),%xmm3
addsd  %xmm0,%xmm3
cmpltsd %xmm0,%xmm2
andpd  %xmm2,%xmm3
andnpd %xmm0,%xmm2
orpd   %xmm3,%xmm2
addsd  %xmm2,%xmm12
movapd %xmm2,%xmm6
cmpltsd %xmm5,%xmm6
andpd  %xmm6,%xmm12
andnpd %xmm2,%xmm6
orpd   %xmm12,%xmm6
movapd 0xd89(%rip),%xmm2
xorpd  %xmm2,%xmm14
xorpd  %xmm2,%xmm10
xorpd  %xmm13,%xmm2
unpcklpd %xmm8,%xmm6
unpcklpd %xmm1,%xmm15
movapd %xmm13,%xmm12
shufpd $0x1,%xmm13,%xmm12
mov    %r8,%r9
neg    %r9
movapd 0xd47(%rip),%xmm7
mov    $0x1,%sil
mov    $0x1,%eax
movapd 0xd56(%rip),%xmm8
movsd  0xd1d(%rip),%xmm9
jmp    1331 <find_ij_weights+0x231>
cs nopw 0x0(%rax,%rax,1)
nop
addpd  %xmm3,%xmm7
cmp    %r8,%rax
setl   %sil
lea    (%r9,%rax,1),%rdi
add    $0x1,%rdi
add    $0x1,%rax
cmp    $0x1,%rdi
je     13f0 <find_ij_weights+0x2f0>
movapd %xmm7,%xmm0
unpckhpd %xmm7,%xmm0
movapd %xmm14,%xmm1
mulpd  %xmm0,%xmm1
addpd  %xmm6,%xmm1
movapd %xmm7,%xmm5
unpcklpd %xmm7,%xmm5
movapd %xmm10,%xmm4
mulpd  %xmm5,%xmm4
addpd  %xmm1,%xmm4
mulpd  %xmm2,%xmm0
mulpd  %xmm5,%xmm0
addpd  %xmm4,%xmm0
movapd %xmm13,%xmm4
mulpd  %xmm7,%xmm4
addpd  %xmm15,%xmm4
movapd %xmm12,%xmm3
mulpd  %xmm7,%xmm3
addpd  %xmm11,%xmm3
movapd %xmm4,%xmm5
unpckhpd %xmm4,%xmm5
mulsd  %xmm4,%xmm5
movapd %xmm3,%xmm1
unpckhpd %xmm3,%xmm1
mulsd  %xmm3,%xmm1
subsd  %xmm5,%xmm1
mulpd  %xmm0,%xmm3
shufpd $0x1,%xmm0,%xmm0
mulpd  %xmm4,%xmm0
subpd  %xmm0,%xmm3
unpcklpd %xmm1,%xmm1
divpd  %xmm1,%xmm3
movapd %xmm3,%xmm0
unpckhpd %xmm3,%xmm0
andpd  %xmm8,%xmm0
ucomisd %xmm0,%xmm9
jbe    1310 <find_ij_weights+0x210>
movapd %xmm3,%xmm0
andpd  %xmm8,%xmm0
ucomisd %xmm0,%xmm9
jbe    1310 <find_ij_weights+0x210>
jmp    13f0 <find_ij_weights+0x2f0>
movapd 0xc42(%rip),%xmm7
xor    %esi,%esi
movhpd %xmm7,(%rdx)
movlpd %xmm7,(%rcx)
movzbl %sil,%eax
and    $0x1,%eax
ret

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

LLVM IR (-O2):
@remap_max_iter = external global i64
define i32 @find_ij_weights(double %0, double %1, double* noalias nocapture %2, double* noalias nocapture %3, double* nocapture writeonly %4, double* nocapture writeonly %5) {
%7 = getelementptr inbounds double, double* %2, i64 1
%8 = load double, double* %7
%9 = load double, double* %2
%10 = fsub double %8, %9
%11 = getelementptr inbounds double, double* %2, i64 3
%12 = load double, double* %11
%13 = fsub double %12, %9
%14 = getelementptr inbounds double, double* %2, i64 2
%15 = load double, double* %14
%16 = fsub double %15, %8
%17 = getelementptr inbounds double, double* %3, i64 1
%18 = load double, double* %17
%19 = load double, double* %3
%20 = fsub double %18, %19
%21 = getelementptr inbounds double, double* %3, i64 3
%22 = load double, double* %21
%23 = fsub double %22, %19
%24 = getelementptr inbounds double, double* %3, i64 2
%25 = load double, double* %24
%26 = fsub double %25, %18
%27 = fcmp ogt double %20, 0x4012D97C7F3321D2
%28 = fadd double %20, 0xC01921FB54442D18
%29 = select i1 %27, double %28, double %20
%30 = fcmp ogt double %23, 0x4012D97C7F3321D2
%31 = fadd double %23, 0xC01921FB54442D18
%32 = select i1 %30, double %31, double %23
%33 = fcmp ogt double %26, 0x4012D97C7F3321D2
%34 = fadd double %26, 0xC01921FB54442D18
%35 = select i1 %33, double %34, double %26
%36 = fcmp olt double %32, 0xC012D97C7F3321D2
%37 = fadd double %32, 0x401921FB54442D18
%38 = select i1 %36, double %37, double %32
%39 = fcmp olt double %35, 0xC012D97C7F3321D2
%40 = fadd double %35, 0x401921FB54442D18
%41 = select i1 %39, double %40, double %35
%42 = insertelement <2 x double> poison, double %41, i64 0
%43 = insertelement <2 x double> %42, double %16, i64 1
%44 = insertelement <2 x double> poison, double %38, i64 0
%45 = insertelement <2 x double> %44, double %13, i64 1
%46 = fsub <2 x double> %43, %45
%47 = load i64, i64* @remap_max_iter
%48 = icmp sgt i64 %47, 0
br i1 %48, label %49, label %110
49: ; preds = %6
%50 = fcmp olt double %29, 0xC012D97C7F3321D2
%51 = fadd double %29, 0x401921FB54442D18
%52 = select i1 %50, double %51, double %29
%53 = fsub double %1, %9
%54 = fsub double %0, %19
%55 = fcmp ogt double %54, 0x4012D97C7F3321D2
%56 = fadd double %54, 0xC01921FB54442D18
%57 = select i1 %55, double %56, double %54
%58 = fcmp olt double %57, 0xC012D97C7F3321D2
%59 = fadd double %57, 0x401921FB54442D18
%60 = select i1 %58, double %59, double %57
%61 = insertelement <2 x double> poison, double %52, i64 0
%62 = insertelement <2 x double> %61, double %10, i64 1
%63 = fneg <2 x double> %62
%64 = fneg <2 x double> %45
%65 = fneg <2 x double> %46
%66 = insertelement <2 x double> poison, double %60, i64 0
%67 = insertelement <2 x double> %66, double %53, i64 1
%68 = insertelement <2 x double> poison, double %10, i64 0
%69 = insertelement <2 x double> %68, double %38, i64 1
%70 = insertelement <2 x double> %61, double %13, i64 1
%71 = shufflevector <2 x double> %46, <2 x double> undef, <2 x i32> <i32 1, i32 0>
br label %72
72: ; preds = %49, %105
%73 = phi i1 [ true, %49 ], [ %108, %105 ]
%74 = phi i64 [ 0, %49 ], [ %107, %105 ]
%75 = phi <2 x double> [ <double 5.000000e-01, double 5.000000e-01>, %49 ], [ %106, %105 ]
%76 = shufflevector <2 x double> %75, <2 x double> undef, <2 x i32> <i32 1, i32 1>
%77 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %63, <2 x double> %76, <2 x double> %67)
%78 = shufflevector <2 x double> %75, <2 x double> undef, <2 x i32> zeroinitializer
%79 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %64, <2 x double> %78, <2 x double> %77)
%80 = fmul <2 x double> %76, %65
%81 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %80, <2 x double> %78, <2 x double> %79)
%82 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %46, <2 x double> %75, <2 x double> %70)
%83 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %71, <2 x double> %75, <2 x double> %69)
%84 = extractelement <2 x double> %82, i64 1
%85 = fneg double %84
%86 = extractelement <2 x double> %82, i64 0
%87 = fmul double %86, %85
%88 = extractelement <2 x double> %83, i64 0
%89 = extractelement <2 x double> %83, i64 1
%90 = tail call double @llvm.fmuladd.f64(double %88, double %89, double %87)
%91 = shufflevector <2 x double> %81, <2 x double> undef, <2 x i32> <i32 1, i32 0>
%92 = fneg <2 x double> %91
%93 = fmul <2 x double> %82, %92
%94 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %81, <2 x double> %83, <2 x double> %93)
%95 = insertelement <2 x double> poison, double %90, i64 0
%96 = shufflevector <2 x double> %95, <2 x double> poison, <2 x i32> zeroinitializer
%97 = fdiv <2 x double> %94, %96
%98 = extractelement <2 x double> %97, i64 1
%99 = tail call double @llvm.fabs.f64(double %98)
%100 = fcmp olt double %99, 1.000000e-10
%101 = extractelement <2 x double> %97, i64 0
%102 = tail call double @llvm.fabs.f64(double %101)
%103 = fcmp olt double %102, 1.000000e-10
%104 = select i1 %100, i1 %103, i1 false
br i1 %104, label %110, label %105
105: ; preds = %72
%106 = fadd <2 x double> %75, %97
%107 = add nuw nsw i64 %74, 1
%108 = icmp slt i64 %107, %47
%109 = icmp eq i64 %107, %47
br i1 %109, label %110, label %72
110: ; preds = %105, %72, %6
%111 = phi i1 [ false, %6 ], [ %73, %72 ], [ %108, %105 ]
%112 = phi <2 x double> [ <double 5.000000e-01, double 5.000000e-01>, %6 ], [ %75, %72 ], [ %106, %105 ]
%113 = extractelement <2 x double> %112, i64 1
store double %113, double* %4
%114 = extractelement <2 x double> %112, i64 0
store double %114, double* %5
%115 = zext i1 %111 to i32
ret i32 %115
}