#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*/ Pescar(int *);
scalar_t__ acertou(int *, int **);
int /*<<< orphan*/ alteraTabuleiro(int *, int **, int **);
int /*<<< orphan*/ dica(int *, int **, int);
int /*<<< orphan*/ iniciaLixos(int **);
int /*<<< orphan*/ inicializaTabuleiro(int **);
int /*<<< orphan*/ mostraTabuleiro(int **);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  int tabuleiro[5][5];
  int lixos[3][2];
  int pesca[2];
  int tentativas = 0, acertos = 0;
  inicializaTabuleiro(tabuleiro);
  iniciaLixos(lixos);
  printf("\n");
  do {
    mostraTabuleiro(tabuleiro);
    Pescar(pesca);
    tentativas++;
    if (acertou(pesca, lixos)) {
      dica(pesca, lixos, tentativas);
      acertos++;
    } else
      dica(pesca, lixos, tentativas);
    alteraTabuleiro(pesca, lixos, tabuleiro);
  } while (acertos != 3);
  printf(
      "\n\n\nJogo terminado. Voce encontrou 3 lixos no oceano em %d tentativas",
      tentativas);
  printf("\n\n\nVoce tornou o oceano um pouco mais limpo, as tartarugas e "
         "baleias agradecem!!!\n\n\n");
  mostraTabuleiro(tabuleiro);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x9c(%rbp)
