#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 campo[5][5] = {{1, 1, 0, 0, 0},
                     {0, 0, 0, 0, 0},
                     {0, 1, 1, 1, 1},
                     {1, 0, 0, 0, 1},
                     {0, 0, 1, 1, 1}};
  int i, j;
  char nome[30];
  int saida = 1;
  int ponto = 0;
  printf("Informe seu nome:");
  scanf(" %s", nome);
  while (saida == 1) {
    printf("Informe as coordenadas do tiro (0 a 4 para linha e coluna.)\n "
           "Separe os valores de linha e coluna com um espaço.): ");
    scanf("%d %d", &i, &j);
    if (campo[i][j] == 1) {
      printf("\nBomba!! Você ganhou um ponto\n");
      ponto++;
    } else if (campo[i][j] == 0) {
      printf("\nAgua!! Você não pontuou :( \n");
    }
    printf("\n Olá %s, você fez %d pontos!\n", nome, ponto);
    printf("Deseja continuar? (Sim = 1, Não = 0)\n");
    scanf("%d", &saida);
  }
  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    1271 <main+0x141>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf3e(%rip),%rdi
lea    -0x74(%rbp),%rsi
lea    -0x78(%rbp),%rdx
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    11fe <main+0xce>
lea    0xf11(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xa8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa8(%rbp)
jmp    122e <main+0xfe>
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    1229 <main+0xf9>
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122e <main+0xfe>
lea    -0xa0(%rbp),%rsi
mov    -0xa8(%rbp),%edx
lea    0xef2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf05(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%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    0x8(%rsp),%rbx
lea    0xf81(%rip),%rbp
lea    0xf9b(%rip),%r14
lea    0xf70(%rip),%r15
lea    0x4(%rsp),%r12
xor    %r13d,%r13d
jmp    11ca <main+0x9a>
nopl   0x0(%rax,%rax,1)
lea    0xfa4(%rip),%rdi
call   1030 <puts@plt>
mov    %rbp,%rdi
lea    0x10(%rsp),%rsi
mov    %r13d,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpl   $0x1,0x4(%rsp)
jne    1228 <main+0xf8>
lea    0xea9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf0f(%rip),%rdi
lea    0xc(%rsp),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
movslq 0xc(%rsp),%rax
movslq 0x8(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    0xdfd(%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    0xf40(%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.campo = [5 x [5 x i32]] [[5 x i32] [i32 1, i32 1, i32 0, i32 0, i32 0], [5 x i32] zeroinitializer, [5 x i32] [i32 0, i32 1, i32 1, i32 1, i32 1], [5 x i32] [i32 1, i32 0, i32 0, i32 0, i32 1], [5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 1]]
@.str = [18 x i8] c"Informe seu nome:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [116 x i8] c"Informe as coordenadas do tiro (0 a 4 para linha e coluna.)\0A Separe os valores de linha e coluna com um espa\C3\A7o.): \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.4 = [32 x i8] c"\0ABomba!! Voc\C3\AA ganhou um ponto\0A\00"
@.str.5 = [32 x i8] c"\0AAgua!! Voc\C3\AA n\C3\A3o pontuou :( \0A\00"
@.str.6 = [33 x i8] c"\0A Ol\C3\A1 %s, voc\C3\AA fez %d pontos!\0A\00"
@.str.7 = [39 x i8] c"Deseja continuar? (Sim = 1, N\C3\A3o = 0)\0A\00"
@.str.8 = [3 x i8] c"%d\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 = %42, %0
%13 = load i32, i32* %6
%14 = icmp eq i32 %13, 1
br i1 %14, label %15, label %48
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([116 x i8], [116 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %3, i32* %4)
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %19
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [5 x i32], [5 x i32]* %20, i64 0, i64 %22
%24 = load i32, i32* %23
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %30
26: ; preds = %15
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%28 = load i32, i32* %7
%29 = add nsw i32 %28, 1
store i32 %29, i32* %7
br label %42
30: ; preds = %15
%31 = load i32, i32* %3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %2, i64 0, i64 %32
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %33, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %30
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.5, i64 0, i64 0))
br label %41
41: ; preds = %39, %30
br label %42
42: ; preds = %41, %26
%43 = getelementptr inbounds [30 x i8], [30 x i8]* %5, i64 0, i64 0
%44 = load i32, i32* %7
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %43, i32 %44)
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.7, i64 0, i64 0))
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %6)
br label %12
48: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.campo = [5 x [5 x i32]] [[5 x i32] [i32 1, i32 1, i32 0, i32 0, i32 0], [5 x i32] zeroinitializer, [5 x i32] [i32 0, i32 1, i32 1, i32 1, i32 1], [5 x i32] [i32 1, i32 0, i32 0, i32 0, i32 1], [5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 1]]
@.str = [18 x i8] c"Informe seu nome:\00"
@.str.1 = [4 x i8] c" %s\00"
@.str.2 = [116 x i8] c"Informe as coordenadas do tiro (0 a 4 para linha e coluna.)\0A Separe os valores de linha e coluna com um espa\C3\A7o.): \00"
@.str.3 = [6 x i8] c"%d %d\00"
@.str.6 = [33 x i8] c"\0A Ol\C3\A1 %s, voc\C3\AA fez %d pontos!\0A\00"
@.str.8 = [3 x i8] c"%d\00"
@str = [38 x i8] c"Deseja continuar? (Sim = 1, N\C3\A3o = 0)\00"
@str.9 = [31 x i8] c"\0AAgua!! Voc\C3\AA n\C3\A3o pontuou :( \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, %26
%12 = phi i32 [ %27, %26 ], [ 0, %0 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([116 x i8], [116 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* %1, i32* %2)
%15 = load i32, i32* %1
%16 = sext i32 %15 to i64
%17 = load i32, i32* %2
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* @__const.main.campo, i64 0, i64 %16, i64 %18
%20 = load i32, i32* %19
switch i32 %20, label %26 [
i32 1, label %21
i32 0, label %24
]
21: ; preds = %11
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.10, i64 0, i64 0))
%23 = add nsw i32 %12, 1
br label %26
24: ; preds = %11
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.9, i64 0, i64 0))
br label %26
26: ; preds = %11, %24, %21
%27 = phi i32 [ %23, %21 ], [ %12, %24 ], [ %12, %11 ]
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %7, i32 %27)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%30 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0), i32* %4)
%31 = load i32, i32* %4
%32 = icmp eq i32 %31, 1
br i1 %32, label %11, label %33
33: ; preds = %26
ret i32 0
}