#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*/ calcular_puntos(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int jugar(int mida, char taulell[11][11], int freq[5]) {
  int i, j, k, pos_x, pos_y, tipus_bomba, sup_x, sup_y, inf_x, inf_y,
      cont_enf = 0, cont_sim = 0, cont_exp = 0, cont_toc = 0, num_tocats = 0,
      fi = 0;
  char taulell_jugador[mida][mida];
  system("cls");
  for (i = 0; i < mida; i++) {
    for (j = 0; j < mida; j++) {
      taulell_jugador[i][j] = '#';
    }
  }
  for (k = 0; k < 5; k++) {
    num_tocats = num_tocats + (freq[k] * k);
  }
  while (cont_toc < num_tocats) {
    printf("\nIndica les coordenades on vols posicionar la bomba.\n");
    scanf("%d", &pos_x);
    scanf("%d", &pos_y);
    while (pos_x > mida - 1 || pos_y > mida - 1) {
      printf("\nTorna a introduir uns valors valids.\n");
      scanf("%d", &pos_x);
      scanf("%d", &pos_y);
    }
    while (taulell_jugador[pos_x][pos_y] == 'T' ||
           taulell_jugador[pos_x][pos_y] == 'A' ||
           taulell_jugador[pos_x][pos_y] == 'E') {
      printf("\nPosicio ja ocupada. Torna a introduir uns valors valids.\n");
      scanf("%d", &pos_x);
      scanf("%d", &pos_y);
    }
    printf("\nIndica quin tipus de bomba vols utilitzar. (0 per a bomba simple "
           "i 1 per a bomba expansiva)\n");
    scanf("%d", &tipus_bomba);
    while (tipus_bomba != 0 && tipus_bomba != 1) {
      printf("\nIntrodueix 0 per a la bomba simple o 1 per a la bomba "
             "expansiva. \n");
      scanf("%d", &tipus_bomba);
    }
    if (tipus_bomba == 0) {
      cont_sim++;
      if (taulell[pos_x][pos_y] == 'v') {
        taulell_jugador[pos_x][pos_y] = 'T';
        cont_toc++;
      } else {
        taulell_jugador[pos_x][pos_y] = 'A';
      }
    }
    sup_x = pos_x - 1;
    sup_y = pos_y - 1;
    inf_x = pos_x + 1;
    inf_y = pos_y + 1;
    if (tipus_bomba == 1) {
      if (cont_exp < 2) {
        if ((sup_x >= 0 && sup_y >= 0) && (inf_x < mida && inf_y < mida)) {
          for (i = pos_x - 1; i <= pos_x + 1; i++) {
            for (j = pos_y - 1; j <= pos_y + 1; j++) {
              if ((i >= 0 && i < mida) && (j >= 0 && j < mida)) {
                if (taulell[i][j] == 'v') {
                  taulell_jugador[i][j] = 'T';
                  cont_toc++;
                } else {
                  taulell_jugador[i][j] = 'A';
                }
              }
            }
          }
          cont_exp++;
        } else {
          printf("\nError la bomba surt dels limits.\n");
        }
      } else {
        printf("\nS'han esgotat les bombes expansives.\n");
      }
    }
    printf("\n\t");
    for (i = 0; i < mida; i++) {
      for (j = 0; j < mida; j++) {
        printf("%c ", taulell_jugador[i][j]);
      }
      printf("\n\t");
    }
    printf("\nHas tocat %d .", cont_toc);
    printf("\nHas enfonsat %d vaixells.\n", cont_enf);
  }
  calcular_puntos(cont_sim, cont_exp);
  fi = 1;
  return fi;
}


