#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 fabs(scalar_t__);
scalar_t__ gridInqXval(int, int);
int /*<<< orphan*/ *gridInqXvalsPtr(int);
scalar_t__ gridInqYval(int, int);
int /*<<< orphan*/ *gridInqYvalsPtr(int);
int compareXYvals2(int gridID, int gridsize, double *xvals, double *yvals) {
  int differ = 0;
  if (!differ && ((xvals == NULL && gridInqXvalsPtr(gridID) != NULL) ||
                  (xvals != NULL && gridInqXvalsPtr(gridID) == NULL)))
    differ = 1;
  if (!differ && ((yvals == NULL && gridInqYvalsPtr(gridID) != NULL) ||
                  (yvals != NULL && gridInqYvalsPtr(gridID) == NULL)))
    differ = 1;
  if (!differ && xvals && gridInqXvalsPtr(gridID)) {
    if (fabs(xvals[0] - gridInqXval(gridID, 0)) > 1.e-9 ||
        fabs(xvals[gridsize - 1] - gridInqXval(gridID, gridsize - 1)) > 1.e-9)
      differ = 1;
  }
  if (!differ && yvals && gridInqYvalsPtr(gridID)) {
    if (fabs(yvals[0] - gridInqYval(gridID, 0)) > 1.e-9 ||
        fabs(yvals[gridsize - 1] - gridInqYval(gridID, gridsize - 1)) > 1.e-9)
      differ = 1;
  }
  return (differ);
}


