#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 *);
scalar_t__ malloc(int);
double const poly_area(double *, double *, int);
int create_xgrid_2dx1d_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;
  int n_in, n_out;
  double Xarea;
  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((nx2 + 1) * (ny2 + 1) * sizeof(double));
  tmpy = (double *)malloc((nx2 + 1) * (ny2 + 1) * sizeof(double));
  for (j2 = 0; j2 <= ny2; j2++)
    for (i2 = 0; i2 <= nx2; i2++) {
      tmpx[j2 * nx2p + i2] = lon_out[i2];
      tmpy[j2 * nx2p + i2] = lat_out[j2];
    }
  get_grid_area(nlon_in, nlat_in, lon_in, lat_in, area_in);
  get_grid_area(nlon_out, nlat_out, tmpx, tmpy, area_out);
  free(tmpx);
  free(tmpy);
  for (j2 = 0; j2 < ny2; j2++)
    for (i2 = 0; i2 < nx2; i2++) {
      ll_lon = lon_out[i2];
      ll_lat = lat_out[j2];
      ur_lon = lon_out[i2 + 1];
      ur_lat = lat_out[j2 + 1];
      for (j1 = 0; j1 < ny1; j1++)
        for (i1 = 0; i1 < nx1; i1++)
          if (mask_in[j1 * nx1 + i1] > (0.5)) {
            y_in[0] = lat_in[j1 * nx1p + i1];
            y_in[1] = lat_in[j1 * nx1p + i1 + 1];
            y_in[2] = lat_in[(j1 + 1) * nx1p + i1 + 1];
            y_in[3] = lat_in[(j1 + 1) * nx1p + i1];
            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_in[j1 * nx1p + i1];
            x_in[1] = lon_in[j1 * nx1p + i1 + 1];
            x_in[2] = lon_in[(j1 + 1) * nx1p + i1 + 1];
            x_in[3] = lon_in[(j1 + 1) * nx1p + i1];
            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_2dx1d_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    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    -0x40(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1080 <malloc@plt>
mov    %rax,-0x6e0(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    -0x40(%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,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x40(%rbp),%eax
jg     12ff <create_xgrid_2dx1d_order1+0x18f>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jg     12ec <create_xgrid_2dx1d_order1+0x17c>
mov    0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e0(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    0x18(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e8(%rbp),%rax
mov    -0x58(%rbp),%ecx
imul   -0x48(%rbp),%ecx
add    -0x54(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    1286 <create_xgrid_2dx1d_order1+0x116>
jmp    12f1 <create_xgrid_2dx1d_order1+0x181>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1273 <create_xgrid_2dx1d_order1+0x103>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x6c8(%rbp),%r8
call   1090 <get_grid_area@plt>
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x6e0(%rbp),%rdx
mov    -0x6e8(%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,-0x58(%rbp)
mov    -0x58(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1813 <create_xgrid_2dx1d_order1+0x6a3>
movl   $0x0,-0x54(%rbp)
mov    -0x54(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1800 <create_xgrid_2dx1d_order1+0x690>
mov    0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    0x18(%rbp),%rax
movslq -0x58(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    0x10(%rbp),%rax
mov    -0x54(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    0x18(%rbp),%rax
mov    -0x58(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x80(%rbp)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    17ed <create_xgrid_2dx1d_order1+0x67d>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    17da <create_xgrid_2dx1d_order1+0x66a>
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  0xbef(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17c7 <create_xgrid_2dx1d_order1+0x657>
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3a0(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x398(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x390(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%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     1500 <create_xgrid_2dx1d_order1+0x390>
movsd  -0x398(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1500 <create_xgrid_2dx1d_order1+0x390>
movsd  -0x390(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1500 <create_xgrid_2dx1d_order1+0x390>
movsd  -0x388(%rbp),%xmm1
ff
movsd  -0x70(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1500 <create_xgrid_2dx1d_order1+0x390>
jmp    17cc <create_xgrid_2dx1d_order1+0x65c>
movsd  -0x3a0(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1551 <create_xgrid_2dx1d_order1+0x3e1>
movsd  -0x398(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1551 <create_xgrid_2dx1d_order1+0x3e1>
movsd  -0x390(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1551 <create_xgrid_2dx1d_order1+0x3e1>
movsd  -0x388(%rbp),%xmm0
ff
ucomisd -0x80(%rbp),%xmm0
jb     1551 <create_xgrid_2dx1d_order1+0x3e1>
jmp    17cc <create_xgrid_2dx1d_order1+0x65c>
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
mov    -0x28(%rbp),%rax
mov    -0x50(%rbp),%ecx
add    $0x1,%ecx
imul   -0x44(%rbp),%ecx
add    -0x4c(%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  0xa13(%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    17c2 <create_xgrid_2dx1d_order1+0x652>
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    16ec <create_xgrid_2dx1d_order1+0x57c>
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    170d <create_xgrid_2dx1d_order1+0x59d>
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  0x8db(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17bd <create_xgrid_2dx1d_order1+0x64d>
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  0x876(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17b8 <create_xgrid_2dx1d_order1+0x648>
lea    0x86d(%rip),%rdi
call   1050 <error_handler@plt>
jmp    17bd <create_xgrid_2dx1d_order1+0x64d>
jmp    17c2 <create_xgrid_2dx1d_order1+0x652>
jmp    17c7 <create_xgrid_2dx1d_order1+0x657>
jmp    17cc <create_xgrid_2dx1d_order1+0x65c>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    13e7 <create_xgrid_2dx1d_order1+0x277>
jmp    17df <create_xgrid_2dx1d_order1+0x66f>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    13d4 <create_xgrid_2dx1d_order1+0x264>
jmp    17f2 <create_xgrid_2dx1d_order1+0x682>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    136f <create_xgrid_2dx1d_order1+0x1ff>
jmp    1805 <create_xgrid_2dx1d_order1+0x695>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    135c <create_xgrid_2dx1d_order1+0x1ec>
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_2dx1d_order1>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x758,%rsp
mov    %r9,0xe0(%rsp)
mov    %r8,0xd8(%rsp)
mov    0x798(%rsp),%r13
mov    0x790(%rsp),%r14
mov    %rdi,0x50(%rsp)
movslq (%rdi),%rax
mov    %rsi,0x58(%rsp)
mov    (%rsi),%esi
mov    %rdx,0x60(%rsp)
movslq (%rdx),%rbx
mov    %ebx,%edx
mov    %rdx,0xc0(%rsp)
mov    %rcx,0x70(%rsp)
mov    (%rcx),%r12d
lea    0x1(%rbx),%ebp
mov    %rsi,0xe8(%rsp)
mov    %esi,%edi
mov    %rax,0xd0(%rsp)
imul   %eax,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,0x68(%rsp)
mov    %rbx,0xc8(%rsp)
mov    %ebx,%edi
imul   %r12d,%edi
shl    $0x3,%edi
call   1080 <malloc@plt>
mov    %rax,0x90(%rsp)
lea    0x1(%r12),%ebx
mov    %ebp,0x38(%rsp)
imul   %ebx,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
call   1080 <malloc@plt>
mov    %rax,0x8(%rsp)
mov    %ebp,%edi
call   1080 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %r12,0xb8(%rsp)
test   %r12d,%r12d
js     15cb <create_xgrid_2dx1d_order1+0x45b>
movslq 0x38(%rsp),%r15
mov    %ebx,%r11d
mov    %r15d,%edx
lea    (%r14,%rdx,8),%rax
mov    %rax,0x98(%rsp)
mov    %edx,%eax
and    $0xfffffffc,%eax
mov    %rax,0x88(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0x80(%rsp)
mov    %rax,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x18(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0x78(%rsp)
mov    %rdx,%rax
neg    %rax
mov    %rax,0xf0(%rsp)
mov    0x40(%rsp),%rax
lea    0x30(%rax),%rsi
lea    0x0(,%r15,8),%rdi
mov    0x8(%rsp),%rbp
lea    0x30(%rbp),%rcx
lea    0x8(%rbp),%rbx
lea    0x8(%rax),%r10
xor    %r8d,%r8d
mov    %r15,0x10(%rsp)
mov    %r11,0x28(%rsp)
mov    %rdi,0x20(%rsp)
jmp    12f9 <create_xgrid_2dx1d_order1+0x189>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r8
add    %rdi,%rsi
add    %rdi,%rcx
add    %rdi,%rbx
add    %rdi,%r10
cmp    %r11,%r8
je     15cb <create_xgrid_2dx1d_order1+0x45b>
cmpl   $0x0,0xc0(%rsp)
js     12e0 <create_xgrid_2dx1d_order1+0x170>
mov    %r8,%r9
imul   %r15,%r9
cmp    $0x4,%r15d
jae    1320 <create_xgrid_2dx1d_order1+0x1b0>
xor    %eax,%eax
jmp    1510 <create_xgrid_2dx1d_order1+0x3a0>
nopw   0x0(%rax,%rax,1)
lea    (%r9,%rdx,1),%rax
mov    0x8(%rsp),%rdi
lea    (%rdi,%r9,8),%rbp
lea    (%rdi,%rax,8),%rdi
mov    0x40(%rsp),%r15
lea    (%r15,%r9,8),%r11
lea    (%r15,%rax,8),%r15
lea    0x0(,%r8,8),%r12
add    %r13,%r12
lea    0x8(%r13,%r8,8),%r13
cmp    %r15,%rbp
setb   0x38(%rsp)
cmp    %rdi,%r11
setb   0x30(%rsp)
mov    0x98(%rsp),%rax
cmp    %rax,%rbp
setb   0xb0(%rsp)
cmp    %r14,%rdi
seta   0xa8(%rsp)
cmp    %r13,%rbp
setb   %bpl
cmp    %rdi,%r12
setb   0xa0(%rsp)
cmp    %rax,%r11
setb   %dil
cmp    %r14,%r15
seta   %r14b
cmp    %r13,%r11
setb   %r11b
cmp    %r15,%r12
setb   %r15b
mov    0x30(%rsp),%al
test   %al,0x38(%rsp)
jne    15b4 <create_xgrid_2dx1d_order1+0x444>
mov    %r14d,%r12d
mov    0xa8(%rsp),%al
and    %al,0xb0(%rsp)
mov    0x798(%rsp),%r13
mov    0x790(%rsp),%r14
jne    14fb <create_xgrid_2dx1d_order1+0x38b>
and    0xa0(%rsp),%bpl
jne    14fb <create_xgrid_2dx1d_order1+0x38b>
and    %r12b,%dil
jne    14fb <create_xgrid_2dx1d_order1+0x38b>
mov    $0x0,%eax
and    %r15b,%r11b
mov    0x10(%rsp),%r15
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%rdi
jne    1510 <create_xgrid_2dx1d_order1+0x3a0>
cmpq   $0x0,0x80(%rsp)
je     15a1 <create_xgrid_2dx1d_order1+0x431>
movsd  0x0(%r13,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0x78(%rsp),%rax
xor    %r11d,%r11d
cs nopw 0x0(%rax,%rax,1)
nop
movups (%r14,%r11,8),%xmm1
movups 0x10(%r14,%r11,8),%xmm2
movups %xmm1,-0x30(%rcx,%r11,8)
movups %xmm2,-0x20(%rcx,%r11,8)
movupd %xmm0,-0x30(%rsi,%r11,8)
movupd %xmm0,-0x20(%rsi,%r11,8)
movupd 0x20(%r14,%r11,8),%xmm1
movupd 0x30(%r14,%r11,8),%xmm2
movupd %xmm1,-0x10(%rcx,%r11,8)
movupd %xmm2,(%rcx,%r11,8)
movupd %xmm0,-0x10(%rsi,%r11,8)
movupd %xmm0,(%rsi,%r11,8)
add    $0x8,%r11
add    $0xfffffffffffffffe,%rax
jne    1440 <create_xgrid_2dx1d_order1+0x2d0>
testb  $0x1,0x18(%rsp)
je     14db <create_xgrid_2dx1d_order1+0x36b>
movups (%r14,%r11,8),%xmm0
movupd 0x10(%r14,%r11,8),%xmm1
add    %r9,%r11
mov    0x8(%rsp),%rax
movups %xmm0,(%rax,%r11,8)
movupd %xmm1,0x10(%rax,%r11,8)
movsd  0x0(%r13,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0x40(%rsp),%rax
movupd %xmm0,(%rax,%r11,8)
movupd %xmm0,0x10(%rax,%r11,8)
mov    0x88(%rsp),%rdi
mov    %rdi,%rax
cmp    %rdx,%rdi
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%rdi
je     12e0 <create_xgrid_2dx1d_order1+0x170>
jmp    1510 <create_xgrid_2dx1d_order1+0x3a0>
xor    %eax,%eax
mov    0x10(%rsp),%r15
mov    0x28(%rsp),%r11
mov    0x20(%rsp),%rdi
nopl   0x0(%rax)
mov    %rax,%rbp
test   $0x1,%dl
je     1547 <create_xgrid_2dx1d_order1+0x3d7>
movsd  (%r14,%rax,8),%xmm0
add    %rax,%r9
mov    0x8(%rsp),%rbp
movsd  %xmm0,0x0(%rbp,%r9,8)
movsd  0x0(%r13,%r8,8),%xmm0
mov    0x40(%rsp),%rbp
movsd  %xmm0,0x0(%rbp,%r9,8)
mov    %rax,%rbp
or     $0x1,%rbp
not    %rax
cmp    0xf0(%rsp),%rax
je     12e0 <create_xgrid_2dx1d_order1+0x170>
nopl   0x0(%rax,%rax,1)
movsd  (%r14,%rbp,8),%xmm0
movsd  %xmm0,-0x8(%rbx,%rbp,8)
movsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,-0x8(%r10,%rbp,8)
movsd  0x8(%r14,%rbp,8),%xmm0
movsd  %xmm0,(%rbx,%rbp,8)
movsd  0x0(%r13,%r8,8),%xmm0
movsd  %xmm0,(%r10,%rbp,8)
add    $0x2,%rbp
cmp    %rbp,%rdx
jne    1560 <create_xgrid_2dx1d_order1+0x3f0>
jmp    12e0 <create_xgrid_2dx1d_order1+0x170>
xor    %r11d,%r11d
testb  $0x1,0x18(%rsp)
jne    149e <create_xgrid_2dx1d_order1+0x32e>
jmp    14db <create_xgrid_2dx1d_order1+0x36b>
xor    %eax,%eax
mov    0x798(%rsp),%r13
mov    0x790(%rsp),%r14
jmp    14fd <create_xgrid_2dx1d_order1+0x38d>
mov    0x50(%rsp),%rdi
mov    0x58(%rsp),%rsi
mov    0xd8(%rsp),%rdx
mov    0xe0(%rsp),%rbx
mov    %rbx,%rcx
mov    0x68(%rsp),%r8
call   1090 <get_grid_area@plt>
mov    0x60(%rsp),%rdi
mov    0x70(%rsp),%rsi
mov    0x8(%rsp),%rbp
mov    %rbp,%rdx
mov    0x40(%rsp),%r15
mov    %r15,%rcx
mov    0x90(%rsp),%r8
call   1090 <get_grid_area@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
cmpl   $0x0,0xb8(%rsp)
jle    1a5e <create_xgrid_2dx1d_order1+0x8ee>
mov    0xd0(%rsp),%rcx
mov    %ecx,%r13d
lea    0x1(%rcx),%rax
mov    %rax,0x60(%rsp)
lea    0x8(%rbx),%rax
mov    %rax,0x58(%rsp)
xor    %eax,%eax
mov    %rax,0x18(%rsp)
movsd  0x99d(%rip),%xmm4
movl   $0x0,0x10(%rsp)
mov    0xc8(%rsp),%rdx
jmp    169e <create_xgrid_2dx1d_order1+0x52e>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x108(%rsp),%rsi
mov    %rsi,%rax
mov    %rsi,0x18(%rsp)
cmp    0xb8(%rsp),%rsi
je     1a66 <create_xgrid_2dx1d_order1+0x8f6>
test   %edx,%edx
jle    1a50 <create_xgrid_2dx1d_order1+0x8e0>
mov    0x18(%rsp),%rax
lea    0x1(%rax),%rsi
mov    %rsi,0x108(%rsp)
imul   %rdx,%rax
mov    %rax,0x50(%rsp)
xor    %edi,%edi
jmp    16e2 <create_xgrid_2dx1d_order1+0x572>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cmp    0xc0(%rsp),%rdi
mov    0x790(%rsp),%r14
je     1680 <create_xgrid_2dx1d_order1+0x510>
mov    %rdi,%rbp
add    $0x1,%rdi
cmpl   $0x0,0xe8(%rsp)
jle    16d0 <create_xgrid_2dx1d_order1+0x560>
movsd  (%r14,%rbp,8),%xmm0
movsd  0x8(%r14,%rbp,8),%xmm1
mov    0x798(%rsp),%rax
mov    0x18(%rsp),%rsi
movsd  (%rax,%rsi,8),%xmm5
movsd  0x8(%rax,%rsi,8),%xmm2
movsd  %xmm0,0xa8(%rsp)
movsd  %xmm1,0xa0(%rsp)
addsd  %xmm1,%xmm0
mulsd  %xmm4,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    0x50(%rsp),%rax
mov    %rbp,0x78(%rsp)
add    %rbp,%rax
mov    %rax,0x98(%rsp)
movapd %xmm2,0xf0(%rsp)
unpcklpd %xmm2,%xmm2
movapd %xmm2,0x40(%rsp)
xor    %ebp,%ebp
mov    %rdi,0x70(%rsp)
movsd  %xmm5,0x8(%rsp)
jmp    17a6 <create_xgrid_2dx1d_order1+0x636>
nop
mov    0x80(%rsp),%rax
mov    %rax,%rbp
mov    0xe0(%rsp),%rbx
mov    0xd0(%rsp),%rcx
mov    0xc8(%rsp),%rdx
mov    0x70(%rsp),%rdi
cmp    0xe8(%rsp),%rax
je     16d0 <create_xgrid_2dx1d_order1+0x560>
test   %ecx,%ecx
jle    1a40 <create_xgrid_2dx1d_order1+0x8d0>
mov    %rbp,%rax
imul   %rcx,%rax
mov    %rbp,%rcx
mov    0x60(%rsp),%rsi
imul   %rsi,%rcx
mov    %rbp,0x88(%rsp)
lea    0x1(%rbp),%rdx
mov    %rdx,0x80(%rsp)
imul   %rsi,%rdx
mov    0x58(%rsp),%rsi
lea    (%rsi,%rdx,8),%r12
mov    0xd8(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdx
mov    %rdx,0x38(%rsp)
lea    (%rbx,%rcx,8),%rdx
lea    (%rsi,%rcx,8),%rcx
mov    %rcx,0xb0(%rsp)
mov    0x7a0(%rsp),%rcx
lea    (%rcx,%rax,8),%rbp
mov    0x68(%rsp),%rcx
lea    (%rcx,%rax,8),%rax
mov    %rax,0x20(%rsp)
xor    %r15d,%r15d
mov    %rdx,0x30(%rsp)
jmp    184d <create_xgrid_2dx1d_order1+0x6dd>
movsd  0x7d1(%rip),%xmm4
movsd  0x8(%rsp),%xmm5
mov    0x30(%rsp),%rdx
nopw   0x0(%rax,%rax,1)
add    $0x1,%r15
cmp    %r15,%r13
je     1770 <create_xgrid_2dx1d_order1+0x600>
movsd  0x0(%rbp,%r15,8),%xmm0
ucomisd %xmm4,%xmm0
jbe    1840 <create_xgrid_2dx1d_order1+0x6d0>
movupd (%rdx,%r15,8),%xmm0
movapd %xmm0,0x110(%rsp)
movsd  (%r12,%r15,8),%xmm1
movsd  %xmm1,0x120(%rsp)
movsd  -0x8(%r12,%r15,8),%xmm2
movsd  %xmm2,0x128(%rsp)
ucomisd %xmm0,%xmm5
jb     18a8 <create_xgrid_2dx1d_order1+0x738>
movapd %xmm0,%xmm3
unpckhpd %xmm0,%xmm3
ucomisd %xmm3,%xmm5
jb     18a8 <create_xgrid_2dx1d_order1+0x738>
ucomisd %xmm1,%xmm5
jb     18a8 <create_xgrid_2dx1d_order1+0x738>
ucomisd %xmm2,%xmm5
jae    1840 <create_xgrid_2dx1d_order1+0x6d0>
unpcklpd %xmm2,%xmm1
movapd 0x40(%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     1840 <create_xgrid_2dx1d_order1+0x6d0>
mov    0xb0(%rsp),%rax
movups (%rax,%r15,8),%xmm0
movaps %xmm0,0x2a0(%rsp)
mov    0x38(%rsp),%rax
movups (%rax,%r15,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movaps %xmm0,0x2b0(%rsp)
lea    0x2a0(%rsp),%r14
mov    %r14,%rdi
lea    0x110(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x4,%edx
movsd  0x28(%rsp),%xmm0
call   1070 <fix_lon@plt>
mov    %r14,%rdi
lea    0x5c0(%rsp),%r14
mov    %rbx,%rsi
lea    0x430(%rsp),%rbx
mov    %eax,%edx
movsd  0xa8(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0xa0(%rsp),%xmm2
movapd 0xf0(%rsp),%xmm3
mov    %r14,%rcx
mov    %rbx,%r8
call   1040 <clip@plt>
test   %eax,%eax
jle    1827 <create_xgrid_2dx1d_order1+0x6b7>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
call   1060 <poly_area@plt>
mulsd  0x0(%rbp,%r15,8),%xmm0
mov    0x20(%rsp),%rax
movsd  (%rax,%r15,8),%xmm1
mov    0x90(%rsp),%rax
mov    0x98(%rsp),%rcx
minsd  (%rax,%rcx,8),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
ucomisd 0x64f(%rip),%xmm2
jbe    1827 <create_xgrid_2dx1d_order1+0x6b7>
movslq 0x10(%rsp),%rax
mov    0x7c8(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
mov    0x7a8(%rsp),%rcx
mov    %r15d,(%rcx,%rax,4)
mov    0x7b0(%rsp),%rcx
mov    0x88(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x7b8(%rsp),%rcx
mov    0x78(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x7c0(%rsp),%rcx
mov    0x18(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
lea    0x1(%rax),%ecx
mov    %ecx,0x10(%rsp)
cmp    $0xf4240,%eax
jl     1827 <create_xgrid_2dx1d_order1+0x6b7>
lea    0x5e7(%rip),%rdi
call   1050 <error_handler@plt>
jmp    1827 <create_xgrid_2dx1d_order1+0x6b7>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbp
mov    %rbp,%rax
jmp    1798 <create_xgrid_2dx1d_order1+0x628>
nopl   0x0(%rax)
mov    0x18(%rsp),%rsi
add    $0x1,%rsi
jmp    1688 <create_xgrid_2dx1d_order1+0x518>
movl   $0x0,0x10(%rsp)
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    0x90(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%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_2dx1d_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* %31
%85 = add nsw i32 %84, 1
%86 = load i32, i32* %32
%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* %31
%95 = add nsw i32 %94, 1
%96 = load i32, i32* %32
%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* %38
br label %104
104: ; preds = %144, %14
%105 = load i32, i32* %38
%106 = load i32, i32* %32
%107 = icmp sle i32 %105, %106
br i1 %107, label %108, label %147
108: ; preds = %104
store i32 0, i32* %37
br label %109
109: ; preds = %140, %108
%110 = load i32, i32* %37
%111 = load i32, i32* %31
%112 = icmp sle i32 %110, %111
br i1 %112, label %113, label %143
113: ; preds = %109
%114 = load double*, double** %21
%115 = load i32, i32* %37
%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* %38
%121 = load i32, i32* %34
%122 = mul nsw i32 %120, %121
%123 = load i32, i32* %37
%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** %22
%128 = load i32, i32* %38
%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* %38
%134 = load i32, i32* %34
%135 = mul nsw i32 %133, %134
%136 = load i32, i32* %37
%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* %37
%142 = add nsw i32 %141, 1
store i32 %142, i32* %37
br label %109
143: ; preds = %109
br label %144
144: ; preds = %143
%145 = load i32, i32* %38
%146 = add nsw i32 %145, 1
store i32 %146, i32* %38
br label %104
147: ; preds = %104
%148 = load i32*, i32** %15
%149 = load i32*, i32** %16
%150 = load double*, double** %19
%151 = load double*, double** %20
%152 = load double*, double** %48
%153 = call i32 @get_grid_area(i32* %148, i32* %149, double* %150, double* %151, double* %152)
%154 = load i32*, i32** %17
%155 = load i32*, i32** %18
%156 = load double*, double** %51
%157 = load double*, double** %52
%158 = load double*, double** %49
%159 = call i32 @get_grid_area(i32* %154, i32* %155, double* %156, double* %157, double* %158)
%160 = load double*, double** %51
%161 = call i32 @free(double* %160)
%162 = load double*, double** %52
%163 = call i32 @free(double* %162)
store i32 0, i32* %38
br label %164
164: ; preds = %474, %147
%165 = load i32, i32* %38
%166 = load i32, i32* %32
%167 = icmp slt i32 %165, %166
br i1 %167, label %168, label %477
168: ; preds = %164
store i32 0, i32* %37
br label %169
169: ; preds = %470, %168
%170 = load i32, i32* %37
%171 = load i32, i32* %31
%172 = icmp slt i32 %170, %171
br i1 %172, label %173, label %473
173: ; preds = %169
%174 = load double*, double** %21
%175 = load i32, i32* %37
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %174, i64 %176
%178 = load double, double* %177
store double %178, double* %40
%179 = load double*, double** %22
%180 = load i32, i32* %38
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %179, i64 %181
%183 = load double, double* %182
store double %183, double* %41
%184 = load double*, double** %21
%185 = load i32, i32* %37
%186 = add nsw i32 %185, 1
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds double, double* %184, i64 %187
%189 = load double, double* %188
store double %189, double* %42
%190 = load double*, double** %22
%191 = load i32, i32* %38
%192 = add nsw i32 %191, 1
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds double, double* %190, i64 %193
%195 = load double, double* %194
store double %195, double* %43
store i32 0, i32* %36
br label %196
196: ; preds = %466, %173
%197 = load i32, i32* %36
%198 = load i32, i32* %30
%199 = icmp slt i32 %197, %198
br i1 %199, label %200, label %469
200: ; preds = %196
store i32 0, i32* %35
br label %201
201: ; preds = %462, %200
%202 = load i32, i32* %35
%203 = load i32, i32* %29
%204 = icmp slt i32 %202, %203
br i1 %204, label %205, label %465
205: ; preds = %201
%206 = load double*, double** %23
%207 = load i32, i32* %36
%208 = load i32, i32* %29
%209 = mul nsw i32 %207, %208
%210 = load i32, i32* %35
%211 = add nsw i32 %209, %210
%212 = sext i32 %211 to i64
%213 = getelementptr inbounds double, double* %206, i64 %212
%214 = load double, double* %213
%215 = fcmp ogt double %214, 5.000000e-01
br i1 %215, label %216, label %461
216: ; preds = %205
%217 = load double*, double** %20
%218 = load i32, i32* %36
%219 = load i32, i32* %33
%220 = mul nsw i32 %218, %219
%221 = load i32, i32* %35
%222 = add nsw i32 %220, %221
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double, double* %217, i64 %223
%225 = load double, double* %224
%226 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
store double %225, double* %226
%227 = load double*, double** %20
%228 = load i32, i32* %36
%229 = load i32, i32* %33
%230 = mul nsw i32 %228, %229
%231 = load i32, i32* %35
%232 = add nsw i32 %230, %231
%233 = add nsw i32 %232, 1
%234 = sext i32 %233 to i64
%235 = getelementptr inbounds double, double* %227, i64 %234
%236 = load double, double* %235
%237 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
store double %236, double* %237
%238 = load double*, double** %20
%239 = load i32, i32* %36
%240 = add nsw i32 %239, 1
%241 = load i32, i32* %33
%242 = mul nsw i32 %240, %241
%243 = load i32, i32* %35
%244 = add nsw i32 %242, %243
%245 = add nsw i32 %244, 1
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %238, i64 %246
%248 = load double, double* %247
%249 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
store double %248, double* %249
%250 = load double*, double** %20
%251 = load i32, i32* %36
%252 = add nsw i32 %251, 1
%253 = load i32, i32* %33
%254 = mul nsw i32 %252, %253
%255 = load i32, i32* %35
%256 = add nsw i32 %254, %255
%257 = sext i32 %256 to i64
%258 = getelementptr inbounds double, double* %250, i64 %257
%259 = load double, double* %258
%260 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
store double %259, double* %260
%261 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%262 = load double, double* %261
%263 = load double, double* %41
%264 = fcmp ole double %262, %263
br i1 %264, label %265, label %281
265: ; preds = %216
%266 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
%267 = load double, double* %266
%268 = load double, double* %41
%269 = fcmp ole double %267, %268
br i1 %269, label %270, label %281
270: ; preds = %265
%271 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
%272 = load double, double* %271
%273 = load double, double* %41
%274 = fcmp ole double %272, %273
br i1 %274, label %275, label %281
275: ; preds = %270
%276 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
%277 = load double, double* %276
%278 = load double, double* %41
%279 = fcmp ole double %277, %278
br i1 %279, label %280, label %281
280: ; preds = %275
br label %462
281: ; preds = %275, %270, %265, %216
%282 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%283 = load double, double* %282
%284 = load double, double* %43
%285 = fcmp oge double %283, %284
br i1 %285, label %286, label %302
286: ; preds = %281
%287 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 1
%288 = load double, double* %287
%289 = load double, double* %43
%290 = fcmp oge double %288, %289
br i1 %290, label %291, label %302
291: ; preds = %286
%292 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 2
%293 = load double, double* %292
%294 = load double, double* %43
%295 = fcmp oge double %293, %294
br i1 %295, label %296, label %302
296: ; preds = %291
%297 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 3
%298 = load double, double* %297
%299 = load double, double* %43
%300 = fcmp oge double %298, %299
br i1 %300, label %301, label %302
301: ; preds = %296
br label %462
302: ; preds = %296, %291, %286, %281
%303 = load double*, double** %19
%304 = load i32, i32* %36
%305 = load i32, i32* %33
%306 = mul nsw i32 %304, %305
%307 = load i32, i32* %35
%308 = add nsw i32 %306, %307
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds double, double* %303, i64 %309
%311 = load double, double* %310
%312 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
store double %311, double* %312
%313 = load double*, double** %19
%314 = load i32, i32* %36
%315 = load i32, i32* %33
%316 = mul nsw i32 %314, %315
%317 = load i32, i32* %35
%318 = add nsw i32 %316, %317
%319 = add nsw i32 %318, 1
%320 = sext i32 %319 to i64
%321 = getelementptr inbounds double, double* %313, i64 %320
%322 = load double, double* %321
%323 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 1
store double %322, double* %323
%324 = load double*, double** %19
%325 = load i32, i32* %36
%326 = add nsw i32 %325, 1
%327 = load i32, i32* %33
%328 = mul nsw i32 %326, %327
%329 = load i32, i32* %35
%330 = add nsw i32 %328, %329
%331 = add nsw i32 %330, 1
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds double, double* %324, i64 %332
%334 = load double, double* %333
%335 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 2
store double %334, double* %335
%336 = load double*, double** %19
%337 = load i32, i32* %36
%338 = add nsw i32 %337, 1
%339 = load i32, i32* %33
%340 = mul nsw i32 %338, %339
%341 = load i32, i32* %35
%342 = add nsw i32 %340, %341
%343 = sext i32 %342 to i64
%344 = getelementptr inbounds double, double* %336, i64 %343
%345 = load double, double* %344
%346 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 3
store double %345, double* %346
%347 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
%348 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%349 = load double, double* %40
%350 = load double, double* %42
%351 = fadd double %349, %350
%352 = fdiv double %351, 2.000000e+00
%353 = call i32 @fix_lon(double* %347, double* %348, i32 4, double %352)
store i32 %353, i32* %53
%354 = getelementptr inbounds [50 x double], [50 x double]* %44, i64 0, i64 0
%355 = getelementptr inbounds [50 x double], [50 x double]* %45, i64 0, i64 0
%356 = load i32, i32* %53
%357 = load double, double* %40
%358 = load double, double* %41
%359 = load double, double* %42
%360 = load double, double* %43
%361 = getelementptr inbounds [50 x double], [50 x double]* %46, i64 0, i64 0
%362 = getelementptr inbounds [50 x double], [50 x double]* %47, i64 0, i64 0
%363 = call i32 @clip(double* %354, double* %355, i32 %356, double %357, double %358, double %359, double %360, double* %361, double* %362)
store i32 %363, i32* %54
%364 = icmp sgt i32 %363, 0
br i1 %364, label %365, label %460
365: ; preds = %302
%366 = getelementptr inbounds [50 x double], [50 x double]* %46, i64 0, i64 0
%367 = getelementptr inbounds [50 x double], [50 x double]* %47, i64 0, i64 0
%368 = load i32, i32* %54
%369 = call double @poly_area(double* %366, double* %367, i32 %368)
%370 = load double*, double** %23
%371 = load i32, i32* %36
%372 = load i32, i32* %29
%373 = mul nsw i32 %371, %372
%374 = load i32, i32* %35
%375 = add nsw i32 %373, %374
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds double, double* %370, i64 %376
%378 = load double, double* %377
%379 = fmul double %369, %378
store double %379, double* %55
%380 = load double*, double** %48
%381 = load i32, i32* %36
%382 = load i32, i32* %29
%383 = mul nsw i32 %381, %382
%384 = load i32, i32* %35
%385 = add nsw i32 %383, %384
%386 = sext i32 %385 to i64
%387 = getelementptr inbounds double, double* %380, i64 %386
%388 = load double, double* %387
%389 = load double*, double** %49
%390 = load i32, i32* %38
%391 = load i32, i32* %31
%392 = mul nsw i32 %390, %391
%393 = load i32, i32* %37
%394 = add nsw i32 %392, %393
%395 = sext i32 %394 to i64
%396 = getelementptr inbounds double, double* %389, i64 %395
%397 = load double, double* %396
%398 = fcmp olt double %388, %397
br i1 %398, label %399, label %409
399: ; preds = %365
%400 = load double*, double** %48
%401 = load i32, i32* %36
%402 = load i32, i32* %29
%403 = mul nsw i32 %401, %402
%404 = load i32, i32* %35
%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
br label %419
409: ; preds = %365
%410 = load double*, double** %49
%411 = load i32, i32* %38
%412 = load i32, i32* %31
%413 = mul nsw i32 %411, %412
%414 = load i32, i32* %37
%415 = add nsw i32 %413, %414
%416 = sext i32 %415 to i64
%417 = getelementptr inbounds double, double* %410, i64 %416
%418 = load double, double* %417
br label %419
419: ; preds = %409, %399
%420 = phi double [ %408, %399 ], [ %418, %409 ]
store double %420, double* %50
%421 = load double, double* %55
%422 = load double, double* %50
%423 = fdiv double %421, %422
%424 = fcmp ogt double %423, 0x3EB0C6F7A0B5ED8D
br i1 %424, label %425, label %459
425: ; preds = %419
%426 = load double, double* %55
%427 = load double*, double** %28
%428 = load i32, i32* %39
%429 = sext i32 %428 to i64
%430 = getelementptr inbounds double, double* %427, i64 %429
store double %426, double* %430
%431 = load i32, i32* %35
%432 = load i32*, i32** %24
%433 = load i32, i32* %39
%434 = sext i32 %433 to i64
%435 = getelementptr inbounds i32, i32* %432, i64 %434
store i32 %431, i32* %435
%436 = load i32, i32* %36
%437 = load i32*, i32** %25
%438 = load i32, i32* %39
%439 = sext i32 %438 to i64
%440 = getelementptr inbounds i32, i32* %437, i64 %439
store i32 %436, i32* %440
%441 = load i32, i32* %37
%442 = load i32*, i32** %26
%443 = load i32, i32* %39
%444 = sext i32 %443 to i64
%445 = getelementptr inbounds i32, i32* %442, i64 %444
store i32 %441, i32* %445
%446 = load i32, i32* %38
%447 = load i32*, i32** %27
%448 = load i32, i32* %39
%449 = sext i32 %448 to i64
%450 = getelementptr inbounds i32, i32* %447, i64 %449
store i32 %446, i32* %450
%451 = load i32, i32* %39
%452 = add nsw i32 %451, 1
store i32 %452, i32* %39
%453 = load i32, i32* %39
%454 = sitofp i32 %453 to double
%455 = fcmp ogt double %454, 1.000000e+06
br i1 %455, label %456, label %458
456: ; preds = %425
%457 = call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %458
458: ; preds = %456, %425
br label %459
459: ; preds = %458, %419
br label %460
460: ; preds = %459, %302
br label %461
461: ; preds = %460, %205
br label %462
462: ; preds = %461, %301, %280
%463 = load i32, i32* %35
%464 = add nsw i32 %463, 1
store i32 %464, i32* %35
br label %201
465: ; preds = %201
br label %466
466: ; preds = %465
%467 = load i32, i32* %36
%468 = add nsw i32 %467, 1
store i32 %468, i32* %36
br label %196
469: ; preds = %196
br label %470
470: ; preds = %469
%471 = load i32, i32* %37
%472 = add nsw i32 %471, 1
store i32 %472, i32* %37
br label %169
473: ; preds = %169
br label %474
474: ; preds = %473
%475 = load i32, i32* %38
%476 = add nsw i32 %475, 1
store i32 %476, i32* %38
br label %164
477: ; preds = %164
%478 = load double*, double** %48
%479 = call i32 @free(double* %478)
%480 = load double*, double** %49
%481 = call i32 @free(double* %480)
%482 = load i32, i32* %39
ret i32 %482
}

LLVM IR (-O2):
@.str = [51 x i8] c"nxgrid is greater than MAXXGRID, increase MAXXGRID\00"
define i32 @create_xgrid_2dx1d_order1(i32* %0, i32* %1, i32* %2, i32* %3, double* %4, double* %5, double* nocapture %6, double* nocapture %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 nsw i32 %23, 1
%28 = add 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 %26, 1
%38 = shl i32 %28, 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 %26, 0
br i1 %44, label %206, label %45
45: ; preds = %14
%46 = icmp slt i32 %25, 0
%47 = sext i32 %28 to i64
%48 = zext i32 %37 to i64
%49 = zext i32 %28 to i64
%50 = getelementptr double, double* %6, 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 %28, 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* %7, i64 %66
%74 = add nuw i64 %66, 1
%75 = getelementptr double, double* %7, i64 %74
br i1 %46, label %203, label %76
76: ; preds = %65
%77 = mul nsw i64 %66, %47
%78 = getelementptr inbounds double, double* %7, 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, %6
%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, %6
%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* %6, 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* %6, 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* %6, 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* %6, 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* %6, 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* %6, 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 = tail call i32 @get_grid_area(i32* %0, i32* %1, double* %4, double* %5, double* %32)
%208 = tail call i32 @get_grid_area(i32* %2, i32* %3, double* %41, double* %43, double* %36)
%209 = tail call i32 @free(double* %41)
%210 = tail call i32 @free(double* %43)
%211 = icmp sgt i32 %26, 0
br i1 %211, label %212, label %357
212: ; preds = %206
%213 = icmp sgt i32 %25, 0
%214 = icmp sgt i32 %24, 0
%215 = icmp sgt i32 %23, 0
%216 = getelementptr inbounds [50 x double], [50 x double]* %16, i64 0, i64 0
%217 = getelementptr inbounds [50 x double], [50 x double]* %16, i64 0, i64 2
%218 = getelementptr inbounds [50 x double], [50 x double]* %16, i64 0, i64 3
%219 = getelementptr inbounds [50 x double], [50 x double]* %15, i64 0, i64 0
%220 = getelementptr inbounds [50 x double], [50 x double]* %15, i64 0, i64 2
%221 = getelementptr inbounds [50 x double], [50 x double]* %17, i64 0, i64 0
%222 = getelementptr inbounds [50 x double], [50 x double]* %18, i64 0, i64 0
%223 = sext i32 %23 to i64
%224 = sext i32 %27 to i64
%225 = sext i32 %25 to i64
%226 = zext i32 %26 to i64
%227 = zext i32 %25 to i64
%228 = zext i32 %24 to i64
%229 = zext i32 %23 to i64
%230 = bitcast [50 x double]* %16 to <2 x double>*
%231 = bitcast [50 x double]* %15 to <2 x double>*
%232 = bitcast double* %220 to <2 x double>*
br label %233
233: ; preds = %212, %353
%234 = phi i64 [ 0, %212 ], [ %354, %353 ]
%235 = phi i32 [ 0, %212 ], [ %355, %353 ]
br i1 %213, label %238, label %236
236: ; preds = %233
%237 = add nuw nsw i64 %234, 1
br label %353
238: ; preds = %233
%239 = getelementptr inbounds double, double* %7, i64 %234
%240 = add nuw nsw i64 %234, 1
%241 = getelementptr inbounds double, double* %7, i64 %240
%242 = mul nsw i64 %234, %225
%243 = trunc i64 %234 to i32
br label %247
244: ; preds = %349, %247
%245 = phi i32 [ %249, %247 ], [ %351, %349 ]
%246 = icmp eq i64 %253, %227
br i1 %246, label %353, label %247
247: ; preds = %238, %244
%248 = phi i64 [ 0, %238 ], [ %253, %244 ]
%249 = phi i32 [ %235, %238 ], [ %245, %244 ]
%250 = getelementptr inbounds double, double* %6, i64 %248
%251 = load double, double* %250
%252 = load double, double* %239
%253 = add nuw nsw i64 %248, 1
%254 = getelementptr inbounds double, double* %6, i64 %253
%255 = load double, double* %254
%256 = load double, double* %241
br i1 %214, label %257, label %244
257: ; preds = %247
%258 = fadd double %251, %255
%259 = fmul double %258, 5.000000e-01
%260 = add nsw i64 %248, %242
%261 = getelementptr inbounds double, double* %36, i64 %260
%262 = trunc i64 %248 to i32
%263 = insertelement <4 x double> poison, double %256, i64 0
%264 = shufflevector <4 x double> %263, <4 x double> poison, <4 x i32> zeroinitializer
br label %265
265: ; preds = %257, %349
%266 = phi i64 [ 0, %257 ], [ %350, %349 ]
%267 = phi i32 [ %249, %257 ], [ %351, %349 ]
br i1 %215, label %270, label %268
268: ; preds = %265
%269 = add nuw nsw i64 %266, 1
br label %349
270: ; preds = %265
%271 = mul nsw i64 %266, %223
%272 = mul nsw i64 %266, %224
%273 = add nuw nsw i64 %266, 1
%274 = mul nsw i64 %273, %224
%275 = trunc i64 %266 to i32
br label %276
276: ; preds = %270, %345
%277 = phi i64 [ 0, %270 ], [ %347, %345 ]
%278 = phi i32 [ %267, %270 ], [ %346, %345 ]
%279 = add nsw i64 %277, %271
%280 = getelementptr inbounds double, double* %8, i64 %279
%281 = load double, double* %280
%282 = fcmp ogt double %281, 5.000000e-01
br i1 %282, label %283, label %345
283: ; preds = %276
%284 = add nsw i64 %277, %272
%285 = getelementptr inbounds double, double* %5, i64 %284
%286 = bitcast double* %285 to <2 x double>*
%287 = load <2 x double>, <2 x double>* %286
store <2 x double> %287, <2 x double>* %230
%288 = add nsw i64 %277, %274
%289 = add nsw i64 %288, 1
%290 = getelementptr inbounds double, double* %5, i64 %289
%291 = load double, double* %290
store double %291, double* %217
%292 = getelementptr inbounds double, double* %5, i64 %288
%293 = load double, double* %292
store double %293, double* %218
%294 = extractelement <2 x double> %287, i64 0
%295 = fcmp ugt double %294, %252
%296 = extractelement <2 x double> %287, i64 1
%297 = fcmp ugt double %296, %252
%298 = select i1 %295, i1 true, i1 %297
%299 = fcmp ugt double %291, %252
%300 = select i1 %298, i1 true, i1 %299
%301 = fcmp ugt double %293, %252
%302 = select i1 %300, i1 true, i1 %301
br i1 %302, label %303, label %345
303: ; preds = %283
%304 = shufflevector <2 x double> %287, <2 x double> poison, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
%305 = insertelement <4 x double> %304, double %291, i64 2
%306 = insertelement <4 x double> %305, double %293, i64 3
%307 = fcmp ult <4 x double> %306, %264
%308 = freeze <4 x i1> %307
%309 = bitcast <4 x i1> %308 to i4
%310 = icmp eq i4 %309, 0
br i1 %310, label %345, label %311
311: ; preds = %303
%312 = getelementptr inbounds double, double* %4, i64 %284
%313 = bitcast double* %312 to <2 x double>*
%314 = load <2 x double>, <2 x double>* %313
store <2 x double> %314, <2 x double>* %231
%315 = getelementptr inbounds double, double* %4, i64 %288
%316 = bitcast double* %315 to <2 x double>*
%317 = load <2 x double>, <2 x double>* %316
%318 = shufflevector <2 x double> %317, <2 x double> poison, <2 x i32> <i32 1, i32 0>
store <2 x double> %318, <2 x double>* %232
%319 = call i32 @fix_lon(double* %219, double* %216, i32 4, double %259)
%320 = call i32 @clip(double* %219, double* %216, i32 %319, double %251, double %252, double %255, double %256, double* %221, double* %222)
%321 = icmp sgt i32 %320, 0
br i1 %321, label %322, label %345
322: ; preds = %311
%323 = call double @poly_area(double* %221, double* %222, i32 %320)
%324 = load double, double* %280
%325 = fmul double %323, %324
%326 = getelementptr inbounds double, double* %32, i64 %279
%327 = load double, double* %326
%328 = load double, double* %261
%329 = fcmp olt double %327, %328
%330 = select i1 %329, double %327, double %328
%331 = fdiv double %325, %330
%332 = fcmp ogt double %331, 0x3EB0C6F7A0B5ED8D
br i1 %332, label %333, label %345
333: ; preds = %322
%334 = sext i32 %278 to i64
%335 = getelementptr inbounds double, double* %13, i64 %334
store double %325, double* %335
%336 = getelementptr inbounds i32, i32* %9, i64 %334
%337 = trunc i64 %277 to i32
store i32 %337, i32* %336
%338 = getelementptr inbounds i32, i32* %10, i64 %334
store i32 %275, i32* %338
%339 = getelementptr inbounds i32, i32* %11, i64 %334
store i32 %262, i32* %339
%340 = getelementptr inbounds i32, i32* %12, i64 %334
store i32 %243, i32* %340
%341 = add nsw i32 %278, 1
%342 = icmp sgt i32 %278, 999999
br i1 %342, label %343, label %345
343: ; preds = %333
%344 = call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %345
345: ; preds = %303, %283, %276, %322, %343, %333, %311
%346 = phi i32 [ %341, %343 ], [ %341, %333 ], [ %278, %322 ], [ %278, %311 ], [ %278, %276 ], [ %278, %283 ], [ %278, %303 ]
%347 = add nuw nsw i64 %277, 1
%348 = icmp eq i64 %347, %229
br i1 %348, label %349, label %276
349: ; preds = %345, %268
%350 = phi i64 [ %269, %268 ], [ %273, %345 ]
%351 = phi i32 [ %267, %268 ], [ %346, %345 ]
%352 = icmp eq i64 %350, %228
br i1 %352, label %244, label %265
353: ; preds = %244, %236
%354 = phi i64 [ %237, %236 ], [ %240, %244 ]
%355 = phi i32 [ %235, %236 ], [ %245, %244 ]
%356 = icmp eq i64 %354, %226
br i1 %356, label %357, label %233
357: ; preds = %353, %206
%358 = phi i32 [ 0, %206 ], [ %355, %353 ]
%359 = call i32 @free(double* %32)
%360 = call i32 @free(double* %36)
ret i32 %358
}