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

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double genYmax(double const, double const);
double genYmin(double const, double const);
void grid_cell_center_to_bounds_Y2D(const char *yunitstr, long xsize,
                                    long ysize,
                                    const double *restrict grid_center_lat,
                                    double *restrict grid_corner_lat) {
  long i, j, index;
  double minlat, maxlat;
  double firstlat, lastlat;
  firstlat = grid_center_lat[0];
  lastlat = grid_center_lat[xsize * ysize - 1];
  for (j = 0; j < ysize; ++j) {
    if (ysize == 1) {
      minlat = grid_center_lat[0] - 360. / ysize;
      maxlat = grid_center_lat[0] + 360. / ysize;
    } else {
      index = j * xsize;
      if (firstlat > lastlat) {
        if (j == 0)
          maxlat =
              genYmax(grid_center_lat[index], grid_center_lat[index + xsize]);
        else
          maxlat =
              0.5 * (grid_center_lat[index] + grid_center_lat[index - xsize]);
        if (j == (ysize - 1))
          minlat =
              genYmin(grid_center_lat[index], grid_center_lat[index - xsize]);
        else
          minlat =
              0.5 * (grid_center_lat[index] + grid_center_lat[index + xsize]);
      } else {
        if (j == 0)
          minlat =
              genYmin(grid_center_lat[index], grid_center_lat[index + xsize]);
        else
          minlat =
              0.5 * (grid_center_lat[index] + grid_center_lat[index - xsize]);
        if (j == (ysize - 1))
          maxlat =
              genYmax(grid_center_lat[index], grid_center_lat[index - xsize]);
        else
          maxlat =
              0.5 * (grid_center_lat[index] + grid_center_lat[index + xsize]);
      }
    }
    for (i = 0; i < xsize; ++i) {
      index = (j << 2) * xsize + (i << 2);
      grid_corner_lat[index] = minlat;
      grid_corner_lat[index + 1] = minlat;
      grid_corner_lat[index + 2] = maxlat;
      grid_corner_lat[index + 3] = maxlat;
    }
  }
}


