#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int clip_2dx2d_great_circle(double *, double *, double *, int, double *,
                            double *, double *, int, double *, double *,
                            double *);
int /*<<< orphan*/ error_handler(char *);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ get_grid_great_circle_area(int const *, int const *,
                                              double const *, double const *,
                                              double *);
double const great_circle_area(int, double *, double *, double *);
int /*<<< orphan*/ latlon2xyz(int, double const *, double const *, double *,
                              double *, double *);
scalar_t__ malloc(int);
int create_xgrid_great_circle(const int *nlon_in, const int *nlat_in,
                              const int *nlon_out, const int *nlat_out,
                              const double *lon_in, const double *lat_in,
                              const double *lon_out, const double *lat_out,
                              const double *mask_in, int *i_in, int *j_in,
                              int *i_out, int *j_out, double *xgrid_area,
                              double *xgrid_clon, double *xgrid_clat) {
  int nx1, nx2, ny1, ny2, nx1p, nx2p, ny1p, ny2p, nxgrid, n1_in, n2_in;
  int n0, n1, n2, n3, i1, j1, i2, j2;
  double x1_in[50], y1_in[50], z1_in[50];
  double x2_in[50], y2_in[50], z2_in[50];
  double x_out[50], y_out[50], z_out[50];
  double *x1 = NULL, *y1 = NULL, *z1 = NULL;
  double *x2 = NULL, *y2 = NULL, *z2 = NULL;
  double xctrlon, xctrlat;
  double *area1, *area2, min_area;
  nx1 = *nlon_in;
  ny1 = *nlat_in;
  nx2 = *nlon_out;
  ny2 = *nlat_out;
  nxgrid = 0;
  nx1p = nx1 + 1;
  nx2p = nx2 + 1;
  ny1p = ny1 + 1;
  ny2p = ny2 + 1;
  x1 = (double *)malloc(nx1p * ny1p * sizeof(double));
  y1 = (double *)malloc(nx1p * ny1p * sizeof(double));
  z1 = (double *)malloc(nx1p * ny1p * sizeof(double));
  x2 = (double *)malloc(nx2p * ny2p * sizeof(double));
  y2 = (double *)malloc(nx2p * ny2p * sizeof(double));
  z2 = (double *)malloc(nx2p * ny2p * sizeof(double));
  latlon2xyz(nx1p * ny1p, lon_in, lat_in, x1, y1, z1);
  latlon2xyz(nx2p * ny2p, lon_out, lat_out, x2, y2, z2);
  area1 = (double *)malloc(nx1 * ny1 * sizeof(double));
  area2 = (double *)malloc(nx2 * ny2 * sizeof(double));
  get_grid_great_circle_area(nlon_in, nlat_in, lon_in, lat_in, area1);
  get_grid_great_circle_area(nlon_out, nlat_out, lon_out, lat_out, area2);
  n1_in = 4;
  n2_in = 4;
  for (j1 = 0; j1 < ny1; j1++)
    for (i1 = 0; i1 < nx1; i1++)
      if (mask_in[j1 * nx1 + i1] > (0.5)) {
        n0 = j1 * nx1p + i1;
        n1 = (j1 + 1) * nx1p + i1;
        n2 = (j1 + 1) * nx1p + i1 + 1;
        n3 = j1 * nx1p + i1 + 1;
        x1_in[0] = x1[n0];
        y1_in[0] = y1[n0];
        z1_in[0] = z1[n0];
        x1_in[1] = x1[n1];
        y1_in[1] = y1[n1];
        z1_in[1] = z1[n1];
        x1_in[2] = x1[n2];
        y1_in[2] = y1[n2];
        z1_in[2] = z1[n2];
        x1_in[3] = x1[n3];
        y1_in[3] = y1[n3];
        z1_in[3] = z1[n3];
        for (j2 = 0; j2 < ny2; j2++)
          for (i2 = 0; i2 < nx2; i2++) {
            int n_in, n_out;
            double xarea;
            n0 = j2 * nx2p + i2;
            n1 = (j2 + 1) * nx2p + i2;
            n2 = (j2 + 1) * nx2p + i2 + 1;
            n3 = j2 * nx2p + i2 + 1;
            x2_in[0] = x2[n0];
            y2_in[0] = y2[n0];
            z2_in[0] = z2[n0];
            x2_in[1] = x2[n1];
            y2_in[1] = y2[n1];
            z2_in[1] = z2[n1];
            x2_in[2] = x2[n2];
            y2_in[2] = y2[n2];
            z2_in[2] = z2[n2];
            x2_in[3] = x2[n3];
            y2_in[3] = y2[n3];
            z2_in[3] = z2[n3];
            if ((n_out = clip_2dx2d_great_circle(x1_in, y1_in, z1_in, n1_in,
                                                 x2_in, y2_in, z2_in, n2_in,
                                                 x_out, y_out, z_out)) > 0) {
              xarea = great_circle_area(n_out, x_out, y_out, z_out) *
                      mask_in[j1 * nx1 + i1];
              min_area = (area1[j1 * nx1 + i1] < area2[j2 * nx2 + i2]
                              ? area1[j1 * nx1 + i1]
                              : area2[j2 * nx2 + i2]);
              if (xarea / min_area > (1.e-6)) {
                xgrid_area[nxgrid] = xarea;
                xgrid_clon[nxgrid] = 0;
                xgrid_clat[nxgrid] = 0;
                i_in[nxgrid] = i1;
                j_in[nxgrid] = j1;
                i_out[nxgrid] = i2;
                j_out[nxgrid] = j2;
                ++nxgrid;
                if (nxgrid > 1e6)
                  error_handler(
                      "nxgrid is greater than MAXXGRID, increase MAXXGRID");
              }
            }
          }
      }
  free(area1);
  free(area2);
  free(x1);
  free(y1);
  free(z1);
  free(x2);
  free(y2);
  free(z2);
  return nxgrid;
}


