#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 i, j, batalha[5][5], continuar;
  char nome[50];
  do {
    printf("Qual o seu nome\n");
    scanf("%s", nome);
    printf("\nDigite valor para os elementos da matriz\n\n");
    for (i = 0; i < 5; i++) {
      for (j = 0; j < 5; j++) {
        printf("\nElemento[%d][%d] = ", i + 1, j + 1);
        scanf("%d", &batalha[i][j]);
      }
    }
    for (i = 0; i < 5; i++) {
      for (j = 0; j < 5; j++) {
        printf(" %d ", batalha[i][j]);
      }
      printf("\n");
    }
    printf("Digite a linha e a coluna:\n");
    scanf("%d%d", &i, &j);
    if (batalha[i][j] == 1) {
      printf("BOMBA");
    } else if (batalha[i][j] == 0) {
      printf("ÁGUA");
    }
    printf("\n Deseja continuar? 1=Sim/2=Nao\n");
    scanf("%d", &continuar);
  } while (continuar == 1);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xb0(%rbp),%rsi
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    11e8 <main+0xc8>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11d5 <main+0xb5>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0xc(%rbp),%edx
add    $0x1,%edx
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x8(%rbp),%rax
lea    -0x70(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117b <main+0x5b>
jmp    11da <main+0xba>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x4a>
movl   $0x0,-0x8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1258 <main+0x138>
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    123c <main+0x11c>
movslq -0x8(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe2e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1200 <main+0xe0>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ef <main+0xcf>
lea    0xdfb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe09(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
movslq -0x8(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x1,(%rax,%rcx,4)
jne    12ac <main+0x18c>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <main+0x1bc>
movslq -0x8(%rbp),%rcx
lea    -0x70(%rbp),%rax
imul   $0x14,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    12d7 <main+0x1b7>
lea    0xdb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12dc <main+0x1bc>
lea    0xda4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd87(%rip),%rdi
lea    -0x74(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x1,-0x74(%rbp)
je     1132 <main+0x12>
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    $0xb8,%rsp
lea    0xeab(%rip),%rbx
lea    0xec0(%rip),%rbp
lea    0xeb2(%rip),%r14
lea    0xeb5(%rip),%r15
lea    0xf10(%rip),%r12
lea    0xc(%rsp),%r13
jmp    11a7 <main+0x67>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1050 <printf@plt>
mov    %r12,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
cmpl   $0x1,0xc(%rsp)
jne    134d <main+0x20d>
lea    0xe80(%rip),%rdi
call   1040 <puts@plt>
lea    0xe46(%rip),%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1060 <scanf@plt>
lea    0xe6e(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,0x8(%rsp)
xor    %esi,%esi
nop
movl   $0x0,0x4(%rsp)
xor    %edx,%edx
nopw   0x0(%rax,%rax,1)
add    $0x1,%esi
add    $0x1,%edx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq 0x8(%rsp),%rax
movslq 0x4(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,4),%rax
add    $0x10,%rax
lea    (%rax,%rcx,4),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1060 <scanf@plt>
mov    0x4(%rsp),%eax
lea    0x1(%rax),%edx
mov    %edx,0x4(%rsp)
mov    0x8(%rsp),%esi
cmp    $0x4,%eax
jl     11f0 <main+0xb0>
lea    0x1(%rsi),%eax
mov    %eax,0x8(%rsp)
cmp    $0x4,%esi
mov    %eax,%esi
jl     11e0 <main+0xa0>
movl   $0x0,0x8(%rsp)
xor    %eax,%eax
jmp    127a <main+0x13a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0x8(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x8(%rsp)
cmp    $0x4,%ecx
jge    12f0 <main+0x1b0>
movl   $0x0,0x4(%rsp)
cltq
lea    (%rax,%rax,4),%rax
mov    0x10(%rsp,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x4(%rsp)
cmp    $0x3,%ecx
jg     1260 <main+0x120>
cs nopw 0x0(%rax,%rax,1)
movslq 0x8(%rsp),%rcx
cltq
lea    (%rcx,%rcx,4),%rcx
lea    (%rsp,%rcx,4),%rcx
add    $0x10,%rcx
mov    (%rcx,%rax,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0x4(%rsp)
cmp    $0x4,%ecx
jl     12b0 <main+0x170>
jmp    1260 <main+0x120>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xd72(%rip),%rdi
call   1040 <puts@plt>
lea    0xd1a(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
xor    %eax,%eax
call   1060 <scanf@plt>
movslq 0x8(%rsp),%rax
movslq 0x4(%rsp),%rcx
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,4),%rax
add    $0x10,%rax
mov    (%rax,%rcx,4),%eax
mov    %r15,%rdi
cmp    $0x1,%eax
je     1180 <main+0x40>
test   %eax,%eax
jne    1187 <main+0x47>
lea    0xce0(%rip),%rdi
jmp    1180 <main+0x40>
xor    %eax,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Qual o seu nome\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [44 x i8] c"\0ADigite valor para os elementos da matriz\0A\0A\00"
@.str.3 = [21 x i8] c"\0AElemento[%d][%d] = \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c" %d \00"
@.str.6 = [2 x i8] c"\0A\00"
@.str.7 = [28 x i8] c"Digite a linha e a coluna:\0A\00"
@.str.8 = [5 x i8] c"%d%d\00"
@.str.9 = [6 x i8] c"BOMBA\00"
@.str.10 = [6 x i8] c"\C3\81GUA\00"
@.str.11 = [33 x i8] c"\0A Deseja continuar? 1=Sim/2=Nao\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [5 x [5 x i32]]
%5 = alloca i32
%6 = alloca [50 x i8]
store i32 0, i32* %1
br label %7
7: ; preds = %92, %0
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [50 x i8], [50 x i8]* %6, i64 0, i64 0
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %12
12: ; preds = %36, %7
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 5
br i1 %14, label %15, label %39
15: ; preds = %12
store i32 0, i32* %3
br label %16
16: ; preds = %32, %15
%17 = load i32, i32* %3
%18 = icmp slt i32 %17, 5
br i1 %18, label %19, label %35
19: ; preds = %16
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %23)
%25 = load i32, i32* %2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 %26
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [5 x i32], [5 x i32]* %27, i64 0, i64 %29
%31 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %30)
br label %32
32: ; preds = %19
%33 = load i32, i32* %3
%34 = add nsw i32 %33, 1
store i32 %34, i32* %3
br label %16
35: ; preds = %16
br label %36
36: ; preds = %35
%37 = load i32, i32* %2
%38 = add nsw i32 %37, 1
store i32 %38, i32* %2
br label %12
39: ; preds = %12
store i32 0, i32* %2
br label %40
40: ; preds = %61, %39
%41 = load i32, i32* %2
%42 = icmp slt i32 %41, 5
br i1 %42, label %43, label %64
43: ; preds = %40
store i32 0, i32* %3
br label %44
44: ; preds = %56, %43
%45 = load i32, i32* %3
%46 = icmp slt i32 %45, 5
br i1 %46, label %47, label %59
47: ; preds = %44
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 %49
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [5 x i32], [5 x i32]* %50, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %54)
br label %56
56: ; preds = %47
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %44
59: ; preds = %44
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %61
61: ; preds = %59
%62 = load i32, i32* %2
%63 = add nsw i32 %62, 1
store i32 %63, i32* %2
br label %40
64: ; preds = %40
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0))
%66 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32* %2, i32* %3)
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 %68
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [5 x i32], [5 x i32]* %69, i64 0, i64 %71
%73 = load i32, i32* %72
%74 = icmp eq i32 %73, 1
br i1 %74, label %75, label %77
75: ; preds = %64
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
br label %89
77: ; preds = %64
%78 = load i32, i32* %2
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %4, i64 0, i64 %79
%81 = load i32, i32* %3
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [5 x i32], [5 x i32]* %80, i64 0, i64 %82
%84 = load i32, i32* %83
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %88
86: ; preds = %77
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
br label %88
88: ; preds = %86, %77
br label %89
89: ; preds = %88, %75
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.11, i64 0, i64 0))
%91 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %5)
br label %92
92: ; preds = %89
%93 = load i32, i32* %5
%94 = icmp eq i32 %93, 1
br i1 %94, label %7, label %95
95: ; preds = %92
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@.str.3 = [21 x i8] c"\0AElemento[%d][%d] = \00"
@.str.4 = [3 x i8] c"%d\00"
@.str.5 = [5 x i8] c" %d \00"
@.str.8 = [5 x i8] c"%d%d\00"
@.str.9 = [6 x i8] c"BOMBA\00"
@.str.10 = [6 x i8] c"\C3\81GUA\00"
@str = [16 x i8] c"Qual o seu nome\00"
@str.12 = [43 x i8] c"\0ADigite valor para os elementos da matriz\0A\00"
@str.13 = [27 x i8] c"Digite a linha e a coluna:\00"
@str.14 = [32 x i8] c"\0A Deseja continuar? 1=Sim/2=Nao\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [5 x [5 x i32]]
%4 = alloca i32
%5 = alloca [50 x i8]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = bitcast [5 x [5 x i32]]* %3 to i8*
%9 = bitcast i32* %4 to i8*
%10 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
br label %11
11: ; preds = %75, %0
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str.12, i64 0, i64 0))
store i32 0, i32* %1
br label %16
15: ; preds = %34
store i32 0, i32* %1
br label %37
16: ; preds = %11, %34
%17 = phi i32 [ 0, %11 ], [ %35, %34 ]
store i32 0, i32* %2
br label %18
18: ; preds = %18, %16
%19 = phi i32 [ %17, %16 ], [ %33, %18 ]
%20 = phi i32 [ 0, %16 ], [ %31, %18 ]
%21 = add nsw i32 %19, 1
%22 = add nsw i32 %20, 1
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %21, i32 %22)
%24 = load i32, i32* %1
%25 = sext i32 %24 to i64
%26 = load i32, i32* %2
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 %25, i64 %27
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %28)
%30 = load i32, i32* %2
%31 = add nsw i32 %30, 1
store i32 %31, i32* %2
%32 = icmp slt i32 %30, 4
%33 = load i32, i32* %1
br i1 %32, label %18, label %34
34: ; preds = %18
%35 = add nsw i32 %33, 1
store i32 %35, i32* %1
%36 = icmp slt i32 %33, 4
br i1 %36, label %16, label %15
37: ; preds = %15, %57
%38 = phi i32 [ 0, %15 ], [ %60, %57 ]
store i32 0, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 %39, i64 0
%41 = load i32, i32* %40
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %41)
%43 = load i32, i32* %2
%44 = add nsw i32 %43, 1
store i32 %44, i32* %2
%45 = icmp slt i32 %43, 4
br i1 %45, label %46, label %57
46: ; preds = %37, %46
%47 = phi i32 [ %55, %46 ], [ %44, %37 ]
%48 = load i32, i32* %1
%49 = sext i32 %48 to i64
%50 = sext i32 %47 to i64
%51 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 %49, i64 %50
%52 = load i32, i32* %51
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i32 %52)
%54 = load i32, i32* %2
%55 = add nsw i32 %54, 1
store i32 %55, i32* %2
%56 = icmp slt i32 %54, 4
br i1 %56, label %46, label %57
57: ; preds = %46, %37
%58 = call i32 @putchar(i32 10)
%59 = load i32, i32* %1
%60 = add nsw i32 %59, 1
store i32 %60, i32* %1
%61 = icmp slt i32 %59, 4
br i1 %61, label %37, label %62
62: ; preds = %57
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.13, i64 0, i64 0))
%64 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i32* %1, i32* %2)
%65 = load i32, i32* %1
%66 = sext i32 %65 to i64
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [5 x [5 x i32]], [5 x [5 x i32]]* %3, i64 0, i64 %66, i64 %68
%70 = load i32, i32* %69
switch i32 %70, label %75 [
i32 1, label %72
i32 0, label %71
]
71: ; preds = %62
br label %72
72: ; preds = %62, %71
%73 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0), %71 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), %62 ]
%74 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %73)
br label %75
75: ; preds = %72, %62
%76 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.14, i64 0, i64 0))
%77 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i32* %4)
%78 = load i32, i32* %4
%79 = icmp eq i32 %78, 1
br i1 %79, label %11, label %80
80: ; preds = %75
ret i32 0
}