#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 KEY_DOWN;
int KEY_UP;
int /*<<< orphan*/ clrtobot();
int getch();
int /*<<< orphan*/ move(int, int /*<<< orphan*/);
int /*<<< orphan*/ mvaddch(int, int /*<<< orphan*/, char);
int /*<<< orphan*/ mvprintw(int, int, char *, ...);
int rand();
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
void fight(int *cur_hp, int *str, int *dex) {
  int perc, buf = 0, dmg, crit;
  int en_hp = 20;
  char enemy[20], currow = 1;
  srand(time(NULL));
  perc = rand() % 100 + 1;
  en_hp = en_hp + rand() % 11 - 5;
  if (perc >= 1 && perc <= 20) {
    enemy[0] = 'O';
    enemy[1] = 'r';
    enemy[2] = 'c';
    enemy[3] = ' ';
    enemy[4] = '\0';
  } else {
    enemy[0] = 'C';
    enemy[1] = 'a';
    enemy[2] = 'h';
    enemy[3] = 'n';
    enemy[4] = '\0';
    en_hp -= 3;
  }
  while (*cur_hp > 0 && en_hp > 0) {
    mvprintw(8, 0, "A wild %s appeared!", enemy);
    buf = 0;
    while (buf != '\n' && buf != '\r') {
      mvprintw(10, 1, "Attack                  ");
      mvprintw(11, 1, "Skills");
      mvprintw(12, 1, "Inventory");
      mvprintw(13, 1, "Retreat");
      if (currow == 1) {
        mvaddch(10, 0, '>');
        mvaddch(11, 0, ' ');
        mvaddch(12, 0, ' ');
        mvaddch(13, 0, ' ');
      }
      if (currow == 2) {
        mvaddch(10, 0, ' ');
        mvaddch(11, 0, '>');
        mvaddch(12, 0, ' ');
        mvaddch(13, 0, ' ');
      }
      if (currow == 3) {
        mvaddch(10, 0, ' ');
        mvaddch(11, 0, ' ');
        mvaddch(12, 0, '>');
        mvaddch(13, 0, ' ');
      }
      if (currow == 4) {
        mvaddch(10, 0, ' ');
        mvaddch(11, 0, ' ');
        mvaddch(12, 0, ' ');
        mvaddch(13, 0, '>');
      }
      buf = getch();
      if (buf == KEY_UP && currow != 1)
        currow--;
      else if (buf == KEY_UP && currow == 1)
        currow = 4;
      else if (buf == KEY_DOWN && currow != 4)
        currow++;
      else if (buf == KEY_DOWN && currow == 4)
        currow = 1;
    }
    if (currow == 1) {
      dmg = *str / 5;
      crit = 5 + *dex / 5;
      perc = rand() % 100 + 1;
      if (perc <= crit)
        dmg = dmg + dmg / 2;
      mvprintw(15, 0, "You damage %s with %d damage.", enemy, dmg);
      en_hp -= dmg;
    } else if (currow == 2)
      mvprintw(15, 0, "You have no skills yet!        ");
    else if (currow == 3)
      mvprintw(15, 0, "Your inventory is empty!       ");
    else if (currow == 4)
      mvprintw(15, 0, "There's no escape!             ");
    if (en_hp > 0) {
      dmg = rand() % 5;
      mvprintw(17, 0, "%s damages you with %d damage.", enemy, dmg);
      refresh();
      *cur_hp -= dmg;
    }
    mvprintw(3, 4, "%3d", *cur_hp);
  }
  move(10, 0);
  clrtobot();
  if (*cur_hp <= 0)
    mvprintw(8, 0, "You died!            ");
  else
    mvprintw(8, 0, "%s died!           ", enemy);
  mvprintw(10, 0, "Press any key to continue");
  refresh();
  getch();
  return;
}


