#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 poly_area_no_adjust(double *, double *, int);
void get_grid_area_no_adjust(const int *nlon, const int *nlat,
                             const double *lon, const double *lat,
                             double *area) {
  int nx, ny, nxp, i, j, n_in;
  double x_in[20], y_in[20];
  nx = *nlon;
  ny = *nlat;
  nxp = nx + 1;
  for (j = 0; j < ny; j++)
    for (i = 0; i < nx; i++) {
      x_in[0] = lon[j * nxp + i];
      x_in[1] = lon[j * nxp + i + 1];
      x_in[2] = lon[(j + 1) * nxp + i + 1];
      x_in[3] = lon[(j + 1) * nxp + i];
      y_in[0] = lat[j * nxp + i];
      y_in[1] = lat[j * nxp + i + 1];
      y_in[2] = lat[(j + 1) * nxp + i + 1];
      y_in[3] = lat[(j + 1) * nxp + i];
      n_in = 4;
      area[j * nx + i] = poly_area_no_adjust(x_in, y_in, n_in);
    }
}


x86 assembly (clang, -O0):
<get_grid_area_no_adjust>:
push   %rbp
mov    %rsp,%rbp
sub    $0x180,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%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)
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x30(%rbp),%eax
jge    12cc <get_grid_area_no_adjust+0x1bc>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    12b9 <get_grid_area_no_adjust+0x1a9>
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd8(%rbp)
ff
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x18(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x180(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x178(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x170(%rbp)
ff
mov    -0x20(%rbp),%rax
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
imul   -0x34(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x168(%rbp)
ff
movl   $0x4,-0x40(%rbp)
lea    -0xe0(%rbp),%rdi
lea    -0x180(%rbp),%rsi
mov    -0x40(%rbp),%edx
call   1030 <poly_area_no_adjust@plt>
mov    -0x28(%rbp),%rax
mov    -0x3c(%rbp),%ecx
imul   -0x2c(%rbp),%ecx
add    -0x38(%rbp),%ecx
movslq %ecx,%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1164 <get_grid_area_no_adjust+0x54>
jmp    12be <get_grid_area_no_adjust+0x1ae>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1151 <get_grid_area_no_adjust+0x41>
add    $0x180,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_grid_area_no_adjust>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x198,%rsp
mov    %r8,0x20(%rsp)
mov    %rcx,0x18(%rsp)
mov    %rdx,0x10(%rsp)
mov    (%rsi),%eax
mov    %rax,0x28(%rsp)
test   %eax,%eax
jle    1263 <get_grid_area_no_adjust+0x153>
movslq (%rdi),%r8
lea    0x1(%r8),%rax
mov    %rax,(%rsp)
mov    %r8d,%eax
xor    %ebx,%ebx
lea    0xf0(%rsp),%r14
lea    0x50(%rsp),%r12
mov    %r8,0x8(%rsp)
jmp    1182 <get_grid_area_no_adjust+0x72>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%rbx
mov    %rbx,%rdx
cmp    0x28(%rsp),%rdx
je     1263 <get_grid_area_no_adjust+0x153>
test   %r8d,%r8d
jle    1170 <get_grid_area_no_adjust+0x60>
mov    %rbx,%rbp
mov    (%rsp),%rsi
imul   %rsi,%rbp
lea    0x1(%rbx),%rdx
mov    %rdx,0x30(%rsp)
imul   %rsi,%rdx
imul   %r8,%rbx
mov    0x20(%rsp),%rsi
lea    (%rsi,%rbx,8),%rsi
mov    %rsi,0x48(%rsp)
mov    0x10(%rsp),%rsi
lea    (%rsi,%rdx,8),%rbx
mov    %rbx,0x40(%rsp)
mov    0x18(%rsp),%rbx
lea    (%rbx,%rdx,8),%rdx
mov    %rdx,0x38(%rsp)
lea    (%rsi,%rbp,8),%r13
lea    (%rbx,%rbp,8),%rbx
xor    %r15d,%r15d
nopl   0x0(%rax,%rax,1)
movups 0x0(%r13,%r15,8),%xmm0
movaps %xmm0,0xf0(%rsp)
mov    0x40(%rsp),%rdx
movups (%rdx,%r15,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movaps %xmm0,0x100(%rsp)
movups (%rbx,%r15,8),%xmm0
movaps %xmm0,0x50(%rsp)
mov    0x38(%rsp),%rdx
movups (%rdx,%r15,8),%xmm0
shufps $0x4e,%xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x4,%edx
mov    %rax,%rbp
call   1030 <poly_area_no_adjust@plt>
mov    %rbp,%rax
mov    0x48(%rsp),%rdx
movsd  %xmm0,(%rdx,%r15,8)
add    $0x1,%r15
cmp    %r15,%rbp
jne    11e0 <get_grid_area_no_adjust+0xd0>
mov    0x30(%rsp),%rdx
mov    %rdx,%rbx
mov    0x8(%rsp),%r8
cmp    0x28(%rsp),%rdx
jne    1182 <get_grid_area_no_adjust+0x72>
add    $0x198,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @get_grid_area_no_adjust(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 [20 x double]
%18 = alloca [20 x 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
%19 = load i32*, i32** %6
%20 = load i32, i32* %19
store i32 %20, i32* %11
%21 = load i32*, i32** %7
%22 = load i32, i32* %21
store i32 %22, i32* %12
%23 = load i32, i32* %11
%24 = add nsw i32 %23, 1
store i32 %24, i32* %13
store i32 0, i32* %15
br label %25
25: ; preds = %139, %5
%26 = load i32, i32* %15
%27 = load i32, i32* %12
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %142
29: ; preds = %25
store i32 0, i32* %14
br label %30
30: ; preds = %135, %29
%31 = load i32, i32* %14
%32 = load i32, i32* %11
%33 = icmp slt i32 %31, %32
br i1 %33, label %34, label %138
34: ; preds = %30
%35 = load double*, double** %8
%36 = load i32, i32* %15
%37 = load i32, i32* %13
%38 = mul nsw i32 %36, %37
%39 = load i32, i32* %14
%40 = add nsw i32 %38, %39
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %35, i64 %41
%43 = load double, double* %42
%44 = getelementptr inbounds [20 x double], [20 x double]* %17, i64 0, i64 0
store double %43, double* %44
%45 = load double*, double** %8
%46 = load i32, i32* %15
%47 = load i32, i32* %13
%48 = mul nsw i32 %46, %47
%49 = load i32, i32* %14
%50 = add nsw i32 %48, %49
%51 = add nsw i32 %50, 1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds double, double* %45, i64 %52
%54 = load double, double* %53
%55 = getelementptr inbounds [20 x double], [20 x double]* %17, i64 0, i64 1
store double %54, double* %55
%56 = load double*, double** %8
%57 = load i32, i32* %15
%58 = add nsw i32 %57, 1
%59 = load i32, i32* %13
%60 = mul nsw i32 %58, %59
%61 = load i32, i32* %14
%62 = add nsw i32 %60, %61
%63 = add nsw i32 %62, 1
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds double, double* %56, i64 %64
%66 = load double, double* %65
%67 = getelementptr inbounds [20 x double], [20 x double]* %17, i64 0, i64 2
store double %66, double* %67
%68 = load double*, double** %8
%69 = load i32, i32* %15
%70 = add nsw i32 %69, 1
%71 = load i32, i32* %13
%72 = mul nsw i32 %70, %71
%73 = load i32, i32* %14
%74 = add nsw i32 %72, %73
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds double, double* %68, i64 %75
%77 = load double, double* %76
%78 = getelementptr inbounds [20 x double], [20 x double]* %17, i64 0, i64 3
store double %77, double* %78
%79 = load double*, double** %9
%80 = load i32, i32* %15
%81 = load i32, i32* %13
%82 = mul nsw i32 %80, %81
%83 = load i32, i32* %14
%84 = add nsw i32 %82, %83
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds double, double* %79, i64 %85
%87 = load double, double* %86
%88 = getelementptr inbounds [20 x double], [20 x double]* %18, i64 0, i64 0
store double %87, double* %88
%89 = load double*, double** %9
%90 = load i32, i32* %15
%91 = load i32, i32* %13
%92 = mul nsw i32 %90, %91
%93 = load i32, i32* %14
%94 = add nsw i32 %92, %93
%95 = add nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %89, i64 %96
%98 = load double, double* %97
%99 = getelementptr inbounds [20 x double], [20 x double]* %18, i64 0, i64 1
store double %98, double* %99
%100 = load double*, double** %9
%101 = load i32, i32* %15
%102 = add nsw i32 %101, 1
%103 = load i32, i32* %13
%104 = mul nsw i32 %102, %103
%105 = load i32, i32* %14
%106 = add nsw i32 %104, %105
%107 = add nsw i32 %106, 1
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %100, i64 %108
%110 = load double, double* %109
%111 = getelementptr inbounds [20 x double], [20 x double]* %18, i64 0, i64 2
store double %110, double* %111
%112 = load double*, double** %9
%113 = load i32, i32* %15
%114 = add nsw i32 %113, 1
%115 = load i32, i32* %13
%116 = mul nsw i32 %114, %115
%117 = load i32, i32* %14
%118 = add nsw i32 %116, %117
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds double, double* %112, i64 %119
%121 = load double, double* %120
%122 = getelementptr inbounds [20 x double], [20 x double]* %18, i64 0, i64 3
store double %121, double* %122
store i32 4, i32* %16
%123 = getelementptr inbounds [20 x double], [20 x double]* %17, i64 0, i64 0
%124 = getelementptr inbounds [20 x double], [20 x double]* %18, i64 0, i64 0
%125 = load i32, i32* %16
%126 = call double @poly_area_no_adjust(double* %123, double* %124, i32 %125)
%127 = load double*, double** %10
%128 = load i32, i32* %15
%129 = load i32, i32* %11
%130 = mul nsw i32 %128, %129
%131 = load i32, i32* %14
%132 = add nsw i32 %130, %131
%133 = sext i32 %132 to i64
%134 = getelementptr inbounds double, double* %127, i64 %133
store double %126, double* %134
br label %135
135: ; preds = %34
%136 = load i32, i32* %14
%137 = add nsw i32 %136, 1
store i32 %137, i32* %14
br label %30
138: ; preds = %30
br label %139
139: ; preds = %138
%140 = load i32, i32* %15
%141 = add nsw i32 %140, 1
store i32 %141, i32* %15
br label %25
142: ; preds = %25
ret void
}

LLVM IR (-O2):
define void @get_grid_area_no_adjust(i32* nocapture %0, i32* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture writeonly %4) {
%6 = alloca [20 x double]
%7 = alloca [20 x double]
%8 = bitcast [20 x double]* %6 to i8*
%9 = bitcast [20 x double]* %7 to i8*
%10 = load i32, i32* %0
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %63
13: ; preds = %5
%14 = add nsw i32 %10, 1
%15 = icmp sgt i32 %10, 0
%16 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 0
%17 = getelementptr inbounds [20 x double], [20 x double]* %6, i64 0, i64 2
%18 = getelementptr inbounds [20 x double], [20 x double]* %7, i64 0, i64 0
%19 = getelementptr inbounds [20 x double], [20 x double]* %7, i64 0, i64 2
%20 = sext i32 %14 to i64
%21 = sext i32 %10 to i64
%22 = zext i32 %11 to i64
%23 = zext i32 %10 to i64
%24 = bitcast [20 x double]* %6 to <2 x double>*
%25 = bitcast double* %17 to <2 x double>*
%26 = bitcast [20 x double]* %7 to <2 x double>*
%27 = bitcast double* %19 to <2 x double>*
br label %28
28: ; preds = %13, %60
%29 = phi i64 [ 0, %13 ], [ %61, %60 ]
br i1 %15, label %32, label %30
30: ; preds = %28
%31 = add nuw nsw i64 %29, 1
br label %60
32: ; preds = %28
%33 = mul nsw i64 %29, %20
%34 = add nuw nsw i64 %29, 1
%35 = mul nsw i64 %34, %20
%36 = mul nsw i64 %29, %21
br label %37
37: ; preds = %32, %37
%38 = phi i64 [ 0, %32 ], [ %58, %37 ]
%39 = add nsw i64 %38, %33
%40 = getelementptr inbounds double, double* %2, i64 %39
%41 = bitcast double* %40 to <2 x double>*
%42 = load <2 x double>, <2 x double>* %41
store <2 x double> %42, <2 x double>* %24
%43 = add nsw i64 %38, %35
%44 = getelementptr inbounds double, double* %2, i64 %43
%45 = bitcast double* %44 to <2 x double>*
%46 = load <2 x double>, <2 x double>* %45
%47 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> <i32 1, i32 0>
store <2 x double> %47, <2 x double>* %25
%48 = getelementptr inbounds double, double* %3, i64 %39
%49 = bitcast double* %48 to <2 x double>*
%50 = load <2 x double>, <2 x double>* %49
store <2 x double> %50, <2 x double>* %26
%51 = getelementptr inbounds double, double* %3, i64 %43
%52 = bitcast double* %51 to <2 x double>*
%53 = load <2 x double>, <2 x double>* %52
%54 = shufflevector <2 x double> %53, <2 x double> poison, <2 x i32> <i32 1, i32 0>
store <2 x double> %54, <2 x double>* %27
%55 = call double @poly_area_no_adjust(double* %16, double* %18, i32 4)
%56 = add nsw i64 %38, %36
%57 = getelementptr inbounds double, double* %4, i64 %56
store double %55, double* %57
%58 = add nuw nsw i64 %38, 1
%59 = icmp eq i64 %58, %23
br i1 %59, label %60, label %37
60: ; preds = %37, %30
%61 = phi i64 [ %31, %30 ], [ %34, %37 ]
%62 = icmp eq i64 %61, %22
br i1 %62, label %63, label %28
63: ; preds = %60, %5
ret void
}