#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*/ retCeros(int **, int, int);
int sumCuadrante(int **, int, int);
void mayorCuadrante(int matriz[4][4], int fil, int col) {
  int mayor = 0, i, suma, cuadranteM;
  for (i = 1; i <= 4; i++) {
    if ((suma = sumCuadrante(matriz, fil, i)) >= mayor) {
      mayor = suma;
      cuadranteM = i;
    }
  }
  retCeros(matriz, fil, cuadranteM);
}


x86 assembly (clang, -O0):
<mayorCuadrante>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x18(%rbp)
cmpl   $0x4,-0x18(%rbp)
jg     1184 <mayorCuadrante+0x64>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%edx
call   1030 <sumCuadrante@plt>
mov    %eax,-0x1c(%rbp)
cmp    -0x14(%rbp),%eax
jl     1171 <mayorCuadrante+0x51>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1176 <mayorCuadrante+0x56>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1140 <mayorCuadrante+0x20>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%edx
call   1040 <retCeros@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mayorCuadrante>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    $0x1,%edx
call   1030 <sumCuadrante@plt>
xor    %ebx,%ebx
test   %eax,%eax
cmovns %eax,%ebx
mov    $0x2,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x2,%edx
call   1030 <sumCuadrante@plt>
xor    %ecx,%ecx
cmp    %ebx,%eax
setl   %cl
cmovge %eax,%ebx
sub    %ecx,%ebp
mov    $0x3,%r12d
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x3,%edx
call   1030 <sumCuadrante@plt>
cmp    %ebx,%eax
cmovge %eax,%ebx
cmovge %r12d,%ebp
mov    $0x4,%r12d
mov    %r15,%rdi
mov    %r14d,%esi
mov    $0x4,%edx
call   1030 <sumCuadrante@plt>
cmp    %ebx,%eax
cmovge %r12d,%ebp
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <retCeros@plt>

LLVM IR (-O0):
define void @mayorCuadrante([4 x i32]* %0, i32 %1, i32 %2) {
%4 = alloca [4 x i32]*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store [4 x i32]* %0, [4 x i32]** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %7
store i32 1, i32* %8
br label %11
11: ; preds = %26, %3
%12 = load i32, i32* %8
%13 = icmp sle i32 %12, 4
br i1 %13, label %14, label %29
14: ; preds = %11
%15 = load [4 x i32]*, [4 x i32]** %4
%16 = bitcast [4 x i32]* %15 to i32**
%17 = load i32, i32* %5
%18 = load i32, i32* %8
%19 = call i32 @sumCuadrante(i32** %16, i32 %17, i32 %18)
store i32 %19, i32* %9
%20 = load i32, i32* %7
%21 = icmp sge i32 %19, %20
br i1 %21, label %22, label %25
22: ; preds = %14
%23 = load i32, i32* %9
store i32 %23, i32* %7
%24 = load i32, i32* %8
store i32 %24, i32* %10
br label %25
25: ; preds = %22, %14
br label %26
26: ; preds = %25
%27 = load i32, i32* %8
%28 = add nsw i32 %27, 1
store i32 %28, i32* %8
br label %11
29: ; preds = %11
%30 = load [4 x i32]*, [4 x i32]** %4
%31 = bitcast [4 x i32]* %30 to i32**
%32 = load i32, i32* %5
%33 = load i32, i32* %10
%34 = call i32 @retCeros(i32** %31, i32 %32, i32 %33)
ret void
}

LLVM IR (-O2):
define void @mayorCuadrante([4 x i32]* %0, i32 %1, i32 %2) {
%4 = bitcast [4 x i32]* %0 to i32**
%5 = tail call i32 @sumCuadrante(i32** %4, i32 %1, i32 1)
%6 = icmp sgt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
%8 = tail call i32 @sumCuadrante(i32** %4, i32 %1, i32 2)
%9 = icmp slt i32 %8, %7
%10 = select i1 %9, i32 %7, i32 %8
%11 = select i1 %9, i32 1, i32 2
%12 = tail call i32 @sumCuadrante(i32** %4, i32 %1, i32 3)
%13 = icmp slt i32 %12, %10
%14 = select i1 %13, i32 %10, i32 %12
%15 = select i1 %13, i32 %11, i32 3
%16 = tail call i32 @sumCuadrante(i32** %4, i32 %1, i32 4)
%17 = icmp slt i32 %16, %14
%18 = select i1 %17, i32 %15, i32 4
%19 = tail call i32 @retCeros(i32** %4, i32 %1, i32 %18)
ret void
}