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


x86 assembly (clang, -O0):
<changeInSign>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x20(%rbp),%eax
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    %r9d,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <isChangeInSignNeighborhood@plt>
cmp    $0x1,%eax
jne    1171 <changeInSign+0x61>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <isChangeInSignNeighborhood@plt>
cmp    $0x1,%eax
jne    11a3 <changeInSign+0x93>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
mov    0x20(%rbp),%eax
mov    %eax,(%rsp)
call   1030 <isChangeInSignNeighborhood@plt>
cmp    $0x1,%eax
jne    11d5 <changeInSign+0xc5>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
cmpl   $0x3,-0x30(%rbp)
jne    11eb <changeInSign+0xdb>
movl   $0x1,-0x4(%rbp)
jmp    11f2 <changeInSign+0xe2>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<changeInSign>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r14d
mov    %r8d,%r12d
mov    %ecx,%ebx
mov    %rdx,0x10(%rsp)
mov    %rsi,%r15
mov    0x50(%rsp),%ebp
mov    0x58(%rsp),%r9d
mov    0x60(%rsp),%eax
mov    %eax,(%rsp)
mov    %ecx,%esi
mov    %r8d,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
call   1030 <isChangeInSignNeighborhood@plt>
xor    %r13d,%r13d
cmp    $0x1,%eax
sete   %r13b
mov    0x60(%rsp),%eax
mov    %eax,(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r14d,%ecx
mov    %ebp,%r8d
mov    %ebp,%r15d
mov    0x58(%rsp),%r9d
call   1030 <isChangeInSignNeighborhood@plt>
lea    0x1(%r13),%ebp
cmp    $0x1,%eax
cmovne %r13d,%ebp
mov    0x60(%rsp),%eax
mov    %eax,(%rsp)
mov    0x10(%rsp),%rdi
mov    %ebx,%esi
mov    %r12d,%edx
mov    %r14d,%ecx
mov    %r15d,%r8d
mov    0x58(%rsp),%r9d
call   1030 <isChangeInSignNeighborhood@plt>
xor    %ecx,%ecx
cmp    $0x1,%eax
sete   %cl
add    %ebp,%ecx
xor    %eax,%eax
cmp    $0x3,%ecx
sete   %al
add    %eax,%eax
add    $0xffffffff,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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