#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 /*<<< orphan*/ copyMatriz(int **, int **);
int /*<<< orphan*/ sePuedeSwapArriba(int);
int /*<<< orphan*/ swap(int **, int, int, int);
scalar_t__ verificarReglasEnGeneral(int **);
int swapArriba(int sudokuSolucion[9][9], int sudokuSimulacion[9][9],
               int iPosicionConflicto, int jPosicionConflicto, int fatalError) {
  swap(sudokuSimulacion, iPosicionConflicto, iPosicionConflicto - 1,
       jPosicionConflicto);
  if (verificarReglasEnGeneral(sudokuSimulacion)) {
    return 1;
  } else {
    if (fatalError) {
      return 0;
    }
    if (!sePuedeSwapArriba(iPosicionConflicto)) {
      return 0;
    }
    copyMatriz(sudokuSolucion, sudokuSimulacion);
    if (swapArriba(sudokuSolucion, sudokuSimulacion, iPosicionConflicto - 1,
                   jPosicionConflicto, 0)) {
      return swapArriba(sudokuSolucion, sudokuSimulacion, iPosicionConflicto,
                        jPosicionConflicto, 1);
    }
    return 0;
  }
}


x86 assembly (clang, -O0):
<swapArriba>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x20(%rbp),%ecx
call   1060 <swap@plt>
mov    -0x18(%rbp),%rdi
call   1030 <verificarReglasEnGeneral@plt>
cmp    $0x0,%rax
je     119e <swapArriba+0x4e>
movl   $0x1,-0x4(%rbp)
jmp    1228 <swapArriba+0xd8>
cmpl   $0x0,-0x24(%rbp)
je     11b4 <swapArriba+0x64>
movl   $0x0,-0x4(%rbp)
jmp    1228 <swapArriba+0xd8>
mov    -0x1c(%rbp),%edi
call   1050 <sePuedeSwapArriba@plt>
cmp    $0x0,%eax
jne    11d1 <swapArriba+0x81>
movl   $0x0,-0x4(%rbp)
jmp    1228 <swapArriba+0xd8>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1070 <copyMatriz@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
mov    -0x20(%rbp),%ecx
xor    %r8d,%r8d
call   1040 <swapArriba@plt>
cmp    $0x0,%eax
je     1221 <swapArriba+0xd1>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x1c(%rbp),%edx
mov    -0x20(%rbp),%ecx
mov    $0x1,%r8d
call   1040 <swapArriba@plt>
mov    %eax,-0x4(%rbp)
jmp    1228 <swapArriba+0xd8>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<swapArriba>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,0x4(%rsp)
mov    %ecx,%r15d
mov    %edx,%ebp
mov    %rsi,%r13
mov    %rdi,%r14
lea    -0x1(%rbp),%r12d
mov    %rsi,%rdi
mov    %edx,%esi
mov    %r12d,%edx
call   1060 <swap@plt>
mov    %r13,%rdi
call   1030 <verificarReglasEnGeneral@plt>
mov    $0x1,%ebx
test   %rax,%rax
jne    11ee <swapArriba+0x9e>
xor    %ebx,%ebx
cmpl   $0x0,0x4(%rsp)
jne    11ee <swapArriba+0x9e>
mov    %ebp,%edi
call   1050 <sePuedeSwapArriba@plt>
test   %eax,%eax
mov    %r15d,0x4(%rsp)
je     11ee <swapArriba+0x9e>
mov    %r14,%rdi
mov    %r13,%rsi
call   1070 <copyMatriz@plt>
xor    %ebx,%ebx
mov    %r14,%rdi
mov    %r13,%rsi
mov    %r12d,%edx
mov    0x4(%rsp),%ecx
xor    %r8d,%r8d
call   1040 <swapArriba@plt>
test   %eax,%eax
je     11ee <swapArriba+0x9e>
mov    %r13,%rdi
mov    %ebp,%esi
mov    %r12d,%edx
mov    0x4(%rsp),%ecx
call   1060 <swap@plt>
mov    %r13,%rdi
call   1030 <verificarReglasEnGeneral@plt>
xor    %ebx,%ebx
test   %rax,%rax
setne  %bl
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @swapArriba([9 x i32]* %0, [9 x i32]* %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca [9 x i32]*
%8 = alloca [9 x i32]*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store [9 x i32]* %0, [9 x i32]** %7
store [9 x i32]* %1, [9 x 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]** %8
%13 = bitcast [9 x i32]* %12 to i32**
%14 = load i32, i32* %9
%15 = load i32, i32* %9
%16 = sub nsw i32 %15, 1
%17 = load i32, i32* %10
%18 = call i32 @swap(i32** %13, i32 %14, i32 %16, i32 %17)
%19 = load [9 x i32]*, [9 x i32]** %8
%20 = bitcast [9 x i32]* %19 to i32**
%21 = call i64 @verificarReglasEnGeneral(i32** %20)
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %5
store i32 1, i32* %6
br label %53
24: ; preds = %5
%25 = load i32, i32* %11
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %24
store i32 0, i32* %6
br label %53
28: ; preds = %24
%29 = load i32, i32* %9
%30 = call i32 @sePuedeSwapArriba(i32 %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %28
store i32 0, i32* %6
br label %53
33: ; preds = %28
%34 = load [9 x i32]*, [9 x i32]** %7
%35 = bitcast [9 x i32]* %34 to i32**
%36 = load [9 x i32]*, [9 x i32]** %8
%37 = bitcast [9 x i32]* %36 to i32**
%38 = call i32 @copyMatriz(i32** %35, i32** %37)
%39 = load [9 x i32]*, [9 x i32]** %7
%40 = load [9 x i32]*, [9 x i32]** %8
%41 = load i32, i32* %9
%42 = sub nsw i32 %41, 1
%43 = load i32, i32* %10
%44 = call i32 @swapArriba([9 x i32]* %39, [9 x i32]* %40, i32 %42, i32 %43, i32 0)
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %52
46: ; preds = %33
%47 = load [9 x i32]*, [9 x i32]** %7
%48 = load [9 x i32]*, [9 x i32]** %8
%49 = load i32, i32* %9
%50 = load i32, i32* %10
%51 = call i32 @swapArriba([9 x i32]* %47, [9 x i32]* %48, i32 %49, i32 %50, i32 1)
store i32 %51, i32* %6
br label %53
52: ; preds = %33
store i32 0, i32* %6
br label %53
53: ; preds = %52, %46, %32, %27, %23
%54 = load i32, i32* %6
ret i32 %54
}

LLVM IR (-O2):
define i32 @swapArriba([9 x i32]* %0, [9 x i32]* %1, i32 %2, i32 %3, i32 %4) {
%6 = bitcast [9 x i32]* %1 to i32**
%7 = add nsw i32 %2, -1
%8 = tail call i32 @swap(i32** %6, i32 %2, i32 %7, i32 %3)
%9 = tail call i64 @verificarReglasEnGeneral(i32** %6)
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %5
%12 = icmp eq i32 %4, 0
br i1 %12, label %13, label %26
13: ; preds = %11
%14 = tail call i32 @sePuedeSwapArriba(i32 %2)
%15 = icmp eq i32 %14, 0
br i1 %15, label %26, label %16
16: ; preds = %13
%17 = bitcast [9 x i32]* %0 to i32**
%18 = tail call i32 @copyMatriz(i32** %17, i32** %6)
%19 = tail call i32 @swapArriba([9 x i32]* %0, [9 x i32]* %1, i32 %7, i32 %3, i32 0)
%20 = icmp eq i32 %19, 0
br i1 %20, label %26, label %21
21: ; preds = %16
%22 = tail call i32 @swap(i32** %6, i32 %2, i32 %7, i32 %3)
%23 = tail call i64 @verificarReglasEnGeneral(i32** %6)
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i32
br label %26
26: ; preds = %21, %16, %13, %11, %5
%27 = phi i32 [ 1, %5 ], [ 0, %11 ], [ 0, %13 ], [ 0, %16 ], [ %25, %21 ]
ret i32 %27
}