#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*/ colocaNavio(int **, int, int);
scalar_t__ malloc(int);
int **geraTabuleiro() {
  int **tabuleiro = (int **)malloc(10 * sizeof(int *));
  for (int i = 0; i < 10; i++)
    tabuleiro[i] = (int *)malloc(10 * sizeof(int));
  for (int i = 0; i < 10; i++)
    for (int j = 0; j < 10; j++)
      tabuleiro[i][j] = 0;
  colocaNavio(tabuleiro, 5, 1);
  colocaNavio(tabuleiro, 4, 2);
  colocaNavio(tabuleiro, 3, 3);
  colocaNavio(tabuleiro, 2, 4);
  return tabuleiro;
}


x86 assembly (clang, -O0):
<geraTabuleiro>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x50,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xa,-0xc(%rbp)
jge    116e <geraTabuleiro+0x4e>
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113d <geraTabuleiro+0x1d>
movl   $0x0,-0x10(%rbp)
cmpl   $0xa,-0x10(%rbp)
jge    11c8 <geraTabuleiro+0xa8>
movl   $0x0,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    11b5 <geraTabuleiro+0x95>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movslq -0x14(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1186 <geraTabuleiro+0x66>
jmp    11ba <geraTabuleiro+0x9a>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1175 <geraTabuleiro+0x55>
mov    -0x8(%rbp),%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <colocaNavio@plt>
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1040 <colocaNavio@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3,%edx
mov    %edx,%esi
call   1040 <colocaNavio@plt>
mov    -0x8(%rbp),%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <colocaNavio@plt>
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<geraTabuleiro>:
push   %rbx
mov    $0x50,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x8(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x10(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x18(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x20(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x28(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x30(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x38(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x40(%rbx)
mov    $0x28,%edi
call   1030 <malloc@plt>
mov    %rax,0x48(%rbx)
mov    (%rbx),%rcx
xorps  %xmm0,%xmm0
movups %xmm0,0x10(%rcx)
movups %xmm0,(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x8(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x10(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x18(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x20(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x28(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x30(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x38(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
mov    0x40(%rbx),%rcx
movups %xmm0,(%rcx)
movups %xmm0,0x10(%rcx)
movq   $0x0,0x20(%rcx)
movups %xmm0,(%rax)
movups %xmm0,0x10(%rax)
movq   $0x0,0x20(%rax)
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%edx
call   1040 <colocaNavio@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x2,%edx
call   1040 <colocaNavio@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x3,%edx
call   1040 <colocaNavio@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x4,%edx
call   1040 <colocaNavio@plt>
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i32** @geraTabuleiro() {
%1 = alloca i32**
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i64 @malloc(i32 80)
%6 = inttoptr i64 %5 to i32**
store i32** %6, i32*** %1
store i32 0, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 10
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = call i64 @malloc(i32 40)
%12 = inttoptr i64 %11 to i32*
%13 = load i32**, i32*** %1
%14 = load i32, i32* %2
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i32*, i32** %13, i64 %15
store i32* %12, i32** %16
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
store i32 0, i32* %3
br label %21
21: ; preds = %41, %20
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 10
br i1 %23, label %24, label %44
24: ; preds = %21
store i32 0, i32* %4
br label %25
25: ; preds = %37, %24
%26 = load i32, i32* %4
%27 = icmp slt i32 %26, 10
br i1 %27, label %28, label %40
28: ; preds = %25
%29 = load i32**, i32*** %1
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32*, i32** %29, i64 %31
%33 = load i32*, i32** %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %33, i64 %35
store i32 0, i32* %36
br label %37
37: ; preds = %28
%38 = load i32, i32* %4
%39 = add nsw i32 %38, 1
store i32 %39, i32* %4
br label %25
40: ; preds = %25
br label %41
41: ; preds = %40
%42 = load i32, i32* %3
%43 = add nsw i32 %42, 1
store i32 %43, i32* %3
br label %21
44: ; preds = %21
%45 = load i32**, i32*** %1
%46 = call i32 @colocaNavio(i32** %45, i32 5, i32 1)
%47 = load i32**, i32*** %1
%48 = call i32 @colocaNavio(i32** %47, i32 4, i32 2)
%49 = load i32**, i32*** %1
%50 = call i32 @colocaNavio(i32** %49, i32 3, i32 3)
%51 = load i32**, i32*** %1
%52 = call i32 @colocaNavio(i32** %51, i32 2, i32 4)
%53 = load i32**, i32*** %1
ret i32** %53
}

LLVM IR (-O2):
define i32** @geraTabuleiro() {
%1 = tail call i64 @malloc(i32 80)
%2 = inttoptr i64 %1 to i32**
%3 = tail call i64 @malloc(i32 40)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %2
%5 = tail call i64 @malloc(i32 40)
%6 = inttoptr i64 %5 to i32*
%7 = getelementptr inbounds i32*, i32** %2, i64 1
store i32* %6, i32** %7
%8 = tail call i64 @malloc(i32 40)
%9 = inttoptr i64 %8 to i32*
%10 = getelementptr inbounds i32*, i32** %2, i64 2
store i32* %9, i32** %10
%11 = tail call i64 @malloc(i32 40)
%12 = inttoptr i64 %11 to i32*
%13 = getelementptr inbounds i32*, i32** %2, i64 3
store i32* %12, i32** %13
%14 = tail call i64 @malloc(i32 40)
%15 = inttoptr i64 %14 to i32*
%16 = getelementptr inbounds i32*, i32** %2, i64 4
store i32* %15, i32** %16
%17 = tail call i64 @malloc(i32 40)
%18 = inttoptr i64 %17 to i32*
%19 = getelementptr inbounds i32*, i32** %2, i64 5
store i32* %18, i32** %19
%20 = tail call i64 @malloc(i32 40)
%21 = inttoptr i64 %20 to i32*
%22 = getelementptr inbounds i32*, i32** %2, i64 6
store i32* %21, i32** %22
%23 = tail call i64 @malloc(i32 40)
%24 = inttoptr i64 %23 to i32*
%25 = getelementptr inbounds i32*, i32** %2, i64 7
store i32* %24, i32** %25
%26 = tail call i64 @malloc(i32 40)
%27 = inttoptr i64 %26 to i32*
%28 = getelementptr inbounds i32*, i32** %2, i64 8
store i32* %27, i32** %28
%29 = tail call i64 @malloc(i32 40)
%30 = inttoptr i64 %29 to i32*
%31 = getelementptr inbounds i32*, i32** %2, i64 9
store i32* %30, i32** %31
%32 = inttoptr i64 %1 to i8**
%33 = load i8*, i8** %32
%34 = bitcast i32** %7 to i8**
%35 = load i8*, i8** %34
%36 = bitcast i32** %10 to i8**
%37 = load i8*, i8** %36
%38 = bitcast i32** %13 to i8**
%39 = load i8*, i8** %38
%40 = bitcast i32** %16 to i8**
%41 = load i8*, i8** %40
%42 = bitcast i32** %19 to i8**
%43 = load i8*, i8** %42
%44 = bitcast i32** %22 to i8**
%45 = load i8*, i8** %44
%46 = bitcast i32** %25 to i8**
%47 = load i8*, i8** %46
%48 = bitcast i32** %28 to i8**
%49 = load i8*, i8** %48
%50 = inttoptr i64 %29 to i8*
%51 = tail call i32 @colocaNavio(i32** %2, i32 5, i32 1)
%52 = tail call i32 @colocaNavio(i32** %2, i32 4, i32 2)
%53 = tail call i32 @colocaNavio(i32** %2, i32 3, i32 3)
%54 = tail call i32 @colocaNavio(i32** %2, i32 2, i32 4)
ret i32** %2
}