#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 */
int isChangeInSignNeighborhoodInterp(float *, int const, int const, int const,
                                     double const, double const, double const,
                                     double const);
int changeInSignInterp(float *gvf_x, float *gvf_y, float *gvf_z, const int dimx,
                       const int dimy, const int dimz, const double i,
                       const double j, const double k, const double cellsize) {
  int ct = 0;
  if (isChangeInSignNeighborhoodInterp(gvf_x, dimx, dimy, dimz, i, j, k,
                                       cellsize) == 1)
    ct++;
  if (isChangeInSignNeighborhoodInterp(gvf_y, dimx, dimy, dimz, i, j, k,
                                       cellsize) == 1)
    ct++;
  if (isChangeInSignNeighborhoodInterp(gvf_z, dimx, dimy, dimz, i, j, k,
                                       cellsize) == 1)
    ct++;
  if (ct == 3)
    return 1;
  return -1;
}


x86 assembly (clang, -O0):
<changeInSignInterp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movsd  %xmm0,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
movsd  %xmm2,-0x48(%rbp)
movsd  %xmm3,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
call   1030 <isChangeInSignNeighborhoodInterp@plt>
cmp    $0x1,%eax
jne    1182 <changeInSignInterp+0x72>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
call   1030 <isChangeInSignNeighborhoodInterp@plt>
cmp    $0x1,%eax
jne    11ba <changeInSignInterp+0xaa>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
movsd  -0x38(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x50(%rbp),%xmm3
call   1030 <isChangeInSignNeighborhoodInterp@plt>
cmp    $0x1,%eax
jne    11f2 <changeInSignInterp+0xe2>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jne    1208 <changeInSignInterp+0xf8>
movl   $0x1,-0x4(%rbp)
jmp    120f <changeInSignInterp+0xff>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeInSignInterp>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,(%rsp)
mov    %r9d,%r14d
mov    %r8d,%r13d
mov    %ecx,%r15d
mov    %rdx,0x20(%rsp)
mov    %rsi,%r12
mov    %ecx,%esi
mov    %r8d,%edx
mov    %r9d,%ecx
call   1030 <isChangeInSignNeighborhoodInterp@plt>
xor    %ebp,%ebp
cmp    $0x1,%eax
sete   %bpl
mov    %r12,%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r14d,%ecx
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1030 <isChangeInSignNeighborhoodInterp@plt>
lea    0x1(%rbp),%ebx
cmp    $0x1,%eax
cmovne %ebp,%ebx
mov    0x20(%rsp),%rdi
mov    %r15d,%esi
mov    %r13d,%edx
mov    %r14d,%ecx
movsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm3
call   1030 <isChangeInSignNeighborhoodInterp@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ebx,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
sete   %al
add    %eax,%eax
add    $0xffffffff,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @changeInSignInterp(float* %0, float* %1, float* %2, i32 %3, i32 %4, i32 %5, double %6, double %7, double %8, double %9) {
%11 = alloca i32
%12 = alloca float*
%13 = alloca float*
%14 = alloca float*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca i32
store float* %0, float** %12
store float* %1, float** %13
store float* %2, float** %14
store i32 %3, i32* %15
store i32 %4, i32* %16
store i32 %5, i32* %17
store double %6, double* %18
store double %7, double* %19
store double %8, double* %20
store double %9, double* %21
store i32 0, i32* %22
%23 = load float*, float** %12
%24 = load i32, i32* %15
%25 = load i32, i32* %16
%26 = load i32, i32* %17
%27 = load double, double* %18
%28 = load double, double* %19
%29 = load double, double* %20
%30 = load double, double* %21
%31 = call i32 @isChangeInSignNeighborhoodInterp(float* %23, i32 %24, i32 %25, i32 %26, double %27, double %28, double %29, double %30)
%32 = icmp eq i32 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %10
%34 = load i32, i32* %22
%35 = add nsw i32 %34, 1
store i32 %35, i32* %22
br label %36
36: ; preds = %33, %10
%37 = load float*, float** %13
%38 = load i32, i32* %15
%39 = load i32, i32* %16
%40 = load i32, i32* %17
%41 = load double, double* %18
%42 = load double, double* %19
%43 = load double, double* %20
%44 = load double, double* %21
%45 = call i32 @isChangeInSignNeighborhoodInterp(float* %37, i32 %38, i32 %39, i32 %40, double %41, double %42, double %43, double %44)
%46 = icmp eq i32 %45, 1
br i1 %46, label %47, label %50
47: ; preds = %36
%48 = load i32, i32* %22
%49 = add nsw i32 %48, 1
store i32 %49, i32* %22
br label %50
50: ; preds = %47, %36
%51 = load float*, float** %14
%52 = load i32, i32* %15
%53 = load i32, i32* %16
%54 = load i32, i32* %17
%55 = load double, double* %18
%56 = load double, double* %19
%57 = load double, double* %20
%58 = load double, double* %21
%59 = call i32 @isChangeInSignNeighborhoodInterp(float* %51, i32 %52, i32 %53, i32 %54, double %55, double %56, double %57, double %58)
%60 = icmp eq i32 %59, 1
br i1 %60, label %61, label %64
61: ; preds = %50
%62 = load i32, i32* %22
%63 = add nsw i32 %62, 1
store i32 %63, i32* %22
br label %64
64: ; preds = %61, %50
%65 = load i32, i32* %22
%66 = icmp eq i32 %65, 3
br i1 %66, label %67, label %68
67: ; preds = %64
store i32 1, i32* %11
br label %69
68: ; preds = %64
store i32 -1, i32* %11
br label %69
69: ; preds = %68, %67
%70 = load i32, i32* %11
ret i32 %70
}

LLVM IR (-O2):
define i32 @changeInSignInterp(float* %0, float* %1, float* %2, i32 %3, i32 %4, i32 %5, double %6, double %7, double %8, double %9) {
%11 = tail call i32 @isChangeInSignNeighborhoodInterp(float* %0, i32 %3, i32 %4, i32 %5, double %6, double %7, double %8, double %9)
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
%14 = tail call i32 @isChangeInSignNeighborhoodInterp(float* %1, i32 %3, i32 %4, i32 %5, double %6, double %7, double %8, double %9)
%15 = icmp eq i32 %14, 1
%16 = select i1 %12, i32 2, i32 1
%17 = select i1 %15, i32 %16, i32 %13
%18 = tail call i32 @isChangeInSignNeighborhoodInterp(float* %2, i32 %3, i32 %4, i32 %5, double %6, double %7, double %8, double %9)
%19 = icmp eq i32 %18, 1
%20 = zext i1 %19 to i32
%21 = add nuw nsw i32 %17, %20
%22 = icmp eq i32 %21, 3
%23 = select i1 %22, i32 1, i32 -1
ret i32 %23
}