x86 assembly (clang, -O0):
<jugar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    %rcx,%rax
mov    %rax,-0x80(%rbp)
mov    %rsp,%rdx
mov    %rdx,-0x60(%rbp)
mov    %rcx,%rsi
imul   %rsi,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,-0x78(%rbp)
mov    %rdx,%rsp
mov    %rcx,-0x68(%rbp)
mov    %rax,-0x70(%rbp)
lea    0xe42(%rip),%rdi
call   1030 <system@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1225 <jugar+0xe5>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1212 <jugar+0xd2>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movb   $0x23,(%rax,%rcx,1)
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dd <jugar+0x9d>
jmp    1217 <jugar+0xd7>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11ca <jugar+0x8a>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    125b <jugar+0x11b>
mov    -0x54(%rbp),%eax
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rdx
mov    (%rcx,%rdx,4),%ecx
imul   -0x24(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x54(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    122c <jugar+0xec>
jmp    1260 <jugar+0x120>
mov    -0x50(%rbp),%eax
cmp    -0x54(%rbp),%eax
jge    16fb <jugar+0x5bb>
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xdb9(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xda9(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x28(%rbp),%ecx
mov    -0x4(%rbp),%edx
sub    $0x1,%edx
mov    $0x1,%al
cmp    %edx,%ecx
mov    %al,-0x81(%rbp)
jg     12c7 <jugar+0x187>
mov    -0x2c(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
setg   %al
mov    %al,-0x81(%rbp)
mov    -0x81(%rbp),%al
test   $0x1,%al
jne    12da <jugar+0x19a>
jmp    130d <jugar+0x1cd>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd4b(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xd3b(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
jmp    129a <jugar+0x15a>
jmp    1312 <jugar+0x1d2>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x28(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x54,%ecx
mov    %al,-0x82(%rbp)
je     1391 <jugar+0x251>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x28(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
mov    $0x1,%al
cmp    $0x41,%ecx
mov    %al,-0x82(%rbp)
je     1391 <jugar+0x251>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x28(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x45,%eax
sete   %al
mov    %al,-0x82(%rbp)
mov    -0x82(%rbp),%al
test   $0x1,%al
jne    13a4 <jugar+0x264>
jmp    13d7 <jugar+0x297>
lea    0xcb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc81(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1060 <scanf@plt>
lea    0xc71(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1060 <scanf@plt>
jmp    1312 <jugar+0x1d2>
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc4e(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x30(%rbp)
mov    %al,-0x83(%rbp)
je     1414 <jugar+0x2d4>
cmpl   $0x1,-0x30(%rbp)
setne  %al
mov    %al,-0x83(%rbp)
mov    -0x83(%rbp),%al
test   $0x1,%al
jne    1427 <jugar+0x2e7>
jmp    144a <jugar+0x30a>
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xbfe(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1060 <scanf@plt>
jmp    13f5 <jugar+0x2b5>
cmpl   $0x0,-0x30(%rbp)
jne    14c6 <jugar+0x386>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x28(%rbp),%rcx
imul   $0xb,%rcx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x76,%eax
jne    14a6 <jugar+0x366>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x28(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    14c1 <jugar+0x381>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x28(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x2c(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    14c6 <jugar+0x386>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
cmpl   $0x1,-0x30(%rbp)
jne    164d <jugar+0x50d>
cmpl   $0x2,-0x4c(%rbp)
jge    163a <jugar+0x4fa>
cmpl   $0x0,-0x34(%rbp)
jl     1627 <jugar+0x4e7>
cmpl   $0x0,-0x38(%rbp)
jl     1627 <jugar+0x4e7>
mov    -0x3c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1627 <jugar+0x4e7>
mov    -0x40(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1627 <jugar+0x4e7>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x28(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1619 <jugar+0x4d9>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jg     1606 <jugar+0x4c6>
cmpl   $0x0,-0x1c(%rbp)
jl     15f3 <jugar+0x4b3>
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    15f3 <jugar+0x4b3>
cmpl   $0x0,-0x20(%rbp)
jl     15f3 <jugar+0x4b3>
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    15f3 <jugar+0x4b3>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
imul   $0xb,%rcx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x76,%eax
jne    15d3 <jugar+0x493>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movb   $0x54,(%rax,%rcx,1)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    15ee <jugar+0x4ae>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movb   $0x41,(%rax,%rcx,1)
jmp    15f3 <jugar+0x4b3>
jmp    15f8 <jugar+0x4b8>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    154d <jugar+0x40d>
jmp    160b <jugar+0x4cb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1533 <jugar+0x3f3>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1635 <jugar+0x4f5>
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1648 <jugar+0x508>
lea    0xb23(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    164d <jugar+0x50d>
lea    0xb37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    16d4 <jugar+0x594>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    16b8 <jugar+0x578>
mov    -0x78(%rbp),%rax
mov    -0x80(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
imul   %rdx,%rcx
add    %rcx,%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xaeb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1675 <jugar+0x535>
lea    0xacc(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1662 <jugar+0x522>
mov    -0x50(%rbp),%esi
lea    0xab4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x44(%rbp),%esi
lea    0xab3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1260 <jugar+0x120>
mov    -0x48(%rbp),%edi
mov    -0x4c(%rbp),%esi
call   1050 <calcular_puntos@plt>
movl   $0x1,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    -0x60(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jugar>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
mov    %rdx,-0x58(%rbp)
mov    %rsi,-0x48(%rbp)
mov    %edi,%r14d
mov    %rsp,-0x78(%rbp)
mov    %edi,%r15d
mov    %r15,%rax
imul   %r15,%rax
mov    %rsp,%r12
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0xe5e(%rip),%rdi
call   1040 <system@plt>
test   %r14d,%r14d
mov    %r12,-0x70(%rbp)
jle    12c9 <jugar+0x169>
lea    -0x1(%r15),%rax
mov    %r15d,%ecx
and    $0x7,%ecx
mov    %rcx,-0x50(%rbp)
cmp    $0x7,%rax
jae    11cf <jugar+0x6f>
xor    %ebx,%ebx
jmp    1298 <jugar+0x138>
mov    %r15d,%eax
and    $0xfffffff8,%eax
mov    %rax,-0x38(%rbp)
lea    0x0(,%r15,8),%rax
mov    %rax,-0x68(%rbp)
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
lea    (%r12,%r15,1),%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%r13
mov    %r13,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    $0x8,%rbx
add    -0x68(%rbp),%r12
cmp    %rbx,-0x38(%rbp)
jne    11f0 <jugar+0x90>
mov    -0x50(%rbp),%r13
test   %r13,%r13
mov    -0x70(%rbp),%r12
je     12c9 <jugar+0x169>
imul   %r15,%rbx
add    %r12,%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x23,%esi
mov    %r15,%rdx
call   1070 <memset@plt>
add    %r15,%rbx
add    $0xffffffffffffffff,%r13
jne    12b0 <jugar+0x150>
mov    -0x58(%rbp),%rdx
mov    0x8(%rdx),%eax
mov    0xc(%rdx),%ecx
add    %eax,%eax
add    0x4(%rdx),%eax
lea    (%rcx,%rcx,2),%ecx
add    %eax,%ecx
mov    0x10(%rdx),%eax
shl    $0x2,%eax
add    %ecx,%eax
mov    %eax,-0x68(%rbp)
jle    1754 <jugar+0x5f4>
lea    0xd0f(%rip),%rbx
lea    -0x3c(%rbp),%r13
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x58(%rbp)
movl   $0x0,-0x50(%rbp)
mov    %r14d,-0x5c(%rbp)
jmp    135f <jugar+0x1ff>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xce7(%rip),%rdi
mov    -0x38(%rbp),%ebx
mov    %ebx,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xce4(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    -0x68(%rbp),%ebx
mov    -0x5c(%rbp),%r14d
mov    -0x70(%rbp),%r12
lea    0xcaf(%rip),%rbx
lea    -0x3c(%rbp),%r13
jge    1762 <jugar+0x602>
lea    0xcd4(%rip),%rdi
jmp    1377 <jugar+0x217>
nopl   0x0(%rax,%rax,1)
lea    0xe1a(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
lea    -0x2c(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x3c(%rbp),%eax
cmp    %r14d,%eax
jge    1370 <jugar+0x210>
mov    -0x2c(%rbp),%ecx
cmp    %r14d,%ecx
jge    1370 <jugar+0x210>
jmp    13d9 <jugar+0x279>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xda0(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    %rbx,%rdi
lea    -0x2c(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x3c(%rbp),%eax
mov    -0x2c(%rbp),%ecx
cltq
imul   %r15,%rax
add    %r12,%rax
movslq %ecx,%rcx
movzbl (%rcx,%rax,1),%eax
add    $0xbf,%al
cmp    $0x13,%al
ja     13fd <jugar+0x29d>
movzbl %al,%eax
mov    $0x80011,%ecx
bt     %rax,%rcx
jb     13b0 <jugar+0x250>
lea    0xc6b(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
lea    -0x60(%rbp),%r13
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    -0x60(%rbp),%eax
cmp    $0x2,%eax
lea    0xcef(%rip),%r14
jb     144b <jugar+0x2eb>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1080 <scanf@plt>
mov    -0x60(%rbp),%eax
cmp    $0x1,%eax
ja     1430 <jugar+0x2d0>
test   %eax,%eax
mov    -0x5c(%rbp),%r14d
je     14f0 <jugar+0x390>
cmpl   $0x1,-0x58(%rbp)
jg     1530 <jugar+0x3d0>
mov    -0x3c(%rbp),%eax
test   %eax,%eax
jle    153f <jugar+0x3df>
mov    -0x2c(%rbp),%r9d
test   %r9d,%r9d
jle    153f <jugar+0x3df>
lea    0x1(%rax),%edx
cmp    %r14d,%edx
jge    153f <jugar+0x3df>
lea    0x1(%r9),%esi
cmp    %r14d,%esi
jge    153f <jugar+0x3df>
lea    -0x1(%r9),%r8d
lea    -0x1(%rax),%edx
mov    %rdx,%rdi
imul   %r15,%rdi
add    %r12,%rdi
cmp    %r14d,%eax
lea    0xb5a(%rip),%rbx
jg     14d4 <jugar+0x374>
cmp    %r14d,%r9d
jg     14d4 <jugar+0x374>
lea    (%rdx,%rdx,4),%rcx
lea    (%rdx,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r8,%rcx,1)
jne    15b7 <jugar+0x457>
movb   $0x54,(%rdi,%r8,1)
addl   $0x1,-0x38(%rbp)
cmp    %r14d,%eax
jle    15c1 <jugar+0x461>
jmp    15e4 <jugar+0x484>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    -0x50(%rbp),%esi
add    $0x1,%esi
movslq -0x3c(%rbp),%rax
movslq -0x2c(%rbp),%rcx
lea    (%rax,%rax,4),%rdx
lea    (%rax,%rdx,2),%rdx
add    -0x48(%rbp),%rdx
imul   %r15,%rax
add    %r12,%rax
cmpb   $0x76,(%rcx,%rdx,1)
mov    %esi,-0x50(%rbp)
jne    1539 <jugar+0x3d9>
movb   $0x54,(%rax,%rcx,1)
addl   $0x1,-0x38(%rbp)
jmp    154b <jugar+0x3eb>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xb95(%rip),%rdi
jmp    1546 <jugar+0x3e6>
movb   $0x41,(%rax,%rcx,1)
jmp    154b <jugar+0x3eb>
lea    0xbac(%rip),%rdi
call   1030 <puts@plt>
lea    0xab5(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14d,%r14d
jle    1320 <jugar+0x1c0>
mov    -0x70(%rbp),%r12
xor    %r14d,%r14d
nopl   0x0(%rax)
xor    %r13d,%r13d
lea    0xa90(%rip),%rbx
nopw   0x0(%rax,%rax,1)
movsbl (%r12,%r13,1),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r13
cmp    %r13,%r15
jne    1580 <jugar+0x420>
lea    0xa68(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%r14
add    %r15,%r12
cmp    %r15,%r14
jne    1570 <jugar+0x410>
jmp    1320 <jugar+0x1c0>
movb   $0x41,(%rdi,%r8,1)
cmp    %r14d,%eax
jg     15e4 <jugar+0x484>
lea    (%rdx,%rdx,4),%rcx
lea    (%rdx,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r9,%rcx,1)
jne    15df <jugar+0x47f>
movb   $0x54,(%rdi,%r9,1)
addl   $0x1,-0x38(%rbp)
jmp    15e4 <jugar+0x484>
movb   $0x41,(%rdi,%r9,1)
mov    %esi,%esi
cmp    %r14d,%eax
jg     1605 <jugar+0x4a5>
lea    (%rdx,%rdx,4),%rcx
lea    (%rdx,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%rsi,%rcx,1)
jne    1644 <jugar+0x4e4>
movb   $0x54,(%rdi,%rsi,1)
addl   $0x1,-0x38(%rbp)
test   %eax,%eax
js     169f <jugar+0x53f>
mov    %rax,%rdi
imul   %r15,%rdi
add    %r12,%rdi
cmp    %r14d,%eax
jge    163d <jugar+0x4dd>
cmp    %r14d,%r9d
jg     163d <jugar+0x4dd>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r8,%rcx,1)
jne    164e <jugar+0x4ee>
movb   $0x54,(%rdi,%r8,1)
addl   $0x1,-0x38(%rbp)
cmp    %r14d,%eax
jl     1658 <jugar+0x4f8>
jmp    1674 <jugar+0x514>
movb   $0x41,(%rdi,%rsi,1)
test   %eax,%eax
jns    160d <jugar+0x4ad>
jmp    169f <jugar+0x53f>
movb   $0x41,(%rdi,%r8,1)
cmp    %r14d,%eax
jge    1674 <jugar+0x514>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r9,%rcx,1)
jne    167b <jugar+0x51b>
movb   $0x54,(%rdi,%r9,1)
addl   $0x1,-0x38(%rbp)
cmp    %r14d,%eax
jl     1685 <jugar+0x525>
jmp    169f <jugar+0x53f>
movb   $0x41,(%rdi,%r9,1)
cmp    %r14d,%eax
jge    169f <jugar+0x53f>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%rsi,%rcx,1)
jne    16e2 <jugar+0x582>
movb   $0x54,(%rdi,%rsi,1)
addl   $0x1,-0x38(%rbp)
cmp    $0xffffffff,%eax
jl     173e <jugar+0x5de>
add    $0x1,%eax
mov    %rax,%rdi
imul   %r15,%rdi
add    %r12,%rdi
cmp    %r14d,%eax
jge    16db <jugar+0x57b>
cmp    %r14d,%r9d
jg     16db <jugar+0x57b>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r8,%rcx,1)
jne    16ed <jugar+0x58d>
movb   $0x54,(%rdi,%r8,1)
addl   $0x1,-0x38(%rbp)
cmp    %r14d,%eax
jl     16f7 <jugar+0x597>
jmp    1713 <jugar+0x5b3>
movb   $0x41,(%rdi,%rsi,1)
cmp    $0xffffffff,%eax
jge    16a8 <jugar+0x548>
jmp    173e <jugar+0x5de>
movb   $0x41,(%rdi,%r8,1)
cmp    %r14d,%eax
jge    1713 <jugar+0x5b3>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rcx
add    -0x48(%rbp),%rcx
cmpb   $0x76,(%r9,%rcx,1)
jne    171a <jugar+0x5ba>
movb   $0x54,(%rdi,%r9,1)
addl   $0x1,-0x38(%rbp)
cmp    %r14d,%eax
jl     1724 <jugar+0x5c4>
jmp    173e <jugar+0x5de>
movb   $0x41,(%rdi,%r9,1)
cmp    %r14d,%eax
jge    173e <jugar+0x5de>
lea    (%rax,%rax,4),%rcx
lea    (%rax,%rcx,2),%rax
add    -0x48(%rbp),%rax
cmpb   $0x76,(%rsi,%rax,1)
jne    1747 <jugar+0x5e7>
movb   $0x54,(%rdi,%rsi,1)
addl   $0x1,-0x38(%rbp)
addl   $0x1,-0x58(%rbp)
jmp    1552 <jugar+0x3f2>
movb   $0x41,(%rdi,%rsi,1)
addl   $0x1,-0x58(%rbp)
jmp    1552 <jugar+0x3f2>
movl   $0x0,-0x50(%rbp)
movl   $0x0,-0x58(%rbp)
mov    -0x50(%rbp),%edi
mov    -0x58(%rbp),%esi
call   1060 <calcular_puntos@plt>
mov    -0x78(%rbp),%rsp
mov    $0x1,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"cls\00"
@.str.1 = [54 x i8] c"\0AIndica les coordenades on vols posicionar la bomba.\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [39 x i8] c"\0ATorna a introduir uns valors valids.\0A\00"
@.str.4 = [59 x i8] c"\0APosicio ja ocupada. Torna a introduir uns valors valids.\0A\00"
@.str.5 = [94 x i8] c"\0AIndica quin tipus de bomba vols utilitzar. (0 per a bomba simple i 1 per a bomba expansiva)\0A\00"
@.str.6 = [68 x i8] c"\0AIntrodueix 0 per a la bomba simple o 1 per a la bomba expansiva. \0A\00"
@.str.7 = [35 x i8] c"\0AError la bomba surt dels limits.\0A\00"
@.str.8 = [39 x i8] c"\0AS'han esgotat les bombes expansives.\0A\00"
@.str.9 = [3 x i8] c"\0A\09\00"
@.str.10 = [4 x i8] c"%c \00"
@.str.11 = [16 x i8] c"\0AHas tocat %d .\00"
@.str.12 = [28 x i8] c"\0AHas enfonsat %d vaixells.\0A\00"
define i32 @jugar(i32 %0, [11 x i8]* %1, i32* %2) {
%4 = alloca i32
%5 = alloca [11 x i8]*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i8*
%24 = alloca i64
%25 = alloca i64
store i32 %0, i32* %4
store [11 x i8]* %1, [11 x i8]** %5
store i32* %2, i32** %6
store i32 0, i32* %17
store i32 0, i32* %18
store i32 0, i32* %19
store i32 0, i32* %20
store i32 0, i32* %21
store i32 0, i32* %22
%26 = load i32, i32* %4
%27 = zext i32 %26 to i64
%28 = load i32, i32* %4
%29 = zext i32 %28 to i64
%30 = call i8* @llvm.stacksave()
store i8* %30, i8** %23
%31 = mul nuw i64 %27, %29
%32 = alloca i8, i64 %31
store i64 %27, i64* %24
store i64 %29, i64* %25
%33 = call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %7
br label %34
34: ; preds = %55, %3
%35 = load i32, i32* %7
%36 = load i32, i32* %4
%37 = icmp slt i32 %35, %36
br i1 %37, label %38, label %58
38: ; preds = %34
store i32 0, i32* %8
br label %39
39: ; preds = %51, %38
%40 = load i32, i32* %8
%41 = load i32, i32* %4
%42 = icmp slt i32 %40, %41
br i1 %42, label %43, label %54
43: ; preds = %39
%44 = load i32, i32* %7
%45 = sext i32 %44 to i64
%46 = mul nsw i64 %45, %29
%47 = getelementptr inbounds i8, i8* %32, i64 %46
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds i8, i8* %47, i64 %49
store i8 35, i8* %50
br label %51
51: ; preds = %43
%52 = load i32, i32* %8
%53 = add nsw i32 %52, 1
store i32 %53, i32* %8
br label %39
54: ; preds = %39
br label %55
55: ; preds = %54
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %34
58: ; preds = %34
store i32 0, i32* %9
br label %59
59: ; preds = %72, %58
%60 = load i32, i32* %9
%61 = icmp slt i32 %60, 5
br i1 %61, label %62, label %75
62: ; preds = %59
%63 = load i32, i32* %21
%64 = load i32*, i32** %6
%65 = load i32, i32* %9
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i32, i32* %64, i64 %66
%68 = load i32, i32* %67
%69 = load i32, i32* %9
%70 = mul nsw i32 %68, %69
%71 = add nsw i32 %63, %70
store i32 %71, i32* %21
br label %72
72: ; preds = %62
%73 = load i32, i32* %9
%74 = add nsw i32 %73, 1
store i32 %74, i32* %9
br label %59
75: ; preds = %59
br label %76
76: ; preds = %324, %75
%77 = load i32, i32* %20
%78 = load i32, i32* %21
%79 = icmp slt i32 %77, %78
br i1 %79, label %80, label %329
80: ; preds = %76
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%82 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%83 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
br label %84
84: ; preds = %96, %80
%85 = load i32, i32* %10
%86 = load i32, i32* %4
%87 = sub nsw i32 %86, 1
%88 = icmp sgt i32 %85, %87
br i1 %88, label %94, label %89
89: ; preds = %84
%90 = load i32, i32* %11
%91 = load i32, i32* %4
%92 = sub nsw i32 %91, 1
%93 = icmp sgt i32 %90, %92
br label %94
94: ; preds = %89, %84
%95 = phi i1 [ true, %84 ], [ %93, %89 ]
br i1 %95, label %96, label %100
96: ; preds = %94
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
%98 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%99 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
br label %84
100: ; preds = %94
br label %101
101: ; preds = %136, %100
%102 = load i32, i32* %10
%103 = sext i32 %102 to i64
%104 = mul nsw i64 %103, %29
%105 = getelementptr inbounds i8, i8* %32, i64 %104
%106 = load i32, i32* %11
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8, i8* %105, i64 %107
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp eq i32 %110, 84
br i1 %111, label %134, label %112
112: ; preds = %101
%113 = load i32, i32* %10
%114 = sext i32 %113 to i64
%115 = mul nsw i64 %114, %29
%116 = getelementptr inbounds i8, i8* %32, i64 %115
%117 = load i32, i32* %11
%118 = sext i32 %117 to i64
%119 = getelementptr inbounds i8, i8* %116, i64 %118
%120 = load i8, i8* %119
%121 = sext i8 %120 to i32
%122 = icmp eq i32 %121, 65
br i1 %122, label %134, label %123
123: ; preds = %112
%124 = load i32, i32* %10
%125 = sext i32 %124 to i64
%126 = mul nsw i64 %125, %29
%127 = getelementptr inbounds i8, i8* %32, i64 %126
%128 = load i32, i32* %11
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds i8, i8* %127, i64 %129
%131 = load i8, i8* %130
%132 = sext i8 %131 to i32
%133 = icmp eq i32 %132, 69
br label %134
134: ; preds = %123, %112, %101
%135 = phi i1 [ true, %112 ], [ true, %101 ], [ %133, %123 ]
br i1 %135, label %136, label %140
136: ; preds = %134
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.4, i64 0, i64 0))
%138 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %10)
%139 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %11)
br label %101
140: ; preds = %134
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.5, i64 0, i64 0))
%142 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %12)
br label %143
143: ; preds = %151, %140
%144 = load i32, i32* %12
%145 = icmp ne i32 %144, 0
br i1 %145, label %146, label %149
146: ; preds = %143
%147 = load i32, i32* %12
%148 = icmp ne i32 %147, 1
br label %149
149: ; preds = %146, %143
%150 = phi i1 [ false, %143 ], [ %148, %146 ]
br i1 %150, label %151, label %154
151: ; preds = %149
%152 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.6, i64 0, i64 0))
%153 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %12)
br label %143
154: ; preds = %149
%155 = load i32, i32* %12
%156 = icmp eq i32 %155, 0
br i1 %156, label %157, label %189
157: ; preds = %154
%158 = load i32, i32* %18
%159 = add nsw i32 %158, 1
store i32 %159, i32* %18
%160 = load [11 x i8]*, [11 x i8]** %5
%161 = load i32, i32* %10
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [11 x i8], [11 x i8]* %160, i64 %162
%164 = load i32, i32* %11
%165 = sext i32 %164 to i64
%166 = getelementptr inbounds [11 x i8], [11 x i8]* %163, i64 0, i64 %165
%167 = load i8, i8* %166
%168 = sext i8 %167 to i32
%169 = icmp eq i32 %168, 118
br i1 %169, label %170, label %180
170: ; preds = %157
%171 = load i32, i32* %10
%172 = sext i32 %171 to i64
%173 = mul nsw i64 %172, %29
%174 = getelementptr inbounds i8, i8* %32, i64 %173
%175 = load i32, i32* %11
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds i8, i8* %174, i64 %176
store i8 84, i8* %177
%178 = load i32, i32* %20
%179 = add nsw i32 %178, 1
store i32 %179, i32* %20
br label %188
180: ; preds = %157
%181 = load i32, i32* %10
%182 = sext i32 %181 to i64
%183 = mul nsw i64 %182, %29
%184 = getelementptr inbounds i8, i8* %32, i64 %183
%185 = load i32, i32* %11
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds i8, i8* %184, i64 %186
store i8 65, i8* %187
br label %188
188: ; preds = %180, %170
br label %189
189: ; preds = %188, %154
%190 = load i32, i32* %10
%191 = sub nsw i32 %190, 1
store i32 %191, i32* %13
%192 = load i32, i32* %11
%193 = sub nsw i32 %192, 1
store i32 %193, i32* %14
%194 = load i32, i32* %10
%195 = add nsw i32 %194, 1
store i32 %195, i32* %15
%196 = load i32, i32* %11
%197 = add nsw i32 %196, 1
store i32 %197, i32* %16
%198 = load i32, i32* %12
%199 = icmp eq i32 %198, 1
br i1 %199, label %200, label %294
200: ; preds = %189
%201 = load i32, i32* %19
%202 = icmp slt i32 %201, 2
br i1 %202, label %203, label %291
203: ; preds = %200
%204 = load i32, i32* %13
%205 = icmp sge i32 %204, 0
br i1 %205, label %206, label %288
206: ; preds = %203
%207 = load i32, i32* %14
%208 = icmp sge i32 %207, 0
br i1 %208, label %209, label %288
209: ; preds = %206
%210 = load i32, i32* %15
%211 = load i32, i32* %4
%212 = icmp slt i32 %210, %211
br i1 %212, label %213, label %288
213: ; preds = %209
%214 = load i32, i32* %16
%215 = load i32, i32* %4
%216 = icmp slt i32 %214, %215
br i1 %216, label %217, label %288
217: ; preds = %213
%218 = load i32, i32* %10
%219 = sub nsw i32 %218, 1
store i32 %219, i32* %7
br label %220
220: ; preds = %282, %217
%221 = load i32, i32* %7
%222 = load i32, i32* %10
%223 = add nsw i32 %222, 1
%224 = icmp sle i32 %221, %223
br i1 %224, label %225, label %285
225: ; preds = %220
%226 = load i32, i32* %11
%227 = sub nsw i32 %226, 1
store i32 %227, i32* %8
br label %228
228: ; preds = %278, %225
%229 = load i32, i32* %8
%230 = load i32, i32* %11
%231 = add nsw i32 %230, 1
%232 = icmp sle i32 %229, %231
br i1 %232, label %233, label %281
233: ; preds = %228
%234 = load i32, i32* %7
%235 = icmp sge i32 %234, 0
br i1 %235, label %236, label %277
236: ; preds = %233
%237 = load i32, i32* %7
%238 = load i32, i32* %4
%239 = icmp slt i32 %237, %238
br i1 %239, label %240, label %277
240: ; preds = %236
%241 = load i32, i32* %8
%242 = icmp sge i32 %241, 0
br i1 %242, label %243, label %277
243: ; preds = %240
%244 = load i32, i32* %8
%245 = load i32, i32* %4
%246 = icmp slt i32 %244, %245
br i1 %246, label %247, label %277
247: ; preds = %243
%248 = load [11 x i8]*, [11 x i8]** %5
%249 = load i32, i32* %7
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds [11 x i8], [11 x i8]* %248, i64 %250
%252 = load i32, i32* %8
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds [11 x i8], [11 x i8]* %251, i64 0, i64 %253
%255 = load i8, i8* %254
%256 = sext i8 %255 to i32
%257 = icmp eq i32 %256, 118
br i1 %257, label %258, label %268
258: ; preds = %247
%259 = load i32, i32* %7
%260 = sext i32 %259 to i64
%261 = mul nsw i64 %260, %29
%262 = getelementptr inbounds i8, i8* %32, i64 %261
%263 = load i32, i32* %8
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds i8, i8* %262, i64 %264
store i8 84, i8* %265
%266 = load i32, i32* %20
%267 = add nsw i32 %266, 1
store i32 %267, i32* %20
br label %276
268: ; preds = %247
%269 = load i32, i32* %7
%270 = sext i32 %269 to i64
%271 = mul nsw i64 %270, %29
%272 = getelementptr inbounds i8, i8* %32, i64 %271
%273 = load i32, i32* %8
%274 = sext i32 %273 to i64
%275 = getelementptr inbounds i8, i8* %272, i64 %274
store i8 65, i8* %275
br label %276
276: ; preds = %268, %258
br label %277
277: ; preds = %276, %243, %240, %236, %233
br label %278
278: ; preds = %277
%279 = load i32, i32* %8
%280 = add nsw i32 %279, 1
store i32 %280, i32* %8
br label %228
281: ; preds = %228
br label %282
282: ; preds = %281
%283 = load i32, i32* %7
%284 = add nsw i32 %283, 1
store i32 %284, i32* %7
br label %220
285: ; preds = %220
%286 = load i32, i32* %19
%287 = add nsw i32 %286, 1
store i32 %287, i32* %19
br label %290
288: ; preds = %213, %209, %206, %203
%289 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0))
br label %290
290: ; preds = %288, %285
br label %293
291: ; preds = %200
%292 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.8, i64 0, i64 0))
br label %293
293: ; preds = %291, %290
br label %294
294: ; preds = %293, %189
%295 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %7
br label %296
296: ; preds = %321, %294
%297 = load i32, i32* %7
%298 = load i32, i32* %4
%299 = icmp slt i32 %297, %298
br i1 %299, label %300, label %324
300: ; preds = %296
store i32 0, i32* %8
br label %301
301: ; preds = %316, %300
%302 = load i32, i32* %8
%303 = load i32, i32* %4
%304 = icmp slt i32 %302, %303
br i1 %304, label %305, label %319
305: ; preds = %301
%306 = load i32, i32* %7
%307 = sext i32 %306 to i64
%308 = mul nsw i64 %307, %29
%309 = getelementptr inbounds i8, i8* %32, i64 %308
%310 = load i32, i32* %8
%311 = sext i32 %310 to i64
%312 = getelementptr inbounds i8, i8* %309, i64 %311
%313 = load i8, i8* %312
%314 = sext i8 %313 to i32
%315 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %314)
br label %316
316: ; preds = %305
%317 = load i32, i32* %8
%318 = add nsw i32 %317, 1
store i32 %318, i32* %8
br label %301
319: ; preds = %301
%320 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br label %321
321: ; preds = %319
%322 = load i32, i32* %7
%323 = add nsw i32 %322, 1
store i32 %323, i32* %7
br label %296
324: ; preds = %296
%325 = load i32, i32* %20
%326 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %325)
%327 = load i32, i32* %17
%328 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 %327)
br label %76
329: ; preds = %76
%330 = load i32, i32* %18
%331 = load i32, i32* %19
%332 = call i32 @calcular_puntos(i32 %330, i32 %331)
store i32 1, i32* %22
%333 = load i32, i32* %22
%334 = load i8*, i8** %23
ret i32 %333
}

LLVM IR (-O2):
@.str = [4 x i8] c"cls\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.9 = [3 x i8] c"\0A\09\00"
@.str.10 = [4 x i8] c"%c \00"
@.str.11 = [16 x i8] c"\0AHas tocat %d .\00"
@.str.12 = [28 x i8] c"\0AHas enfonsat %d vaixells.\0A\00"
@str = [53 x i8] c"\0AIndica les coordenades on vols posicionar la bomba.\00"
@str.13 = [93 x i8] c"\0AIndica quin tipus de bomba vols utilitzar. (0 per a bomba simple i 1 per a bomba expansiva)\00"
@str.14 = [38 x i8] c"\0AS'han esgotat les bombes expansives.\00"
@str.15 = [34 x i8] c"\0AError la bomba surt dels limits.\00"
@str.16 = [67 x i8] c"\0AIntrodueix 0 per a la bomba simple o 1 per a la bomba expansiva. \00"
@str.17 = [58 x i8] c"\0APosicio ja ocupada. Torna a introduir uns valors valids.\00"
@str.18 = [38 x i8] c"\0ATorna a introduir uns valors valids.\00"
define i32 @jugar(i32 %0, [11 x i8]* nocapture %1, i32* nocapture %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = bitcast i32* %6 to i8*
%10 = zext i32 %0 to i64
%11 = tail call i8* @llvm.stacksave()
%12 = mul nuw i64 %10, %10
%13 = alloca i8, i64 %12
%14 = tail call i32 @system(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%15 = icmp sgt i32 %0, 0
br i1 %15, label %16, label %33
16: ; preds = %3
%17 = add nsw i64 %10, -1
%18 = and i64 %10, 7
%19 = icmp ult i64 %17, 7
br i1 %19, label %22, label %20
20: ; preds = %16
%21 = and i64 %10, 4294967288
br label %49
22: ; preds = %49, %16
%23 = phi i64 [ 0, %16 ], [ %75, %49 ]
%24 = icmp eq i64 %18, 0
br i1 %24, label %33, label %25
25: ; preds = %22, %25
%26 = phi i64 [ %30, %25 ], [ %23, %22 ]
%27 = phi i64 [ %31, %25 ], [ 0, %22 ]
%28 = mul nuw nsw i64 %26, %10
%29 = getelementptr i8, i8* %13, i64 %28
%30 = add nuw nsw i64 %26, 1
%31 = add i64 %27, 1
%32 = icmp eq i64 %31, %18
br i1 %32, label %33, label %25
33: ; preds = %22, %25, %3
%34 = getelementptr inbounds i32, i32* %2, i64 1
%35 = load i32, i32* %34
%36 = getelementptr inbounds i32, i32* %2, i64 2
%37 = load i32, i32* %36
%38 = shl nsw i32 %37, 1
%39 = add nsw i32 %38, %35
%40 = getelementptr inbounds i32, i32* %2, i64 3
%41 = load i32, i32* %40
%42 = mul nsw i32 %41, 3
%43 = add nsw i32 %42, %39
%44 = getelementptr inbounds i32, i32* %2, i64 4
%45 = load i32, i32* %44
%46 = shl nsw i32 %45, 2
%47 = add nsw i32 %46, %43
%48 = icmp sgt i32 %47, 0
br i1 %48, label %78, label %306
49: ; preds = %49, %20
%50 = phi i64 [ 0, %20 ], [ %75, %49 ]
%51 = phi i64 [ 0, %20 ], [ %76, %49 ]
%52 = mul nuw nsw i64 %50, %10
%53 = getelementptr i8, i8* %13, i64 %52
%54 = or i64 %50, 1
%55 = mul nuw nsw i64 %54, %10
%56 = getelementptr i8, i8* %13, i64 %55
%57 = or i64 %50, 2
%58 = mul nuw nsw i64 %57, %10
%59 = getelementptr i8, i8* %13, i64 %58
%60 = or i64 %50, 3
%61 = mul nuw nsw i64 %60, %10
%62 = getelementptr i8, i8* %13, i64 %61
%63 = or i64 %50, 4
%64 = mul nuw nsw i64 %63, %10
%65 = getelementptr i8, i8* %13, i64 %64
%66 = or i64 %50, 5
%67 = mul nuw nsw i64 %66, %10
%68 = getelementptr i8, i8* %13, i64 %67
%69 = or i64 %50, 6
%70 = mul nuw nsw i64 %69, %10
%71 = getelementptr i8, i8* %13, i64 %70
%72 = or i64 %50, 7
%73 = mul nuw nsw i64 %72, %10
%74 = getelementptr i8, i8* %13, i64 %73
%75 = add nuw nsw i64 %50, 8
%76 = add i64 %51, 8
%77 = icmp eq i64 %76, %21
br i1 %77, label %22, label %49
78: ; preds = %33, %302
%79 = phi i32 [ %284, %302 ], [ 0, %33 ]
%80 = phi i32 [ %283, %302 ], [ 0, %33 ]
%81 = phi i32 [ %282, %302 ], [ 0, %33 ]
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%83 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%84 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%85 = load i32, i32* %4
%86 = icmp sge i32 %85, %0
%87 = load i32, i32* %5
%88 = icmp sge i32 %87, %0
%89 = select i1 %86, i1 true, i1 %88
br i1 %89, label %90, label %99
90: ; preds = %78, %90
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.18, i64 0, i64 0))
%92 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%93 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%94 = load i32, i32* %4
%95 = icmp sge i32 %94, %0
%96 = load i32, i32* %5
%97 = icmp sge i32 %96, %0
%98 = select i1 %95, i1 true, i1 %97
br i1 %98, label %90, label %99
99: ; preds = %90, %78
%100 = phi i32 [ %87, %78 ], [ %96, %90 ]
%101 = phi i32 [ %85, %78 ], [ %94, %90 ]
br label %102
102: ; preds = %99, %111
%103 = phi i32 [ %116, %111 ], [ %100, %99 ]
%104 = phi i32 [ %115, %111 ], [ %101, %99 ]
%105 = sext i32 %104 to i64
%106 = mul nsw i64 %105, %10
%107 = getelementptr inbounds i8, i8* %13, i64 %106
%108 = sext i32 %103 to i64
%109 = getelementptr inbounds i8, i8* %107, i64 %108
%110 = load i8, i8* %109
switch i8 %110, label %117 [
i8 84, label %111
i8 65, label %111
i8 69, label %111
]
111: ; preds = %102, %102, %102
%112 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str.17, i64 0, i64 0))
%113 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%114 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %5)
%115 = load i32, i32* %4
%116 = load i32, i32* %5
br label %102
117: ; preds = %102
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.13, i64 0, i64 0))
%119 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%120 = load i32, i32* %6
%121 = icmp ult i32 %120, 2
br i1 %121, label %127, label %122
122: ; preds = %117, %122
%123 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.16, i64 0, i64 0))
%124 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%125 = load i32, i32* %6
%126 = icmp ult i32 %125, 2
br i1 %126, label %127, label %122
127: ; preds = %122, %117
%128 = phi i32 [ %120, %117 ], [ %125, %122 ]
%129 = icmp eq i32 %128, 0
br i1 %129, label %130, label %145
130: ; preds = %127
%131 = add nsw i32 %81, 1
%132 = load i32, i32* %4
%133 = sext i32 %132 to i64
%134 = load i32, i32* %5
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %133, i64 %135
%137 = load i8, i8* %136
%138 = icmp eq i8 %137, 118
%139 = mul nsw i64 %133, %10
%140 = getelementptr inbounds i8, i8* %13, i64 %139
%141 = getelementptr inbounds i8, i8* %140, i64 %135
br i1 %138, label %142, label %144
142: ; preds = %130
store i8 84, i8* %141
%143 = add nsw i32 %79, 1
br label %281
144: ; preds = %130
store i8 65, i8* %141
br label %281
145: ; preds = %127
%146 = load i32, i32* %4
%147 = load i32, i32* %5
%148 = icmp slt i32 %80, 2
br i1 %148, label %149, label %279
149: ; preds = %145
%150 = add nsw i32 %146, 1
%151 = add nsw i32 %147, 1
%152 = icmp sgt i32 %146, 0
%153 = icmp sgt i32 %147, 0
%154 = select i1 %152, i1 %153, i1 false
%155 = icmp slt i32 %150, %0
%156 = select i1 %154, i1 %155, i1 false
%157 = icmp slt i32 %151, %0
%158 = select i1 %156, i1 %157, i1 false
br i1 %158, label %159, label %277
159: ; preds = %149
%160 = add nsw i32 %147, -1
%161 = icmp sle i32 %147, %0
%162 = zext i32 %160 to i64
%163 = zext i32 %147 to i64
%164 = zext i32 %151 to i64
%165 = add nsw i32 %146, -1
%166 = icmp sle i32 %146, %0
%167 = zext i32 %165 to i64
%168 = mul nuw nsw i64 %167, %10
%169 = getelementptr inbounds i8, i8* %13, i64 %168
%170 = select i1 %166, i1 %161, i1 false
br i1 %170, label %171, label %179
171: ; preds = %159
%172 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %167, i64 %162
%173 = load i8, i8* %172
%174 = icmp eq i8 %173, 118
%175 = getelementptr inbounds i8, i8* %169, i64 %162
br i1 %174, label %176, label %178
176: ; preds = %171
store i8 84, i8* %175
%177 = add nsw i32 %79, 1
br label %179
178: ; preds = %171
store i8 65, i8* %175
br label %179
179: ; preds = %176, %178, %159
%180 = phi i32 [ %79, %159 ], [ %79, %178 ], [ %177, %176 ]
br i1 %166, label %181, label %189
181: ; preds = %179
%182 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %167, i64 %163
%183 = load i8, i8* %182
%184 = icmp eq i8 %183, 118
%185 = getelementptr inbounds i8, i8* %169, i64 %163
br i1 %184, label %187, label %186
186: ; preds = %181
store i8 65, i8* %185
br label %189
187: ; preds = %181
store i8 84, i8* %185
%188 = add nsw i32 %180, 1
br label %189
189: ; preds = %187, %186, %179
%190 = phi i32 [ %180, %179 ], [ %180, %186 ], [ %188, %187 ]
br i1 %166, label %191, label %199
191: ; preds = %189
%192 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %167, i64 %164
%193 = load i8, i8* %192
%194 = icmp eq i8 %193, 118
%195 = getelementptr inbounds i8, i8* %169, i64 %164
br i1 %194, label %197, label %196
196: ; preds = %191
store i8 65, i8* %195
br label %199
197: ; preds = %191
store i8 84, i8* %195
%198 = add nsw i32 %190, 1
br label %199
199: ; preds = %197, %196, %189
%200 = phi i32 [ %198, %197 ], [ %190, %196 ], [ %190, %189 ]
%201 = icmp sgt i32 %146, -1
%202 = icmp slt i32 %146, %0
%203 = zext i32 %146 to i64
%204 = mul nuw nsw i64 %203, %10
%205 = getelementptr inbounds i8, i8* %13, i64 %204
br i1 %201, label %206, label %236
206: ; preds = %199
%207 = select i1 %202, i1 %161, i1 false
br i1 %207, label %208, label %216
208: ; preds = %206
%209 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %203, i64 %162
%210 = load i8, i8* %209
%211 = icmp eq i8 %210, 118
%212 = getelementptr inbounds i8, i8* %205, i64 %162
br i1 %211, label %214, label %213
213: ; preds = %208
store i8 65, i8* %212
br label %216
214: ; preds = %208
store i8 84, i8* %212
%215 = add nsw i32 %200, 1
br label %216
216: ; preds = %214, %213, %206
%217 = phi i32 [ %200, %206 ], [ %200, %213 ], [ %215, %214 ]
br i1 %202, label %218, label %226
218: ; preds = %216
%219 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %203, i64 %163
%220 = load i8, i8* %219
%221 = icmp eq i8 %220, 118
%222 = getelementptr inbounds i8, i8* %205, i64 %163
br i1 %221, label %224, label %223
223: ; preds = %218
store i8 65, i8* %222
br label %226
224: ; preds = %218
store i8 84, i8* %222
%225 = add nsw i32 %217, 1
br label %226
226: ; preds = %224, %223, %216
%227 = phi i32 [ %217, %216 ], [ %217, %223 ], [ %225, %224 ]
br i1 %202, label %228, label %236
228: ; preds = %226
%229 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %203, i64 %164
%230 = load i8, i8* %229
%231 = icmp eq i8 %230, 118
%232 = getelementptr inbounds i8, i8* %205, i64 %164
br i1 %231, label %234, label %233
233: ; preds = %228
store i8 65, i8* %232
br label %236
234: ; preds = %228
store i8 84, i8* %232
%235 = add nsw i32 %227, 1
br label %236
236: ; preds = %234, %233, %226, %199
%237 = phi i32 [ %235, %234 ], [ %227, %233 ], [ %227, %226 ], [ %200, %199 ]
%238 = add nsw i32 %146, 1
%239 = icmp sgt i32 %146, -2
%240 = icmp slt i32 %238, %0
%241 = zext i32 %238 to i64
%242 = mul nuw nsw i64 %241, %10
%243 = getelementptr inbounds i8, i8* %13, i64 %242
br i1 %239, label %244, label %274
244: ; preds = %236
%245 = select i1 %240, i1 %161, i1 false
br i1 %245, label %246, label %254
246: ; preds = %244
%247 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %241, i64 %162
%248 = load i8, i8* %247
%249 = icmp eq i8 %248, 118
%250 = getelementptr inbounds i8, i8* %243, i64 %162
br i1 %249, label %252, label %251
251: ; preds = %246
store i8 65, i8* %250
br label %254
252: ; preds = %246
store i8 84, i8* %250
%253 = add nsw i32 %237, 1
br label %254
254: ; preds = %252, %251, %244
%255 = phi i32 [ %237, %244 ], [ %237, %251 ], [ %253, %252 ]
br i1 %240, label %256, label %264
256: ; preds = %254
%257 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %241, i64 %163
%258 = load i8, i8* %257
%259 = icmp eq i8 %258, 118
%260 = getelementptr inbounds i8, i8* %243, i64 %163
br i1 %259, label %262, label %261
261: ; preds = %256
store i8 65, i8* %260
br label %264
262: ; preds = %256
store i8 84, i8* %260
%263 = add nsw i32 %255, 1
br label %264
264: ; preds = %262, %261, %254
%265 = phi i32 [ %255, %254 ], [ %255, %261 ], [ %263, %262 ]
br i1 %240, label %266, label %274
266: ; preds = %264
%267 = getelementptr inbounds [11 x i8], [11 x i8]* %1, i64 %241, i64 %164
%268 = load i8, i8* %267
%269 = icmp eq i8 %268, 118
%270 = getelementptr inbounds i8, i8* %243, i64 %164
br i1 %269, label %272, label %271
271: ; preds = %266
store i8 65, i8* %270
br label %274
272: ; preds = %266
store i8 84, i8* %270
%273 = add nsw i32 %265, 1
br label %274
274: ; preds = %236, %264, %271, %272
%275 = phi i32 [ %273, %272 ], [ %265, %271 ], [ %265, %264 ], [ %237, %236 ]
%276 = add nsw i32 %80, 1
br label %281
277: ; preds = %149
%278 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.15, i64 0, i64 0))
br label %281
279: ; preds = %145
%280 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.14, i64 0, i64 0))
br label %281
281: ; preds = %144, %142, %279, %277, %274
%282 = phi i32 [ %81, %274 ], [ %81, %277 ], [ %81, %279 ], [ %131, %142 ], [ %131, %144 ]
%283 = phi i32 [ %276, %274 ], [ %80, %277 ], [ %80, %279 ], [ %80, %142 ], [ %80, %144 ]
%284 = phi i32 [ %275, %274 ], [ %79, %277 ], [ %79, %279 ], [ %143, %142 ], [ %79, %144 ]
%285 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
br i1 %15, label %286, label %302
286: ; preds = %281, %298
%287 = phi i64 [ %300, %298 ], [ 0, %281 ]
%288 = mul nuw nsw i64 %287, %10
%289 = getelementptr inbounds i8, i8* %13, i64 %288
br label %290
290: ; preds = %286, %290
%291 = phi i64 [ 0, %286 ], [ %296, %290 ]
%292 = getelementptr inbounds i8, i8* %289, i64 %291
%293 = load i8, i8* %292
%294 = sext i8 %293 to i32
%295 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %294)
%296 = add nuw nsw i64 %291, 1
%297 = icmp eq i64 %296, %10
br i1 %297, label %298, label %290
298: ; preds = %290
%299 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%300 = add nuw nsw i64 %287, 1
%301 = icmp eq i64 %300, %10
br i1 %301, label %302, label %286
302: ; preds = %298, %281
%303 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32 %284)
%304 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i32 0)
%305 = icmp slt i32 %284, %47
br i1 %305, label %78, label %306
306: ; preds = %302, %33
%307 = phi i32 [ 0, %33 ], [ %282, %302 ]
%308 = phi i32 [ 0, %33 ], [ %283, %302 ]
%309 = call i32 @calcular_puntos(i32 %307, i32 %308)
ret i32 1
}