#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 */
scalar_t__ getCantidadConflictosEnReglaCuadrado(int **, int, int, int, int);
scalar_t__ getCantidadConflictosEnReglaHorizontal(int **, int, int, int, int);
scalar_t__ getCantidadConflictosEnReglaVertical(int **, int, int, int, int);
int verificarReglas(int tabla[9][9], int ii, int jj, int candidato,
                    int enGeneral) {
  if (getCantidadConflictosEnReglaHorizontal(tabla, ii, jj, candidato,
                                             enGeneral)) {
    return 0;
  }
  if (getCantidadConflictosEnReglaVertical(tabla, ii, jj, candidato,
                                           enGeneral)) {
    return 0;
  }
  if (getCantidadConflictosEnReglaCuadrado(tabla, ii, jj, candidato,
                                           enGeneral)) {
    return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<verificarReglas>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1040 <getCantidadConflictosEnReglaHorizontal@plt>
cmp    $0x0,%rax
je     1175 <verificarReglas+0x45>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <verificarReglas+0xa4>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1030 <getCantidadConflictosEnReglaVertical@plt>
cmp    $0x0,%rax
je     11a1 <verificarReglas+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <verificarReglas+0xa4>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
call   1050 <getCantidadConflictosEnReglaCuadrado@plt>
cmp    $0x0,%rax
je     11cd <verificarReglas+0x9d>
movl   $0x0,-0x4(%rbp)
jmp    11d4 <verificarReglas+0xa4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<verificarReglas>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbx
call   1040 <getCantidadConflictosEnReglaHorizontal@plt>
xor    %ebp,%ebp
test   %rax,%rax
jne    118c <verificarReglas+0x5c>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1030 <getCantidadConflictosEnReglaVertical@plt>
test   %rax,%rax
jne    118c <verificarReglas+0x5c>
mov    %rbx,%rdi
mov    %r13d,%esi
mov    %r12d,%edx
mov    %r15d,%ecx
mov    %r14d,%r8d
call   1050 <getCantidadConflictosEnReglaCuadrado@plt>
xor    %ebp,%ebp
test   %rax,%rax
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @verificarReglas([9 x i32]* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca [9 x i32]*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store [9 x i32]* %0, [9 x i32]** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load [9 x i32]*, [9 x i32]** %7
%13 = bitcast [9 x i32]* %12 to i32**
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = load i32, i32* %11
%18 = call i64 @getCantidadConflictosEnReglaHorizontal(i32** %13, i32 %14, i32 %15, i32 %16, i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %5
store i32 0, i32* %6
br label %42
21: ; preds = %5
%22 = load [9 x i32]*, [9 x i32]** %7
%23 = bitcast [9 x i32]* %22 to i32**
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = load i32, i32* %10
%27 = load i32, i32* %11
%28 = call i64 @getCantidadConflictosEnReglaVertical(i32** %23, i32 %24, i32 %25, i32 %26, i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %21
store i32 0, i32* %6
br label %42
31: ; preds = %21
%32 = load [9 x i32]*, [9 x i32]** %7
%33 = bitcast [9 x i32]* %32 to i32**
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = load i32, i32* %10
%37 = load i32, i32* %11
%38 = call i64 @getCantidadConflictosEnReglaCuadrado(i32** %33, i32 %34, i32 %35, i32 %36, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %31
store i32 0, i32* %6
br label %42
41: ; preds = %31
store i32 1, i32* %6
br label %42
42: ; preds = %41, %40, %30, %20
%43 = load i32, i32* %6
ret i32 %43
}

LLVM IR (-O2):
define i32 @verificarReglas([9 x i32]* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = bitcast [9 x i32]* %0 to i32**
%7 = tail call i64 @getCantidadConflictosEnReglaHorizontal(i32** %6, i32 %1, i32 %2, i32 %3, i32 %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %16
9: ; preds = %5
%10 = tail call i64 @getCantidadConflictosEnReglaVertical(i32** %6, i32 %1, i32 %2, i32 %3, i32 %4)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = tail call i64 @getCantidadConflictosEnReglaCuadrado(i32** %6, i32 %1, i32 %2, i32 %3, i32 %4)
%14 = icmp eq i64 %13, 0
%15 = zext i1 %14 to i32
br label %16
16: ; preds = %12, %9, %5
%17 = phi i32 [ 0, %5 ], [ 0, %9 ], [ %15, %12 ]
ret i32 %17
}