x86 assembly (clang, -O0):
<grid_cell_center_to_bounds_Y2D>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
imul   -0x18(%rbp),%rcx
sub    $0x1,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x60(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%rax
cmp    -0x18(%rbp),%rax
jge    1450 <grid_cell_center_to_bounds_Y2D+0x330>
cmpq   $0x1,-0x18(%rbp)
jne    11d0 <grid_cell_center_to_bounds_Y2D+0xb0>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdq -0x18(%rbp),%xmm2
movsd  0xe6d(%rip),%xmm1
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
cvtsi2sdq -0x18(%rbp),%xmm2
movsd  0xe4a(%rip),%xmm1
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13ac <grid_cell_center_to_bounds_Y2D+0x28c>
mov    -0x38(%rbp),%rax
imul   -0x10(%rbp),%rax
mov    %rax,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm0
ucomisd -0x60(%rbp),%xmm0
jbe    12ca <grid_cell_center_to_bounds_Y2D+0x1aa>
cmpq   $0x0,-0x38(%rbp)
jne    1225 <grid_cell_center_to_bounds_Y2D+0x105>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1040 <genYmax@plt>
movsd  %xmm0,-0x50(%rbp)
jmp    1254 <grid_cell_center_to_bounds_Y2D+0x134>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xdb5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    1296 <grid_cell_center_to_bounds_Y2D+0x176>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <genYmin@plt>
movsd  %xmm0,-0x48(%rbp)
jmp    12c5 <grid_cell_center_to_bounds_Y2D+0x1a5>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xd44(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    13a7 <grid_cell_center_to_bounds_Y2D+0x287>
cmpq   $0x0,-0x38(%rbp)
jne    1302 <grid_cell_center_to_bounds_Y2D+0x1e2>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <genYmin@plt>
movsd  %xmm0,-0x48(%rbp)
jmp    1331 <grid_cell_center_to_bounds_Y2D+0x211>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xcd8(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jne    1373 <grid_cell_center_to_bounds_Y2D+0x253>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
sub    -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1040 <genYmax@plt>
movsd  %xmm0,-0x50(%rbp)
jmp    13a2 <grid_cell_center_to_bounds_Y2D+0x282>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
add    -0x10(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  0xc67(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
jmp    13a7 <grid_cell_center_to_bounds_Y2D+0x287>
jmp    13ac <grid_cell_center_to_bounds_Y2D+0x28c>
movq   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%rax
cmp    -0x10(%rbp),%rax
jge    143a <grid_cell_center_to_bounds_Y2D+0x31a>
mov    -0x38(%rbp),%rax
shl    $0x2,%rax
imul   -0x10(%rbp),%rax
mov    -0x30(%rbp),%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x48(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,0x8(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,0x10(%rax,%rcx,8)
movsd  -0x50(%rbp),%xmm0
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%rcx
movsd  %xmm0,0x18(%rax,%rcx,8)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    13b4 <grid_cell_center_to_bounds_Y2D+0x294>
jmp    143f <grid_cell_center_to_bounds_Y2D+0x31f>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    116c <grid_cell_center_to_bounds_Y2D+0x4c>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<grid_cell_center_to_bounds_Y2D>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    %r8,0x48(%rsp)
test   %rdx,%rdx
jle    152e <grid_cell_center_to_bounds_Y2D+0x40e>
mov    %rcx,%rbx
mov    %rdx,%r9
mov    %rsi,%rbp
movsd  (%rcx),%xmm0
mov    %rdx,%rax
imul   %rsi,%rax
movsd  -0x8(%rcx,%rax,8),%xmm1
movsd  %xmm1,0x68(%rsp)
lea    -0x1(%rdx),%rax
mov    %rax,0x50(%rsp)
movsd  0xe93(%rip),%xmm2
addsd  %xmm0,%xmm2
movsd  0xe8f(%rip),%xmm3
movsd  %xmm0,0x70(%rsp)
addsd  %xmm0,%xmm3
lea    -0x1(%rsi),%rax
mov    $0x20,%ecx
mul    %rcx
lea    0x0(,%rsi,4),%rcx
mov    %rcx,0x58(%rsp)
seto   %r11b
mov    %rsi,%rcx
and    $0xfffffffffffffffc,%rcx
mov    %rcx,0x40(%rsp)
mov    0x48(%rsp),%rcx
lea    0x40(%rcx),%r14
mov    %rax,0x60(%rsp)
lea    0x20(%rax),%r15
lea    0x10(%rcx),%r13
xor    %r12d,%r12d
mov    %r9,0x30(%rsp)
movsd  %xmm2,0x28(%rsp)
movsd  %xmm3,0x20(%rsp)
mov    %r11b,0xf(%rsp)
mov    %r15,0x38(%rsp)
jmp    1203 <grid_cell_center_to_bounds_Y2D+0xe3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%r12
add    %r15,%r14
add    %r15,%r13
cmp    %r9,%r12
je     152e <grid_cell_center_to_bounds_Y2D+0x40e>
movapd %xmm2,%xmm4
movapd %xmm3,%xmm5
cmp    $0x1,%r9
je     13bb <grid_cell_center_to_bounds_Y2D+0x29b>
mov    %r12,%r15
imul   %rbp,%r15
movsd  0x70(%rsp),%xmm0
ucomisd 0x68(%rsp),%xmm0
movsd  (%rbx,%r15,8),%xmm0
jbe    12a0 <grid_cell_center_to_bounds_Y2D+0x180>
test   %r12,%r12
je     1300 <grid_cell_center_to_bounds_Y2D+0x1e0>
mov    %r15,%rax
sub    %rbp,%rax
movsd  (%rbx,%rax,8),%xmm5
addsd  %xmm0,%xmm5
mulsd  0xdc0(%rip),%xmm5
cmp    0x50(%rsp),%r12
jne    1345 <grid_cell_center_to_bounds_Y2D+0x225>
sub    %rbp,%r15
movsd  (%rbx,%r15,8),%xmm1
movapd %xmm5,0x10(%rsp)
call   1040 <genYmin@plt>
movapd 0x10(%rsp),%xmm5
mov    0xf(%rsp),%r11b
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm2
mov    0x30(%rsp),%r9
movapd %xmm0,%xmm4
jmp    13b6 <grid_cell_center_to_bounds_Y2D+0x296>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
test   %r12,%r12
je     135c <grid_cell_center_to_bounds_Y2D+0x23c>
mov    %r15,%rax
sub    %rbp,%rax
movsd  (%rbx,%rax,8),%xmm4
addsd  %xmm0,%xmm4
mulsd  0xd50(%rip),%xmm4
cmp    0x50(%rsp),%r12
jne    13a1 <grid_cell_center_to_bounds_Y2D+0x281>
sub    %rbp,%r15
movsd  (%rbx,%r15,8),%xmm1
movapd %xmm4,0x10(%rsp)
call   1030 <genYmax@plt>
movapd 0x10(%rsp),%xmm4
mov    0xf(%rsp),%r11b
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm2
mov    0x30(%rsp),%r9
jmp    13b2 <grid_cell_center_to_bounds_Y2D+0x292>
lea    (%r15,%rbp,1),%rax
movsd  (%rbx,%rax,8),%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1030 <genYmax@plt>
mov    0xf(%rsp),%r11b
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm2
mov    0x30(%rsp),%r9
movapd %xmm0,%xmm5
movsd  0x10(%rsp),%xmm0
cmp    0x50(%rsp),%r12
je     125b <grid_cell_center_to_bounds_Y2D+0x13b>
add    %rbp,%r15
addsd  (%rbx,%r15,8),%xmm0
mulsd  0xcba(%rip),%xmm0
movapd %xmm0,%xmm4
jmp    13b6 <grid_cell_center_to_bounds_Y2D+0x296>
lea    (%r15,%rbp,1),%rax
movsd  (%rbx,%rax,8),%xmm1
movsd  %xmm0,0x10(%rsp)
movsd  0x10(%rsp),%xmm0
call   1040 <genYmin@plt>
mov    0xf(%rsp),%r11b
movsd  0x20(%rsp),%xmm3
movsd  0x28(%rsp),%xmm2
mov    0x30(%rsp),%r9
movapd %xmm0,%xmm4
movsd  0x10(%rsp),%xmm0
cmp    0x50(%rsp),%r12
je     12cb <grid_cell_center_to_bounds_Y2D+0x1ab>
add    %rbp,%r15
addsd  (%rbx,%r15,8),%xmm0
mulsd  0xc5e(%rip),%xmm0
movapd %xmm0,%xmm5
mov    0x38(%rsp),%r15
test   %rbp,%rbp
jle    11f0 <grid_cell_center_to_bounds_Y2D+0xd0>
cmp    $0x4,%rbp
jae    1410 <grid_cell_center_to_bounds_Y2D+0x2f0>
xor    %eax,%eax
mov    %rbp,%rcx
sub    %rax,%rcx
shl    $0x5,%rax
add    %r13,%rax
nopl   0x0(%rax)
movsd  %xmm4,-0x10(%rax)
movsd  %xmm4,-0x8(%rax)
movsd  %xmm5,(%rax)
movsd  %xmm5,0x8(%rax)
add    $0x20,%rax
add    $0xffffffffffffffff,%rcx
jne    13e0 <grid_cell_center_to_bounds_Y2D+0x2c0>
jmp    11f0 <grid_cell_center_to_bounds_Y2D+0xd0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %rbp,%r10
mov    %rbx,%r8
mov    0x58(%rsp),%rax
imul   %r12,%rax
lea    0x0(,%rax,8),%rcx
mov    %rcx,%rdx
or     $0x10,%rdx
mov    %rcx,%rsi
or     $0x18,%rsi
or     $0x8,%rcx
mov    0x48(%rsp),%rdi
add    %rdi,%rdx
add    %rdi,%rsi
add    %rdi,%rcx
lea    (%rdi,%rax,8),%rax
mov    0x60(%rsp),%rbp
lea    (%rdx,%rbp,1),%rdi
cmp    %rdx,%rdi
setb   %bl
or     %r11b,%bl
lea    (%rsi,%rbp,1),%rdx
cmp    %rsi,%rdx
setb   %dl
lea    (%rcx,%rbp,1),%rsi
cmp    %rcx,%rsi
setb   %cl
lea    (%rax,%rbp,1),%rsi
cmp    %rax,%rsi
setb   %al
test   %bl,%bl
jne    1517 <grid_cell_center_to_bounds_Y2D+0x3f7>
or     %r11b,%dl
mov    %r8,%rbx
jne    1524 <grid_cell_center_to_bounds_Y2D+0x404>
or     %r11b,%cl
mov    %r10,%rbp
jne    13ca <grid_cell_center_to_bounds_Y2D+0x2aa>
or     %r11b,%al
mov    $0x0,%eax
jne    13cc <grid_cell_center_to_bounds_Y2D+0x2ac>
movapd %xmm5,%xmm0
unpcklpd %xmm5,%xmm0
movapd %xmm4,%xmm1
unpcklpd %xmm4,%xmm1
mov    0x40(%rsp),%rax
mov    %r14,%rcx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movupd %xmm1,-0x40(%rcx)
movupd %xmm0,-0x30(%rcx)
movupd %xmm1,-0x20(%rcx)
movupd %xmm0,-0x10(%rcx)
movupd %xmm1,(%rcx)
movupd %xmm0,0x10(%rcx)
movupd %xmm1,0x20(%rcx)
movupd %xmm0,0x30(%rcx)
sub    $0xffffffffffffff80,%rcx
add    $0xfffffffffffffffc,%rax
jne    14d0 <grid_cell_center_to_bounds_Y2D+0x3b0>
mov    0x40(%rsp),%rcx
mov    %rcx,%rax
cmp    %rbp,%rcx
je     11f0 <grid_cell_center_to_bounds_Y2D+0xd0>
jmp    13cc <grid_cell_center_to_bounds_Y2D+0x2ac>
xor    %eax,%eax
mov    %r8,%rbx
mov    %r10,%rbp
jmp    13cc <grid_cell_center_to_bounds_Y2D+0x2ac>
xor    %eax,%eax
mov    %r10,%rbp
jmp    13cc <grid_cell_center_to_bounds_Y2D+0x2ac>
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @grid_cell_center_to_bounds_Y2D(i8* nocapture readnone %0, i64 %1, i64 %2, double* noalias nocapture %3, double* noalias nocapture writeonly %4) {
%6 = load double, double* %3
%7 = icmp sgt i64 %2, 0
br i1 %7, label %8, label %176
8: ; preds = %5
%9 = mul nsw i64 %2, %1
%10 = add nsw i64 %9, -1
%11 = getelementptr inbounds double, double* %3, i64 %10
%12 = load double, double* %11
%13 = icmp eq i64 %2, 1
%14 = fcmp ogt double %6, %12
%15 = add nsw i64 %2, -1
%16 = fadd double %6, -3.600000e+02
%17 = fadd double %6, 3.600000e+02
%18 = icmp sgt i64 %1, 0
%19 = shl i64 %1, 2
%20 = add i64 %1, -1
%21 = shl i64 %1, 2
%22 = icmp ult i64 %1, 4
%23 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 32)
%24 = extractvalue { i64, i1 } %23, 0
%25 = extractvalue { i64, i1 } %23, 1
%26 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 32)
%27 = extractvalue { i64, i1 } %26, 0
%28 = extractvalue { i64, i1 } %26, 1
%29 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 32)
%30 = extractvalue { i64, i1 } %29, 0
%31 = extractvalue { i64, i1 } %29, 1
%32 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %20, i64 32)
%33 = extractvalue { i64, i1 } %32, 0
%34 = extractvalue { i64, i1 } %32, 1
%35 = and i64 %1, -4
%36 = getelementptr inbounds double, double* %4, i64 -3
%37 = getelementptr inbounds double, double* %4, i64 -3
%38 = icmp eq i64 %35, %1
br label %39
39: ; preds = %8, %173
%40 = phi i64 [ 0, %8 ], [ %174, %173 ]
%41 = mul i64 %21, %40
%42 = or i64 %41, 2
%43 = getelementptr double, double* %4, i64 %42
%44 = bitcast double* %43 to i8*
%45 = or i64 %41, 3
%46 = getelementptr double, double* %4, i64 %45
%47 = bitcast double* %46 to i8*
%48 = or i64 %41, 1
%49 = getelementptr double, double* %4, i64 %48
%50 = bitcast double* %49 to i8*
%51 = getelementptr double, double* %4, i64 %41
%52 = bitcast double* %51 to i8*
br i1 %13, label %110, label %53
53: ; preds = %39
%54 = mul nsw i64 %40, %1
%55 = icmp eq i64 %40, 0
%56 = getelementptr inbounds double, double* %3, i64 %54
%57 = load double, double* %56
br i1 %14, label %58, label %84
58: ; preds = %53
br i1 %55, label %59, label %64
59: ; preds = %58
%60 = add nuw nsw i64 %54, %1
%61 = getelementptr inbounds double, double* %3, i64 %60
%62 = load double, double* %61
%63 = tail call double @genYmax(double %57, double %62)
br label %70
64: ; preds = %58
%65 = sub nsw i64 %54, %1
%66 = getelementptr inbounds double, double* %3, i64 %65
%67 = load double, double* %66
%68 = fadd double %57, %67
%69 = fmul double %68, 5.000000e-01
br label %70
70: ; preds = %64, %59
%71 = phi double [ %63, %59 ], [ %69, %64 ]
%72 = icmp eq i64 %40, %15
br i1 %72, label %73, label %78
73: ; preds = %70
%74 = sub nsw i64 %54, %1
%75 = getelementptr inbounds double, double* %3, i64 %74
%76 = load double, double* %75
%77 = tail call double @genYmin(double %57, double %76)
br label %110
78: ; preds = %70
%79 = add nsw i64 %54, %1
%80 = getelementptr inbounds double, double* %3, i64 %79
%81 = load double, double* %80
%82 = fadd double %57, %81
%83 = fmul double %82, 5.000000e-01
br label %110
84: ; preds = %53
br i1 %55, label %85, label %90
85: ; preds = %84
%86 = add nuw nsw i64 %54, %1
%87 = getelementptr inbounds double, double* %3, i64 %86
%88 = load double, double* %87
%89 = tail call double @genYmin(double %57, double %88)
br label %96
90: ; preds = %84
%91 = sub nsw i64 %54, %1
%92 = getelementptr inbounds double, double* %3, i64 %91
%93 = load double, double* %92
%94 = fadd double %57, %93
%95 = fmul double %94, 5.000000e-01
br label %96
96: ; preds = %90, %85
%97 = phi double [ %89, %85 ], [ %95, %90 ]
%98 = icmp eq i64 %40, %15
br i1 %98, label %99, label %104
99: ; preds = %96
%100 = sub nsw i64 %54, %1
%101 = getelementptr inbounds double, double* %3, i64 %100
%102 = load double, double* %101
%103 = tail call double @genYmax(double %57, double %102)
br label %110
104: ; preds = %96
%105 = add nsw i64 %54, %1
%106 = getelementptr inbounds double, double* %3, i64 %105
%107 = load double, double* %106
%108 = fadd double %57, %107
%109 = fmul double %108, 5.000000e-01
br label %110
110: ; preds = %39, %78, %73, %104, %99
%111 = phi double [ %77, %73 ], [ %83, %78 ], [ %97, %99 ], [ %97, %104 ], [ %16, %39 ]
%112 = phi double [ %71, %73 ], [ %71, %78 ], [ %103, %99 ], [ %109, %104 ], [ %17, %39 ]
br i1 %18, label %113, label %173
113: ; preds = %110
%114 = mul i64 %19, %40
br i1 %22, label %158, label %115
115: ; preds = %113
%116 = getelementptr i8, i8* %44, i64 %24
%117 = icmp ult i8* %116, %44
%118 = or i1 %117, %25
%119 = getelementptr i8, i8* %47, i64 %27
%120 = icmp ult i8* %119, %47
%121 = or i1 %120, %28
%122 = getelementptr i8, i8* %50, i64 %30
%123 = icmp ult i8* %122, %50
%124 = or i1 %123, %31
%125 = getelementptr i8, i8* %52, i64 %33
%126 = icmp ult i8* %125, %52
%127 = or i1 %126, %34
%128 = or i1 %118, %121
%129 = or i1 %128, %124
%130 = or i1 %129, %127
br i1 %130, label %158, label %131
131: ; preds = %115
%132 = insertelement <2 x double> poison, double %111, i64 0
%133 = insertelement <2 x double> poison, double %112, i64 0
%134 = insertelement <2 x double> poison, double %111, i64 0
%135 = insertelement <2 x double> poison, double %112, i64 0
%136 = shufflevector <2 x double> %132, <2 x double> poison, <4 x i32> zeroinitializer
%137 = shufflevector <2 x double> %133, <2 x double> poison, <4 x i32> zeroinitializer
%138 = shufflevector <4 x double> %136, <4 x double> %137, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 1, i32 3, i32 5, i32 7>
%139 = shufflevector <2 x double> %134, <2 x double> poison, <4 x i32> zeroinitializer
%140 = shufflevector <2 x double> %135, <2 x double> poison, <4 x i32> zeroinitializer
%141 = shufflevector <4 x double> %139, <4 x double> %140, <8 x i32> <i32 0, i32 2, i32 4, i32 6, i32 1, i32 3, i32 5, i32 7>
br label %142
142: ; preds = %142, %131
%143 = phi i64 [ 0, %131 ], [ %155, %142 ]
%144 = shl i64 %143, 2
%145 = shl i64 %143, 2
%146 = or i64 %145, 8
%147 = add nsw i64 %144, %114
%148 = add nsw i64 %146, %114
%149 = or i64 %147, 3
%150 = or i64 %148, 3
%151 = getelementptr inbounds double, double* %36, i64 %149
%152 = bitcast double* %151 to <8 x double>*
%153 = getelementptr inbounds double, double* %37, i64 %150
%154 = bitcast double* %153 to <8 x double>*
store <8 x double> %138, <8 x double>* %152
store <8 x double> %141, <8 x double>* %154
%155 = add nuw i64 %143, 4
%156 = icmp eq i64 %155, %35
br i1 %156, label %157, label %142
157: ; preds = %142
br i1 %38, label %173, label %158
158: ; preds = %115, %113, %157
%159 = phi i64 [ 0, %115 ], [ 0, %113 ], [ %35, %157 ]
br label %160
160: ; preds = %158, %160
%161 = phi i64 [ %171, %160 ], [ %159, %158 ]
%162 = shl i64 %161, 2
%163 = add nsw i64 %162, %114
%164 = getelementptr inbounds double, double* %4, i64 %163
store double %111, double* %164
%165 = or i64 %163, 1
%166 = getelementptr inbounds double, double* %4, i64 %165
store double %111, double* %166
%167 = or i64 %163, 2
%168 = getelementptr inbounds double, double* %4, i64 %167
store double %112, double* %168
%169 = or i64 %163, 3
%170 = getelementptr inbounds double, double* %4, i64 %169
store double %112, double* %170
%171 = add nuw nsw i64 %161, 1
%172 = icmp eq i64 %171, %1
br i1 %172, label %173, label %160
173: ; preds = %160, %157, %110
%174 = add nuw nsw i64 %40, 1
%175 = icmp eq i64 %174, %2
br i1 %175, label %176, label %39
176: ; preds = %173, %5
ret void
}