x86 assembly (clang, -O0):
<create_xgrid_great_circle>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
sub    $0xf30,%rsp
mov    0x58(%rbp),%rax
mov    0x50(%rbp),%rax
mov    0x48(%rbp),%rax
mov    0x40(%rbp),%rax
mov    0x38(%rbp),%rax
mov    0x30(%rbp),%rax
mov    0x28(%rbp),%rax
mov    0x20(%rbp),%rax
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
mov    %r9,-0x40(%rbp)
movq   $0x0,-0xea8(%rbp)
movq   $0x0,-0xeb0(%rbp)
movq   $0x0,-0xeb8(%rbp)
movq   $0x0,-0xec0(%rbp)
movq   $0x0,-0xec8(%rbp)
movq   $0x0,-0xed0(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x4c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x48(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x50(%rbp)
movl   $0x0,-0x64(%rbp)
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
mov    -0x54(%rbp),%eax
imul   -0x5c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xea8(%rbp)
mov    -0x54(%rbp),%eax
imul   -0x5c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xeb0(%rbp)
mov    -0x54(%rbp),%eax
imul   -0x5c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xeb8(%rbp)
mov    -0x58(%rbp),%eax
imul   -0x60(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xec0(%rbp)
mov    -0x58(%rbp),%eax
imul   -0x60(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xec8(%rbp)
mov    -0x58(%rbp),%eax
imul   -0x60(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xed0(%rbp)
mov    -0x54(%rbp),%edi
imul   -0x5c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    -0x40(%rbp),%rdx
mov    -0xea8(%rbp),%rcx
mov    -0xeb0(%rbp),%r8
mov    -0xeb8(%rbp),%r9
call   1070 <latlon2xyz@plt>
mov    -0x58(%rbp),%edi
imul   -0x60(%rbp),%edi
mov    0x10(%rbp),%rsi
mov    0x18(%rbp),%rdx
mov    -0xec0(%rbp),%rcx
mov    -0xec8(%rbp),%r8
mov    -0xed0(%rbp),%r9
call   1070 <latlon2xyz@plt>
mov    -0x44(%rbp),%eax
imul   -0x4c(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xee8(%rbp)
mov    -0x48(%rbp),%eax
imul   -0x50(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,-0xef0(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    -0x40(%rbp),%rcx
mov    -0xee8(%rbp),%r8
call   1090 <get_grid_great_circle_area@plt>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    -0xef0(%rbp),%r8
call   1090 <get_grid_great_circle_area@plt>
movl   $0x4,-0x68(%rbp)
movl   $0x4,-0x6c(%rbp)
movl   $0x0,-0x84(%rbp)
mov    -0x84(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    19b3 <create_xgrid_great_circle+0x843>
movl   $0x0,-0x80(%rbp)
mov    -0x80(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    199a <create_xgrid_great_circle+0x82a>
mov    0x20(%rbp),%rax
mov    -0x84(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xbf4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1987 <create_xgrid_great_circle+0x817>
mov    -0x84(%rbp),%eax
imul   -0x54(%rbp),%eax
add    -0x80(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
imul   -0x54(%rbp),%eax
add    -0x80(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x84(%rbp),%eax
add    $0x1,%eax
imul   -0x54(%rbp),%eax
add    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
mov    -0x84(%rbp),%eax
imul   -0x54(%rbp),%eax
add    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0xea8(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x220(%rbp)
ff
mov    -0xeb0(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3b0(%rbp)
ff
mov    -0xeb8(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x540(%rbp)
ff
mov    -0xea8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x218(%rbp)
ff
mov    -0xeb0(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3a8(%rbp)
ff
mov    -0xeb8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x538(%rbp)
ff
mov    -0xea8(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
mov    -0xeb0(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3a0(%rbp)
ff
mov    -0xeb8(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x530(%rbp)
ff
mov    -0xea8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
mov    -0xeb0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x398(%rbp)
ff
mov    -0xeb8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x528(%rbp)
ff
movl   $0x0,-0x8c(%rbp)
mov    -0x8c(%rbp),%eax
cmp    -0x50(%rbp),%eax
jge    1982 <create_xgrid_great_circle+0x812>
movl   $0x0,-0x88(%rbp)
mov    -0x88(%rbp),%eax
cmp    -0x48(%rbp),%eax
jge    1969 <create_xgrid_great_circle+0x7f9>
mov    -0x8c(%rbp),%eax
imul   -0x58(%rbp),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
imul   -0x58(%rbp),%eax
add    -0x88(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
imul   -0x58(%rbp),%eax
add    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x78(%rbp)
mov    -0x8c(%rbp),%eax
imul   -0x58(%rbp),%eax
add    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
mov    -0xec0(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6d0(%rbp)
ff
mov    -0xec8(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x860(%rbp)
ff
mov    -0xed0(%rbp),%rax
movslq -0x70(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x9f0(%rbp)
ff
mov    -0xec0(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6c8(%rbp)
ff
mov    -0xec8(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x858(%rbp)
ff
mov    -0xed0(%rbp),%rax
movslq -0x74(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x9e8(%rbp)
ff
mov    -0xec0(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6c0(%rbp)
ff
mov    -0xec8(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x850(%rbp)
ff
mov    -0xed0(%rbp),%rax
movslq -0x78(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x9e0(%rbp)
ff
mov    -0xec0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6b8(%rbp)
ff
mov    -0xec8(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x848(%rbp)
ff
mov    -0xed0(%rbp),%rax
movslq -0x7c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x9d8(%rbp)
ff
lea    -0x220(%rbp),%rdi
lea    -0x3b0(%rbp),%rsi
lea    -0x540(%rbp),%rdx
mov    -0x68(%rbp),%ecx
lea    -0x6d0(%rbp),%r8
lea    -0x860(%rbp),%r9
lea    -0x9f0(%rbp),%r14
mov    -0x6c(%rbp),%ebx
lea    -0xb80(%rbp),%r11
lea    -0xd10(%rbp),%r10
lea    -0xea0(%rbp),%rax
mov    %r14,(%rsp)
mov    %ebx,0x8(%rsp)
mov    %r11,0x10(%rsp)
mov    %r10,0x18(%rsp)
mov    %rax,0x20(%rsp)
call   1040 <clip_2dx2d_great_circle@plt>
mov    %eax,-0xf00(%rbp)
cmp    $0x0,%eax
jle    1950 <create_xgrid_great_circle+0x7e0>
mov    -0xf00(%rbp),%edi
lea    -0xb80(%rbp),%rsi
lea    -0xd10(%rbp),%rdx
lea    -0xea0(%rbp),%rcx
call   1080 <great_circle_area@plt>
mov    0x20(%rbp),%rax
mov    -0x84(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf08(%rbp)
ff
mov    -0xee8(%rbp),%rax
mov    -0x84(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0xef0(%rbp),%rax
mov    -0x8c(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    184b <create_xgrid_great_circle+0x6db>
mov    -0xee8(%rbp),%rax
mov    -0x84(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x80(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf10(%rbp)
ff
jmp    1872 <create_xgrid_great_circle+0x702>
mov    -0xef0(%rbp),%rax
mov    -0x8c(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x88(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xf10(%rbp)
ff
movsd  -0xf10(%rbp),%xmm0
ff
movsd  %xmm0,-0xef8(%rbp)
ff
movsd  -0xf08(%rbp),%xmm0
ff
divsd  -0xef8(%rbp),%xmm0
ff
movsd  0x76e(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    194b <create_xgrid_great_circle+0x7db>
movsd  -0xf08(%rbp),%xmm0
ff
mov    0x48(%rbp),%rax
movslq -0x64(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x50(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    0x58(%rbp),%rax
movslq -0x64(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x80(%rbp),%edx
mov    0x28(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x84(%rbp),%edx
mov    0x30(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x88(%rbp),%edx
mov    0x38(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8c(%rbp),%edx
mov    0x40(%rbp),%rax
movslq -0x64(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x64(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x64(%rbp)
cvtsi2sdl -0x64(%rbp),%xmm0
movsd  0x6e0(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1946 <create_xgrid_great_circle+0x7d6>
lea    0x6d7(%rip),%rdi
call   1050 <error_handler@plt>
jmp    194b <create_xgrid_great_circle+0x7db>
jmp    1950 <create_xgrid_great_circle+0x7e0>
jmp    1955 <create_xgrid_great_circle+0x7e5>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
jmp    15a5 <create_xgrid_great_circle+0x435>
jmp    196e <create_xgrid_great_circle+0x7fe>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    158c <create_xgrid_great_circle+0x41c>
jmp    1987 <create_xgrid_great_circle+0x817>
jmp    198c <create_xgrid_great_circle+0x81c>
mov    -0x80(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x80(%rbp)
jmp    13df <create_xgrid_great_circle+0x26f>
jmp    199f <create_xgrid_great_circle+0x82f>
mov    -0x84(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x84(%rbp)
jmp    13c9 <create_xgrid_great_circle+0x259>
mov    -0xee8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xef0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xea8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xeb0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xeb8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xec0(%rbp),%rdi
call   1030 <free@plt>
mov    -0xec8(%rbp),%rdi
call   1030 <free@plt>
mov    -0xed0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x64(%rbp),%eax
add    $0xf30,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_xgrid_great_circle>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf38,%rsp
mov    %r9,0x28(%rsp)
mov    %r8,0x20(%rsp)
mov    %rcx,0x68(%rsp)
mov    %rdx,0x70(%rsp)
mov    %rsi,0x58(%rsp)
mov    %rdi,0x60(%rsp)
movslq (%rdi),%rax
mov    %rax,0x98(%rsp)
mov    (%rsi),%edi
mov    %rdi,0x30(%rsp)
movslq (%rdx),%rdx
mov    %rdx,0x90(%rsp)
mov    (%rcx),%ecx
mov    %rcx,0x48(%rsp)
add    $0x1,%rax
lea    0x1(%rdx),%rbp
lea    0x1(%rdi),%r13d
mov    %rax,0xa8(%rsp)
imul   %eax,%r13d
lea    0x1(%rcx),%r12d
lea    0x0(,%r13,8),%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x38(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rbp,0x100(%rsp)
imul   %ebp,%r12d
lea    0x0(,%r12,8),%ebx
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,0x88(%rsp)
mov    %ebx,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %ebx,%edi
mov    0x98(%rsp),%rbx
call   1060 <malloc@plt>
mov    %rax,%rbp
mov    %r13d,%edi
mov    0x20(%rsp),%rsi
mov    0x28(%rsp),%rdx
mov    0x40(%rsp),%rcx
mov    0x38(%rsp),%r8
mov    %r14,0x78(%rsp)
mov    %r14,%r9
mov    0x88(%rsp),%r14
call   1070 <latlon2xyz@plt>
mov    %r12d,%edi
mov    %rbp,%r12
mov    0x90(%rsp),%rbp
mov    0xf70(%rsp),%rsi
mov    0xf78(%rsp),%rdx
mov    %r14,%rcx
mov    %r15,%r8
mov    %r12,%r9
call   1070 <latlon2xyz@plt>
mov    %ebx,%edi
imul   0x30(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,0x50(%rsp)
mov    %ebp,%edi
imul   0x48(%rsp),%edi
shl    $0x3,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    0x60(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    0x20(%rsp),%rdx
mov    0x28(%rsp),%rcx
mov    0x50(%rsp),%r8
call   1090 <get_grid_great_circle_area@plt>
mov    0x70(%rsp),%rdi
mov    0x68(%rsp),%rsi
mov    0xf70(%rsp),%rdx
mov    0xf78(%rsp),%rcx
mov    %r13,0x80(%rsp)
mov    %r13,%r8
call   1090 <get_grid_great_circle_area@plt>
cmpl   $0x0,0x30(%rsp)
jle    18ae <create_xgrid_great_circle+0x73e>
mov    %ebx,%eax
mov    %rax,0xc8(%rsp)
mov    %ebp,%eax
mov    %rax,0x58(%rsp)
mov    %r14,%rax
add    $0x8,%rax
mov    %rax,0xe8(%rsp)
mov    %r15,%rax
add    $0x8,%rax
mov    %rax,0xe0(%rsp)
mov    %r12,%rax
add    $0x8,%rax
mov    %rax,0xd8(%rsp)
xor    %eax,%eax
mov    %rax,0x10(%rsp)
lea    0xc10(%rsp),%r10
lea    0xda0(%rsp),%r11
movl   $0x0,0xc(%rsp)
mov    %r15,0xf8(%rsp)
mov    %r12,0xf0(%rsp)
jmp    13ab <create_xgrid_great_circle+0x23b>
nopl   0x0(%rax,%rax,1)
mov    0xb0(%rsp),%rcx
mov    %rcx,%rax
mov    %rcx,0x10(%rsp)
cmp    0x30(%rsp),%rcx
je     18b6 <create_xgrid_great_circle+0x746>
test   %ebx,%ebx
jle    18a0 <create_xgrid_great_circle+0x730>
mov    0x10(%rsp),%rcx
mov    %rcx,%rax
imul   %rbx,%rax
mov    %rax,0xd0(%rsp)
mov    %rcx,%rdx
mov    0xa8(%rsp),%rax
imul   %rax,%rdx
mov    %rdx,0xc0(%rsp)
add    $0x1,%rcx
mov    %rcx,0xb0(%rsp)
imul   %rax,%rcx
mov    %rcx,0xb8(%rsp)
xor    %edx,%edx
jmp    141a <create_xgrid_great_circle+0x2aa>
nopw   0x0(%rax,%rax,1)
mov    0xa0(%rsp),%rdx
add    $0x1,%rdx
cmp    0xc8(%rsp),%rdx
je     1390 <create_xgrid_great_circle+0x220>
mov    0xd0(%rsp),%rax
lea    (%rdx,%rax,1),%rcx
mov    0xf80(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm0
ucomisd 0xbc5(%rip),%xmm0
mov    %rdx,0xa0(%rsp)
jbe    1400 <create_xgrid_great_circle+0x290>
mov    %rcx,0x110(%rsp)
mov    0xc0(%rsp),%rax
add    %rdx,%rax
mov    0xb8(%rsp),%rcx
lea    (%rdx,%rcx,1),%rcx
mov    0x40(%rsp),%rdx
movsd  (%rdx,%rax,8),%xmm0
movsd  %xmm0,0x8f0(%rsp)
mov    0x38(%rsp),%rsi
movsd  (%rsi,%rax,8),%xmm0
movsd  %xmm0,0x760(%rsp)
mov    0x78(%rsp),%rdi
movsd  (%rdi,%rax,8),%xmm0
movsd  %xmm0,0x5d0(%rsp)
movsd  (%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x8f8(%rsp)
movsd  (%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x768(%rsp)
movsd  (%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x5d8(%rsp)
movsd  0x8(%rdx,%rcx,8),%xmm0
movsd  %xmm0,0x900(%rsp)
movsd  0x8(%rsi,%rcx,8),%xmm0
movsd  %xmm0,0x770(%rsp)
movsd  0x8(%rdi,%rcx,8),%xmm0
movsd  %xmm0,0x5e0(%rsp)
movsd  0x8(%rdx,%rax,8),%xmm0
movsd  %xmm0,0x908(%rsp)
movsd  0x8(%rsi,%rax,8),%xmm0
movsd  %xmm0,0x778(%rsp)
movsd  0x8(%rdi,%rax,8),%xmm0
movsd  %xmm0,0x5e8(%rsp)
cmpl   $0x0,0x48(%rsp)
jle    1400 <create_xgrid_great_circle+0x290>
xor    %eax,%eax
mov    %rax,0x18(%rsp)
jmp    1583 <create_xgrid_great_circle+0x413>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x108(%rsp),%rcx
mov    %rcx,%rax
mov    %rcx,0x18(%rsp)
mov    0x98(%rsp),%rbx
mov    0x90(%rsp),%rbp
mov    0x88(%rsp),%r14
mov    0xf8(%rsp),%r15
mov    0xf0(%rsp),%r12
cmp    0x48(%rsp),%rcx
je     1400 <create_xgrid_great_circle+0x290>
test   %ebp,%ebp
jle    1870 <create_xgrid_great_circle+0x700>
mov    0x18(%rsp),%rsi
mov    %rsi,%rax
mov    0x100(%rsp),%rdx
imul   %rdx,%rax
lea    0x1(%rsi),%rcx
mov    %rcx,0x108(%rsp)
imul   %rdx,%rcx
mov    %rsi,%rdx
imul   %rbp,%rdx
mov    0x80(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdx
mov    %rdx,0x118(%rsp)
mov    0xe8(%rsp),%rdx
lea    (%rdx,%rcx,8),%rsi
mov    %rsi,0x28(%rsp)
mov    0xe0(%rsp),%rsi
lea    (%rsi,%rcx,8),%rdi
mov    %rdi,0x20(%rsp)
mov    0xd8(%rsp),%rdi
lea    (%rdi,%rcx,8),%rcx
mov    %rcx,0x70(%rsp)
lea    (%rdx,%rax,8),%rcx
mov    %rcx,0x68(%rsp)
lea    (%rsi,%rax,8),%rcx
mov    %rcx,0x60(%rsp)
lea    (%rdi,%rax,8),%r13
xor    %r14d,%r14d
lea    0xa80(%rsp),%rbx
jmp    163d <create_xgrid_great_circle+0x4cd>
mov    %rbx,%r10
lea    0xa80(%rsp),%rbx
mov    %rbp,%r11
add    $0x1,%r14
cmp    %r14,0x58(%rsp)
je     1540 <create_xgrid_great_circle+0x3d0>
mov    0x68(%rsp),%rsi
movsd  -0x8(%rsi,%r14,8),%xmm0
movsd  %xmm0,0x440(%rsp)
mov    0x60(%rsp),%rdi
movsd  -0x8(%rdi,%r14,8),%xmm0
movsd  %xmm0,0x2b0(%rsp)
movsd  -0x8(%r13,%r14,8),%xmm0
movsd  %xmm0,0x120(%rsp)
mov    0x28(%rsp),%rax
movsd  -0x8(%rax,%r14,8),%xmm0
movsd  %xmm0,0x448(%rsp)
mov    0x20(%rsp),%rcx
movsd  -0x8(%rcx,%r14,8),%xmm0
movsd  %xmm0,0x2b8(%rsp)
mov    0x70(%rsp),%rdx
movsd  -0x8(%rdx,%r14,8),%xmm0
movsd  %xmm0,0x128(%rsp)
movsd  (%rax,%r14,8),%xmm0
movsd  %xmm0,0x450(%rsp)
movsd  (%rcx,%r14,8),%xmm0
movsd  %xmm0,0x2c0(%rsp)
movsd  (%rdx,%r14,8),%xmm0
movsd  %xmm0,0x130(%rsp)
movsd  (%rsi,%r14,8),%xmm0
movsd  %xmm0,0x458(%rsp)
movsd  (%rdi,%r14,8),%xmm0
movsd  %xmm0,0x2c8(%rsp)
movsd  0x0(%r13,%r14,8),%xmm0
movsd  %xmm0,0x138(%rsp)
sub    $0x8,%rsp
lea    0x8f8(%rsp),%rdi
lea    0x768(%rsp),%rsi
lea    0x5d8(%rsp),%rdx
mov    $0x4,%ecx
lea    0x448(%rsp),%r8
lea    0x2b8(%rsp),%r9
push   %r10
push   %rbx
push   %r11
push   $0x4
lea    0x148(%rsp),%rax
push   %rax
mov    %r10,%r15
mov    %r11,%r12
call   1040 <clip_2dx2d_great_circle@plt>
add    $0x30,%rsp
test   %eax,%eax
jle    1860 <create_xgrid_great_circle+0x6f0>
mov    %eax,%edi
mov    %r12,%rbp
mov    %r12,%rsi
mov    %rbx,%rdx
mov    %r15,%rbx
mov    %r15,%rcx
call   1080 <great_circle_area@plt>
mov    0xf80(%rsp),%rax
mov    0x110(%rsp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x50(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm1
mov    0x118(%rsp),%rax
minsd  (%rax,%r14,8),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
ucomisd 0x84c(%rip),%xmm2
jbe    1620 <create_xgrid_great_circle+0x4b0>
movslq 0xc(%rsp),%rax
mov    0xfa8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
mov    0xfb0(%rsp),%rcx
movq   $0x0,(%rcx,%rax,8)
mov    0xfb8(%rsp),%rcx
movq   $0x0,(%rcx,%rax,8)
mov    0xf88(%rsp),%rcx
mov    0xa0(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0xf90(%rsp),%rcx
mov    0x10(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0xf98(%rsp),%rcx
mov    %r14d,(%rcx,%rax,4)
mov    0xfa0(%rsp),%rcx
mov    0x18(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
lea    0x1(%rax),%ecx
cmp    $0xf4240,%eax
mov    %ecx,0xc(%rsp)
jl     1620 <create_xgrid_great_circle+0x4b0>
lea    0x7c4(%rip),%rdi
call   1050 <error_handler@plt>
jmp    1620 <create_xgrid_great_circle+0x4b0>
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%r10
mov    %r12,%r11
jmp    162e <create_xgrid_great_circle+0x4be>
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x18(%rsp)
cmp    0x48(%rsp),%rcx
jne    1583 <create_xgrid_great_circle+0x413>
jmp    1400 <create_xgrid_great_circle+0x290>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x10(%rsp),%rcx
add    $0x1,%rcx
jmp    1398 <create_xgrid_great_circle+0x228>
movl   $0x0,0xc(%rsp)
mov    0x50(%rsp),%rdi
call   1030 <free@plt>
mov    0x80(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x38(%rsp),%rdi
call   1030 <free@plt>
mov    0x78(%rsp),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
mov    0xc(%rsp),%eax
add    $0xf38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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