void compare_lat_reg2d(int ysize, int gridID1, int gridID2) {
  if (ysize > 1) {
    double *yvals1, *yvals2;
    yvals1 = (double *)Malloc(
        __func__,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c",
        31, (ysize * sizeof(double)));
    yvals2 = (double *)Malloc(
        __func__,
        "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
        "2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c",
        32, (ysize * sizeof(double)));
    gridInqYvals(gridID1, yvals1);
    gridInqYvals(gridID2, yvals2);
    if ((!(yvals1[0] < yvals2[ysize - 1] || yvals2[ysize - 1] < yvals1[0])) &&
        (!(yvals1[ysize - 1] < yvals2[0] || yvals2[0] < yvals1[ysize - 1]))) {
      if (yvals1[0] > yvals2[0])
        cdoWarning(
            "Latitude orientation differ! First grid: N->S; second grid: S->N");
      else
        cdoWarning(
            "Latitude orientation differ! First grid: S->N; second grid: N->S");
    } else {
      for (int i = 0; i < ysize; ++i)
        if (fabs(yvals1[i] - yvals2[i]) > 1.e-5) {
          cdoWarning("Grid latitudes differ!");
          break;
        }
    }
    Free(__func__,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c",
         56, (yvals1));
    Free(__func__,
         "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
         "2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c",
         57, (yvals2));
  }
}