movl   $0x0,-0xa0(%rbp)
lea    -0x70(%rbp),%rdi
call   1030 <inicializaTabuleiro@plt>
lea    -0x90(%rbp),%rdi
call   1060 <iniciaLixos@plt>
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1070 <mostraTabuleiro@plt>
lea    -0x98(%rbp),%rdi
call   1090 <Pescar@plt>
mov    -0x9c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
lea    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   10a0 <acertou@plt>
cmp    $0x0,%rax
je     1237 <main+0xb7>
lea    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    -0x9c(%rbp),%edx
call   1040 <dica@plt>
mov    -0xa0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
jmp    1250 <main+0xd0>
lea    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    -0x9c(%rbp),%edx
call   1040 <dica@plt>
lea    -0x98(%rbp),%rdi
lea    -0x90(%rbp),%rsi
lea    -0x70(%rbp),%rdx
call   1080 <alteraTabuleiro@plt>
cmpl   $0x3,-0xa0(%rbp)
jne    11c9 <main+0x49>
mov    -0x9c(%rbp),%esi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xdb6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x70(%rbp),%rdi
call   1070 <mostraTabuleiro@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
lea    0x30(%rsp),%r14
mov    %r14,%rdi
call   1050 <inicializaTabuleiro@plt>
lea    0x10(%rsp),%r15
mov    %r15,%rdi
call   1080 <iniciaLixos@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
lea    0x8(%rsp),%r12
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
call   1090 <mostraTabuleiro@plt>
mov    %r12,%rdi
call   10b0 <Pescar@plt>
add    $0x1,%ebp
mov    %r12,%rdi
mov    %r15,%rsi
call   10c0 <acertou@plt>
mov    %rax,%r13
mov    %r12,%rdi
mov    %r15,%rsi
mov    %ebp,%edx
call   1060 <dica@plt>
cmp    $0x1,%r13
sbb    $0xffffffff,%ebx
mov    %r12,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   10a0 <alteraTabuleiro@plt>
cmp    $0x3,%ebx
jne    11e0 <main+0x40>
lea    0xdd1(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe06(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%rdi
call   1090 <mostraTabuleiro@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"\0A\00"
@.str.1 = [69 x i8] c"\0A\0A\0AJogo terminado. Voce encontrou 3 lixos no oceano em %d tentativas\00"
@.str.2 = [85 x i8] c"\0A\0A\0AVoce tornou o oceano um pouco mais limpo, as tartarugas e baleias agradecem!!!\0A\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca [3 x [2 x i32]]
%4 = alloca [2 x i32]
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
store i32 0, i32* %6
%7 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%8 = bitcast [5 x i32]* %7 to i32**
%9 = call i32 @inicializaTabuleiro(i32** %8)
%10 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%11 = bitcast [2 x i32]* %10 to i32**
%12 = call i32 @iniciaLixos(i32** %11)
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %48, %0
%15 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%16 = bitcast [5 x i32]* %15 to i32**
%17 = call i32 @mostraTabuleiro(i32** %16)
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%19 = call i32 @Pescar(i32* %18)
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
%22 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%23 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%24 = bitcast [2 x i32]* %23 to i32**
%25 = call i64 @acertou(i32* %22, i32** %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %35
27: ; preds = %14
%28 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%29 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%30 = bitcast [2 x i32]* %29 to i32**
%31 = load i32, i32* %5
%32 = call i32 @dica(i32* %28, i32** %30, i32 %31)
%33 = load i32, i32* %6
%34 = add nsw i32 %33, 1
store i32 %34, i32* %6
br label %41
35: ; preds = %14
%36 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%37 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%38 = bitcast [2 x i32]* %37 to i32**
%39 = load i32, i32* %5
%40 = call i32 @dica(i32* %36, i32** %38, i32 %39)
br label %41
41: ; preds = %35, %27
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%43 = getelementptr inbounds [3 x [2 x i32]], [3 x [2 x i32]]* %3, i64 0, i64 0
%44 = bitcast [2 x i32]* %43 to i32**
%45 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%46 = bitcast [5 x i32]* %45 to i32**
%47 = call i32 @alteraTabuleiro(i32* %42, i32** %44, i32** %46)
br label %48
48: ; preds = %41
%49 = load i32, i32* %6
%50 = icmp ne i32 %49, 3
br i1 %50, label %14, label %51
51: ; preds = %48
%52 = load i32, i32* %5
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %52)
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([85 x i8], [85 x i8]* @.str.2, i64 0, i64 0))
%55 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 0
%56 = bitcast [5 x i32]* %55 to i32**
%57 = call i32 @mostraTabuleiro(i32** %56)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [69 x i8] c"\0A\0A\0AJogo terminado. Voce encontrou 3 lixos no oceano em %d tentativas\00"
@str = [84 x i8] c"\0A\0A\0AVoce tornou o oceano um pouco mais limpo, as tartarugas e baleias agradecem!!!\0A\0A\00"
define i32 @main() {
%1 = alloca [5 x [5 x i32]]
%2 = alloca [3 x [2 x i32]]
%3 = alloca [2 x i32]
%4 = bitcast [5 x [5 x i32]]* %1 to i8*
%5 = bitcast [3 x [2 x i32]]* %2 to i8*
%6 = bitcast [2 x i32]* %3 to i8*
%7 = bitcast [5 x [5 x i32]]* %1 to i32**
%8 = call i32 @inicializaTabuleiro(i32** %7)
%9 = bitcast [3 x [2 x i32]]* %2 to i32**
%10 = call i32 @iniciaLixos(i32** %9)
%11 = call i32 @putchar(i32 10)
%12 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
br label %13
13: ; preds = %13, %0
%14 = phi i32 [ 0, %0 ], [ %18, %13 ]
%15 = phi i32 [ 0, %0 ], [ %23, %13 ]
%16 = call i32 @mostraTabuleiro(i32** %7)
%17 = call i32 @Pescar(i32* %12)
%18 = add nuw nsw i32 %14, 1
%19 = call i64 @acertou(i32* %12, i32** %9)
%20 = icmp ne i64 %19, 0
%21 = call i32 @dica(i32* %12, i32** %9, i32 %18)
%22 = zext i1 %20 to i32
%23 = add nuw nsw i32 %15, %22
%24 = call i32 @alteraTabuleiro(i32* %12, i32** %9, i32** %7)
%25 = icmp eq i32 %23, 3
br i1 %25, label %26, label %13
26: ; preds = %13
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str.1, i64 0, i64 0), i32 %18)
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([84 x i8], [84 x i8]* @str, i64 0, i64 0))
%29 = call i32 @mostraTabuleiro(i32** %7)
ret i32 0
}