x86 assembly (clang, -O0):
<fight>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x14,-0x2c(%rbp)
movb   $0x1,-0x41(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
mov    -0x2c(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0xb,%ecx
cltd
idiv   %ecx
mov    -0x48(%rbp),%eax
add    %edx,%eax
sub    $0x5,%eax
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x1c(%rbp)
jl     1228 <fight+0x98>
cmpl   $0x14,-0x1c(%rbp)
jg     1228 <fight+0x98>
movb   $0x4f,-0x40(%rbp)
movb   $0x72,-0x3f(%rbp)
movb   $0x63,-0x3e(%rbp)
movb   $0x20,-0x3d(%rbp)
movb   $0x0,-0x3c(%rbp)
jmp    1245 <fight+0xb5>
movb   $0x43,-0x40(%rbp)
movb   $0x61,-0x3f(%rbp)
movb   $0x68,-0x3e(%rbp)
movb   $0x6e,-0x3d(%rbp)
movb   $0x0,-0x3c(%rbp)
mov    -0x2c(%rbp),%eax
sub    $0x3,%eax
mov    %eax,-0x2c(%rbp)
jmp    124a <fight+0xba>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmpl   $0x0,(%rcx)
mov    %al,-0x49(%rbp)
jle    1266 <fight+0xd6>
cmpl   $0x0,-0x2c(%rbp)
setg   %al
mov    %al,-0x49(%rbp)
mov    -0x49(%rbp),%al
test   $0x1,%al
jne    1276 <fight+0xe6>
jmp    16ae <fight+0x51e>
lea    -0x40(%rbp),%rcx
mov    $0x8,%edi
xor    %esi,%esi
lea    0xd78(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
movl   $0x0,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0xa,-0x20(%rbp)
mov    %al,-0x4a(%rbp)
je     12af <fight+0x11f>
cmpl   $0xd,-0x20(%rbp)
setne  %al
mov    %al,-0x4a(%rbp)
mov    -0x4a(%rbp),%al
test   $0x1,%al
jne    12bf <fight+0x12f>
jmp    1524 <fight+0x394>
mov    $0xa,%edi
mov    $0x1,%esi
lea    0xd44(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0xb,%edi
mov    $0x1,%esi
lea    0xd45(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0xc,%edi
mov    $0x1,%esi
lea    0xd34(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0xd,%edi
mov    $0x1,%esi
lea    0xd26(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
movsbl -0x41(%rbp),%eax
cmp    $0x1,%eax
jne    1370 <fight+0x1e0>
mov    $0xa,%edi
xor    %esi,%esi
mov    $0x3e,%edx
call   1080 <mvaddch@plt>
mov    $0xb,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xd,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
movsbl -0x41(%rbp),%eax
cmp    $0x2,%eax
jne    13c1 <fight+0x231>
mov    $0xa,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xb,%edi
xor    %esi,%esi
mov    $0x3e,%edx
call   1080 <mvaddch@plt>
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xd,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
movsbl -0x41(%rbp),%eax
cmp    $0x3,%eax
jne    1412 <fight+0x282>
mov    $0xa,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xb,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x3e,%edx
call   1080 <mvaddch@plt>
mov    $0xd,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
movsbl -0x41(%rbp),%eax
cmp    $0x4,%eax
jne    1463 <fight+0x2d3>
mov    $0xa,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xb,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xc,%edi
xor    %esi,%esi
mov    $0x20,%edx
call   1080 <mvaddch@plt>
mov    $0xd,%edi
xor    %esi,%esi
mov    $0x3e,%edx
call   1080 <mvaddch@plt>
mov    $0x0,%al
call   1070 <getch@plt>
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    0x2b69(%rip),%rcx
cmp    (%rcx),%eax
jne    1499 <fight+0x309>
movsbl -0x41(%rbp),%eax
cmp    $0x1,%eax
je     1499 <fight+0x309>
mov    -0x41(%rbp),%al
add    $0xff,%al
mov    %al,-0x41(%rbp)
jmp    151f <fight+0x38f>
mov    -0x20(%rbp),%eax
mov    0x2b3d(%rip),%rcx
cmp    (%rcx),%eax
jne    14c1 <fight+0x331>
movsbl -0x41(%rbp),%eax
cmp    $0x1,%eax
jne    14c1 <fight+0x331>
movb   $0x4,-0x41(%rbp)
jmp    151a <fight+0x38a>
mov    -0x20(%rbp),%eax
mov    0x2b1d(%rip),%rcx
cmp    (%rcx),%eax
jne    14ed <fight+0x35d>
movsbl -0x41(%rbp),%eax
cmp    $0x4,%eax
je     14ed <fight+0x35d>
mov    -0x41(%rbp),%al
add    $0x1,%al
mov    %al,-0x41(%rbp)
jmp    1515 <fight+0x385>
mov    -0x20(%rbp),%eax
mov    0x2af1(%rip),%rcx
cmp    (%rcx),%eax
jne    1510 <fight+0x380>
movsbl -0x41(%rbp),%eax
cmp    $0x4,%eax
jne    1510 <fight+0x380>
movb   $0x1,-0x41(%rbp)
jmp    1515 <fight+0x385>
jmp    151a <fight+0x38a>
jmp    151f <fight+0x38f>
jmp    1296 <fight+0x106>
movsbl -0x41(%rbp),%eax
cmp    $0x1,%eax
jne    15bf <fight+0x42f>
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
add    $0x5,%eax
mov    %eax,-0x28(%rbp)
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x64,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jg     1592 <fight+0x402>
mov    -0x24(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x24(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x50(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
lea    -0x40(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    $0xf,%edi
xor    %esi,%esi
lea    0xa9e(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    -0x24(%rbp),%ecx
mov    -0x2c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x2c(%rbp)
jmp    163e <fight+0x4ae>
movsbl -0x41(%rbp),%eax
cmp    $0x2,%eax
jne    15e6 <fight+0x456>
mov    $0xf,%edi
xor    %esi,%esi
lea    0xa8a(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
jmp    1639 <fight+0x4a9>
movsbl -0x41(%rbp),%eax
cmp    $0x3,%eax
jne    160d <fight+0x47d>
mov    $0xf,%edi
xor    %esi,%esi
lea    0xa83(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
jmp    1634 <fight+0x4a4>
movsbl -0x41(%rbp),%eax
cmp    $0x4,%eax
jne    162f <fight+0x49f>
mov    $0xf,%edi
xor    %esi,%esi
lea    0xa7c(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
jmp    1634 <fight+0x4a4>
jmp    1639 <fight+0x4a9>
jmp    163e <fight+0x4ae>
cmpl   $0x0,-0x2c(%rbp)
jle    168b <fight+0x4fb>
mov    $0x0,%al
call   10a0 <rand@plt>
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %edx,-0x24(%rbp)
lea    -0x40(%rbp),%rcx
mov    -0x24(%rbp),%r8d
mov    $0x11,%edi
xor    %esi,%esi
lea    0xa54(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    -0x24(%rbp),%edx
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
sub    %edx,%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    $0x3,%edi
mov    $0x4,%esi
lea    0xa41(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
jmp    124a <fight+0xba>
mov    $0xa,%edi
xor    %esi,%esi
call   10b0 <move@plt>
mov    $0x0,%al
call   1030 <clrtobot@plt>
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jg     16e8 <fight+0x558>
mov    $0x8,%edi
xor    %esi,%esi
lea    0xa0b(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
jmp    1701 <fight+0x571>
lea    -0x40(%rbp),%rcx
mov    $0x8,%edi
xor    %esi,%esi
lea    0xa03(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0xa,%edi
xor    %esi,%esi
lea    0xa02(%rip),%rdx
mov    $0x0,%al
call   1090 <mvprintw@plt>
mov    $0x0,%al
call   1060 <refresh@plt>
mov    $0x0,%al
call   1070 <getch@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fight>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,0x30(%rsp)
mov    %rsi,0x28(%rsp)
mov    %rdi,%r12
xor    %edi,%edi
call   1050 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbx
imul   $0x51eb851f,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x25,%rax
add    %ecx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ebx
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbp
imul   $0x2e8ba2e9,%rbp,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,2),%eax
sub    %eax,%ebp
cmp    $0x13,%ebx
ja     1216 <fight+0x86>
add    $0xf,%ebp
movb   $0x4f,(%rsp)
mov    $0x20,%al
mov    $0x63,%cl
mov    $0x72,%dl
jmp    1223 <fight+0x93>
movb   $0x43,(%rsp)
add    $0xc,%ebp
mov    $0x6e,%al
mov    $0x68,%cl
mov    $0x61,%dl
mov    %dl,0x1(%rsp)
mov    %cl,0x2(%rsp)
mov    %al,0x3(%rsp)
movb   $0x0,0x4(%rsp)
cmpl   $0x0,(%r12)
jle    15af <fight+0x41f>
mov    $0x1,%r15b
lea    0xe05(%rip),%r14
mov    %r12,0x18(%rsp)
xchg   %ax,%ax
mov    %rbp,0x20(%rsp)
mov    $0x8,%edi
xor    %esi,%esi
lea    0xdad(%rip),%rdx
mov    %rsp,%rcx
xor    %eax,%eax
call   1090 <mvprintw@plt>
xor    %eax,%eax
jmp    13e4 <fight+0x254>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ecx,%r15d
cmp    $0xa,%eax
je     1400 <fight+0x270>
cmp    $0xd,%eax
je     1400 <fight+0x270>
xor    %r13d,%r13d
mov    $0xa,%edi
mov    $0x1,%esi
lea    0xd7b(%rip),%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    $0xb,%edi
mov    $0x1,%esi
lea    0xd7c(%rip),%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    $0xc,%edi
mov    $0x1,%esi
lea    0xd6b(%rip),%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    $0xd,%edi
mov    $0x1,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
cmp    $0x1,%r15b
jne    1310 <fight+0x180>
mov    $0x20,%bpl
mov    $0x3e,%al
mov    $0x20,%r12b
mov    $0x20,%bl
jmp    133f <fight+0x1af>
cs nopw 0x0(%rax,%rax,1)
lea    -0x2(%r15),%eax
cmp    $0x2,%al
ja     1380 <fight+0x1f0>
movzbl %al,%ecx
shl    $0x3,%ecx
mov    $0x20203e,%ebp
shr    %cl,%ebp
mov    $0x203e20,%r12d
shr    %cl,%r12d
mov    $0x3e2020,%ebx
shr    %cl,%ebx
and    $0x7,%al
cmp    $0x2,%al
sete   %r13b
mov    $0x20,%al
movzbl %al,%edx
mov    $0xa,%edi
xor    %esi,%esi
call   1080 <mvaddch@plt>
movsbl %bpl,%edx
mov    $0xb,%edi
xor    %esi,%esi
call   1080 <mvaddch@plt>
movsbl %r12b,%edx
mov    $0xc,%edi
xor    %esi,%esi
call   1080 <mvaddch@plt>
movsbl %bl,%edx
mov    $0xd,%edi
xor    %esi,%esi
call   1080 <mvaddch@plt>
jmp    1383 <fight+0x1f3>
nop
xor    %r13d,%r13d
xor    %eax,%eax
call   1070 <getch@plt>
mov    0x2c4f(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%eax
jne    139d <fight+0x20d>
cmp    $0x1,%r15b
jne    13e0 <fight+0x250>
cmp    %ecx,%eax
jne    13ad <fight+0x21d>
mov    $0x4,%cl
cmp    $0x1,%r15b
je     1280 <fight+0xf0>
mov    0x2c34(%rip),%rcx
mov    (%rcx),%ecx
cmp    %ecx,%eax
jne    13c0 <fight+0x230>
cmp    $0x4,%r15b
jne    13ec <fight+0x25c>
cmp    %ecx,%eax
movzbl %r15b,%edx
mov    %edx,%ecx
mov    $0x1,%esi
cmove  %esi,%ecx
test   %r13b,%r13b
cmove  %edx,%ecx
jmp    1280 <fight+0xf0>
nopl   0x0(%rax,%rax,1)
add    $0xff,%r15b
mov    %r15d,%ecx
jmp    1280 <fight+0xf0>
add    $0x1,%r15b
jmp    13e4 <fight+0x254>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    -0x1(%r15),%eax
cmp    $0x3,%al
ja     14e0 <fight+0x350>
movzbl %al,%eax
lea    0xbea(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
mov    0x18(%rsp),%r12
mov    0x20(%rsp),%rbp
jmp    *%rax
mov    0x28(%rsp),%rax
movslq (%rax),%rbx
imul   $0x66666667,%rbx,%r13
mov    %r13,%rax
shr    $0x3f,%rax
sar    $0x21,%r13
add    %eax,%r13d
mov    0x30(%rsp),%rax
movslq (%rax),%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
sar    $0x21,%rcx
shr    $0x3f,%rax
lea    (%rcx,%rax,1),%ebp
add    $0x5,%ebp
xor    %eax,%eax
call   10a0 <rand@plt>
cltq
imul   $0x51eb851f,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x25,%rcx
add    %edx,%ecx
imul   $0x64,%ecx,%ecx
sub    %ecx,%eax
cmp    %ebp,%eax
jge    14a6 <fight+0x316>
movslq %ebx,%rax
imul   $0x66666667,%rax,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%r13d
mov    $0xf,%edi
xor    %esi,%esi
lea    0xba2(%rip),%rdx
mov    %rsp,%rcx
mov    %r13d,%r8d
xor    %eax,%eax
call   1090 <mvprintw@plt>
mov    0x20(%rsp),%rbp
sub    %r13d,%ebp
mov    0x18(%rsp),%r12
test   %ebp,%ebp
jg     1539 <fight+0x3a9>
jmp    14f0 <fight+0x360>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    0x18(%rsp),%r12
mov    0x20(%rsp),%rbp
test   %ebp,%ebp
jg     1539 <fight+0x3a9>
xchg   %ax,%ax
mov    (%r12),%ecx
jmp    1588 <fight+0x3f8>
nopl   0x0(%rax)
mov    $0xf,%edi
xor    %esi,%esi
lea    0xb66(%rip),%rdx
jmp    152e <fight+0x39e>
mov    $0xf,%edi
xor    %esi,%esi
lea    0xb76(%rip),%rdx
jmp    152e <fight+0x39e>
mov    $0xf,%edi
xor    %esi,%esi
lea    0xb86(%rip),%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
test   %ebp,%ebp
jle    14f0 <fight+0x360>
xor    %eax,%eax
call   10a0 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x21,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    $0x11,%edi
xor    %esi,%esi
lea    0xb6a(%rip),%rdx
mov    %rsp,%rcx
mov    %ebx,%r8d
xor    %eax,%eax
call   1090 <mvprintw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
mov    (%r12),%ecx
sub    %ebx,%ecx
mov    %ecx,(%r12)
mov    $0x3,%edi
mov    $0x4,%esi
lea    0xb5a(%rip),%rdx
xor    %eax,%eax
call   1090 <mvprintw@plt>
cmpl   $0x0,(%r12)
jle    15af <fight+0x41f>
test   %ebp,%ebp
jg     1250 <fight+0xc0>
mov    $0xa,%edi
xor    %esi,%esi
call   10b0 <move@plt>
xor    %eax,%eax
call   1030 <clrtobot@plt>
cmpl   $0x0,(%r12)
jle    15e3 <fight+0x453>
lea    0xb3d(%rip),%rdx
mov    %rsp,%rcx
mov    $0x8,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <mvprintw@plt>
jmp    15f8 <fight+0x468>
lea    0xb0d(%rip),%rdx
mov    $0x8,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <mvprintw@plt>
lea    0xb22(%rip),%rdx
mov    $0xa,%edi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <mvprintw@plt>
xor    %eax,%eax
call   1060 <refresh@plt>
xor    %eax,%eax
call   1070 <getch@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [20 x i8] c"A wild %s appeared!\00"
@.str.1 = [25 x i8] c"Attack \00"
@.str.2 = [7 x i8] c"Skills\00"
@.str.3 = [10 x i8] c"Inventory\00"
@.str.4 = [8 x i8] c"Retreat\00"
@KEY_UP = global i32 0
@KEY_DOWN = global i32 0
@.str.5 = [30 x i8] c"You damage %s with %d damage.\00"
@.str.6 = [32 x i8] c"You have no skills yet! \00"
@.str.7 = [32 x i8] c"Your inventory is empty! \00"
@.str.8 = [32 x i8] c"There's no escape! \00"
@.str.9 = [31 x i8] c"%s damages you with %d damage.\00"
@.str.10 = [4 x i8] c"%3d\00"
@.str.11 = [22 x i8] c"You died! \00"
@.str.12 = [20 x i8] c"%s died! \00"
@.str.13 = [26 x i8] c"Press any key to continue\00"
define void @fight(i32* %0, i32* %1, i32* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [20 x i8]
%13 = alloca i8
store i32* %0, i32** %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %8
store i32 20, i32* %11
store i8 1, i8* %13
%14 = call i32 @time(i32* null)
%15 = call i32 @srand(i32 %14)
%16 = call i32 (...) @rand()
%17 = srem i32 %16, 100
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
%19 = load i32, i32* %11
%20 = call i32 (...) @rand()
%21 = srem i32 %20, 11
%22 = add nsw i32 %19, %21
%23 = sub nsw i32 %22, 5
store i32 %23, i32* %11
%24 = load i32, i32* %7
%25 = icmp sge i32 %24, 1
br i1 %25, label %26, label %35
26: ; preds = %3
%27 = load i32, i32* %7
%28 = icmp sle i32 %27, 20
br i1 %28, label %29, label %35
29: ; preds = %26
%30 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
store i8 79, i8* %30
%31 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 1
store i8 114, i8* %31
%32 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 2
store i8 99, i8* %32
%33 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 3
store i8 32, i8* %33
%34 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 4
store i8 0, i8* %34
br label %43
35: ; preds = %26, %3
%36 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
store i8 67, i8* %36
%37 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 1
store i8 97, i8* %37
%38 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 2
store i8 104, i8* %38
%39 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 3
store i8 110, i8* %39
%40 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 4
store i8 0, i8* %40
%41 = load i32, i32* %11
%42 = sub nsw i32 %41, 3
store i32 %42, i32* %11
br label %43
43: ; preds = %35, %29
br label %44
44: ; preds = %214, %43
%45 = load i32*, i32** %4
%46 = load i32, i32* %45
%47 = icmp sgt i32 %46, 0
br i1 %47, label %48, label %51
48: ; preds = %44
%49 = load i32, i32* %11
%50 = icmp sgt i32 %49, 0
br label %51
51: ; preds = %48, %44
%52 = phi i1 [ false, %44 ], [ %50, %48 ]
br i1 %52, label %53, label %218
53: ; preds = %51
%54 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%55 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %54)
store i32 0, i32* %8
br label %56
56: ; preds = %148, %53
%57 = load i32, i32* %8
%58 = icmp ne i32 %57, 10
br i1 %58, label %59, label %62
59: ; preds = %56
%60 = load i32, i32* %8
%61 = icmp ne i32 %60, 13
br label %62
62: ; preds = %59, %56
%63 = phi i1 [ false, %56 ], [ %61, %59 ]
br i1 %63, label %64, label %149
64: ; preds = %62
%65 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 10, i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%66 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 11, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%67 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 12, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%68 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 13, i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%69 = load i8, i8* %13
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 1
br i1 %71, label %72, label %77
72: ; preds = %64
%73 = call i32 @mvaddch(i32 10, i32 0, i8 signext 62)
%74 = call i32 @mvaddch(i32 11, i32 0, i8 signext 32)
%75 = call i32 @mvaddch(i32 12, i32 0, i8 signext 32)
%76 = call i32 @mvaddch(i32 13, i32 0, i8 signext 32)
br label %77
77: ; preds = %72, %64
%78 = load i8, i8* %13
%79 = sext i8 %78 to i32
%80 = icmp eq i32 %79, 2
br i1 %80, label %81, label %86
81: ; preds = %77
%82 = call i32 @mvaddch(i32 10, i32 0, i8 signext 32)
%83 = call i32 @mvaddch(i32 11, i32 0, i8 signext 62)
%84 = call i32 @mvaddch(i32 12, i32 0, i8 signext 32)
%85 = call i32 @mvaddch(i32 13, i32 0, i8 signext 32)
br label %86
86: ; preds = %81, %77
%87 = load i8, i8* %13
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 3
br i1 %89, label %90, label %95
90: ; preds = %86
%91 = call i32 @mvaddch(i32 10, i32 0, i8 signext 32)
%92 = call i32 @mvaddch(i32 11, i32 0, i8 signext 32)
%93 = call i32 @mvaddch(i32 12, i32 0, i8 signext 62)
%94 = call i32 @mvaddch(i32 13, i32 0, i8 signext 32)
br label %95
95: ; preds = %90, %86
%96 = load i8, i8* %13
%97 = sext i8 %96 to i32
%98 = icmp eq i32 %97, 4
br i1 %98, label %99, label %104
99: ; preds = %95
%100 = call i32 @mvaddch(i32 10, i32 0, i8 signext 32)
%101 = call i32 @mvaddch(i32 11, i32 0, i8 signext 32)
%102 = call i32 @mvaddch(i32 12, i32 0, i8 signext 32)
%103 = call i32 @mvaddch(i32 13, i32 0, i8 signext 62)
br label %104
104: ; preds = %99, %95
%105 = call i32 (...) @getch()
store i32 %105, i32* %8
%106 = load i32, i32* %8
%107 = load i32, i32* @KEY_UP
%108 = icmp eq i32 %106, %107
br i1 %108, label %109, label %116
109: ; preds = %104
%110 = load i8, i8* %13
%111 = sext i8 %110 to i32
%112 = icmp ne i32 %111, 1
br i1 %112, label %113, label %116
113: ; preds = %109
%114 = load i8, i8* %13
%115 = add i8 %114, -1
store i8 %115, i8* %13
br label %148
116: ; preds = %109, %104
%117 = load i32, i32* %8
%118 = load i32, i32* @KEY_UP
%119 = icmp eq i32 %117, %118
br i1 %119, label %120, label %125
120: ; preds = %116
%121 = load i8, i8* %13
%122 = sext i8 %121 to i32
%123 = icmp eq i32 %122, 1
br i1 %123, label %124, label %125
124: ; preds = %120
store i8 4, i8* %13
br label %147
125: ; preds = %120, %116
%126 = load i32, i32* %8
%127 = load i32, i32* @KEY_DOWN
%128 = icmp eq i32 %126, %127
br i1 %128, label %129, label %136
129: ; preds = %125
%130 = load i8, i8* %13
%131 = sext i8 %130 to i32
%132 = icmp ne i32 %131, 4
br i1 %132, label %133, label %136
133: ; preds = %129
%134 = load i8, i8* %13
%135 = add i8 %134, 1
store i8 %135, i8* %13
br label %146
136: ; preds = %129, %125
%137 = load i32, i32* %8
%138 = load i32, i32* @KEY_DOWN
%139 = icmp eq i32 %137, %138
br i1 %139, label %140, label %145
140: ; preds = %136
%141 = load i8, i8* %13
%142 = sext i8 %141 to i32
%143 = icmp eq i32 %142, 4
br i1 %143, label %144, label %145
144: ; preds = %140
store i8 1, i8* %13
br label %145
145: ; preds = %144, %140, %136
br label %146
146: ; preds = %145, %133
br label %147
147: ; preds = %146, %124
br label %148
148: ; preds = %147, %113
br label %56
149: ; preds = %62
%150 = load i8, i8* %13
%151 = sext i8 %150 to i32
%152 = icmp eq i32 %151, 1
br i1 %152, label %153, label %179
153: ; preds = %149
%154 = load i32*, i32** %5
%155 = load i32, i32* %154
%156 = sdiv i32 %155, 5
store i32 %156, i32* %9
%157 = load i32*, i32** %6
%158 = load i32, i32* %157
%159 = sdiv i32 %158, 5
%160 = add nsw i32 5, %159
store i32 %160, i32* %10
%161 = call i32 (...) @rand()
%162 = srem i32 %161, 100
%163 = add nsw i32 %162, 1
store i32 %163, i32* %7
%164 = load i32, i32* %7
%165 = load i32, i32* %10
%166 = icmp sle i32 %164, %165
br i1 %166, label %167, label %172
167: ; preds = %153
%168 = load i32, i32* %9
%169 = load i32, i32* %9
%170 = sdiv i32 %169, 2
%171 = add nsw i32 %168, %170
store i32 %171, i32* %9
br label %172
172: ; preds = %167, %153
%173 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%174 = load i32, i32* %9
%175 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %173, i32 %174)
%176 = load i32, i32* %9
%177 = load i32, i32* %11
%178 = sub nsw i32 %177, %176
store i32 %178, i32* %11
br label %200
179: ; preds = %149
%180 = load i8, i8* %13
%181 = sext i8 %180 to i32
%182 = icmp eq i32 %181, 2
br i1 %182, label %183, label %185
183: ; preds = %179
%184 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %199
185: ; preds = %179
%186 = load i8, i8* %13
%187 = sext i8 %186 to i32
%188 = icmp eq i32 %187, 3
br i1 %188, label %189, label %191
189: ; preds = %185
%190 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %198
191: ; preds = %185
%192 = load i8, i8* %13
%193 = sext i8 %192 to i32
%194 = icmp eq i32 %193, 4
br i1 %194, label %195, label %197
195: ; preds = %191
%196 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
br label %197
197: ; preds = %195, %191
br label %198
198: ; preds = %197, %189
br label %199
199: ; preds = %198, %183
br label %200
200: ; preds = %199, %172
%201 = load i32, i32* %11
%202 = icmp sgt i32 %201, 0
br i1 %202, label %203, label %214
203: ; preds = %200
%204 = call i32 (...) @rand()
%205 = srem i32 %204, 5
store i32 %205, i32* %9
%206 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%207 = load i32, i32* %9
%208 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 17, i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %206, i32 %207)
%209 = call i32 (...) @refresh()
%210 = load i32, i32* %9
%211 = load i32*, i32** %4
%212 = load i32, i32* %211
%213 = sub nsw i32 %212, %210
store i32 %213, i32* %211
br label %214
214: ; preds = %203, %200
%215 = load i32*, i32** %4
%216 = load i32, i32* %215
%217 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 3, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %216)
br label %44
218: ; preds = %51
%219 = call i32 @move(i32 10, i32 0)
%220 = call i32 (...) @clrtobot()
%221 = load i32*, i32** %4
%222 = load i32, i32* %221
%223 = icmp sle i32 %222, 0
br i1 %223, label %224, label %226
224: ; preds = %218
%225 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %229
226: ; preds = %218
%227 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%228 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* %227)
br label %229
229: ; preds = %226, %224
%230 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 10, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%231 = call i32 (...) @refresh()
%232 = call i32 (...) @getch()
ret void
}

LLVM IR (-O2):
@.str = [20 x i8] c"A wild %s appeared!\00"
@.str.1 = [25 x i8] c"Attack \00"
@.str.2 = [7 x i8] c"Skills\00"
@.str.3 = [10 x i8] c"Inventory\00"
@.str.4 = [8 x i8] c"Retreat\00"
@KEY_UP = global i32 0
@KEY_DOWN = global i32 0
@.str.5 = [30 x i8] c"You damage %s with %d damage.\00"
@.str.6 = [32 x i8] c"You have no skills yet! \00"
@.str.7 = [32 x i8] c"Your inventory is empty! \00"
@.str.8 = [32 x i8] c"There's no escape! \00"
@.str.9 = [31 x i8] c"%s damages you with %d damage.\00"
@.str.10 = [4 x i8] c"%3d\00"
@.str.11 = [22 x i8] c"You died! \00"
@.str.12 = [20 x i8] c"%s died! \00"
@.str.13 = [26 x i8] c"Press any key to continue\00"
define void @fight(i32* nocapture %0, i32* nocapture %1, i32* nocapture %2) {
%4 = alloca [20 x i8]
%5 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%6 = tail call i32 @time(i32* null)
%7 = tail call i32 @srand(i32 %6)
%8 = tail call i32 (...) @rand()
%9 = srem i32 %8, 100
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 11
%12 = icmp ult i32 %9, 20
br i1 %12, label %13, label %15
13: ; preds = %3
%14 = add nsw i32 %11, 15
store i8 79, i8* %5
br label %17
15: ; preds = %3
store i8 67, i8* %5
%16 = add nsw i32 %11, 12
br label %17
17: ; preds = %15, %13
%18 = phi i8 [ 114, %13 ], [ 97, %15 ]
%19 = phi i8 [ 99, %13 ], [ 104, %15 ]
%20 = phi i8 [ 32, %13 ], [ 110, %15 ]
%21 = phi i32 [ %14, %13 ], [ %16, %15 ]
%22 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 1
store i8 %18, i8* %22
%23 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 2
store i8 %19, i8* %23
%24 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 3
store i8 %20, i8* %24
%25 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 4
store i8 0, i8* %25
%26 = load i32, i32* %0
%27 = icmp sgt i32 %26, 0
br i1 %27, label %28, label %133
28: ; preds = %17, %127
%29 = phi i8 [ %34, %127 ], [ 1, %17 ]
%30 = phi i32 [ %116, %127 ], [ %21, %17 ]
%31 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %5)
br label %32
32: ; preds = %90, %28
%33 = phi i32 [ 0, %28 ], [ %71, %90 ]
%34 = phi i8 [ %29, %28 ], [ %91, %90 ]
switch i32 %33, label %35 [
i32 13, label %92
i32 10, label %92
]
35: ; preds = %32
%36 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 10, i32 1, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 11, i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 12, i32 1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
%39 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 13, i32 1, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0))
%40 = icmp eq i8 %34, 1
br i1 %40, label %59, label %41
41: ; preds = %35
%42 = add i8 %34, -2
%43 = icmp ult i8 %42, 3
br i1 %43, label %44, label %69
44: ; preds = %41
%45 = zext i8 %42 to i24
%46 = shl nuw nsw i24 %45, 3
%47 = lshr i24 2105406, %46
%48 = trunc i24 %47 to i8
%49 = zext i8 %42 to i24
%50 = shl nuw nsw i24 %49, 3
%51 = lshr i24 2113056, %50
%52 = trunc i24 %51 to i8
%53 = zext i8 %42 to i24
%54 = shl nuw nsw i24 %53, 3
%55 = lshr i24 4071456, %54
%56 = trunc i24 %55 to i8
%57 = trunc i8 %42 to i3
%58 = icmp eq i3 %57, 2
br label %59
59: ; preds = %44, %35
%60 = phi i8 [ 62, %35 ], [ 32, %44 ]
%61 = phi i8 [ 32, %35 ], [ %48, %44 ]
%62 = phi i8 [ 32, %35 ], [ %52, %44 ]
%63 = phi i8 [ 32, %35 ], [ %56, %44 ]
%64 = phi i1 [ false, %35 ], [ %58, %44 ]
%65 = call i32 @mvaddch(i32 10, i32 0, i8 signext %60)
%66 = call i32 @mvaddch(i32 11, i32 0, i8 signext %61)
%67 = call i32 @mvaddch(i32 12, i32 0, i8 signext %62)
%68 = call i32 @mvaddch(i32 13, i32 0, i8 signext %63)
br label %69
69: ; preds = %41, %59
%70 = phi i1 [ false, %41 ], [ %64, %59 ]
%71 = call i32 (...) @getch()
%72 = load i32, i32* @KEY_UP
%73 = icmp eq i32 %71, %72
%74 = icmp ne i8 %34, 1
%75 = select i1 %73, i1 %74, i1 false
br i1 %75, label %76, label %78
76: ; preds = %69
%77 = add i8 %34, -1
br label %90
78: ; preds = %69
%79 = select i1 %73, i1 %40, i1 false
br i1 %79, label %90, label %80
80: ; preds = %78
%81 = load i32, i32* @KEY_DOWN
%82 = icmp eq i32 %71, %81
%83 = icmp ne i8 %34, 4
%84 = select i1 %82, i1 %83, i1 false
br i1 %84, label %85, label %87
85: ; preds = %80
%86 = add i8 %34, 1
br label %90
87: ; preds = %80
%88 = and i1 %70, %82
%89 = select i1 %88, i8 1, i8 %34
br label %90
90: ; preds = %87, %78, %85, %76
%91 = phi i8 [ %89, %87 ], [ 4, %78 ], [ %86, %85 ], [ %77, %76 ]
br label %32
92: ; preds = %32, %32
switch i8 %34, label %115 [
i8 1, label %93
i8 2, label %109
i8 3, label %111
i8 4, label %113
]
93: ; preds = %92
%94 = load i32, i32* %1
%95 = sdiv i32 %94, 5
%96 = load i32, i32* %2
%97 = sdiv i32 %96, 5
%98 = add nsw i32 %97, 5
%99 = call i32 (...) @rand()
%100 = srem i32 %99, 100
%101 = icmp slt i32 %100, %98
br i1 %101, label %102, label %105
102: ; preds = %93
%103 = sdiv i32 %94, 10
%104 = add nsw i32 %95, %103
br label %105
105: ; preds = %102, %93
%106 = phi i32 [ %104, %102 ], [ %95, %93 ]
%107 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* %5, i32 %106)
%108 = sub nsw i32 %30, %106
br label %115
109: ; preds = %92
%110 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0))
br label %115
111: ; preds = %92
%112 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0))
br label %115
113: ; preds = %92
%114 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 15, i32 0, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0))
br label %115
115: ; preds = %92, %109, %113, %111, %105
%116 = phi i32 [ %108, %105 ], [ %30, %109 ], [ %30, %111 ], [ %30, %113 ], [ %30, %92 ]
%117 = icmp sgt i32 %116, 0
br i1 %117, label %120, label %118
118: ; preds = %115
%119 = load i32, i32* %0
br label %127
120: ; preds = %115
%121 = call i32 (...) @rand()
%122 = srem i32 %121, 5
%123 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 17, i32 0, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.9, i64 0, i64 0), i8* %5, i32 %122)
%124 = call i32 (...) @refresh()
%125 = load i32, i32* %0
%126 = sub nsw i32 %125, %122
store i32 %126, i32* %0
br label %127
127: ; preds = %118, %120
%128 = phi i32 [ %119, %118 ], [ %126, %120 ]
%129 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 3, i32 4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i32 %128)
%130 = load i32, i32* %0
%131 = icmp sgt i32 %130, 0
%132 = select i1 %131, i1 %117, i1 false
br i1 %132, label %28, label %133
133: ; preds = %127, %17
%134 = call i32 @move(i32 10, i32 0)
%135 = call i32 (...) @clrtobot()
%136 = load i32, i32* %0
%137 = icmp slt i32 %136, 1
br i1 %137, label %138, label %140
138: ; preds = %133
%139 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0))
br label %142
140: ; preds = %133
%141 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 8, i32 0, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* %5)
br label %142
142: ; preds = %140, %138
%143 = call i32 (i32, i32, i8*, ...) @mvprintw(i32 10, i32 0, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
%144 = call i32 (...) @refresh()
%145 = call i32 (...) @getch()
ret void
}