x86 assembly (clang, -O0):
<compare_lat_reg2d>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
cmpl   $0x1,-0x4(%rbp)
jle    1344 <compare_lat_reg2d+0x204>
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
lea    0xeb6(%rip),%rdi
lea    0xec1(%rip),%rsi
mov    $0x1f,%edx
mov    $0x0,%al
call   1030 <Malloc@plt>
cltq
mov    %rax,-0x18(%rbp)
movslq -0x4(%rbp),%rcx
shl    $0x3,%rcx
lea    0xe8e(%rip),%rdi
lea    0xe99(%rip),%rsi
mov    $0x20,%edx
mov    $0x0,%al
call   1030 <Malloc@plt>
cltq
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <gridInqYvals@plt>
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%rsi
mov    $0x0,%al
call   1040 <gridInqYvals@plt>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
ja     1293 <compare_lat_reg2d+0x153>
mov    -0x20(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1293 <compare_lat_reg2d+0x153>
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
ja     1293 <compare_lat_reg2d+0x153>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm1
mov    -0x18(%rbp),%rax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd %xmm1,%xmm0
ja     1293 <compare_lat_reg2d+0x153>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    1280 <compare_lat_reg2d+0x140>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1060 <cdoWarning@plt>
jmp    128e <compare_lat_reg2d+0x14e>
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1060 <cdoWarning@plt>
jmp    1308 <compare_lat_reg2d+0x1c8>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1303 <compare_lat_reg2d+0x1c3>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movaps 0xd49(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  0xd2d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12f0 <compare_lat_reg2d+0x1b0>
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1060 <cdoWarning@plt>
jmp    1303 <compare_lat_reg2d+0x1c3>
jmp    12f5 <compare_lat_reg2d+0x1b5>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    129a <compare_lat_reg2d+0x15a>
jmp    1308 <compare_lat_reg2d+0x1c8>
mov    -0x18(%rbp),%rcx
lea    0xd0d(%rip),%rdi
lea    0xd18(%rip),%rsi
mov    $0x38,%edx
mov    $0x0,%al
call   1050 <Free@plt>
mov    -0x20(%rbp),%rcx
lea    0xcef(%rip),%rdi
lea    0xcfa(%rip),%rsi
mov    $0x39,%edx
mov    $0x0,%al
call   1050 <Free@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compare_lat_reg2d>:
cmp    $0x2,%edi
jl     11d9 <compare_lat_reg2d+0x99>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r13d
mov    %edi,%ebx
mov    %edi,%r12d
lea    0x0(,%r12,8),%rbp
lea    0xead(%rip),%r15
lea    0xeb8(%rip),%rsi
mov    %r15,%rdi
mov    %edx,0x4(%rsp)
mov    $0x1f,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1030 <Malloc@plt>
movslq %eax,%r14
mov    %r15,%rdi
lea    0xe95(%rip),%rsi
mov    $0x20,%edx
mov    %rbp,%rcx
xor    %eax,%eax
call   1030 <Malloc@plt>
movslq %eax,%r15
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <gridInqYvals@plt>
mov    0x4(%rsp),%edi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <gridInqYvals@plt>
movsd  (%r14),%xmm0
add    $0xffffffff,%ebx
ucomisd (%r15,%rbx,8),%xmm0
je     11da <compare_lat_reg2d+0x9a>
movsd  (%r15),%xmm1
jmp    11eb <compare_lat_reg2d+0xab>
ret
movsd  (%r14,%rbx,8),%xmm2
movsd  (%r15),%xmm1
ucomisd %xmm1,%xmm2
je     1241 <compare_lat_reg2d+0x101>
subsd  %xmm1,%xmm0
andpd  0xe09(%rip),%xmm0
lea    0xf33(%rip),%rdi
ucomisd 0xe0a(%rip),%xmm0
ja     1257 <compare_lat_reg2d+0x117>
mov    $0x1,%eax
movapd 0xdeb(%rip),%xmm0
movsd  0xdf3(%rip),%xmm1
nopl   (%rax)
cmp    %rax,%r12
je     125e <compare_lat_reg2d+0x11e>
movsd  (%r14,%rax,8),%xmm2
subsd  (%r15,%rax,8),%xmm2
andpd  %xmm0,%xmm2
add    $0x1,%rax
ucomisd %xmm1,%xmm2
jbe    1220 <compare_lat_reg2d+0xe0>
jmp    1257 <compare_lat_reg2d+0x117>
ucomisd %xmm1,%xmm0
lea    0xe63(%rip),%rax
lea    0xe9d(%rip),%rdi
cmova  %rax,%rdi
xor    %eax,%eax
call   1060 <cdoWarning@plt>
lea    0xdb3(%rip),%rbx
lea    0xdbe(%rip),%rbp
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x38,%edx
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <Free@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x39,%edx
mov    %r15,%rcx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <Free@plt>

LLVM IR (-O0):
@__func__.compare_lat_reg2d = [18 x i8] c"compare_lat_reg2d\00"
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c\00"
@.str.1 = [65 x i8] c"Latitude orientation differ! First grid: N->S; second grid: S->N\00"
@.str.2 = [65 x i8] c"Latitude orientation differ! First grid: S->N; second grid: N->S\00"
@.str.3 = [23 x i8] c"Grid latitudes differ!\00"
define void @compare_lat_reg2d(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 1
br i1 %11, label %12, label %118
12: ; preds = %3
%13 = load i32, i32* %4
%14 = sext i32 %13 to i64
%15 = mul i64 %14, 8
%16 = call i32 (i8*, i8*, i32, i64, ...) bitcast (i32 (...)* @Malloc to i32 (i8*, i8*, i32, i64, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 31, i64 %15)
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to double*
store double* %18, double** %7
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = mul i64 %20, 8
%22 = call i32 (i8*, i8*, i32, i64, ...) bitcast (i32 (...)* @Malloc to i32 (i8*, i8*, i32, i64, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 32, i64 %21)
%23 = sext i32 %22 to i64
%24 = inttoptr i64 %23 to double*
store double* %24, double** %8
%25 = load i32, i32* %5
%26 = load double*, double** %7
%27 = call i32 (i32, double*, ...) bitcast (i32 (...)* @gridInqYvals to i32 (i32, double*, ...)*)(i32 %25, double* %26)
%28 = load i32, i32* %6
%29 = load double*, double** %8
%30 = call i32 (i32, double*, ...) bitcast (i32 (...)* @gridInqYvals to i32 (i32, double*, ...)*)(i32 %28, double* %29)
%31 = load double*, double** %7
%32 = getelementptr inbounds double, double* %31, i64 0
%33 = load double, double* %32
%34 = load double*, double** %8
%35 = load i32, i32* %4
%36 = sub nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %34, i64 %37
%39 = load double, double* %38
%40 = fcmp olt double %33, %39
br i1 %40, label %87, label %41
41: ; preds = %12
%42 = load double*, double** %8
%43 = load i32, i32* %4
%44 = sub nsw i32 %43, 1
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %42, i64 %45
%47 = load double, double* %46
%48 = load double*, double** %7
%49 = getelementptr inbounds double, double* %48, i64 0
%50 = load double, double* %49
%51 = fcmp olt double %47, %50
br i1 %51, label %87, label %52
52: ; preds = %41
%53 = load double*, double** %7
%54 = load i32, i32* %4
%55 = sub nsw i32 %54, 1
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds double, double* %53, i64 %56
%58 = load double, double* %57
%59 = load double*, double** %8
%60 = getelementptr inbounds double, double* %59, i64 0
%61 = load double, double* %60
%62 = fcmp olt double %58, %61
br i1 %62, label %87, label %63
63: ; preds = %52
%64 = load double*, double** %8
%65 = getelementptr inbounds double, double* %64, i64 0
%66 = load double, double* %65
%67 = load double*, double** %7
%68 = load i32, i32* %4
%69 = sub nsw i32 %68, 1
%70 = sext i32 %69 to i64
%71 = getelementptr inbounds double, double* %67, i64 %70
%72 = load double, double* %71
%73 = fcmp olt double %66, %72
br i1 %73, label %87, label %74
74: ; preds = %63
%75 = load double*, double** %7
%76 = getelementptr inbounds double, double* %75, i64 0
%77 = load double, double* %76
%78 = load double*, double** %8
%79 = getelementptr inbounds double, double* %78, i64 0
%80 = load double, double* %79
%81 = fcmp ogt double %77, %80
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = call i32 (i8*, ...) bitcast (i32 (...)* @cdoWarning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0))
br label %86
84: ; preds = %74
%85 = call i32 (i8*, ...) bitcast (i32 (...)* @cdoWarning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0))
br label %86
86: ; preds = %84, %82
br label %113
87: ; preds = %63, %52, %41, %12
store i32 0, i32* %9
br label %88
88: ; preds = %109, %87
%89 = load i32, i32* %9
%90 = load i32, i32* %4
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %112
92: ; preds = %88
%93 = load double*, double** %7
%94 = load i32, i32* %9
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = load double*, double** %8
%99 = load i32, i32* %9
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds double, double* %98, i64 %100
%102 = load double, double* %101
%103 = fsub double %97, %102
%104 = call double @llvm.fabs.f64(double %103)
%105 = fcmp ogt double %104, 1.000000e-05
br i1 %105, label %106, label %108
106: ; preds = %92
%107 = call i32 (i8*, ...) bitcast (i32 (...)* @cdoWarning to i32 (i8*, ...)*)(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
br label %112
108: ; preds = %92
br label %109
109: ; preds = %108
%110 = load i32, i32* %9
%111 = add nsw i32 %110, 1
store i32 %111, i32* %9
br label %88
112: ; preds = %106, %88
br label %113
113: ; preds = %112, %86
%114 = load double*, double** %7
%115 = call i32 (i8*, i8*, i32, double*, ...) bitcast (i32 (...)* @Free to i32 (i8*, i8*, i32, double*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 56, double* %114)
%116 = load double*, double** %8
%117 = call i32 (i8*, i8*, i32, double*, ...) bitcast (i32 (...)* @Free to i32 (i8*, i8*, i32, double*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 57, double* %116)
br label %118
118: ; preds = %113, %3
ret void
}

LLVM IR (-O2):
@__func__.compare_lat_reg2d = [18 x i8] c"compare_lat_reg2d\00"
@.str = [133 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/AZed/cdo/refs/heads/master/src/cdo_vlist.c\00"
@.str.1 = [65 x i8] c"Latitude orientation differ! First grid: N->S; second grid: S->N\00"
@.str.2 = [65 x i8] c"Latitude orientation differ! First grid: S->N; second grid: N->S\00"
@.str.3 = [23 x i8] c"Grid latitudes differ!\00"
define void @compare_lat_reg2d(i32 %0, i32 %1, i32 %2) {
%4 = icmp sgt i32 %0, 1
br i1 %4, label %5, label %55
5: ; preds = %3
%6 = zext i32 %0 to i64
%7 = shl nuw nsw i64 %6, 3
%8 = tail call i32 (i8*, i8*, i32, i64, ...) bitcast (i32 (...)* @Malloc to i32 (i8*, i8*, i32, i64, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 31, i64 %7)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to double*
%11 = tail call i32 (i8*, i8*, i32, i64, ...) bitcast (i32 (...)* @Malloc to i32 (i8*, i8*, i32, i64, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 32, i64 %7)
%12 = sext i32 %11 to i64
%13 = inttoptr i64 %12 to double*
%14 = tail call i32 (i32, double*, ...) bitcast (i32 (...)* @gridInqYvals to i32 (i32, double*, ...)*)(i32 %1, double* %10)
%15 = tail call i32 (i32, double*, ...) bitcast (i32 (...)* @gridInqYvals to i32 (i32, double*, ...)*)(i32 %2, double* %13)
%16 = load double, double* %10
%17 = add nsw i32 %0, -1
%18 = zext i32 %17 to i64
%19 = getelementptr inbounds double, double* %13, i64 %18
%20 = load double, double* %19
%21 = fcmp ueq double %16, %20
br i1 %21, label %24, label %22
22: ; preds = %5
%23 = load double, double* %13
br label %32
24: ; preds = %5
%25 = getelementptr inbounds double, double* %10, i64 %18
%26 = load double, double* %25
%27 = load double, double* %13
%28 = fcmp ueq double %26, %27
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = fcmp ogt double %16, %27
%31 = select i1 %30, i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([65 x i8], [65 x i8]* @.str.2, i64 0, i64 0)
br label %49
32: ; preds = %22, %24
%33 = phi double [ %23, %22 ], [ %27, %24 ]
%34 = fsub double %16, %33
%35 = tail call double @llvm.fabs.f64(double %34)
%36 = fcmp ogt double %35, 1.000000e-05
br i1 %36, label %49, label %37
37: ; preds = %32, %40
%38 = phi i64 [ %48, %40 ], [ 1, %32 ]
%39 = icmp eq i64 %38, %6
br i1 %39, label %52, label %40
40: ; preds = %37
%41 = getelementptr inbounds double, double* %10, i64 %38
%42 = load double, double* %41
%43 = getelementptr inbounds double, double* %13, i64 %38
%44 = load double, double* %43
%45 = fsub double %42, %44
%46 = tail call double @llvm.fabs.f64(double %45)
%47 = fcmp ogt double %46, 1.000000e-05
%48 = add nuw nsw i64 %38, 1
br i1 %47, label %49, label %37
49: ; preds = %40, %32, %29
%50 = phi i8* [ %31, %29 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %32 ], [ getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), %40 ]
%51 = tail call i32 (i8*, ...) bitcast (i32 (...)* @cdoWarning to i32 (i8*, ...)*)(i8* %50)
br label %52
52: ; preds = %37, %49
%53 = tail call i32 (i8*, i8*, i32, double*, ...) bitcast (i32 (...)* @Free to i32 (i8*, i8*, i32, double*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 56, double* %10)
%54 = tail call i32 (i8*, i8*, i32, double*, ...) bitcast (i32 (...)* @Free to i32 (i8*, i8*, i32, double*, ...)*)(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @__func__.compare_lat_reg2d, i64 0, i64 0), i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str, i64 0, i64 0), i32 57, double* %13)
br label %55
55: ; preds = %52, %3
ret void
}