x86 assembly (clang, -O0):
<compareXYvals2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    11b8 <compareXYvals2+0x68>
cmpq   $0x0,-0x10(%rbp)
jne    1194 <compareXYvals2+0x44>
mov    -0x4(%rbp),%edi
call   1070 <gridInqXvalsPtr@plt>
cmp    $0x0,%rax
jne    11b1 <compareXYvals2+0x61>
cmpq   $0x0,-0x10(%rbp)
je     11b8 <compareXYvals2+0x68>
mov    -0x4(%rbp),%edi
call   1070 <gridInqXvalsPtr@plt>
cmp    $0x0,%rax
jne    11b8 <compareXYvals2+0x68>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    1203 <compareXYvals2+0xb3>
cmpq   $0x0,-0x18(%rbp)
jne    11df <compareXYvals2+0x8f>
mov    -0x4(%rbp),%edi
call   1040 <gridInqYvalsPtr@plt>
cmp    $0x0,%rax
jne    11fc <compareXYvals2+0xac>
cmpq   $0x0,-0x18(%rbp)
je     1203 <compareXYvals2+0xb3>
mov    -0x4(%rbp),%edi
call   1040 <gridInqYvalsPtr@plt>
cmp    $0x0,%rax
jne    1203 <compareXYvals2+0xb3>
movl   $0x1,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12c6 <compareXYvals2+0x176>
cmpq   $0x0,-0x10(%rbp)
je     12c6 <compareXYvals2+0x176>
mov    -0x4(%rbp),%edi
call   1070 <gridInqXvalsPtr@plt>
cmp    $0x0,%rax
je     12c6 <compareXYvals2+0x176>
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1060 <gridInqXval@plt>
movsd  -0x28(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <fabs@plt>
movsd  0xd9f(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     12ba <compareXYvals2+0x16a>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1060 <gridInqXval@plt>
movsd  -0x30(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <fabs@plt>
movsd  0xd50(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    12c1 <compareXYvals2+0x171>
movl   $0x1,-0x1c(%rbp)
jmp    12c6 <compareXYvals2+0x176>
cmpl   $0x0,-0x1c(%rbp)
jne    1389 <compareXYvals2+0x239>
cmpq   $0x0,-0x18(%rbp)
je     1389 <compareXYvals2+0x239>
mov    -0x4(%rbp),%edi
call   1040 <gridInqYvalsPtr@plt>
cmp    $0x0,%rax
je     1389 <compareXYvals2+0x239>
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
xor    %esi,%esi
call   1050 <gridInqYval@plt>
movsd  -0x38(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <fabs@plt>
movsd  0xcdc(%rip),%xmm1
ucomisd %xmm1,%xmm0
ja     137d <compareXYvals2+0x22d>
mov    -0x18(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
sub    $0x1,%esi
call   1050 <gridInqYval@plt>
movsd  -0x40(%rbp),%xmm0
cvtsi2sd %rax,%xmm1
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%rdi
call   1030 <fabs@plt>
movsd  0xc8d(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1384 <compareXYvals2+0x234>
movl   $0x1,-0x1c(%rbp)
jmp    1389 <compareXYvals2+0x239>
mov    -0x1c(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compareXYvals2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %esi,%r14d
mov    %edi,%r12d
call   1070 <gridInqXvalsPtr@plt>
test   %rbp,%rbp
je     117c <compareXYvals2+0x2c>
test   %rax,%rax
jne    118a <compareXYvals2+0x3a>
jmp    12fd <compareXYvals2+0x1ad>
mov    $0x1,%ebx
test   %rax,%rax
jne    1306 <compareXYvals2+0x1b6>
mov    %r12d,%edi
call   1040 <gridInqYvalsPtr@plt>
test   %r15,%r15
je     11a1 <compareXYvals2+0x51>
test   %rax,%rax
jne    11af <compareXYvals2+0x5f>
jmp    12fd <compareXYvals2+0x1ad>
mov    $0x1,%ebx
test   %rax,%rax
jne    1306 <compareXYvals2+0x1b6>
test   %rbp,%rbp
je     1261 <compareXYvals2+0x111>
mov    %r12d,%edi
call   1070 <gridInqXvalsPtr@plt>
test   %rax,%rax
je     1261 <compareXYvals2+0x111>
movsd  0x0(%rbp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12d,%edi
xor    %esi,%esi
call   1060 <gridInqXval@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <fabs@plt>
mov    $0x1,%ebx
ucomisd 0xdf9(%rip),%xmm0
ja     1306 <compareXYvals2+0x1b6>
lea    -0x1(%r14),%esi
movslq %r14d,%rax
movsd  -0x8(%rbp,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12d,%edi
call   1060 <gridInqXval@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <fabs@plt>
xor    %ebx,%ebx
ucomisd 0xdb2(%rip),%xmm0
seta   %bl
ja     1306 <compareXYvals2+0x1b6>
test   %r15,%r15
jne    126a <compareXYvals2+0x11a>
jmp    1306 <compareXYvals2+0x1b6>
test   %r15,%r15
je     1304 <compareXYvals2+0x1b4>
mov    %r12d,%edi
call   1040 <gridInqYvalsPtr@plt>
test   %rax,%rax
je     1304 <compareXYvals2+0x1b4>
movsd  (%r15),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
mov    %r12d,%edi
xor    %esi,%esi
call   1050 <gridInqYval@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <fabs@plt>
ucomisd 0xd4a(%rip),%xmm0
ja     12fd <compareXYvals2+0x1ad>
movslq %r14d,%rax
add    $0xffffffff,%r14d
movsd  -0x8(%r15,%rax,8),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12d,%edi
mov    %r14d,%esi
call   1050 <gridInqYval@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
cvttsd2si %xmm1,%rdi
call   1030 <fabs@plt>
ucomisd 0xd05(%rip),%xmm0
jbe    1306 <compareXYvals2+0x1b6>
mov    $0x1,%ebx
jmp    1306 <compareXYvals2+0x1b6>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @compareXYvals2(i32 %0, i32 %1, double* %2, double* %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca double*
%8 = alloca double*
%9 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store double* %2, double** %7
store double* %3, double** %8
store i32 0, i32* %9
%10 = load i32, i32* %9
%11 = icmp ne i32 %10, 0
br i1 %11, label %27, label %12
12: ; preds = %4
%13 = load double*, double** %7
%14 = icmp eq double* %13, null
br i1 %14, label %15, label %19
15: ; preds = %12
%16 = load i32, i32* %5
%17 = call i32* @gridInqXvalsPtr(i32 %16)
%18 = icmp ne i32* %17, null
br i1 %18, label %26, label %19
19: ; preds = %15, %12
%20 = load double*, double** %7
%21 = icmp ne double* %20, null
br i1 %21, label %22, label %27
22: ; preds = %19
%23 = load i32, i32* %5
%24 = call i32* @gridInqXvalsPtr(i32 %23)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %27
26: ; preds = %22, %15
store i32 1, i32* %9
br label %27
27: ; preds = %26, %22, %19, %4
%28 = load i32, i32* %9
%29 = icmp ne i32 %28, 0
br i1 %29, label %45, label %30
30: ; preds = %27
%31 = load double*, double** %8
%32 = icmp eq double* %31, null
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* %5
%35 = call i32* @gridInqYvalsPtr(i32 %34)
%36 = icmp ne i32* %35, null
br i1 %36, label %44, label %37
37: ; preds = %33, %30
%38 = load double*, double** %8
%39 = icmp ne double* %38, null
br i1 %39, label %40, label %45
40: ; preds = %37
%41 = load i32, i32* %5
%42 = call i32* @gridInqYvalsPtr(i32 %41)
%43 = icmp eq i32* %42, null
br i1 %43, label %44, label %45
44: ; preds = %40, %33
store i32 1, i32* %9
br label %45
45: ; preds = %44, %40, %37, %27
%46 = load i32, i32* %9
%47 = icmp ne i32 %46, 0
br i1 %47, label %84, label %48
48: ; preds = %45
%49 = load double*, double** %7
%50 = icmp ne double* %49, null
br i1 %50, label %51, label %84
51: ; preds = %48
%52 = load i32, i32* %5
%53 = call i32* @gridInqXvalsPtr(i32 %52)
%54 = icmp ne i32* %53, null
br i1 %54, label %55, label %84
55: ; preds = %51
%56 = load double*, double** %7
%57 = getelementptr inbounds double, double* %56, i64 0
%58 = load double, double* %57
%59 = load i32, i32* %5
%60 = call i64 @gridInqXval(i32 %59, i32 0)
%61 = sitofp i64 %60 to double
%62 = fsub double %58, %61
%63 = fptosi double %62 to i64
%64 = call double @fabs(i64 %63)
%65 = fcmp ogt double %64, 1.000000e-09
br i1 %65, label %82, label %66
66: ; preds = %55
%67 = load double*, double** %7
%68 = load i32, i32* %6
%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 = load i32, i32* %5
%74 = load i32, i32* %6
%75 = sub nsw i32 %74, 1
%76 = call i64 @gridInqXval(i32 %73, i32 %75)
%77 = sitofp i64 %76 to double
%78 = fsub double %72, %77
%79 = fptosi double %78 to i64
%80 = call double @fabs(i64 %79)
%81 = fcmp ogt double %80, 1.000000e-09
br i1 %81, label %82, label %83
82: ; preds = %66, %55
store i32 1, i32* %9
br label %83
83: ; preds = %82, %66
br label %84
84: ; preds = %83, %51, %48, %45
%85 = load i32, i32* %9
%86 = icmp ne i32 %85, 0
br i1 %86, label %123, label %87
87: ; preds = %84
%88 = load double*, double** %8
%89 = icmp ne double* %88, null
br i1 %89, label %90, label %123
90: ; preds = %87
%91 = load i32, i32* %5
%92 = call i32* @gridInqYvalsPtr(i32 %91)
%93 = icmp ne i32* %92, null
br i1 %93, label %94, label %123
94: ; preds = %90
%95 = load double*, double** %8
%96 = getelementptr inbounds double, double* %95, i64 0
%97 = load double, double* %96
%98 = load i32, i32* %5
%99 = call i64 @gridInqYval(i32 %98, i32 0)
%100 = sitofp i64 %99 to double
%101 = fsub double %97, %100
%102 = fptosi double %101 to i64
%103 = call double @fabs(i64 %102)
%104 = fcmp ogt double %103, 1.000000e-09
br i1 %104, label %121, label %105
105: ; preds = %94
%106 = load double*, double** %8
%107 = load i32, i32* %6
%108 = sub nsw i32 %107, 1
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds double, double* %106, i64 %109
%111 = load double, double* %110
%112 = load i32, i32* %5
%113 = load i32, i32* %6
%114 = sub nsw i32 %113, 1
%115 = call i64 @gridInqYval(i32 %112, i32 %114)
%116 = sitofp i64 %115 to double
%117 = fsub double %111, %116
%118 = fptosi double %117 to i64
%119 = call double @fabs(i64 %118)
%120 = fcmp ogt double %119, 1.000000e-09
br i1 %120, label %121, label %122
121: ; preds = %105, %94
store i32 1, i32* %9
br label %122
122: ; preds = %121, %105
br label %123
123: ; preds = %122, %90, %87, %84
%124 = load i32, i32* %9
ret i32 %124
}

LLVM IR (-O2):
define i32 @compareXYvals2(i32 %0, i32 %1, double* %2, double* %3) {
%5 = icmp eq double* %2, null
%6 = tail call i32* @gridInqXvalsPtr(i32 %0)
%7 = icmp eq i32* %6, null
br i1 %5, label %8, label %9
8: ; preds = %4
br i1 %7, label %10, label %65
9: ; preds = %4
br i1 %7, label %65, label %10
10: ; preds = %8, %9
%11 = icmp eq double* %3, null
%12 = tail call i32* @gridInqYvalsPtr(i32 %0)
%13 = icmp eq i32* %12, null
br i1 %11, label %14, label %15
14: ; preds = %10
br i1 %13, label %16, label %65
15: ; preds = %10
br i1 %13, label %65, label %16
16: ; preds = %14, %15
br i1 %5, label %41, label %17
17: ; preds = %16
%18 = tail call i32* @gridInqXvalsPtr(i32 %0)
%19 = icmp eq i32* %18, null
br i1 %19, label %41, label %20
20: ; preds = %17
%21 = load double, double* %2
%22 = tail call i64 @gridInqXval(i32 %0, i32 0)
%23 = sitofp i64 %22 to double
%24 = fsub double %21, %23
%25 = fptosi double %24 to i64
%26 = tail call double @fabs(i64 %25)
%27 = fcmp ogt double %26, 1.000000e-09
br i1 %27, label %65, label %28
28: ; preds = %20
%29 = add nsw i32 %1, -1
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %2, i64 %30
%32 = load double, double* %31
%33 = tail call i64 @gridInqXval(i32 %0, i32 %29)
%34 = sitofp i64 %33 to double
%35 = fsub double %32, %34
%36 = fptosi double %35 to i64
%37 = tail call double @fabs(i64 %36)
%38 = fcmp ogt double %37, 1.000000e-09
%39 = or i1 %38, %11
%40 = zext i1 %38 to i32
br i1 %39, label %65, label %42
41: ; preds = %17, %16
br i1 %11, label %65, label %42
42: ; preds = %28, %41
%43 = tail call i32* @gridInqYvalsPtr(i32 %0)
%44 = icmp eq i32* %43, null
br i1 %44, label %65, label %45
45: ; preds = %42
%46 = load double, double* %3
%47 = tail call i64 @gridInqYval(i32 %0, i32 0)
%48 = sitofp i64 %47 to double
%49 = fsub double %46, %48
%50 = fptosi double %49 to i64
%51 = tail call double @fabs(i64 %50)
%52 = fcmp ogt double %51, 1.000000e-09
br i1 %52, label %64, label %53
53: ; preds = %45
%54 = add nsw i32 %1, -1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds double, double* %3, i64 %55
%57 = load double, double* %56
%58 = tail call i64 @gridInqYval(i32 %0, i32 %54)
%59 = sitofp i64 %58 to double
%60 = fsub double %57, %59
%61 = fptosi double %60 to i64
%62 = tail call double @fabs(i64 %61)
%63 = fcmp ogt double %62, 1.000000e-09
br i1 %63, label %64, label %65
64: ; preds = %53, %45
br label %65
65: ; preds = %28, %20, %14, %15, %8, %9, %53, %64, %42, %41
%66 = phi i32 [ 1, %64 ], [ 0, %53 ], [ 0, %42 ], [ 0, %41 ], [ 1, %9 ], [ 1, %8 ], [ 1, %15 ], [ 1, %14 ], [ %40, %28 ], [ 1, %20 ]
ret i32 %66
}