#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 *, double *,
                                 double *);
int /*<<< orphan*/ get_grid_area_no_adjust(int const *, int const *, double *,
                                           double *, double *);
int /*<<< orphan*/ get_grid_area_ug(int const *, double const *, double const *,
                                    double *);
scalar_t__ malloc(int);
double const poly_area(double *, double *, int);
int create_xgrid_1dx2d_order1_ug(const int *nlon_in, const int *nlat_in,
                                 const int *npts_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 *l_out,
                                 double *xgrid_area) {
  int nx1, ny1, nx1p, nv, npts2;
  int i1, j1, l2, 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;
  nv = 4;
  npts2 = *npts_out;
  nxgrid = 0;
  nx1p = nx1 + 1;
  area_in = (double *)malloc(nx1 * ny1 * sizeof(double));
  area_out = (double *)malloc(npts2 * 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_ug(npts_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 (l2 = 0; l2 < npts2; l2++) {
          int n_in, n_out;
          double Xarea;
          y_in[0] = lat_out[l2 * nv];
          y_in[1] = lat_out[l2 * nv + 1];
          y_in[2] = lat_out[l2 * nv + 2];
          y_in[3] = lat_out[l2 * nv + 3];
          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[l2 * nv];
          x_in[1] = lon_out[l2 * nv + 1];
          x_in[2] = lon_out[l2 * nv + 2];
          x_in[3] = lon_out[l2 * nv + 3];
          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[l2] ? area_in[j1 * nx1 + i1]
                                                       : area_out[l2]);
            if (Xarea / min_area > (1.e-6)) {
              xgrid_area[nxgrid] = Xarea;
              i_in[nxgrid] = i1;
              j_in[nxgrid] = j1;
              l_out[nxgrid] = l2;
              ++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_ug>:
push   %rbp
mov    %rsp,%rbp
sub    $0x700,%rsp
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)
movl   $0x4,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <malloc@plt>
mov    %rax,-0x6c8(%rbp)
movslq -0x44(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1090 <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   1090 <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   1090 <malloc@plt>
mov    %rax,-0x6e8(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     1307 <create_xgrid_1dx2d_order1_ug+0x177>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x34(%rbp),%eax
jg     12f4 <create_xgrid_1dx2d_order1_ug+0x164>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e0(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x6e8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x3c(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    128e <create_xgrid_1dx2d_order1_ug+0xfe>
jmp    12f9 <create_xgrid_1dx2d_order1_ug+0x169>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    127b <create_xgrid_1dx2d_order1_ug+0xeb>
cmpl   $0x1,-0x34(%rbp)
jle    1338 <create_xgrid_1dx2d_order1_ug+0x1a8>
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@plt>
jmp    135a <create_xgrid_1dx2d_order1_ug+0x1ca>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x6e0(%rbp),%rdx
mov    -0x6e8(%rbp),%rcx
mov    -0x6c8(%rbp),%r8
call   10b0 <get_grid_area_no_adjust@plt>
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    0x10(%rbp),%rdx
mov    -0x6d0(%rbp),%rcx
call   1070 <get_grid_area_ug@plt>
mov    -0x6e0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x6e8(%rbp),%rdi
call   1030 <free@plt>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    17e4 <create_xgrid_1dx2d_order1_ug+0x654>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    17d1 <create_xgrid_1dx2d_order1_ug+0x641>
mov    0x18(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  0xc32(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17be <create_xgrid_1dx2d_order1_ug+0x62e>
mov    -0x20(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x28(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%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)
movl   $0x0,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    17b9 <create_xgrid_1dx2d_order1_ug+0x629>
mov    0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x3a0(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x398(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x390(%rbp)
ff
mov    0x10(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x388(%rbp)
ff
movsd  -0x3a0(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1513 <create_xgrid_1dx2d_order1_ug+0x383>
movsd  -0x398(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1513 <create_xgrid_1dx2d_order1_ug+0x383>
movsd  -0x390(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1513 <create_xgrid_1dx2d_order1_ug+0x383>
movsd  -0x388(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1513 <create_xgrid_1dx2d_order1_ug+0x383>
jmp    17ab <create_xgrid_1dx2d_order1_ug+0x61b>
movsd  -0x3a0(%rbp),%xmm0
ff
ucomisd -0x78(%rbp),%xmm0
jb     1564 <create_xgrid_1dx2d_order1_ug+0x3d4>
movsd  -0x398(%rbp),%xmm0
ff
ucomisd -0x78(%rbp),%xmm0
jb     1564 <create_xgrid_1dx2d_order1_ug+0x3d4>
movsd  -0x390(%rbp),%xmm0
ff
ucomisd -0x78(%rbp),%xmm0
jb     1564 <create_xgrid_1dx2d_order1_ug+0x3d4>
movsd  -0x388(%rbp),%xmm0
ff
ucomisd -0x78(%rbp),%xmm0
jb     1564 <create_xgrid_1dx2d_order1_ug+0x3d4>
jmp    17ab <create_xgrid_1dx2d_order1_ug+0x61b>
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x210(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x208(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x200(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
imul   -0x40(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x1f8(%rbp)
ff
lea    -0x210(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
movsd  -0x60(%rbp),%xmm0
addsd  -0x70(%rbp),%xmm0
movsd  0xa0f(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    $0x4,%edx
call   1080 <fix_lon@plt>
mov    %eax,-0x6ec(%rbp)
lea    -0x210(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
mov    -0x6ec(%rbp),%edx
movsd  -0x60(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x78(%rbp),%xmm3
lea    -0x530(%rbp),%rcx
lea    -0x6c0(%rbp),%r8
call   1040 <clip@plt>
mov    %eax,-0x6f0(%rbp)
cmp    $0x0,%eax
jle    17a6 <create_xgrid_1dx2d_order1_ug+0x616>
lea    -0x530(%rbp),%rdi
lea    -0x6c0(%rbp),%rsi
mov    -0x6f0(%rbp),%edx
call   1060 <poly_area@plt>
mov    0x18(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x6f8(%rbp)
ff
mov    -0x6c8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x6d0(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
jbe    16e7 <create_xgrid_1dx2d_order1_ug+0x557>
mov    -0x6c8(%rbp),%rax
mov    -0x4c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x48(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x700(%rbp)
ff
jmp    16ff <create_xgrid_1dx2d_order1_ug+0x56f>
mov    -0x6d0(%rbp),%rax
movslq -0x50(%rbp),%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  0x8e9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    17a1 <create_xgrid_1dx2d_order1_ug+0x611>
movsd  -0x6f8(%rbp),%xmm0
ff
mov    0x38(%rbp),%rax
movslq -0x54(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x48(%rbp),%edx
mov    0x20(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x4c(%rbp),%edx
mov    0x28(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x50(%rbp),%edx
mov    0x30(%rbp),%rax
movslq -0x54(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
cvtsi2sdl -0x54(%rbp),%xmm0
movsd  0x892(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    179c <create_xgrid_1dx2d_order1_ug+0x60c>
lea    0x889(%rip),%rdi
call   1050 <error_handler@plt>
jmp    17a1 <create_xgrid_1dx2d_order1_ug+0x611>
jmp    17a6 <create_xgrid_1dx2d_order1_ug+0x616>
jmp    17ab <create_xgrid_1dx2d_order1_ug+0x61b>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1431 <create_xgrid_1dx2d_order1_ug+0x2a1>
jmp    17be <create_xgrid_1dx2d_order1_ug+0x62e>
jmp    17c3 <create_xgrid_1dx2d_order1_ug+0x633>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    13a4 <create_xgrid_1dx2d_order1_ug+0x214>
jmp    17d6 <create_xgrid_1dx2d_order1_ug+0x646>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1391 <create_xgrid_1dx2d_order1_ug+0x201>
mov    -0x6c8(%rbp),%rdi
call   1030 <free@plt>
mov    -0x6d0(%rbp),%rdi
call   1030 <free@plt>
mov    -0x54(%rbp),%eax
add    $0x700,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_xgrid_1dx2d_order1_ug>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x728,%rsp
mov    %r9,0xa8(%rsp)
mov    %r8,%r12
mov    %rcx,0x40(%rsp)
mov    %rdi,0x88(%rsp)
movslq (%rdi),%rax
mov    %eax,%ebx
mov    %rsi,0x90(%rsp)
mov    (%rsi),%r14d
mov    %rdx,0xb0(%rsp)
mov    (%rdx),%r13d
lea    0x1(%rax),%ebp
mov    %rax,0x50(%rsp)
mov    %eax,%edi
imul   %r14d,%edi
shl    $0x3,%edi
call   1090 <malloc@plt>
mov    %rax,0x48(%rsp)
lea    0x0(,%r13,8),%edi
call   1090 <malloc@plt>
mov    %rax,0x68(%rsp)
lea    0x1(%r14),%eax
mov    %ebp,0x18(%rsp)
mov    %eax,0x8(%rsp)
imul   %eax,%ebp
shl    $0x3,%ebp
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
mov    %ebp,%edi
call   1090 <malloc@plt>
mov    %r15,%r10
mov    %rax,0x30(%rsp)
mov    %r14,0x98(%rsp)
test   %r14d,%r14d
mov    %r12,0x58(%rsp)
mov    %rbx,0xa0(%rsp)
js     15da <create_xgrid_1dx2d_order1_ug+0x44a>
movslq 0x18(%rsp),%r15
mov    0x8(%rsp),%r11d
mov    %r15d,%r14d
mov    0x40(%rsp),%rax
lea    (%rax,%r14,8),%rax
mov    %rax,0xd8(%rsp)
mov    %r14d,%eax
and    $0xfffffffc,%eax
mov    %rax,0xd0(%rsp)
add    $0xfffffffffffffffc,%rax
mov    %rax,0xc8(%rsp)
mov    %rax,%rcx
shr    $0x2,%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0xc0(%rsp)
and    $0xfffffffffffffffe,%rcx
mov    %rcx,0xb8(%rsp)
mov    %r14,%rax
neg    %rax
mov    %rax,0x60(%rsp)
mov    0x30(%rsp),%rax
lea    0x30(%rax),%rdi
lea    0x0(,%r15,8),%rcx
mov    %rcx,0x18(%rsp)
lea    0x30(%r10),%rbp
lea    0x8(%r10),%rcx
lea    0x8(%rax),%r9
xor    %r8d,%r8d
mov    %r10,0x10(%rsp)
mov    %r15,0x38(%rsp)
mov    %r11,0x20(%rsp)
jmp    1316 <create_xgrid_1dx2d_order1_ug+0x186>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%r8
mov    0x18(%rsp),%rax
add    %rax,%rdi
add    %rax,%rbp
add    %rax,%rcx
add    %rax,%r9
cmp    %r11,%r8
mov    0xa0(%rsp),%rbx
je     15da <create_xgrid_1dx2d_order1_ug+0x44a>
test   %ebx,%ebx
mov    0x40(%rsp),%rbx
js     12f0 <create_xgrid_1dx2d_order1_ug+0x160>
mov    %r8,%rdx
imul   %r15,%rdx
cmp    $0x4,%r15d
mov    %rdx,0x8(%rsp)
jae    1340 <create_xgrid_1dx2d_order1_ug+0x1b0>
xor    %esi,%esi
jmp    1510 <create_xgrid_1dx2d_order1_ug+0x380>
nopl   0x0(%rax,%rax,1)
lea    (%rdx,%r14,1),%rax
lea    (%r10,%rdx,8),%rsi
lea    (%r10,%rax,8),%r15
mov    0x30(%rsp),%r11
lea    (%r11,%rdx,8),%r10
lea    (%r11,%rax,8),%r11
lea    (%r12,%r8,8),%rax
lea    (%r12,%r8,8),%r12
add    $0x8,%r12
cmp    %r11,%rsi
setb   0x80(%rsp)
cmp    %r15,%r10
setb   0x78(%rsp)
mov    0xd8(%rsp),%rdx
cmp    %rdx,%rsi
setb   0x70(%rsp)
cmp    0x40(%rsp),%r15
seta   0x4(%rsp)
cmp    %r12,%rsi
setb   %sil
cmp    %r15,%rax
mov    0x40(%rsp),%rbx
setb   %r15b
cmp    %rdx,%r10
setb   %dl
cmp    %rbx,%r11
seta   0x28(%rsp)
cmp    %r12,%r10
setb   %r10b
cmp    %r11,%rax
setb   %r11b
mov    0x78(%rsp),%al
test   %al,0x80(%rsp)
jne    15b3 <create_xgrid_1dx2d_order1_ug+0x423>
mov    0x4(%rsp),%al
and    %al,0x70(%rsp)
mov    0x58(%rsp),%r12
jne    15ce <create_xgrid_1dx2d_order1_ug+0x43e>
and    %r15b,%sil
mov    0x38(%rsp),%r15
jne    1500 <create_xgrid_1dx2d_order1_ug+0x370>
and    0x28(%rsp),%dl
jne    1500 <create_xgrid_1dx2d_order1_ug+0x370>
mov    $0x0,%esi
and    %r11b,%r10b
mov    0x20(%rsp),%r11
mov    0x10(%rsp),%r10
jne    1510 <create_xgrid_1dx2d_order1_ug+0x380>
cmpq   $0x0,0xc8(%rsp)
je     159d <create_xgrid_1dx2d_order1_ug+0x40d>
movsd  (%r12,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0xb8(%rsp),%rax
xor    %r10d,%r10d
nopl   0x0(%rax)
movups (%rbx,%r10,8),%xmm1
movups 0x10(%rbx,%r10,8),%xmm2
movups %xmm1,-0x30(%rbp,%r10,8)
movups %xmm2,-0x20(%rbp,%r10,8)
movupd %xmm0,-0x30(%rdi,%r10,8)
movupd %xmm0,-0x20(%rdi,%r10,8)
movupd 0x20(%rbx,%r10,8),%xmm1
movupd 0x30(%rbx,%r10,8),%xmm2
movupd %xmm1,-0x10(%rbp,%r10,8)
movupd %xmm2,0x0(%rbp,%r10,8)
movupd %xmm0,-0x10(%rdi,%r10,8)
movupd %xmm0,(%rdi,%r10,8)
add    $0x8,%r10
add    $0xfffffffffffffffe,%rax
jne    1440 <create_xgrid_1dx2d_order1_ug+0x2b0>
testb  $0x1,0xc0(%rsp)
01
je     14e0 <create_xgrid_1dx2d_order1_ug+0x350>
movups (%rbx,%r10,8),%xmm0
movupd 0x10(%rbx,%r10,8),%xmm1
add    0x8(%rsp),%r10
mov    0x10(%rsp),%rax
movups %xmm0,(%rax,%r10,8)
movupd %xmm1,0x10(%rax,%r10,8)
movsd  (%r12,%r8,8),%xmm0
unpcklpd %xmm0,%xmm0
mov    0x30(%rsp),%rax
movupd %xmm0,(%rax,%r10,8)
movupd %xmm0,0x10(%rax,%r10,8)
mov    0xd0(%rsp),%rax
mov    %rax,%rsi
cmp    %r14,%rax
mov    0x20(%rsp),%r11
mov    0x10(%rsp),%r10
je     12f0 <create_xgrid_1dx2d_order1_ug+0x160>
jmp    1510 <create_xgrid_1dx2d_order1_ug+0x380>
xor    %esi,%esi
mov    0x20(%rsp),%r11
mov    0x10(%rsp),%r10
nopl   0x0(%rax)
mov    %rsi,%rax
test   $0x1,%r14b
je     1543 <create_xgrid_1dx2d_order1_ug+0x3b3>
movsd  (%rbx,%rsi,8),%xmm0
mov    0x8(%rsp),%rdx
add    %rsi,%rdx
movsd  %xmm0,(%r10,%rdx,8)
movsd  (%r12,%r8,8),%xmm0
mov    0x30(%rsp),%rax
movsd  %xmm0,(%rax,%rdx,8)
mov    %rsi,%rax
or     $0x1,%rax
not    %rsi
cmp    0x60(%rsp),%rsi
je     12f0 <create_xgrid_1dx2d_order1_ug+0x160>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsd  (%rbx,%rax,8),%xmm0
movsd  %xmm0,-0x8(%rcx,%rax,8)
movsd  (%r12,%r8,8),%xmm0
movsd  %xmm0,-0x8(%r9,%rax,8)
movsd  0x8(%rbx,%rax,8),%xmm0
movsd  %xmm0,(%rcx,%rax,8)
movsd  (%r12,%r8,8),%xmm0
movsd  %xmm0,(%r9,%rax,8)
add    $0x2,%rax
cmp    %rax,%r14
jne    1560 <create_xgrid_1dx2d_order1_ug+0x3d0>
jmp    12f0 <create_xgrid_1dx2d_order1_ug+0x160>
xor    %r10d,%r10d
testb  $0x1,0xc0(%rsp)
01
jne    14a2 <create_xgrid_1dx2d_order1_ug+0x312>
jmp    14e0 <create_xgrid_1dx2d_order1_ug+0x350>
xor    %esi,%esi
mov    0x58(%rsp),%r12
mov    0x10(%rsp),%r10
mov    0x38(%rsp),%r15
mov    0x20(%rsp),%r11
jmp    1510 <create_xgrid_1dx2d_order1_ug+0x380>
xor    %esi,%esi
mov    0x38(%rsp),%r15
jmp    1502 <create_xgrid_1dx2d_order1_ug+0x372>
mov    0x760(%rsp),%rbp
cmp    $0x2,%ebx
jl     1611 <create_xgrid_1dx2d_order1_ug+0x481>
mov    0x88(%rsp),%rdi
mov    0x90(%rsp),%rsi
mov    %r10,%rdx
mov    0x30(%rsp),%r12
mov    %r12,%rcx
mov    0x48(%rsp),%r8
mov    %r10,%r15
call   10a0 <get_grid_area@plt>
jmp    1639 <create_xgrid_1dx2d_order1_ug+0x4a9>
mov    0x88(%rsp),%rdi
mov    0x90(%rsp),%rsi
mov    %r10,%rdx
mov    0x30(%rsp),%r12
mov    %r12,%rcx
mov    0x48(%rsp),%r8
mov    %r10,%r15
call   10b0 <get_grid_area_no_adjust@plt>
mov    0x50(%rsp),%r14
mov    0xb0(%rsp),%rdi
mov    0xa8(%rsp),%rsi
mov    %rbp,%rdx
mov    0x68(%rsp),%rcx
call   1070 <get_grid_area_ug@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
cmpl   $0x0,0x98(%rsp)
jle    1991 <create_xgrid_1dx2d_order1_ug+0x801>
xor    %eax,%eax
mov    %rax,0x28(%rsp)
movl   $0x0,0x4(%rsp)
jmp    16ab <create_xgrid_1dx2d_order1_ug+0x51b>
nopw   0x0(%rax,%rax,1)
mov    %rcx,%rax
mov    %rcx,0x28(%rsp)
mov    0x50(%rsp),%r14
cmp    0x98(%rsp),%rcx
je     1999 <create_xgrid_1dx2d_order1_ug+0x809>
test   %r14d,%r14d
jle    1970 <create_xgrid_1dx2d_order1_ug+0x7e0>
mov    0x28(%rsp),%rax
mov    %rax,%rdx
imul   %r14,%rdx
lea    0x1(%rax),%rcx
xor    %esi,%esi
mov    %rcx,0x20(%rsp)
mov    %rdx,0x38(%rsp)
jmp    16ef <create_xgrid_1dx2d_order1_ug+0x55f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%rsi
mov    %rsi,%rax
mov    %rax,%rsi
cmp    %rbx,%rax
je     1690 <create_xgrid_1dx2d_order1_ug+0x500>
lea    (%rsi,%rdx,1),%rdi
mov    0x768(%rsp),%rax
mov    %rdi,0x70(%rsp)
movsd  (%rax,%rdi,8),%xmm0
ucomisd 0x8f3(%rip),%xmm0
jbe    16e0 <create_xgrid_1dx2d_order1_ug+0x550>
lea    0x1(%rsi),%rax
test   %r13d,%r13d
jle    16e7 <create_xgrid_1dx2d_order1_ug+0x557>
mov    %rax,0x10(%rsp)
mov    0x40(%rsp),%rax
movsd  (%rax,%rsi,8),%xmm0
mov    %rsi,0x60(%rsp)
movsd  0x8(%rax,%rsi,8),%xmm1
mov    0x58(%rsp),%rax
mov    0x28(%rsp),%rcx
movsd  (%rax,%rcx,8),%xmm4
movsd  0x8(%rax,%rcx,8),%xmm5
movsd  %xmm0,0x30(%rsp)
movsd  %xmm1,0x80(%rsp)
addsd  %xmm1,%xmm0
mulsd  0x89e(%rip),%xmm0
movsd  %xmm0,0x78(%rsp)
mov    $0x2,%r12d
xor    %ebx,%ebx
movsd  %xmm4,0x18(%rsp)
movsd  %xmm5,0x8(%rsp)
jmp    17a1 <create_xgrid_1dx2d_order1_ug+0x611>
mov    %r14,%r13
mov    %r15,%rbp
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm5
add    $0x1,%rbx
add    $0x4,%r12
cmp    %rbx,%r13
je     1950 <create_xgrid_1dx2d_order1_ug+0x7c0>
movupd -0x10(%rbp,%r12,8),%xmm2
movapd %xmm2,0xe0(%rsp)
movupd 0x0(%rbp,%r12,8),%xmm0
movapd %xmm0,0xf0(%rsp)
ucomisd %xmm2,%xmm4
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
movapd %xmm0,%xmm1
unpckhpd %xmm0,%xmm1
jb     17e9 <create_xgrid_1dx2d_order1_ug+0x659>
ucomisd %xmm3,%xmm4
jb     17e9 <create_xgrid_1dx2d_order1_ug+0x659>
ucomisd %xmm0,%xmm4
jb     17e9 <create_xgrid_1dx2d_order1_ug+0x659>
ucomisd %xmm1,%xmm4
jae    1790 <create_xgrid_1dx2d_order1_ug+0x600>
ucomisd %xmm5,%xmm2
jb     1801 <create_xgrid_1dx2d_order1_ug+0x671>
ucomisd %xmm5,%xmm3
jb     1801 <create_xgrid_1dx2d_order1_ug+0x671>
ucomisd %xmm5,%xmm0
jb     1801 <create_xgrid_1dx2d_order1_ug+0x671>
ucomisd %xmm5,%xmm1
jae    1790 <create_xgrid_1dx2d_order1_ug+0x600>
mov    %rbp,%r15
mov    %r13,%r14
mov    0xa8(%rsp),%rax
movups -0x10(%rax,%r12,8),%xmm0
movaps %xmm0,0x270(%rsp)
movups (%rax,%r12,8),%xmm0
movaps %xmm0,0x280(%rsp)
lea    0x270(%rsp),%r13
mov    %r13,%rdi
lea    0xe0(%rsp),%rbp
mov    %rbp,%rsi
mov    $0x4,%edx
movsd  0x78(%rsp),%xmm0
call   1080 <fix_lon@plt>
mov    %r13,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
movsd  0x30(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
movsd  0x80(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
lea    0x590(%rsp),%rbp
mov    %rbp,%rcx
lea    0x400(%rsp),%r13
mov    %r13,%r8
call   1040 <clip@plt>
test   %eax,%eax
jle    177e <create_xgrid_1dx2d_order1_ug+0x5ee>
mov    %rbp,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1060 <poly_area@plt>
mov    0x768(%rsp),%rax
mov    0x70(%rsp),%rcx
mulsd  (%rax,%rcx,8),%xmm0
mov    0x48(%rsp),%rax
movsd  (%rax,%rcx,8),%xmm1
mov    0x68(%rsp),%rax
minsd  (%rax,%rbx,8),%xmm1
movapd %xmm0,%xmm2
divsd  %xmm1,%xmm2
ucomisd 0x72f(%rip),%xmm2
mov    %r14,%r13
jbe    1781 <create_xgrid_1dx2d_order1_ug+0x5f1>
movslq 0x4(%rsp),%rax
mov    0x788(%rsp),%rcx
movsd  %xmm0,(%rcx,%rax,8)
mov    0x770(%rsp),%rcx
mov    0x60(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x778(%rsp),%rcx
mov    0x28(%rsp),%rdx
mov    %edx,(%rcx,%rax,4)
mov    0x780(%rsp),%rcx
mov    %ebx,(%rcx,%rax,4)
lea    0x1(%rax),%ecx
mov    %ecx,0x4(%rsp)
cmp    $0xf4240,%eax
mov    %r15,%rbp
jl     1784 <create_xgrid_1dx2d_order1_ug+0x5f4>
lea    0x6d5(%rip),%rdi
call   1050 <error_handler@plt>
jmp    1784 <create_xgrid_1dx2d_order1_ug+0x5f4>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0xa0(%rsp),%rbx
mov    0x20(%rsp),%rcx
mov    0x38(%rsp),%rdx
mov    0x10(%rsp),%rax
jmp    16e7 <create_xgrid_1dx2d_order1_ug+0x557>
nopl   0x0(%rax)
mov    0x28(%rsp),%rcx
add    $0x1,%rcx
mov    %rcx,%rax
mov    %rcx,0x28(%rsp)
cmp    0x98(%rsp),%rcx
jne    16ab <create_xgrid_1dx2d_order1_ug+0x51b>
jmp    1999 <create_xgrid_1dx2d_order1_ug+0x809>
movl   $0x0,0x4(%rsp)
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
mov    0x68(%rsp),%rdi
call   1030 <free@plt>
mov    0x4(%rsp),%eax
add    $0x728,%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_ug(i32* %0, i32* %1, i32* %2, double* %3, double* %4, double* %5, double* %6, double* %7, i32* %8, i32* %9, i32* %10, double* %11) {
%13 = alloca i32*
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca double*
%17 = alloca double*
%18 = alloca double*
%19 = alloca double*
%20 = alloca double*
%21 = alloca i32*
%22 = alloca i32*
%23 = alloca i32*
%24 = alloca double*
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32
%28 = alloca i32
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca double
%35 = alloca double
%36 = alloca double
%37 = alloca double
%38 = alloca [50 x double]
%39 = alloca [50 x double]
%40 = alloca [50 x double]
%41 = alloca [50 x double]
%42 = alloca double*
%43 = alloca double*
%44 = alloca double
%45 = alloca double*
%46 = alloca double*
%47 = alloca i32
%48 = alloca i32
%49 = alloca double
store i32* %0, i32** %13
store i32* %1, i32** %14
store i32* %2, i32** %15
store double* %3, double** %16
store double* %4, double** %17
store double* %5, double** %18
store double* %6, double** %19
store double* %7, double** %20
store i32* %8, i32** %21
store i32* %9, i32** %22
store i32* %10, i32** %23
store double* %11, double** %24
%50 = load i32*, i32** %13
%51 = load i32, i32* %50
store i32 %51, i32* %25
%52 = load i32*, i32** %14
%53 = load i32, i32* %52
store i32 %53, i32* %26
store i32 4, i32* %28
%54 = load i32*, i32** %15
%55 = load i32, i32* %54
store i32 %55, i32* %29
store i32 0, i32* %33
%56 = load i32, i32* %25
%57 = add nsw i32 %56, 1
store i32 %57, i32* %27
%58 = load i32, i32* %25
%59 = load i32, i32* %26
%60 = mul nsw i32 %58, %59
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 8
%63 = trunc i64 %62 to i32
%64 = call i64 @malloc(i32 %63)
%65 = inttoptr i64 %64 to double*
store double* %65, double** %42
%66 = load i32, i32* %29
%67 = sext i32 %66 to i64
%68 = mul i64 %67, 8
%69 = trunc i64 %68 to i32
%70 = call i64 @malloc(i32 %69)
%71 = inttoptr i64 %70 to double*
store double* %71, double** %43
%72 = load i32, i32* %25
%73 = add nsw i32 %72, 1
%74 = load i32, i32* %26
%75 = add nsw i32 %74, 1
%76 = mul nsw i32 %73, %75
%77 = sext i32 %76 to i64
%78 = mul i64 %77, 8
%79 = trunc i64 %78 to i32
%80 = call i64 @malloc(i32 %79)
%81 = inttoptr i64 %80 to double*
store double* %81, double** %45
%82 = load i32, i32* %25
%83 = add nsw i32 %82, 1
%84 = load i32, i32* %26
%85 = add nsw i32 %84, 1
%86 = mul nsw i32 %83, %85
%87 = sext i32 %86 to i64
%88 = mul i64 %87, 8
%89 = trunc i64 %88 to i32
%90 = call i64 @malloc(i32 %89)
%91 = inttoptr i64 %90 to double*
store double* %91, double** %46
store i32 0, i32* %31
br label %92
92: ; preds = %132, %12
%93 = load i32, i32* %31
%94 = load i32, i32* %26
%95 = icmp sle i32 %93, %94
br i1 %95, label %96, label %135
96: ; preds = %92
store i32 0, i32* %30
br label %97
97: ; preds = %128, %96
%98 = load i32, i32* %30
%99 = load i32, i32* %25
%100 = icmp sle i32 %98, %99
br i1 %100, label %101, label %131
101: ; preds = %97
%102 = load double*, double** %16
%103 = load i32, i32* %30
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds double, double* %102, i64 %104
%106 = load double, double* %105
%107 = load double*, double** %45
%108 = load i32, i32* %31
%109 = load i32, i32* %27
%110 = mul nsw i32 %108, %109
%111 = load i32, i32* %30
%112 = add nsw i32 %110, %111
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %107, i64 %113
store double %106, double* %114
%115 = load double*, double** %17
%116 = load i32, i32* %31
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds double, double* %115, i64 %117
%119 = load double, double* %118
%120 = load double*, double** %46
%121 = load i32, i32* %31
%122 = load i32, i32* %27
%123 = mul nsw i32 %121, %122
%124 = load i32, i32* %30
%125 = add nsw i32 %123, %124
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds double, double* %120, i64 %126
store double %119, double* %127
br label %128
128: ; preds = %101
%129 = load i32, i32* %30
%130 = add nsw i32 %129, 1
store i32 %130, i32* %30
br label %97
131: ; preds = %97
br label %132
132: ; preds = %131
%133 = load i32, i32* %31
%134 = add nsw i32 %133, 1
store i32 %134, i32* %31
br label %92
135: ; preds = %92
%136 = load i32, i32* %25
%137 = icmp sgt i32 %136, 1
br i1 %137, label %138, label %145
138: ; preds = %135
%139 = load i32*, i32** %13
%140 = load i32*, i32** %14
%141 = load double*, double** %45
%142 = load double*, double** %46
%143 = load double*, double** %42
%144 = call i32 @get_grid_area(i32* %139, i32* %140, double* %141, double* %142, double* %143)
br label %152
145: ; preds = %135
%146 = load i32*, i32** %13
%147 = load i32*, i32** %14
%148 = load double*, double** %45
%149 = load double*, double** %46
%150 = load double*, double** %42
%151 = call i32 @get_grid_area_no_adjust(i32* %146, i32* %147, double* %148, double* %149, double* %150)
br label %152
152: ; preds = %145, %138
%153 = load i32*, i32** %15
%154 = load double*, double** %18
%155 = load double*, double** %19
%156 = load double*, double** %43
%157 = call i32 @get_grid_area_ug(i32* %153, double* %154, double* %155, double* %156)
%158 = load double*, double** %45
%159 = call i32 @free(double* %158)
%160 = load double*, double** %46
%161 = call i32 @free(double* %160)
store i32 0, i32* %31
br label %162
162: ; preds = %432, %152
%163 = load i32, i32* %31
%164 = load i32, i32* %26
%165 = icmp slt i32 %163, %164
br i1 %165, label %166, label %435
166: ; preds = %162
store i32 0, i32* %30
br label %167
167: ; preds = %428, %166
%168 = load i32, i32* %30
%169 = load i32, i32* %25
%170 = icmp slt i32 %168, %169
br i1 %170, label %171, label %431
171: ; preds = %167
%172 = load double*, double** %20
%173 = load i32, i32* %31
%174 = load i32, i32* %25
%175 = mul nsw i32 %173, %174
%176 = load i32, i32* %30
%177 = add nsw i32 %175, %176
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds double, double* %172, i64 %178
%180 = load double, double* %179
%181 = fcmp ogt double %180, 5.000000e-01
br i1 %181, label %182, label %427
182: ; preds = %171
%183 = load double*, double** %16
%184 = load i32, i32* %30
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds double, double* %183, i64 %185
%187 = load double, double* %186
store double %187, double* %34
%188 = load double*, double** %17
%189 = load i32, i32* %31
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %188, i64 %190
%192 = load double, double* %191
store double %192, double* %35
%193 = load double*, double** %16
%194 = load i32, i32* %30
%195 = add nsw i32 %194, 1
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds double, double* %193, i64 %196
%198 = load double, double* %197
store double %198, double* %36
%199 = load double*, double** %17
%200 = load i32, i32* %31
%201 = add nsw i32 %200, 1
%202 = sext i32 %201 to i64
%203 = getelementptr inbounds double, double* %199, i64 %202
%204 = load double, double* %203
store double %204, double* %37
store i32 0, i32* %32
br label %205
205: ; preds = %423, %182
%206 = load i32, i32* %32
%207 = load i32, i32* %29
%208 = icmp slt i32 %206, %207
br i1 %208, label %209, label %426
209: ; preds = %205
%210 = load double*, double** %19
%211 = load i32, i32* %32
%212 = load i32, i32* %28
%213 = mul nsw i32 %211, %212
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %210, i64 %214
%216 = load double, double* %215
%217 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 0
store double %216, double* %217
%218 = load double*, double** %19
%219 = load i32, i32* %32
%220 = load i32, i32* %28
%221 = mul nsw i32 %219, %220
%222 = add nsw i32 %221, 1
%223 = sext i32 %222 to i64
%224 = getelementptr inbounds double, double* %218, i64 %223
%225 = load double, double* %224
%226 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 1
store double %225, double* %226
%227 = load double*, double** %19
%228 = load i32, i32* %32
%229 = load i32, i32* %28
%230 = mul nsw i32 %228, %229
%231 = add nsw i32 %230, 2
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %227, i64 %232
%234 = load double, double* %233
%235 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 2
store double %234, double* %235
%236 = load double*, double** %19
%237 = load i32, i32* %32
%238 = load i32, i32* %28
%239 = mul nsw i32 %237, %238
%240 = add nsw i32 %239, 3
%241 = sext i32 %240 to i64
%242 = getelementptr inbounds double, double* %236, i64 %241
%243 = load double, double* %242
%244 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 3
store double %243, double* %244
%245 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 0
%246 = load double, double* %245
%247 = load double, double* %35
%248 = fcmp ole double %246, %247
br i1 %248, label %249, label %265
249: ; preds = %209
%250 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 1
%251 = load double, double* %250
%252 = load double, double* %35
%253 = fcmp ole double %251, %252
br i1 %253, label %254, label %265
254: ; preds = %249
%255 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 2
%256 = load double, double* %255
%257 = load double, double* %35
%258 = fcmp ole double %256, %257
br i1 %258, label %259, label %265
259: ; preds = %254
%260 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 3
%261 = load double, double* %260
%262 = load double, double* %35
%263 = fcmp ole double %261, %262
br i1 %263, label %264, label %265
264: ; preds = %259
br label %423
265: ; preds = %259, %254, %249, %209
%266 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 0
%267 = load double, double* %266
%268 = load double, double* %37
%269 = fcmp oge double %267, %268
br i1 %269, label %270, label %286
270: ; preds = %265
%271 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 1
%272 = load double, double* %271
%273 = load double, double* %37
%274 = fcmp oge double %272, %273
br i1 %274, label %275, label %286
275: ; preds = %270
%276 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 2
%277 = load double, double* %276
%278 = load double, double* %37
%279 = fcmp oge double %277, %278
br i1 %279, label %280, label %286
280: ; preds = %275
%281 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 3
%282 = load double, double* %281
%283 = load double, double* %37
%284 = fcmp oge double %282, %283
br i1 %284, label %285, label %286
285: ; preds = %280
br label %423
286: ; preds = %280, %275, %270, %265
%287 = load double*, double** %18
%288 = load i32, i32* %32
%289 = load i32, i32* %28
%290 = mul nsw i32 %288, %289
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds double, double* %287, i64 %291
%293 = load double, double* %292
%294 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 0
store double %293, double* %294
%295 = load double*, double** %18
%296 = load i32, i32* %32
%297 = load i32, i32* %28
%298 = mul nsw i32 %296, %297
%299 = add nsw i32 %298, 1
%300 = sext i32 %299 to i64
%301 = getelementptr inbounds double, double* %295, i64 %300
%302 = load double, double* %301
%303 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 1
store double %302, double* %303
%304 = load double*, double** %18
%305 = load i32, i32* %32
%306 = load i32, i32* %28
%307 = mul nsw i32 %305, %306
%308 = add nsw i32 %307, 2
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds double, double* %304, i64 %309
%311 = load double, double* %310
%312 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 2
store double %311, double* %312
%313 = load double*, double** %18
%314 = load i32, i32* %32
%315 = load i32, i32* %28
%316 = mul nsw i32 %314, %315
%317 = add nsw i32 %316, 3
%318 = sext i32 %317 to i64
%319 = getelementptr inbounds double, double* %313, i64 %318
%320 = load double, double* %319
%321 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 3
store double %320, double* %321
%322 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 0
%323 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 0
%324 = load double, double* %34
%325 = load double, double* %36
%326 = fadd double %324, %325
%327 = fdiv double %326, 2.000000e+00
%328 = call i32 @fix_lon(double* %322, double* %323, i32 4, double %327)
store i32 %328, i32* %47
%329 = getelementptr inbounds [50 x double], [50 x double]* %38, i64 0, i64 0
%330 = getelementptr inbounds [50 x double], [50 x double]* %39, i64 0, i64 0
%331 = load i32, i32* %47
%332 = load double, double* %34
%333 = load double, double* %35
%334 = load double, double* %36
%335 = load double, double* %37
%336 = getelementptr inbounds [50 x double], [50 x double]* %40, i64 0, i64 0
%337 = getelementptr inbounds [50 x double], [50 x double]* %41, i64 0, i64 0
%338 = call i32 @clip(double* %329, double* %330, i32 %331, double %332, double %333, double %334, double %335, double* %336, double* %337)
store i32 %338, i32* %48
%339 = icmp sgt i32 %338, 0
br i1 %339, label %340, label %422
340: ; preds = %286
%341 = getelementptr inbounds [50 x double], [50 x double]* %40, i64 0, i64 0
%342 = getelementptr inbounds [50 x double], [50 x double]* %41, i64 0, i64 0
%343 = load i32, i32* %48
%344 = call double @poly_area(double* %341, double* %342, i32 %343)
%345 = load double*, double** %20
%346 = load i32, i32* %31
%347 = load i32, i32* %25
%348 = mul nsw i32 %346, %347
%349 = load i32, i32* %30
%350 = add nsw i32 %348, %349
%351 = sext i32 %350 to i64
%352 = getelementptr inbounds double, double* %345, i64 %351
%353 = load double, double* %352
%354 = fmul double %344, %353
store double %354, double* %49
%355 = load double*, double** %42
%356 = load i32, i32* %31
%357 = load i32, i32* %25
%358 = mul nsw i32 %356, %357
%359 = load i32, i32* %30
%360 = add nsw i32 %358, %359
%361 = sext i32 %360 to i64
%362 = getelementptr inbounds double, double* %355, i64 %361
%363 = load double, double* %362
%364 = load double*, double** %43
%365 = load i32, i32* %32
%366 = sext i32 %365 to i64
%367 = getelementptr inbounds double, double* %364, i64 %366
%368 = load double, double* %367
%369 = fcmp olt double %363, %368
br i1 %369, label %370, label %380
370: ; preds = %340
%371 = load double*, double** %42
%372 = load i32, i32* %31
%373 = load i32, i32* %25
%374 = mul nsw i32 %372, %373
%375 = load i32, i32* %30
%376 = add nsw i32 %374, %375
%377 = sext i32 %376 to i64
%378 = getelementptr inbounds double, double* %371, i64 %377
%379 = load double, double* %378
br label %386
380: ; preds = %340
%381 = load double*, double** %43
%382 = load i32, i32* %32
%383 = sext i32 %382 to i64
%384 = getelementptr inbounds double, double* %381, i64 %383
%385 = load double, double* %384
br label %386
386: ; preds = %380, %370
%387 = phi double [ %379, %370 ], [ %385, %380 ]
store double %387, double* %44
%388 = load double, double* %49
%389 = load double, double* %44
%390 = fdiv double %388, %389
%391 = fcmp ogt double %390, 0x3EB0C6F7A0B5ED8D
br i1 %391, label %392, label %421
392: ; preds = %386
%393 = load double, double* %49
%394 = load double*, double** %24
%395 = load i32, i32* %33
%396 = sext i32 %395 to i64
%397 = getelementptr inbounds double, double* %394, i64 %396
store double %393, double* %397
%398 = load i32, i32* %30
%399 = load i32*, i32** %21
%400 = load i32, i32* %33
%401 = sext i32 %400 to i64
%402 = getelementptr inbounds i32, i32* %399, i64 %401
store i32 %398, i32* %402
%403 = load i32, i32* %31
%404 = load i32*, i32** %22
%405 = load i32, i32* %33
%406 = sext i32 %405 to i64
%407 = getelementptr inbounds i32, i32* %404, i64 %406
store i32 %403, i32* %407
%408 = load i32, i32* %32
%409 = load i32*, i32** %23
%410 = load i32, i32* %33
%411 = sext i32 %410 to i64
%412 = getelementptr inbounds i32, i32* %409, i64 %411
store i32 %408, i32* %412
%413 = load i32, i32* %33
%414 = add nsw i32 %413, 1
store i32 %414, i32* %33
%415 = load i32, i32* %33
%416 = sitofp i32 %415 to double
%417 = fcmp ogt double %416, 1.000000e+06
br i1 %417, label %418, label %420
418: ; preds = %392
%419 = call i32 @error_handler(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
br label %420
420: ; preds = %418, %392
br label %421
421: ; preds = %420, %386
br label %422
422: ; preds = %421, %286
br label %423
423: ; preds = %422, %285, %264
%424 = load i32, i32* %32
%425 = add nsw i32 %424, 1
store i32 %425, i32* %32
br label %205
426: ; preds = %205
br label %427
427: ; preds = %426, %171
br label %428
428: ; preds = %427
%429 = load i32, i32* %30
%430 = add nsw i32 %429, 1
store i32 %430, i32* %30
br label %167
431: ; preds = %167
br label %432
432: ; preds = %431
%433 = load i32, i32* %31
%434 = add nsw i32 %433, 1
store i32 %434, i32* %31
br label %162
435: ; preds = %162
%436 = load double*, double** %42
%437 = call i32 @free(double* %436)
%438 = load double*, double** %43
%439 = call i32 @free(double* %438)
%440 = load i32, i32* %33
ret i32 %440
}

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