#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*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int batalha[5][5] = {{0, 0, 1, 1, 0},
                       {1, 0, 1, 0, 0},
                       {0, 1, 1, 0, 0},
                       {1, 0, 0, 1, 1},
                       {0, 1, 0, 1, 0}};
  int i, j;
  char jogador[30];
  int continuar = 1;
  int pontos = 0;
  printf("Informe seu nome:");
  scanf(" %s", jogador);
  while (continuar == 1) {
    printf("Digite a coordenada de linha:(0 a 4)");
    scanf("%d", &i);
    printf("Digite a coordenada de coluna:(0 a 4)");
    scanf("%d", &j);
    if (batalha[i][j] == 1) {
      printf("\nBomba!! Você ganhou um ponto\n");
      pontos++;
    } else if (batalha[i][j] == 0) {
      printf("\nÁgua!! Você não fez pontos :( \n");
    }
    printf("\n Olá %s, você fez %d pontos!\n", jogador, pontos);
    printf("Deseja continuar? (Sim = 1, Não = 0)\n");
    scanf("%d", &continuar);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xeb3(%rip),%rsi
mov    $0x64,%edx
call   1040 <memcpy@plt>
movl   $0x1,-0xa4(%rbp)
movl   $0x0,-0xa8(%rbp)
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xeef(%rip),%rdi
mov    $0x0,%al
call   1050 <scanf@plt>
cmpl   $0x1,-0xa4(%rbp)
jne    128d <main+0x15d>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xecf(%rip),%rdi
lea    -0x78(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    121a <main+0xea>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    124a <main+0x11a>
movslq -0x74(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0x78(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1245 <main+0x115>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    124a <main+0x11a>
lea    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%edx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe25(%rip),%rdi
lea    -0xa4(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
jmp    118e <main+0x5e>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
movl   $0x1,0x4(%rsp)
lea    0xf17(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf1b(%rip),%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xf31(%rip),%rbx
lea    0x8(%rsp),%rbp
lea    0xf4e(%rip),%r14
lea    0xf68(%rip),%r15
lea    0x4(%rsp),%r12
xor    %r13d,%r13d
jmp    11ca <main+0x9a>
nopl   0x0(%rax,%rax,1)
lea    0xf78(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jne    1244 <main+0x114>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    0xde9(%rip),%rdx
lea    (%rdx,%rax,4),%rax
mov    (%rax,%rcx,4),%eax
test   %eax,%eax
je     1190 <main+0x60>
cmp    $0x1,%eax
jne    119c <main+0x6c>
lea    0xefc(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%r13d
jmp    119c <main+0x6c>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.batalha = [5 x [5 x i32]] [[5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 0], [5 x i32] [i32 1, i32 0, i32 1, i32 0, i32 0], [5 x i32] [i32 0, i32 1, i32 1, i32 0, i32 0], [5 x i32] [i32 1, i32 0, i32 0, i32 1, i32 1], [5 x i32] [i32 0, i32 1, i32 0, i32 1, i32 0]]
@.str = [18 x i8] c"Informe seu nome:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [37 x i8] c"Digite a coordenada de linha:(0 a 4)\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [38 x i8] c"Digite a coordenada de coluna:(0 a 4)\00"
@.str.5 = [32 x i8] c"\0ABomba!! Voc\C3\AA ganhou um ponto\0A\00"
@.str.6 = [36 x i8] c"\0A\C3\81gua!! Voc\C3\AA n\C3\A3o fez pontos :( \0A\00"
@.str.7 = [33 x i8] c"\0A Ol\C3\A1 %s, voc\C3\AA fez %d pontos!\0A\00"
@.str.8 = [39 x i8] c"Deseja continuar? (Sim = 1, N\C3\A3o = 0)\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x [5 x i32]]
%3 = alloca i32
%4 = alloca i32
%5 = alloca [30 x i8]
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
%8 = bitcast [5 x [5 x i32]]* %2 to i8*
store i32 1, i32* %6
store i32 0, i32* %7
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %44, %0
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %50
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %3)
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%20 = load i32, i32* %3
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %21
%23 = load i32, i32* %4
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %24
%26 = load i32, i32* %25
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %32
28: ; preds = %15
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %44
32: ; preds = %15
%33 = load i32, i32* %3
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %34
%36 = load i32, i32* %4
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [5 x i32], [5 x i32]* %35, i64 0, i64 %37
%39 = load i32, i32* %38
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %32
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0))
br label %43
43: ; preds = %41, %32
br label %44
44: ; preds = %43, %28
%45 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%46 = load i32, i32* %7
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %45, i32 %46)
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
%49 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %6)
br label %12
50: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.batalha = [5 x [5 x i32]] [[5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 0], [5 x i32] [i32 1, i32 0, i32 1, i32 0, i32 0], [5 x i32] [i32 0, i32 1, i32 1, i32 0, i32 0], [5 x i32] [i32 1, i32 0, i32 0, i32 1, i32 1], [5 x i32] [i32 0, i32 1, i32 0, i32 1, i32 0]]
@.str = [18 x i8] c"Informe seu nome:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [37 x i8] c"Digite a coordenada de linha:(0 a 4)\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [38 x i8] c"Digite a coordenada de coluna:(0 a 4)\00"
@.str.7 = [33 x i8] c"\0A Ol\C3\A1 %s, voc\C3\AA fez %d pontos!\0A\00"
@str = [38 x i8] c"Deseja continuar? (Sim = 1, N\C3\A3o = 0)\00"
@str.9 = [35 x i8] c"\0A\C3\81gua!! Voc\C3\AA n\C3\A3o fez pontos :( \00"
@str.10 = [31 x i8] c"\0ABomba!! Voc\C3\AA ganhou um ponto\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [30 x i8]
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = getelementptr inbounds [30 x i8], [30 x i8]* %3, i64 0, i64 0
%8 = bitcast i32* %4 to i8*
store i32 1, i32* %4
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %7)
br label %11
11: ; preds = %0, %28
%12 = phi i32 [ %29, %28 ], [ 0, %0 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %1)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %1
%18 = sext i32 %17 to i64
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* @__const.main.batalha, i64 0, i64 %18, i64 %20
%22 = load i32, i32* %21
switch i32 %22, label %28 [
i32 1, label %23
i32 0, label %26
]
23: ; preds = %11
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%25 = add nsw i32 %12, 1
br label %28
26: ; preds = %11
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.9, i64 0, i64 0))
br label %28
28: ; preds = %11, %26, %23
%29 = phi i32 [ %25, %23 ], [ %12, %26 ], [ %12, %11 ]
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.7, i64 0, i64 0), i8* %7, i32 %29)
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %4)
%33 = load i32, i32* %4
%34 = icmp eq i32 %33, 1
br i1 %34, label %11, label %35
35: ; preds = %28
ret i32 0
}