#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 */
struct Node {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ addEnd(struct Node *, double, double, double,
                          int /*<<< orphan*/, int /*<<< orphan*/,
                          int /*<<< orphan*/, int);
int /*<<< orphan*/ free(double *);
struct Node *getNext();
double gridArea(struct Node *);
int /*<<< orphan*/ latlon2xyz(int, double const *, double const *, double *,
                              double *, double *);
scalar_t__ malloc(int);
int /*<<< orphan*/ rewindList();
void get_grid_great_circle_area(const int *nlon, const int *nlat,
                                const double *lon, const double *lat,
                                double *area) {
  int nx, ny, nxp, nyp, i, j;
  int n0, n1, n2, n3;
  double x_in[20], y_in[20], z_in[20];
  struct Node *grid = NULL;
  double *x = NULL, *y = NULL, *z = NULL;
  nx = *nlon;
  ny = *nlat;
  nxp = nx + 1;
  nyp = ny + 1;
  x = (double *)malloc(nxp * nyp * sizeof(double));
  y = (double *)malloc(nxp * nyp * sizeof(double));
  z = (double *)malloc(nxp * nyp * sizeof(double));
  latlon2xyz(nxp * nyp, lon, lat, x, y, z);
  for (j = 0; j < ny; j++)
    for (i = 0; i < nx; i++) {
      n0 = j * nxp + i;
      n1 = (j + 1) * nxp + i;
      n2 = (j + 1) * nxp + i + 1;
      n3 = j * nxp + i + 1;
      rewindList();
      grid = getNext();
      addEnd(grid, x[n0], y[n0], z[n0], 0, 0, 0, -1);
      addEnd(grid, x[n1], y[n1], z[n1], 0, 0, 0, -1);
      addEnd(grid, x[n2], y[n2], z[n2], 0, 0, 0, -1);
      addEnd(grid, x[n3], y[n3], z[n3], 0, 0, 0, -1);
      area[j * nx + i] = gridArea(grid);
    }
  free(x);
  free(y);
  free(z);
}


x86 assembly (clang, -O0):
<get_grid_great_circle_area>:
push   %rbp
mov    %rsp,%rbp
sub    $0x250,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
movq   $0x0,-0x238(%rbp)
movq   $0x0,-0x240(%rbp)
movq   $0x0,-0x248(%rbp)
movq   $0x0,-0x250(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x240(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x248(%rbp)
mov    -0x34(%rbp),%eax
imul   -0x38(%rbp),%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x250(%rbp)
mov    -0x34(%rbp),%edi
imul   -0x38(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x240(%rbp),%rcx
mov    -0x248(%rbp),%r8
mov    -0x250(%rbp),%r9
call   1070 <latlon2xyz@plt>
movl   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    1437 <get_grid_great_circle_area+0x2c7>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1424 <get_grid_great_circle_area+0x2b4>
mov    -0x40(%rbp),%eax
imul   -0x34(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
imul   -0x34(%rbp),%eax
add    -0x3c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
imul   -0x34(%rbp),%eax
add    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x40(%rbp),%eax
imul   -0x34(%rbp),%eax
add    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
mov    $0x0,%al
call   1040 <rewindList@plt>
mov    $0x0,%al
call   1080 <getNext@plt>
mov    %rax,-0x238(%rbp)
mov    -0x238(%rbp),%rdi
mov    -0x240(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x248(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x250(%rbp),%rax
movslq -0x44(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <addEnd@plt>
mov    -0x238(%rbp),%rdi
mov    -0x240(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x248(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x250(%rbp),%rax
movslq -0x48(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <addEnd@plt>
mov    -0x238(%rbp),%rdi
mov    -0x240(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x248(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x250(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <addEnd@plt>
mov    -0x238(%rbp),%rdi
mov    -0x240(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x248(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x250(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
mov    %ecx,%esi
mov    %ecx,%edx
call   1060 <addEnd@plt>
mov    -0x238(%rbp),%rdi
call   1090 <gridArea@plt>
mov    -0x28(%rbp),%rax
mov    -0x40(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x3c(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1273 <get_grid_great_circle_area+0x103>
jmp    1429 <get_grid_great_circle_area+0x2b9>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1260 <get_grid_great_circle_area+0xf0>
mov    -0x240(%rbp),%rdi
call   1030 <free@plt>
mov    -0x248(%rbp),%rdi
call   1030 <free@plt>
mov    -0x250(%rbp),%rdi
call   1030 <free@plt>
add    $0x250,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_grid_great_circle_area>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %r8,0x50(%rsp)
mov    %rcx,0x8(%rsp)
mov    %rdx,(%rsp)
movslq (%rdi),%rbp
mov    (%rsi),%r15d
lea    0x1(%rbp),%rax
lea    0x1(%r15),%r14d
mov    %rax,0x48(%rsp)
imul   %eax,%r14d
lea    0x0(,%r14,8),%ebx
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r12
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %rax,%r13
mov    %ebx,%edi
call   1050 <malloc@plt>
mov    %r14d,%edi
mov    (%rsp),%rsi
mov    0x8(%rsp),%rdx
mov    %r12,0x20(%rsp)
mov    %r12,%rcx
mov    %r13,0x18(%rsp)
mov    %r13,%r8
mov    %rax,0x10(%rsp)
mov    %rax,%r9
call   1070 <latlon2xyz@plt>
mov    %r15,0x58(%rsp)
test   %r15d,%r15d
jle    13fc <get_grid_great_circle_area+0x28c>
mov    %ebp,%ebx
mov    0x20(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x38(%rsp)
mov    0x18(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x30(%rsp)
mov    0x10(%rsp),%rax
add    $0x8,%rax
mov    %rax,0x28(%rsp)
shl    $0x3,%rbx
xor    %eax,%eax
mov    %rbp,0x40(%rsp)
mov    %rbx,0x68(%rsp)
jmp    1252 <get_grid_great_circle_area+0xe2>
xchg   %ax,%ax
add    $0x1,%rax
mov    %rax,%rcx
cmp    0x58(%rsp),%rcx
je     13fc <get_grid_great_circle_area+0x28c>
test   %ebp,%ebp
jle    1240 <get_grid_great_circle_area+0xd0>
mov    %rax,%rcx
mov    0x48(%rsp),%rsi
imul   %rsi,%rcx
lea    0x1(%rax),%rdx
mov    %rdx,0x60(%rsp)
imul   %rsi,%rdx
imul   %rbp,%rax
mov    0x50(%rsp),%rsi
lea    (%rsi,%rax,8),%rax
mov    %rax,0x90(%rsp)
mov    0x38(%rsp),%rax
lea    (%rax,%rdx,8),%rsi
mov    %rsi,0x88(%rsp)
mov    0x30(%rsp),%rsi
lea    (%rsi,%rdx,8),%rdi
mov    %rdi,0x80(%rsp)
mov    0x28(%rsp),%rdi
lea    (%rdi,%rdx,8),%rdx
mov    %rdx,0x78(%rsp)
lea    (%rax,%rcx,8),%rax
mov    %rax,0x70(%rsp)
lea    (%rsi,%rcx,8),%rax
mov    %rax,0x8(%rsp)
lea    (%rdi,%rcx,8),%rax
mov    %rax,(%rsp)
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rewindList@plt>
xor    %eax,%eax
call   1080 <getNext@plt>
mov    %rax,%rbx
mov    0x70(%rsp),%r12
movsd  -0x8(%r12,%r13,1),%xmm0
mov    0x8(%rsp),%rax
movsd  -0x8(%rax,%r13,1),%xmm1
mov    (%rsp),%rax
movsd  -0x8(%rax,%r13,1),%xmm2
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
call   1060 <addEnd@plt>
mov    0x88(%rsp),%rbp
movsd  -0x8(%rbp,%r13,1),%xmm0
mov    0x80(%rsp),%r14
movsd  -0x8(%r14,%r13,1),%xmm1
mov    0x78(%rsp),%r15
movsd  -0x8(%r15,%r13,1),%xmm2
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
call   1060 <addEnd@plt>
movsd  0x0(%rbp,%r13,1),%xmm0
movsd  (%r14,%r13,1),%xmm1
movsd  (%r15,%r13,1),%xmm2
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
call   1060 <addEnd@plt>
movsd  (%r12,%r13,1),%xmm0
mov    0x8(%rsp),%rax
movsd  (%rax,%r13,1),%xmm1
mov    (%rsp),%rax
movsd  (%rax,%r13,1),%xmm2
mov    %rbx,%rdi
xor    %esi,%esi
xor    %edx,%edx
xor    %ecx,%ecx
mov    $0xffffffff,%r8d
call   1060 <addEnd@plt>
mov    %rbx,%rdi
call   1090 <gridArea@plt>
mov    0x68(%rsp),%rbx
mov    0x90(%rsp),%rax
movsd  %xmm0,(%rax,%r13,1)
add    $0x8,%r13
cmp    %r13,%rbx
jne    12e0 <get_grid_great_circle_area+0x170>
mov    0x60(%rsp),%rcx
mov    %rcx,%rax
mov    0x40(%rsp),%rbp
cmp    0x58(%rsp),%rcx
jne    1252 <get_grid_great_circle_area+0xe2>
mov    0x20(%rsp),%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rdi
call   1030 <free@plt>
mov    0x10(%rsp),%rdi
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Node = type { i32 }
define void @get_grid_great_circle_area(i32* %0, i32* %1, double* %2, double* %3, double* %4) {
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca [20 x double]
%22 = alloca [20 x double]
%23 = alloca [20 x double]
%24 = alloca %struct.Node*
%25 = alloca double*
%26 = alloca double*
%27 = alloca double*
store i32* %0, i32** %6
store i32* %1, i32** %7
store double* %2, double** %8
store double* %3, double** %9
store double* %4, double** %10
store %struct.Node* null, %struct.Node** %24
store double* null, double** %25
store double* null, double** %26
store double* null, double** %27
%28 = load i32*, i32** %6
%29 = load i32, i32* %28
store i32 %29, i32* %11
%30 = load i32*, i32** %7
%31 = load i32, i32* %30
store i32 %31, i32* %12
%32 = load i32, i32* %11
%33 = add nsw i32 %32, 1
store i32 %33, i32* %13
%34 = load i32, i32* %12
%35 = add nsw i32 %34, 1
store i32 %35, i32* %14
%36 = load i32, i32* %13
%37 = load i32, i32* %14
%38 = mul nsw i32 %36, %37
%39 = sext i32 %38 to i64
%40 = mul i64 %39, 8
%41 = trunc i64 %40 to i32
%42 = call i64 @malloc(i32 %41)
%43 = inttoptr i64 %42 to double*
store double* %43, double** %25
%44 = load i32, i32* %13
%45 = load i32, i32* %14
%46 = mul nsw i32 %44, %45
%47 = sext i32 %46 to i64
%48 = mul i64 %47, 8
%49 = trunc i64 %48 to i32
%50 = call i64 @malloc(i32 %49)
%51 = inttoptr i64 %50 to double*
store double* %51, double** %26
%52 = load i32, i32* %13
%53 = load i32, i32* %14
%54 = mul nsw i32 %52, %53
%55 = sext i32 %54 to i64
%56 = mul i64 %55, 8
%57 = trunc i64 %56 to i32
%58 = call i64 @malloc(i32 %57)
%59 = inttoptr i64 %58 to double*
store double* %59, double** %27
%60 = load i32, i32* %13
%61 = load i32, i32* %14
%62 = mul nsw i32 %60, %61
%63 = load double*, double** %8
%64 = load double*, double** %9
%65 = load double*, double** %25
%66 = load double*, double** %26
%67 = load double*, double** %27
%68 = call i32 @latlon2xyz(i32 %62, double* %63, double* %64, double* %65, double* %66, double* %67)
store i32 0, i32* %16
br label %69
69: ; preds = %187, %5
%70 = load i32, i32* %16
%71 = load i32, i32* %12
%72 = icmp slt i32 %70, %71
br i1 %72, label %73, label %190
73: ; preds = %69
store i32 0, i32* %15
br label %74
74: ; preds = %183, %73
%75 = load i32, i32* %15
%76 = load i32, i32* %11
%77 = icmp slt i32 %75, %76
br i1 %77, label %78, label %186
78: ; preds = %74
%79 = load i32, i32* %16
%80 = load i32, i32* %13
%81 = mul nsw i32 %79, %80
%82 = load i32, i32* %15
%83 = add nsw i32 %81, %82
store i32 %83, i32* %17
%84 = load i32, i32* %16
%85 = add nsw i32 %84, 1
%86 = load i32, i32* %13
%87 = mul nsw i32 %85, %86
%88 = load i32, i32* %15
%89 = add nsw i32 %87, %88
store i32 %89, i32* %18
%90 = load i32, i32* %16
%91 = add nsw i32 %90, 1
%92 = load i32, i32* %13
%93 = mul nsw i32 %91, %92
%94 = load i32, i32* %15
%95 = add nsw i32 %93, %94
%96 = add nsw i32 %95, 1
store i32 %96, i32* %19
%97 = load i32, i32* %16
%98 = load i32, i32* %13
%99 = mul nsw i32 %97, %98
%100 = load i32, i32* %15
%101 = add nsw i32 %99, %100
%102 = add nsw i32 %101, 1
store i32 %102, i32* %20
%103 = call i32 (...) @rewindList()
%104 = call %struct.Node* (...) @getNext()
store %struct.Node* %104, %struct.Node** %24
%105 = load %struct.Node*, %struct.Node** %24
%106 = load double*, double** %25
%107 = load i32, i32* %17
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
%110 = load double, double* %109
%111 = load double*, double** %26
%112 = load i32, i32* %17
%113 = sext i32 %112 to i64
%114 = getelementptr inbounds double, double* %111, i64 %113
%115 = load double, double* %114
%116 = load double*, double** %27
%117 = load i32, i32* %17
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds double, double* %116, i64 %118
%120 = load double, double* %119
%121 = call i32 @addEnd(%struct.Node* %105, double %110, double %115, double %120, i32 0, i32 0, i32 0, i32 -1)
%122 = load %struct.Node*, %struct.Node** %24
%123 = load double*, double** %25
%124 = load i32, i32* %18
%125 = sext i32 %124 to i64
%126 = getelementptr inbounds double, double* %123, i64 %125
%127 = load double, double* %126
%128 = load double*, double** %26
%129 = load i32, i32* %18
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = load double, double* %131
%133 = load double*, double** %27
%134 = load i32, i32* %18
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds double, double* %133, i64 %135
%137 = load double, double* %136
%138 = call i32 @addEnd(%struct.Node* %122, double %127, double %132, double %137, i32 0, i32 0, i32 0, i32 -1)
%139 = load %struct.Node*, %struct.Node** %24
%140 = load double*, double** %25
%141 = load i32, i32* %19
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds double, double* %140, i64 %142
%144 = load double, double* %143
%145 = load double*, double** %26
%146 = load i32, i32* %19
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds double, double* %145, i64 %147
%149 = load double, double* %148
%150 = load double*, double** %27
%151 = load i32, i32* %19
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds double, double* %150, i64 %152
%154 = load double, double* %153
%155 = call i32 @addEnd(%struct.Node* %139, double %144, double %149, double %154, i32 0, i32 0, i32 0, i32 -1)
%156 = load %struct.Node*, %struct.Node** %24
%157 = load double*, double** %25
%158 = load i32, i32* %20
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds double, double* %157, i64 %159
%161 = load double, double* %160
%162 = load double*, double** %26
%163 = load i32, i32* %20
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds double, double* %162, i64 %164
%166 = load double, double* %165
%167 = load double*, double** %27
%168 = load i32, i32* %20
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds double, double* %167, i64 %169
%171 = load double, double* %170
%172 = call i32 @addEnd(%struct.Node* %156, double %161, double %166, double %171, i32 0, i32 0, i32 0, i32 -1)
%173 = load %struct.Node*, %struct.Node** %24
%174 = call double @gridArea(%struct.Node* %173)
%175 = load double*, double** %10
%176 = load i32, i32* %16
%177 = load i32, i32* %11
%178 = mul nsw i32 %176, %177
%179 = load i32, i32* %15
%180 = add nsw i32 %178, %179
%181 = sext i32 %180 to i64
%182 = getelementptr inbounds double, double* %175, i64 %181
store double %174, double* %182
br label %183
183: ; preds = %78
%184 = load i32, i32* %15
%185 = add nsw i32 %184, 1
store i32 %185, i32* %15
br label %74
186: ; preds = %74
br label %187
187: ; preds = %186
%188 = load i32, i32* %16
%189 = add nsw i32 %188, 1
store i32 %189, i32* %16
br label %69
190: ; preds = %69
%191 = load double*, double** %25
%192 = call i32 @free(double* %191)
%193 = load double*, double** %26
%194 = call i32 @free(double* %193)
%195 = load double*, double** %27
%196 = call i32 @free(double* %195)
ret void
}

LLVM IR (-O2):
%struct.Node = type { i32 }
define void @get_grid_great_circle_area(i32* nocapture %0, i32* nocapture %1, double* %2, double* %3, double* nocapture writeonly %4) {
%6 = load i32, i32* %0
%7 = load i32, i32* %1
%8 = add nsw i32 %6, 1
%9 = add nsw i32 %7, 1
%10 = mul nsw i32 %9, %8
%11 = shl i32 %10, 3
%12 = tail call i64 @malloc(i32 %11)
%13 = inttoptr i64 %12 to double*
%14 = tail call i64 @malloc(i32 %11)
%15 = inttoptr i64 %14 to double*
%16 = tail call i64 @malloc(i32 %11)
%17 = inttoptr i64 %16 to double*
%18 = tail call i32 @latlon2xyz(i32 %10, double* %2, double* %3, double* %13, double* %15, double* %17)
%19 = icmp sgt i32 %7, 0
br i1 %19, label %20, label %79
20: ; preds = %5
%21 = icmp sgt i32 %6, 0
%22 = sext i32 %8 to i64
%23 = sext i32 %6 to i64
%24 = zext i32 %7 to i64
%25 = zext i32 %6 to i64
br label %26
26: ; preds = %20, %76
%27 = phi i64 [ 0, %20 ], [ %77, %76 ]
br i1 %21, label %30, label %28
28: ; preds = %26
%29 = add nuw nsw i64 %27, 1
br label %76
30: ; preds = %26
%31 = mul nsw i64 %27, %22
%32 = add nuw nsw i64 %27, 1
%33 = mul nsw i64 %32, %22
%34 = mul nsw i64 %27, %23
br label %35
35: ; preds = %30, %35
%36 = phi i64 [ 0, %30 ], [ %74, %35 ]
%37 = add nsw i64 %36, %31
%38 = add nsw i64 %36, %33
%39 = add nsw i64 %38, 1
%40 = add nsw i64 %37, 1
%41 = tail call i32 (...) @rewindList()
%42 = tail call %struct.Node* (...) @getNext()
%43 = getelementptr inbounds double, double* %13, i64 %37
%44 = load double, double* %43
%45 = getelementptr inbounds double, double* %15, i64 %37
%46 = load double, double* %45
%47 = getelementptr inbounds double, double* %17, i64 %37
%48 = load double, double* %47
%49 = tail call i32 @addEnd(%struct.Node* %42, double %44, double %46, double %48, i32 0, i32 0, i32 0, i32 -1)
%50 = getelementptr inbounds double, double* %13, i64 %38
%51 = load double, double* %50
%52 = getelementptr inbounds double, double* %15, i64 %38
%53 = load double, double* %52
%54 = getelementptr inbounds double, double* %17, i64 %38
%55 = load double, double* %54
%56 = tail call i32 @addEnd(%struct.Node* %42, double %51, double %53, double %55, i32 0, i32 0, i32 0, i32 -1)
%57 = getelementptr inbounds double, double* %13, i64 %39
%58 = load double, double* %57
%59 = getelementptr inbounds double, double* %15, i64 %39
%60 = load double, double* %59
%61 = getelementptr inbounds double, double* %17, i64 %39
%62 = load double, double* %61
%63 = tail call i32 @addEnd(%struct.Node* %42, double %58, double %60, double %62, i32 0, i32 0, i32 0, i32 -1)
%64 = getelementptr inbounds double, double* %13, i64 %40
%65 = load double, double* %64
%66 = getelementptr inbounds double, double* %15, i64 %40
%67 = load double, double* %66
%68 = getelementptr inbounds double, double* %17, i64 %40
%69 = load double, double* %68
%70 = tail call i32 @addEnd(%struct.Node* %42, double %65, double %67, double %69, i32 0, i32 0, i32 0, i32 -1)
%71 = tail call double @gridArea(%struct.Node* %42)
%72 = add nsw i64 %36, %34
%73 = getelementptr inbounds double, double* %4, i64 %72
store double %71, double* %73
%74 = add nuw nsw i64 %36, 1
%75 = icmp eq i64 %74, %25
br i1 %75, label %76, label %35
76: ; preds = %35, %28
%77 = phi i64 [ %29, %28 ], [ %32, %35 ]
%78 = icmp eq i64 %77, %24
br i1 %78, label %79, label %26
79: ; preds = %76, %5
%80 = tail call i32 @free(double* %13)
%81 = tail call i32 @free(double* %15)
%82 = tail call i32 @free(double* %17)
ret void
}