#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(double *, double *, int, double, double, double, double, double *,
         double *);
int /*<<< orphan*/ error_handler(char *);
int fix_lon(double *, double *, int, double);
int /*<<< orphan*/ free(double *);
int /*<<< orphan*/ get_grid_area(int const *, int const *, double const *,
                                 double const *, double *);
int /*<<< orphan*/ get_grid_area_no_adjust(int const *, int const *, double *,
                                           double *, double *);
scalar_t__ malloc(int);
double const poly_area(double *, double *, int);
int create_xgrid_1dx2d_order1(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) {
  int nx1, ny1, nx2, ny2, nx1p, nx2p;
  int i1, j1, i2, j2, nxgrid;
  double ll_lon, ll_lat, ur_lon, ur_lat, x_in[50], y_in[50], x_out[50],
      y_out[50];
  double *area_in, *area_out, min_area;
  double *tmpx, *tmpy;
  nx1 = *nlon_in;
  ny1 = *nlat_in;
  nx2 = *nlon_out;
  ny2 = *nlat_out;
  nxgrid = 0;
  nx1p = nx1 + 1;
  nx2p = nx2 + 1;
  area_in = (double *)malloc(nx1 * ny1 * sizeof(double));
  area_out = (double *)malloc(nx2 * ny2 * sizeof(double));
  tmpx = (double *)malloc((nx1 + 1) * (ny1 + 1) * sizeof(double));
  tmpy = (double *)malloc((nx1 + 1) * (ny1 + 1) * sizeof(double));
  for (j1 = 0; j1 <= ny1; j1++)
    for (i1 = 0; i1 <= nx1; i1++) {
      tmpx[j1 * nx1p + i1] = lon_in[i1];
      tmpy[j1 * nx1p + i1] = lat_in[j1];
    }
  if (nx1 > 1)
    get_grid_area(nlon_in, nlat_in, tmpx, tmpy, area_in);
  else
    get_grid_area_no_adjust(nlon_in, nlat_in, tmpx, tmpy, area_in);
  get_grid_area(nlon_out, nlat_out, lon_out, lat_out, area_out);
  free(tmpx);
  free(tmpy);
  for (j1 = 0; j1 < ny1; j1++)
    for (i1 = 0; i1 < nx1; i1++)
      if (mask_in[j1 * nx1 + i1] > (0.5)) {
        ll_lon = lon_in[i1];
        ll_lat = lat_in[j1];
        ur_lon = lon_in[i1 + 1];
        ur_lat = lat_in[j1 + 1];
        for (j2 = 0; j2 < ny2; j2++)
          for (i2 = 0; i2 < nx2; i2++) {
            int n_in, n_out;
            double Xarea;
            y_in[0] = lat_out[j2 * nx2p + i2];
            y_in[1] = lat_out[j2 * nx2p + i2 + 1];
            y_in[2] = lat_out[(j2 + 1) * nx2p + i2 + 1];
            y_in[3] = lat_out[(j2 + 1) * nx2p + i2];
            if ((y_in[0] <= ll_lat) && (y_in[1] <= ll_lat) &&
                (y_in[2] <= ll_lat) && (y_in[3] <= ll_lat))
              continue;
            if ((y_in[0] >= ur_lat) && (y_in[1] >= ur_lat) &&
                (y_in[2] >= ur_lat) && (y_in[3] >= ur_lat))
              continue;
            x_in[0] = lon_out[j2 * nx2p + i2];
            x_in[1] = lon_out[j2 * nx2p + i2 + 1];
            x_in[2] = lon_out[(j2 + 1) * nx2p + i2 + 1];
            x_in[3] = lon_out[(j2 + 1) * nx2p + i2];
            n_in = fix_lon(x_in, y_in, 4, (ll_lon + ur_lon) / 2);
            if ((n_out = clip(x_in, y_in, n_in, ll_lon, ll_lat, ur_lon, ur_lat,
                              x_out, y_out)) > 0) {
              Xarea = poly_area(x_out, y_out, n_out) * mask_in[j1 * nx1 + i1];
              min_area = (area_in[j1 * nx1 + i1] < area_out[j2 * nx2 + i2]
                              ? area_in[j1 * nx1 + i1]
                              : area_out[j2 * nx2 + i2]);
              if (Xarea / min_area > (1.e-6)) {
                xgrid_area[nxgrid] = Xarea;
                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(area_in);
  free(area_out);
  return nxgrid;
}


x86 assembly (clang, -O0):
<create_xgrid_1dx2d_order1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x700,%rsp
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,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x34(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x40(%rbp)
movl   $0x0,-0x5c(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x6c8(%rbp)
mov    -0x3c(%rbp),%eax
imul   -0x40(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x6d0(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x6e0(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    -0x38(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x6e8(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     130f <create_xgrid_1dx2d_order1+0x18f>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jg     12fc <create_xgrid_1dx2d_order1+0x17c>
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e0(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e8(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1296 <create_xgrid_1dx2d_order1+0x116>
jmp    1301 <create_xgrid_1dx2d_order1+0x181>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1283 <create_xgrid_1dx2d_order1+0x103>
cmpl   $0x1,-0x34(%rbp)
jle    1340 <create_xgrid_1dx2d_order1+0x1c0>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x6e0(%rbp),%rdx
mov    -0x6e8(%rbp),%rcx
mov    -0x6c8(%rbp),%r8
call   1090 <get_grid_area@plt>
jmp    1362 <create_xgrid_1dx2d_order1+0x1e2>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x6e0(%rbp),%rdx
mov    -0x6e8(%rbp),%rcx
mov    -0x6c8(%rbp),%r8
call   10a0 <get_grid_area_no_adjust@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    0x18(%rbp),%rcx
mov    -0x6d0(%rbp),%r8
call   1090 <get_grid_area@plt>
mov    -0x6e0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x6e8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    1854 <create_xgrid_1dx2d_order1+0x6d4>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1841 <create_xgrid_1dx2d_order1+0x6c1>
mov    0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xc26(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    182e <create_xgrid_1dx2d_order1+0x6ae>
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x30(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1829 <create_xgrid_1dx2d_order1+0x6a9>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1816 <create_xgrid_1dx2d_order1+0x696>
mov    0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3a0(%rbp)
ff
mov    0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x398(%rbp)
ff
mov    0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x390(%rbp)
ff
mov    0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x388(%rbp)
ff
movsd  -0x3a0(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1541 <create_xgrid_1dx2d_order1+0x3c1>
movsd  -0x398(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1541 <create_xgrid_1dx2d_order1+0x3c1>
movsd  -0x390(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1541 <create_xgrid_1dx2d_order1+0x3c1>
movsd  -0x388(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1541 <create_xgrid_1dx2d_order1+0x3c1>
jmp    1808 <create_xgrid_1dx2d_order1+0x688>
movsd  -0x3a0(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1592 <create_xgrid_1dx2d_order1+0x412>
movsd  -0x398(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1592 <create_xgrid_1dx2d_order1+0x412>
movsd  -0x390(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1592 <create_xgrid_1dx2d_order1+0x412>
movsd  -0x388(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1592 <create_xgrid_1dx2d_order1+0x412>
jmp    1808 <create_xgrid_1dx2d_order1+0x688>
mov    0x10(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
lea    -0x210(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
movsd  -0x68(%rbp),%xmm0
addsd  -0x78(%rbp),%xmm0
movsd  0x9d2(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x4,%edx
call   1070 <fix_lon@plt>
mov    %eax,-0x6ec(%rbp)
lea    -0x210(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
mov    -0x6ec(%rbp),%edx
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
movsd  -0x80(%rbp),%xmm3
lea    -0x530(%rbp),%rcx
lea    -0x6c0(%rbp),%r8
call   1040 <clip@plt>
mov    %eax,-0x6f0(%rbp)
cmp    $0x0,%eax
jle    1803 <create_xgrid_1dx2d_order1+0x683>
lea    -0x530(%rbp),%rdi
lea    -0x6c0(%rbp),%rsi
mov    -0x6f0(%rbp),%edx
call   1060 <poly_area@plt>
mov    0x20(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6f8(%rbp)
ff
mov    -0x6c8(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x6d0(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    172d <create_xgrid_1dx2d_order1+0x5ad>
mov    -0x6c8(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x700(%rbp)
ff
jmp    174e <create_xgrid_1dx2d_order1+0x5ce>
mov    -0x6d0(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x700(%rbp)
ff
movsd  -0x700(%rbp),%xmm0
ff
movsd  %xmm0,-0x6d8(%rbp)
ff
movsd  -0x6f8(%rbp),%xmm0
ff
divsd  -0x6d8(%rbp),%xmm0
ff
movsd  0x89a(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17fe <create_xgrid_1dx2d_order1+0x67e>
movsd  -0x6f8(%rbp),%xmm0
ff
mov    0x48(%rbp),%rax
movslq -0x5c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%edx
mov    0x28(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%edx
mov    0x30(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x54(%rbp),%edx
mov    0x38(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x58(%rbp),%edx
mov    0x40(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
cvtsi2sdl -0x5c(%rbp),%xmm0
movsd  0x835(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17f9 <create_xgrid_1dx2d_order1+0x679>
lea    0x82c(%rip),%rdi
call   1050 <error_handler@plt>
jmp    17fe <create_xgrid_1dx2d_order1+0x67e>
jmp    1803 <create_xgrid_1dx2d_order1+0x683>
jmp    1808 <create_xgrid_1dx2d_order1+0x688>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1450 <create_xgrid_1dx2d_order1+0x2d0>
jmp    181b <create_xgrid_1dx2d_order1+0x69b>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    143d <create_xgrid_1dx2d_order1+0x2bd>
jmp    182e <create_xgrid_1dx2d_order1+0x6ae>
jmp    1833 <create_xgrid_1dx2d_order1+0x6b3>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13b0 <create_xgrid_1dx2d_order1+0x230>
jmp    1846 <create_xgrid_1dx2d_order1+0x6c6>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    139d <create_xgrid_1dx2d_order1+0x21d>
mov    -0x6c8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x6d0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x5c(%rbp),%eax
add    $0x700,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_xgrid_1dx2d_order1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x758,%rsp
mov    %r9,%r13
mov    %r8,%r15
mov    %rcx,%rbp
mov    %rdi,0x50(%rsp)
movslq (%rdi),%rax
mov    %eax,%ecx
mov    %rcx,0x68(%rsp)
mov    %rsi,0x58(%rsp)
mov    (%rsi),%r12d
mov    %rdx,0x70(%rsp)
movslq (%rdx),%rbx
mov    %rbp,0x98(%rsp)
mov    0x0(%rbp),%ebp
lea    0x1(%rax),%r14d
mov    %rax,0xe0(%rsp)
mov    %eax,%edi
imul   %r12d,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,0x60(%rsp)
mov    %rbp,0xe8(%rsp)
mov    %ebp,%edi
mov    %rbx,0x78(%rsp)
imul   %ebx,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,0x80(%rsp)
lea    0x1(%r12),%ebp
mov    %r14d,0x10(%rsp)
mov    %r14d,%ebx
imul   %ebp,%ebx
shl    $0x3,%ebx
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %rax,%r14
mov    %ebx,%edi
call   1080 <malloc@plt>
mov    %r14,%rdx
mov    %r12,0xd8(%rsp)
test   %r12d,%r12d
mov    %r13,0x90(%rsp)
mov    %r15,0x88(%rsp)
js     15bc <create_xgrid_1dx2d_order1+0x43c>
movslq 0x10(%rsp),%r14
mov    %ebp,%ecx
mov    %rcx,0x10(%rsp)
mov    %r14d,%r11d
lea    (%r15,%r11,8),%rcx
mov    %rcx,0xb0(%rsp)
mov    %r11d,%ecx
and    $0xfffffffc,%ecx
mov    %rcx,0x30(%rsp)
add    $0xfffffffffffffffc,%rcx
mov    %rcx,0x18(%rsp)
mov    %rcx,%rsi
shr    $0x2,%rsi
add    $0x1,%rsi
mov    %rsi,%rcx
mov    %rsi,0xa8(%rsp)
and    $0xfffffffffffffffe,%rsi
mov    %rsi,0xa0(%rsp)
mov    %r11,%rcx
neg    %rcx
mov    %rcx,0xb8(%rsp)
lea    0x30(%rax),%r12
lea    0x0(,%r14,8),%r9
lea    0x30(%rdx),%rsi
lea    0x8(%rdx),%rbx
lea    0x8(%rax),%rcx
xor    %r8d,%r8d
mov    %rdx,0x28(%rsp)
mov    %r14,0x8(%rsp)
mov    %rax,0x40(%rsp)
mov    %r9,0x20(%rsp)
jmp    12fb <create_xgrid_1dx2d_order1+0x17b>
nopl   (%rax)
add    $0x1,%r8
add    %r9,%r12
add    %r9,%rsi
add    %r9,%rbx
add    %r9,%rcx
cmp    0x10(%rsp),%r8
je     15bc <create_xgrid_1dx2d_order1+0x43c>
cmpl   $0x0,0x68(%rsp)
js     12e0 <create_xgrid_1dx2d_order1+0x160>
mov    %r8,%r10
imul   %r14,%r10
cmp    $0x4,%r14d
jae    1320 <create_xgrid_1dx2d_order1+0x1a0>
xor    %ebp,%ebp
jmp    1510 <create_xgrid_1dx2d_order1+0x390>
cs nopw 0x0(%rax,%rax,1)
lea    (%r10,%r11,1),%rbp
lea    (%rdx,%r10,8),%rdi
lea    (%rdx,%rbp,8),%r14
lea    (%rax,%r10,8),%r9
lea    (%rax,%rbp,8),%rdx
mov    %r13,%rbp
lea    0x0(%r13,%r8,8),%r13
lea    0x8(%rbp,%r8,8),%rbp
cmp    %rdx,%rdi
setb   0xf0(%rsp)
cmp    %r14,%r9
setb   0xd0(%rsp)
mov    0xb0(%rsp),%rax
cmp    %rax,%rdi
setb   0x38(%rsp)
cmp    %r15,%r14
seta   0xc8(%rsp)
cmp    %rbp,%rdi
setb   %dil
cmp    %r14,%r13
setb   0xc0(%rsp)
cmp    %rax,%r9
setb   %r14b
cmp    %r15,%rdx
seta   %al
cmp    %rbp,%r9
setb   %r9b
cmp    %rdx,%r13
setb   %bpl
mov    0xd0(%rsp),%dl
test   %dl,0xf0(%rsp)
jne    15a5 <create_xgrid_1dx2d_order1+0x425>
mov    0xc8(%rsp),%dl
and    %dl,0x38(%rsp)
mov    0x90(%rsp),%r13
mov    0x88(%rsp),%r15
jne    14f9 <create_xgrid_1dx2d_order1+0x379>
and    0xc0(%rsp),%dil
jne    14f9 <create_xgrid_1dx2d_order1+0x379>
and    %al,%r14b
jne    14f9 <create_xgrid_1dx2d_order1+0x379>
mov    %ebp,%eax
mov    $0x0,%ebp
and    %al,%r9b
mov    0x28(%rsp),%rdx
mov    0x40(%rsp),%rax
mov    0x8(%rsp),%r14
mov    0x20(%rsp),%r9
jne    1510 <create_xgrid_1dx2d_order1+0x390>
cmpq   $0x0,0x18(%rsp)
je     158f <create_xgrid_1dx2d_order1+0x40f>
movsd  0x0(%r13,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0xa0(%rsp),%rdi
xor    %r9d,%r9d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movups (%r15,%r9,8),%xmm1
movups 0x10(%r15,%r9,8),%xmm2
movups %xmm1,-0x30(%rsi,%r9,8)
movups %xmm2,-0x20(%rsi,%r9,8)
movupd %xmm0,-0x30(%r12,%r9,8)
movupd %xmm0,-0x20(%r12,%r9,8)
movupd 0x20(%r15,%r9,8),%xmm1
movupd 0x30(%r15,%r9,8),%xmm2
movupd %xmm1,-0x10(%rsi,%r9,8)
movupd %xmm2,(%rsi,%r9,8)
movupd %xmm0,-0x10(%r12,%r9,8)
movupd %xmm0,(%r12,%r9,8)
add    $0x8,%r9
add    $0xfffffffffffffffe,%rdi
jne    1440 <create_xgrid_1dx2d_order1+0x2c0>
testb  $0x1,0xa8(%rsp)
01
je     14dc <create_xgrid_1dx2d_order1+0x35c>
movups (%r15,%r9,8),%xmm0
movupd 0x10(%r15,%r9,8),%xmm1
add    %r10,%r9
mov    %rdx,%rax
movups %xmm0,(%rdx,%r9,8)
movupd %xmm1,0x10(%rdx,%r9,8)
movsd  0x0(%r13,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0x40(%rsp),%rax
movupd %xmm0,(%rax,%r9,8)
movupd %xmm0,0x10(%rax,%r9,8)
mov    0x30(%rsp),%rdi
mov    %rdi,%rbp
cmp    %r11,%rdi
mov    0x20(%rsp),%r9
mov    0x40(%rsp),%rax
je     12e0 <create_xgrid_1dx2d_order1+0x160>
jmp    1510 <create_xgrid_1dx2d_order1+0x390>
xor    %ebp,%ebp
mov    0x28(%rsp),%rdx
mov    0x40(%rsp),%rax
mov    0x8(%rsp),%r14
mov    0x20(%rsp),%r9
nop
mov    %rbp,%rdi
test   $0x1,%r11b
je     153c <create_xgrid_1dx2d_order1+0x3bc>
movsd  (%r15,%rbp,8),%xmm0
add    %rbp,%r10
movsd  %xmm0,(%rdx,%r10,8)
movsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,(%rax,%r10,8)
mov    %rbp,%rdi
or     $0x1,%rdi
not    %rbp
cmp    0xb8(%rsp),%rbp
je     12e0 <create_xgrid_1dx2d_order1+0x160>
nopl   (%rax)
movsd  (%r15,%rdi,8),%xmm0
movsd  %xmm0,-0x8(%rbx,%rdi,8)
movsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,-0x8(%rcx,%rdi,8)
movsd  0x8(%r15,%rdi,8),%xmm0
movsd  %xmm0,(%rbx,%rdi,8)
movsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,(%rcx,%rdi,8)
add    $0x2,%rdi
cmp    %rdi,%r11
jne    1550 <create_xgrid_1dx2d_order1+0x3d0>
jmp    12e0 <create_xgrid_1dx2d_order1+0x160>
xor    %r9d,%r9d
testb  $0x1,0xa8(%rsp)
01
jne    14a1 <create_xgrid_1dx2d_order1+0x321>
jmp    14dc <create_xgrid_1dx2d_order1+0x35c>
xor    %ebp,%ebp
mov    0x90(%rsp),%r13
mov    0x88(%rsp),%r15
jmp    14fb <create_xgrid_1dx2d_order1+0x37b>
mov    0x798(%rsp),%r12
cmpl   $0x2,0x68(%rsp)
jl     15ea <create_xgrid_1dx2d_order1+0x46a>
mov    0x50(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    %rax,%rcx
mov    0x60(%rsp),%r8
mov    %rdx,%rbx
mov    %rax,%r14
call   1090 <get_grid_area@plt>
jmp    1607 <create_xgrid_1dx2d_order1+0x487>
mov    0x50(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    %rax,%rcx
mov    0x60(%rsp),%r8
mov    %rdx,%rbx
mov    %rax,%r14
call   10a0 <get_grid_area_no_adjust@plt>
mov    0x78(%rsp),%rbp
mov    0x70(%rsp),%rdi
mov    0x98(%rsp),%rsi
mov    0x790(%rsp),%rdx
mov    %r12,%rcx
mov    0x80(%rsp),%r8
call   1090 <get_grid_area@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
cmpl   $0x0,0xd8(%rsp)
jle    1a8c <create_xgrid_1dx2d_order1+0x90c>
mov    %ebp,%edi
lea    0x1(%rbp),%rax
mov    %rax,0x70(%rsp)
lea    0x8(%r12),%rax
mov    %rax,0x58(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
movl   $0x0,0x30(%rsp)
mov    0xe0(%rsp),%rax
jmp    169f <create_xgrid_1dx2d_order1+0x51f>
nopl   (%rax)
mov    0x18(%rsp),%rdx
add    $0x1,%rdx
mov    %rdx,%rcx
mov    %rdx,0x18(%rsp)
cmp    0xd8(%rsp),%rdx
je     1a94 <create_xgrid_1dx2d_order1+0x914>
test   %eax,%eax
jle    1680 <create_xgrid_1dx2d_order1+0x500>
mov    0x18(%rsp),%rcx
mov    %rcx,%rdx
imul   %rax,%rdx
mov    %rdx,0x50(%rsp)
lea    0x1(%rcx),%rdx
xor    %esi,%esi
mov    %rdx,0x98(%rsp)
jmp    16e1 <create_xgrid_1dx2d_order1+0x561>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%rsi
mov    %rsi,%rcx
mov    %rcx,%rsi
cmp    0x68(%rsp),%rcx
je     1689 <create_xgrid_1dx2d_order1+0x509>
mov    0x50(%rsp),%rcx
lea    (%rsi,%rcx,1),%rbx
mov    0x7a0(%rsp),%rcx
mov    %rbx,0x28(%rsp)
movsd  (%rcx,%rbx,8),%xmm0
ucomisd 0x8fc(%rip),%xmm0
jbe    16d0 <create_xgrid_1dx2d_order1+0x550>
lea    0x1(%rsi),%rcx
cmpl   $0x0,0xe8(%rsp)
jle    16d7 <create_xgrid_1dx2d_order1+0x557>
mov    %rcx,0x108(%rsp)
movsd  (%r15,%rsi,8),%xmm0
mov    %rsi,0xa8(%rsp)
movsd  0x8(%r15,%rsi,8),%xmm1
mov    0x18(%rsp),%rcx
movsd  0x0(%r13,%rcx,8),%xmm4
movsd  0x8(%r13,%rcx,8),%xmm2
movsd  %xmm0,0xc0(%rsp)
movsd  %xmm1,0xb8(%rsp)
addsd  %xmm1,%xmm0
mulsd  0x89e(%rip),%xmm0
movsd  %xmm0,0x20(%rsp)
movapd %xmm2,0x40(%rsp)
unpcklpd %xmm2,%xmm2
movapd %xmm2,0xf0(%rsp)
xor    %ecx,%ecx
mov    %rcx,0x8(%rsp)
movsd  %xmm4,0x10(%rsp)
jmp    17db <create_xgrid_1dx2d_order1+0x65b>
nopw   0x0(%rax,%rax,1)
mov    0xa0(%rsp),%rsi
mov    %rsi,%rax
mov    %rsi,0x8(%rsp)
mov    0x90(%rsp),%r13
mov    0x88(%rsp),%r15
mov    0xe0(%rsp),%rax
mov    0x78(%rsp),%rbp
mov    0x798(%rsp),%r12
mov    0x98(%rsp),%rdx
cmp    0xe8(%rsp),%rsi
je     1a7f <create_xgrid_1dx2d_order1+0x8ff>
test   %ebp,%ebp
jle    1a60 <create_xgrid_1dx2d_order1+0x8e0>
mov    0x8(%rsp),%rsi
mov    %rsi,%rax
mov    0x70(%rsp),%rdx
imul   %rdx,%rax
lea    0x1(%rsi),%rcx
mov    %rcx,0xa0(%rsp)
imul   %rdx,%rcx
mov    %rsi,%rdx
imul   %rbp,%rdx
mov    0x80(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdx
mov    %rdx,0xb0(%rsp)
mov    0x58(%rsp),%rdx
lea    (%rdx,%rcx,8),%r14
mov    0x790(%rsp),%rdx
lea    (%rdx,%rcx,8),%rcx
mov    %rcx,0xd0(%rsp)
lea    (%r12,%rax,8),%rcx
lea    (%rdx,%rax,8),%rax
mov    %rax,0xc8(%rsp)
xor    %ebp,%ebp
mov    %rcx,0x38(%rsp)
jmp    187b <create_xgrid_1dx2d_order1+0x6fb>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12,%rdi
movsd  0x10(%rsp),%xmm4
mov    0x38(%rsp),%rcx
add    $0x1,%rbp
cmp    %rbp,%rdi
je     1790 <create_xgrid_1dx2d_order1+0x610>
movupd (%rcx,%rbp,8),%xmm0
movapd %xmm0,0x110(%rsp)
movsd  (%r14,%rbp,8),%xmm1
movsd  %xmm1,0x120(%rsp)
movsd  -0x8(%r14,%rbp,8),%xmm2
movsd  %xmm2,0x128(%rsp)
ucomisd %xmm0,%xmm4
jb     18c8 <create_xgrid_1dx2d_order1+0x748>
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
ucomisd %xmm3,%xmm4
jb     18c8 <create_xgrid_1dx2d_order1+0x748>
ucomisd %xmm1,%xmm4
jb     18c8 <create_xgrid_1dx2d_order1+0x748>
ucomisd %xmm2,%xmm4
jae    186e <create_xgrid_1dx2d_order1+0x6ee>
unpcklpd %xmm2,%xmm1
movapd 0xf0(%rsp),%xmm3
movapd %xmm3,%xmm2
cmpnlepd %xmm0,%xmm2
movapd %xmm3,%xmm0
cmpnlepd %xmm1,%xmm0
shufps $0x88,%xmm0,%xmm2
pslld  $0x1f,%xmm2
movmskps %xmm2,%eax
test   %eax,%eax
je     186e <create_xgrid_1dx2d_order1+0x6ee>
mov    %rdi,%r12
mov    0xc8(%rsp),%rax
movups (%rax,%rbp,8),%xmm0
movaps %xmm0,0x2a0(%rsp)
mov    0xd0(%rsp),%rax
movups (%rax,%rbp,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movaps %xmm0,0x2b0(%rsp)
lea    0x2a0(%rsp),%r15
mov    %r15,%rdi
lea    0x110(%rsp),%r13
mov    %r13,%rsi
mov    $0x4,%edx
movsd  0x20(%rsp),%xmm0
call   1070 <fix_lon@plt>
mov    %r15,%rdi
lea    0x430(%rsp),%r15
lea    0x5c0(%rsp),%rbx
mov    %r13,%rsi
mov    %eax,%edx
movsd  0xc0(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
movsd  0xb8(%rsp),%xmm2
movapd 0x40(%rsp),%xmm3
mov    %rbx,%rcx
mov    %r15,%r8
call   1040 <clip@plt>
test   %eax,%eax
jle    1860 <create_xgrid_1dx2d_order1+0x6e0>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %eax,%edx
call   1060 <poly_area@plt>
mov    0x7a0(%rsp),%rax
mov    0x28(%rsp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x60(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm1
mov    0xb0(%rsp),%rax
minsd  (%rax,%rbp,8),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
ucomisd 0x629(%rip),%xmm2
jbe    1860 <create_xgrid_1dx2d_order1+0x6e0>
movslq 0x30(%rsp),%rax
mov    0x7c8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
mov    0x7a8(%rsp),%rcx
mov    0xa8(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x7b0(%rsp),%rcx
mov    0x18(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x7b8(%rsp),%rcx
mov    %ebp,(%rcx,%rax,4)
mov    0x7c0(%rsp),%rcx
mov    0x8(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
lea    0x1(%rax),%ecx
mov    %ecx,0x30(%rsp)
cmp    $0xf4240,%eax
jl     1860 <create_xgrid_1dx2d_order1+0x6e0>
lea    0x5c2(%rip),%rdi
call   1050 <error_handler@plt>
jmp    1860 <create_xgrid_1dx2d_order1+0x6e0>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%rsi
add    $0x1,%rsi
mov    %rsi,%rcx
mov    %rsi,0x8(%rsp)
cmp    0xe8(%rsp),%rsi
jne    17db <create_xgrid_1dx2d_order1+0x65b>
mov    0x108(%rsp),%rcx
jmp    16d7 <create_xgrid_1dx2d_order1+0x557>
movl   $0x0,0x30(%rsp)
mov    0x60(%rsp),%rdi
call   1030 <free@plt>
mov    0x80(%rsp),%rdi
call   1030 <free@plt>
mov    0x30(%rsp),%eax
add    $0x758,%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_1dx2d_order1(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) {
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca double*
%20 = alloca double*
%21 = alloca double*
%22 = alloca double*
%23 = alloca double*
%24 = alloca i32*
%25 = alloca i32*
%26 = alloca i32*
%27 = alloca i32*
%28 = alloca double*
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca i32
%36 = alloca i32
%37 = alloca i32
%38 = alloca i32
%39 = alloca i32
%40 = alloca double
%41 = alloca double
%42 = alloca double
%43 = alloca double
%44 = alloca [50 x double]
%45 = alloca [50 x double]
%46 = alloca [50 x double]
%47 = alloca [50 x double]
%48 = alloca double*
%49 = alloca double*
%50 = alloca double
%51 = alloca double*
%52 = alloca double*
%53 = alloca i32
%54 = alloca i32
%55 = alloca double
store i32* %0, i32** %15
store i32* %1, i32** %16
store i32* %2, i32** %17
store i32* %3, i32** %18
store double* %4, double** %19
store double* %5, double** %20
store double* %6, double** %21
store double* %7, double** %22
store double* %8, double** %23
store i32* %9, i32** %24
store i32* %10, i32** %25
store i32* %11, i32** %26
store i32* %12, i32** %27
store double* %13, double** %28
%56 = load i32*, i32** %15
%57 = load i32, i32* %56
store i32 %57, i32* %29
%58 = load i32*, i32** %16
%59 = load i32, i32* %58
store i32 %59, i32* %30
%60 = load i32*, i32** %17
%61 = load i32, i32* %60
store i32 %61, i32* %31
%62 = load i32*, i32** %18
%63 = load i32, i32* %62
store i32 %63, i32* %32
store i32 0, i32* %39
%64 = load i32, i32* %29
%65 = add nsw i32 %64, 1
store i32 %65, i32* %33
%66 = load i32, i32* %31
%67 = add nsw i32 %66, 1
store i32 %67, i32* %34
%68 = load i32, i32* %29
%69 = load i32, i32* %30
%70 = mul nsw i32 %68, %69
%71 = sext i32 %70 to i64
%72 = mul i64 %71, 8
%73 = trunc i64 %72 to i32
%74 = call i64 @malloc(i32 %73)
%75 = inttoptr i64 %74 to double*
store double* %75, double** %48
%76 = load i32, i32* %31
%77 = load i32, i32* %32
%78 = mul nsw i32 %76, %77
%79 = sext i32 %78 to i64
%80 = mul i64 %79, 8
%81 = trunc i64 %80 to i32
%82 = call i64 @malloc(i32 %81)
%83 = inttoptr i64 %82 to double*
store double* %83, double** %49
%84 = load i32, i32* %29
%85 = add nsw i32 %84, 1
%86 = load i32, i32* %30
%87 = add nsw i32 %86, 1
%88 = mul nsw i32 %85, %87
%89 = sext i32 %88 to i64
%90 = mul i64 %89, 8
%91 = trunc i64 %90 to i32
%92 = call i64 @malloc(i32 %91)
%93 = inttoptr i64 %92 to double*
store double* %93, double** %51
%94 = load i32, i32* %29
%95 = add nsw i32 %94, 1
%96 = load i32, i32* %30
%97 = add nsw i32 %96, 1
%98 = mul nsw i32 %95, %97
%99 = sext i32 %98 to i64
%100 = mul i64 %99, 8
%101 = trunc i64 %100 to i32
%102 = call i64 @malloc(i32 %101)
%103 = inttoptr i64 %102 to double*
store double* %103, double** %52
store i32 0, i32* %36
br label %104
104: ; preds = %144, %14
%105 = load i32, i32* %36
%106 = load i32, i32* %30
%107 = icmp sle i32 %105, %106
br i1 %107, label %108, label %147
108: ; preds = %104
store i32 0, i32* %35
br label %109
109: ; preds = %140, %108
%110 = load i32, i32* %35
%111 = load i32, i32* %29
%112 = icmp sle i32 %110, %111
br i1 %112, label %113, label %143
113: ; preds = %109
%114 = load double*, double** %19
%115 = load i32, i32* %35
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %114, i64 %116
%118 = load double, double* %117
%119 = load double*, double** %51
%120 = load i32, i32* %36
%121 = load i32, i32* %33
%122 = mul nsw i32 %120, %121
%123 = load i32, i32* %35
%124 = add nsw i32 %122, %123
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %119, i64 %125
store double %118, double* %126
%127 = load double*, double** %20
%128 = load i32, i32* %36
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds double, double* %127, i64 %129
%131 = load double, double* %130
%132 = load double*, double** %52
%133 = load i32, i32* %36
%134 = load i32, i32* %33
%135 = mul nsw i32 %133, %134
%136 = load i32, i32* %35
%137 = add nsw i32 %135, %136
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %132, i64 %138
store double %131, double* %139
br label %140
140: ; preds = %113
%141 = load i32, i32* %35
%142 = add nsw i32 %141, 1
store i32 %142, i32* %35
br label %109
143: ; preds = %109
br label %144
144: ; preds = %143
%145 = load i32, i32* %36
%146 = add nsw i32 %145, 1
store i32 %146, i32* %36
br label %104
147: ; preds = %104
%148 = load i32, i32* %29
%149 = icmp sgt i32 %148, 1
br i1 %149, label %150, label %157
150: ; preds = %147
%151 = load i32*, i32** %15
%152 = load i32*, i32** %16
%153 = load double*, double** %51
%154 = load double*, double** %52
%155 = load double*, double** %48
%156 = call i32 @get_grid_area(i32* %151, i32* %152, double* %153, double* %154, double* %155)
br label %164
157: ; preds = %147
%158 = load i32*, i32** %15
%159 = load i32*, i32** %16
%160 = load double*, double** %51
%161 = load double*, double** %52
%162 = load double*, double** %48
%163 = call i32 @get_grid_area_no_adjust(i32* %158, i32* %159, double* %160, double* %161, double* %162)
br label %164
164: ; preds = %157, %150
%165 = load i32*, i32** %17
%166 = load i32*, i32** %18
%167 = load double*, double** %21
%168 = load double*, double** %22
%169 = load double*, double** %49
%170 = call i32 @get_grid_area(i32* %165, i32* %166, double* %167, double* %168, double* %169)
%171 = load double*, double** %51
%172 = call i32 @free(double* %171)
%173 = load double*, double** %52
%174 = call i32 @free(double* %173)
store i32 0, i32* %36
br label %175
175: ; preds = %485, %164
%176 = load i32, i32* %36
%177 = load i32, i32* %30
%178 = icmp slt i32 %176, %177
br i1 %178, label %179, label %488
179: ; preds = %175
store i32 0, i32* %35
br label %180
180: ; preds = %481, %179
%181 = load i32, i32* %35
%182 = load i32, i32* %29
%183 = icmp slt i32 %181, %182
br i1 %183, label %184, label %484
184: ; preds = %180
%185 = load double*, double** %23
%186 = load i32, i32* %36
%187 = load i32, i32* %29
%188 = mul nsw i32 %186, %187
%189 = load i32, i32* %35
%190 = add nsw i32 %188, %189
%191 = sext i32 %190 to i64
%192 = getelementptr inbounds double, double* %185, i64 %191
%193 = load double, double* %192
%194 = fcmp ogt double %193, 5.000000e-01
br i1 %194, label %195, label %480
195: ; preds = %184
%196 = load double*, double** %19
%197 = load i32, i32* %35
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds double, double* %196, i64 %198
%200 = load double, double* %199
store double %200, double* %40
%201 = load double*, double** %20
%202 = load i32, i32* %36
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %201, i64 %203
%205 = load double, double* %204
store double %205, double* %41
%206 = load double*, double** %19
%207 = load i32, i32* %35
%208 = add nsw i32 %207, 1
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds double, double* %206, i64 %209
%211 = load double, double* %210
store double %211, double* %42
%212 = load double*, double** %20
%213 = load i32, i32* %36
%214 = add nsw i32 %213, 1
%215 = sext i32 %214 to i64
%216 = getelementptr inbounds double, double* %212, i64 %215
%217 = load double, double* %216
store double %217, double* %43
store i32 0, i32* %38
br label %218
218: ; preds = %476, %195
%219 = load i32, i32* %38
%220 = load i32, i32* %32
%221 = icmp slt i32 %219, %220
br i1 %221, label %222, label %479
222: ; preds = %218
store i32 0, i32* %37
br label %223
223: ; preds = %472, %222
%224 = load i32, i32* %37
%225 = load i32, i32* %31
%226 = icmp slt i32 %224, %225
br i1 %226, label %227, label %475
227: ; preds = %223
%228 = load double*, double** %22
%229 = load i32, i32* %38
%230 = load i32, i32* %34
%231 = mul nsw i32 %229, %230
%232 = load i32, i32* %37
%233 = add nsw i32 %231, %232
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds double, double* %228, i64 %234
%236 = load double, double* %235
%237 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
store double %236, double* %237
%238 = load double*, double** %22
%239 = load i32, i32* %38
%240 = load i32, i32* %34
%241 = mul nsw i32 %239, %240
%242 = load i32, i32* %37
%243 = add nsw i32 %241, %242
%244 = add nsw i32 %243, 1
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds double, double* %238, i64 %245
%247 = load double, double* %246
%248 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
store double %247, double* %248
%249 = load double*, double** %22
%250 = load i32, i32* %38
%251 = add nsw i32 %250, 1
%252 = load i32, i32* %34
%253 = mul nsw i32 %251, %252
%254 = load i32, i32* %37
%255 = add nsw i32 %253, %254
%256 = add nsw i32 %255, 1
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds double, double* %249, i64 %257
%259 = load double, double* %258
%260 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
store double %259, double* %260
%261 = load double*, double** %22
%262 = load i32, i32* %38
%263 = add nsw i32 %262, 1
%264 = load i32, i32* %34
%265 = mul nsw i32 %263, %264
%266 = load i32, i32* %37
%267 = add nsw i32 %265, %266
%268 = sext i32 %267 to i64
%269 = getelementptr inbounds double, double* %261, i64 %268
%270 = load double, double* %269
%271 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
store double %270, double* %271
%272 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%273 = load double, double* %272
%274 = load double, double* %41
%275 = fcmp ole double %273, %274
br i1 %275, label %276, label %292
276: ; preds = %227
%277 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
%278 = load double, double* %277
%279 = load double, double* %41
%280 = fcmp ole double %278, %279
br i1 %280, label %281, label %292
281: ; preds = %276
%282 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
%283 = load double, double* %282
%284 = load double, double* %41
%285 = fcmp ole double %283, %284
br i1 %285, label %286, label %292
286: ; preds = %281
%287 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
%288 = load double, double* %287
%289 = load double, double* %41
%290 = fcmp ole double %288, %289
br i1 %290, label %291, label %292
291: ; preds = %286
br label %472
292: ; preds = %286, %281, %276, %227
%293 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%294 = load double, double* %293
%295 = load double, double* %43
%296 = fcmp oge double %294, %295
br i1 %296, label %297, label %313
297: ; preds = %292
%298 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
%299 = load double, double* %298
%300 = load double, double* %43
%301 = fcmp oge double %299, %300
br i1 %301, label %302, label %313
302: ; preds = %297
%303 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
%304 = load double, double* %303
%305 = load double, double* %43
%306 = fcmp oge double %304, %305
br i1 %306, label %307, label %313
307: ; preds = %302
%308 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
%309 = load double, double* %308
%310 = load double, double* %43
%311 = fcmp oge double %309, %310
br i1 %311, label %312, label %313
312: ; preds = %307
br label %472
313: ; preds = %307, %302, %297, %292
%314 = load double*, double** %21
%315 = load i32, i32* %38
%316 = load i32, i32* %34
%317 = mul nsw i32 %315, %316
%318 = load i32, i32* %37
%319 = add nsw i32 %317, %318
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds double, double* %314, i64 %320
%322 = load double, double* %321
%323 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
store double %322, double* %323
%324 = load double*, double** %21
%325 = load i32, i32* %38
%326 = load i32, i32* %34
%327 = mul nsw i32 %325, %326
%328 = load i32, i32* %37
%329 = add nsw i32 %327, %328
%330 = add nsw i32 %329, 1
%331 = sext i32 %330 to i64
%332 = getelementptr inbounds double, double* %324, i64 %331
%333 = load double, double* %332
%334 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 1
store double %333, double* %334
%335 = load double*, double** %21
%336 = load i32, i32* %38
%337 = add nsw i32 %336, 1
%338 = load i32, i32* %34
%339 = mul nsw i32 %337, %338
%340 = load i32, i32* %37
%341 = add nsw i32 %339, %340
%342 = add nsw i32 %341, 1
%343 = sext i32 %342 to i64
%344 = getelementptr inbounds double, double* %335, i64 %343
%345 = load double, double* %344
%346 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 2
store double %345, double* %346
%347 = load double*, double** %21
%348 = load i32, i32* %38
%349 = add nsw i32 %348, 1
%350 = load i32, i32* %34
%351 = mul nsw i32 %349, %350
%352 = load i32, i32* %37
%353 = add nsw i32 %351, %352
%354 = sext i32 %353 to i64
%355 = getelementptr inbounds double, double* %347, i64 %354
%356 = load double, double* %355
%357 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 3
store double %356, double* %357
%358 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
%359 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%360 = load double, double* %40
%361 = load double, double* %42
%362 = fadd double %360, %361
%363 = fdiv double %362, 2.000000e+00
%364 = call i32 @fix_lon(double* %358, double* %359, i32 4, double %363)
store i32 %364, i32* %53
%365 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
%366 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%367 = load i32, i32* %53
%368 = load double, double* %40
%369 = load double, double* %41
%370 = load double, double* %42
%371 = load double, double* %43
%372 = getelementptr inbounds [50 x double], [50 x double]* %46, i64 0, i64 0
%373 = getelementptr inbounds [50 x double], [50 x double]* %47, i64 0, i64 0
%374 = call i32 @clip(double* %365, double* %366, i32 %367, double %368, double %369, double %370, double %371, double* %372, double* %373)
store i32 %374, i32* %54
%375 = icmp sgt i32 %374, 0
br i1 %375, label %376, label %471
376: ; preds = %313
%377 = getelementptr inbounds [50 x double], [50 x double]* %46, i64 0, i64 0
%378 = getelementptr inbounds [50 x double], [50 x double]* %47, i64 0, i64 0
%379 = load i32, i32* %54
%380 = call double @poly_area(double* %377, double* %378, i32 %379)
%381 = load double*, double** %23
%382 = load i32, i32* %36
%383 = load i32, i32* %29
%384 = mul nsw i32 %382, %383
%385 = load i32, i32* %35
%386 = add nsw i32 %384, %385
%387 = sext i32 %386 to i64
%388 = getelementptr inbounds double, double* %381, i64 %387
%389 = load double, double* %388
%390 = fmul double %380, %389
store double %390, double* %55
%391 = load double*, double** %48
%392 = load i32, i32* %36
%393 = load i32, i32* %29
%394 = mul nsw i32 %392, %393
%395 = load i32, i32* %35
%396 = add nsw i32 %394, %395
%397 = sext i32 %396 to i64
%398 = getelementptr inbounds double, double* %391, i64 %397
%399 = load double, double* %398
%400 = load double*, double** %49
%401 = load i32, i32* %38
%402 = load i32, i32* %31
%403 = mul nsw i32 %401, %402
%404 = load i32, i32* %37
%405 = add nsw i32 %403, %404
%406 = sext i32 %405 to i64
%407 = getelementptr inbounds double, double* %400, i64 %406
%408 = load double, double* %407
%409 = fcmp olt double %399, %408
br i1 %409, label %410, label %420
410: ; preds = %376
%411 = load double*, double** %48
%412 = load i32, i32* %36
%413 = load i32, i32* %29
%414 = mul nsw i32 %412, %413
%415 = load i32, i32* %35
%416 = add nsw i32 %414, %415
%417 = sext i32 %416 to i64
%418 = getelementptr inbounds double, double* %411, i64 %417
%419 = load double, double* %418
br label %430
420: ; preds = %376
%421 = load double*, double** %49
%422 = load i32, i32* %38
%423 = load i32, i32* %31
%424 = mul nsw i32 %422, %423
%425 = load i32, i32* %37
%426 = add nsw i32 %424, %425
%427 = sext i32 %426 to i64
%428 = getelementptr inbounds double, double* %421, i64 %427
%429 = load double, double* %428
br label %430
430: ; preds = %420, %410
%431 = phi double [ %419, %410 ], [ %429, %420 ]
store double %431, double* %50
%432 = load double, double* %55
%433 = load double, double* %50
%434 = fdiv double %432, %433
%435 = fcmp ogt double %434, 0x3EB0C6F7A0B5ED8D
br i1 %435, label %436, label %470
436: ; preds = %430
%437 = load double, double* %55
%438 = load double*, double** %28
%439 = load i32, i32* %39
%440 = sext i32 %439 to i64
%441 = getelementptr inbounds double, double* %438, i64 %440
store double %437, double* %441
%442 = load i32, i32* %35
%443 = load i32*, i32** %24
%444 = load i32, i32* %39
%445 = sext i32 %444 to i64
%446 = getelementptr inbounds i32, i32* %443, i64 %445
store i32 %442, i32* %446
%447 = load i32, i32* %36
%448 = load i32*, i32** %25
%449 = load i32, i32* %39
%450 = sext i32 %449 to i64
%451 = getelementptr inbounds i32, i32* %448, i64 %450
store i32 %447, i32* %451
%452 = load i32, i32* %37
%453 = load i32*, i32** %26
%454 = load i32, i32* %39
%455 = sext i32 %454 to i64
%456 = getelementptr inbounds i32, i32* %453, i64 %455
store i32 %452, i32* %456
%457 = load i32, i32* %38
%458 = load i32*, i32** %27
%459 = load i32, i32* %39
%460 = sext i32 %459 to i64
%461 = getelementptr inbounds i32, i32* %458, i64 %460
store i32 %457, i32* %461
%462 = load i32, i32* %39
%463 = add nsw i32 %462, 1
store i32 %463, i32* %39
%464 = load i32, i32* %39
%465 = sitofp i32 %464 to double
%466 = fcmp ogt double %465, 1.000000e+06
br i1 %466, label %467, label %469
467: ; preds = %436
%468 = call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %469
469: ; preds = %467, %436
br label %470
470: ; preds = %469, %430
br label %471
471: ; preds = %470, %313
br label %472
472: ; preds = %471, %312, %291
%473 = load i32, i32* %37
%474 = add nsw i32 %473, 1
store i32 %474, i32* %37
br label %223
475: ; preds = %223
br label %476
476: ; preds = %475
%477 = load i32, i32* %38
%478 = add nsw i32 %477, 1
store i32 %478, i32* %38
br label %218
479: ; preds = %218
br label %480
480: ; preds = %479, %184
br label %481
481: ; preds = %480
%482 = load i32, i32* %35
%483 = add nsw i32 %482, 1
store i32 %483, i32* %35
br label %180
484: ; preds = %180
br label %485
485: ; preds = %484
%486 = load i32, i32* %36
%487 = add nsw i32 %486, 1
store i32 %487, i32* %36
br label %175
488: ; preds = %175
%489 = load double*, double** %48
%490 = call i32 @free(double* %489)
%491 = load double*, double** %49
%492 = call i32 @free(double* %491)
%493 = load i32, i32* %39
ret i32 %493
}

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