#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 */
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ *xreadline(char *, char *, int);
void _prompt_loop_rpc3(void) {
  int i;
  char buf[128];
  int num_plugs = 8;
  char plug[8][4];
  int plug_origin = 1;
  enum { START, MENU, OUTLET, QUIT } state = START;
  char *prompt = NULL;
  for (i = 0; i < num_plugs; i++)
    strcpy(plug[i], "Off");
  printf(
      "\r\n\r\n\r\n        RPC-3 Telnet Host\r\n    Revision F 5.01, (C) 2001 "
      "\r\n    Bay Technical Associates\r\n    Unit ID: BT RPC3-20\r\n");
  while (state != QUIT) {
    switch (state) {
    case START:
      prompt = "\r\n    Enter password>";
      break;
    case MENU:
      prompt =
          "\r\n  RPC-3 Menu:\r\n\r\n    1)...Outlet Control\r\n    2)...Manage "
          "Users\r\n    3)...Configuration\r\n    4)...Unit Status\r\n    "
          "5)...Reset Unit\r\n    6)...Logout\r\n\r\n  Enter Selection>";
      break;
    case OUTLET:
      printf("  True RMS current:  1.7 Amps\r\n  Maximum Detected:  2.5 "
             "Amps\r\n\r\n  Internal Temperature: 32.0 C\r\n\r\n  Circuit "
             "Breaker: On \r\n\r\n  Selection   Outlet    Outlet   Power\r\n   "
             " Number     Name     Number   Status\r\n      1       Outlet 1   "
             " 1       %s \r\n      2       Outlet 2    2       %s \r\n      3 "
             "      Outlet 3    3       %s \r\n      4       Outlet 4    4     "
             "  %s \r\n      5       Outlet 5    5       %s \r\n      6       "
             "Outlet 6    6       %s \r\n      7       Outlet 7    7       %s "
             "\r\n      8       Outlet 8    8       %s \r\n\r\n  Type \"Help\" "
             "for a list of commands\r\n\r\n",
             plug[0], plug[1], plug[2], plug[3], plug[4], plug[5], plug[6],
             plug[7]);
      prompt = "  RPC-3>";
      break;
    case QUIT:
      break;
    }
    if (xreadline(prompt, buf, sizeof(buf)) == NULL) {
      state = QUIT;
      continue;
    }
    switch (state) {
    case START:
      if (!strcmp(buf, "baytech")) {
        printf("  Option(s) installed:\r\n  True RMS Current\r\n  Internal "
               "Temperature\r\n\r\n\r\n");
        state = MENU;
      } else
        printf("    Invalid password.\r\n\r\n");
      break;
    case MENU:
      if (!strcmp(buf, "1"))
        state = OUTLET;
      else if (!strcmp(buf, "6"))
        state = QUIT;
      else
        goto err;
      break;
    case OUTLET:
      if (!strcmp(buf, "?") || !strcmp(buf, "help")) {
        if (xreadline(
                "  RPC3 Command Summary (F 5.01).\r\n  \"n\" refers to "
                "Selection Number, as displayed in outlet status\r\n  LOGOUT   "
                "  : terminate session\r\n  OFF n      : turn off outlet "
                "\"n\", do all for n = 0\r\n  ON n       : turn on outlet "
                "\"n\", do all for n = 0\r\n  REBOOT n   : cycle power off/on "
                "outlet \"n\", do all for n = 0\r\n  RC         : display "
                "outlet relay control info\r\n  STATUS     : display power "
                "status of outlets\r\n  HELP       : display this message\r\n  "
                "CLEAR      : Reset the maximum detected current\r\n  CURRENT  "
                "  : Read the current\r\n  TEMP       : Read current "
                "temperature\r\n  MENU       : return to main menu\r\n\r\n  "
                "<Strike CR to continue.>",
                buf, sizeof(buf)) == NULL)
          state = QUIT;
      } else if (!strcmp(buf, "menu")) {
        state = MENU;
      } else if (!strcmp(buf, "logout")) {
        state = QUIT;
      } else if (!strcmp(buf, "status")) {
      } else if (sscanf(buf, "on %d", &i) == 1) {
        if (i >= plug_origin && i < num_plugs + plug_origin)
          strcpy(plug[i - plug_origin], "On ");
        else if (i == 0)
          for (i = 0; i < num_plugs; i++)
            strcpy(plug[i], "On ");
        else
          goto err;
      } else if (sscanf(buf, "off %d", &i) == 1) {
        if (i >= plug_origin && i < num_plugs + plug_origin)
          strcpy(plug[i - plug_origin], "Off");
        else if (i == 0)
          for (i = 0; i < num_plugs; i++)
            strcpy(plug[i], "Off");
        else
          goto err;
      } else
        goto err;
      break;
    case QUIT:
      break;
    }
    continue;
  err:
    printf("\r\n  Input error.\r\n\r\n");
  }
}


x86 assembly (clang, -O0):
<_prompt_loop_rpc3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x8,-0x94(%rbp)
movl   $0x1,-0xc4(%rbp)
movl   $0x0,-0xc8(%rbp)
movq   $0x0,-0xd0(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    11c6 <_prompt_loop_rpc3+0x76>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xe6d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    118b <_prompt_loop_rpc3+0x3b>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x3,-0xc8(%rbp)
je     168d <_prompt_loop_rpc3+0x53d>
mov    -0xc8(%rbp),%eax
mov    %rax,-0xd8(%rbp)
sub    $0x3,%rax
ja     12bd <_prompt_loop_rpc3+0x16d>
mov    -0xd8(%rbp),%rax
lea    0xdfa(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xe87(%rip),%rax
mov    %rax,-0xd0(%rbp)
jmp    12bd <_prompt_loop_rpc3+0x16d>
lea    0xe8a(%rip),%rax
mov    %rax,-0xd0(%rbp)
jmp    12bd <_prompt_loop_rpc3+0x16d>
lea    -0xc0(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
add    $0x4,%rdx
lea    -0xc0(%rbp),%rcx
add    $0x8,%rcx
lea    -0xc0(%rbp),%r8
add    $0xc,%r8
lea    -0xc0(%rbp),%r9
add    $0x10,%r9
lea    -0xc0(%rbp),%r11
add    $0x14,%r11
lea    -0xc0(%rbp),%r10
add    $0x18,%r10
lea    -0xc0(%rbp),%rax
add    $0x1c,%rax
lea    0xecf(%rip),%rdi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
lea    0x10e3(%rip),%rax
mov    %rax,-0xd0(%rbp)
jmp    12bd <_prompt_loop_rpc3+0x16d>
jmp    12bd <_prompt_loop_rpc3+0x16d>
mov    -0xd0(%rbp),%rdi
lea    -0x90(%rbp),%rsi
mov    $0x80,%edx
call   1050 <xreadline@plt>
cmp    $0x0,%rax
jne    12ee <_prompt_loop_rpc3+0x19e>
movl   $0x3,-0xc8(%rbp)
jmp    11d4 <_prompt_loop_rpc3+0x84>
mov    -0xc8(%rbp),%eax
mov    %rax,-0xe0(%rbp)
sub    $0x3,%rax
ja     1675 <_prompt_loop_rpc3+0x525>
mov    -0xe0(%rbp),%rax
lea    0xcfd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x90(%rbp),%rdi
lea    0x106e(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1355 <_prompt_loop_rpc3+0x205>
lea    0x1061(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0xc8(%rbp)
jmp    1363 <_prompt_loop_rpc3+0x213>
lea    0x108d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1675 <_prompt_loop_rpc3+0x525>
lea    -0x90(%rbp),%rdi
lea    0x108d(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1393 <_prompt_loop_rpc3+0x243>
movl   $0x2,-0xc8(%rbp)
jmp    13c8 <_prompt_loop_rpc3+0x278>
lea    -0x90(%rbp),%rdi
lea    0x1064(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    13be <_prompt_loop_rpc3+0x26e>
movl   $0x3,-0xc8(%rbp)
jmp    13c3 <_prompt_loop_rpc3+0x273>
jmp    167a <_prompt_loop_rpc3+0x52a>
jmp    13c8 <_prompt_loop_rpc3+0x278>
jmp    1675 <_prompt_loop_rpc3+0x525>
lea    -0x90(%rbp),%rdi
lea    0x102c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
je     1405 <_prompt_loop_rpc3+0x2b5>
lea    -0x90(%rbp),%rdi
lea    0x1012(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1436 <_prompt_loop_rpc3+0x2e6>
lea    -0x90(%rbp),%rsi
lea    0xffb(%rip),%rdi
mov    $0x80,%edx
call   1050 <xreadline@plt>
cmp    $0x0,%rax
jne    1431 <_prompt_loop_rpc3+0x2e1>
movl   $0x3,-0xc8(%rbp)
jmp    166b <_prompt_loop_rpc3+0x51b>
lea    -0x90(%rbp),%rdi
lea    0x123f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1461 <_prompt_loop_rpc3+0x311>
movl   $0x1,-0xc8(%rbp)
jmp    1666 <_prompt_loop_rpc3+0x516>
lea    -0x90(%rbp),%rdi
lea    0x1219(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    148c <_prompt_loop_rpc3+0x33c>
movl   $0x3,-0xc8(%rbp)
jmp    1661 <_prompt_loop_rpc3+0x511>
lea    -0x90(%rbp),%rdi
lea    0x11f5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    14ad <_prompt_loop_rpc3+0x35d>
jmp    165c <_prompt_loop_rpc3+0x50c>
lea    -0x90(%rbp),%rdi
lea    0x11db(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    157d <_prompt_loop_rpc3+0x42d>
mov    -0x4(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jl     151d <_prompt_loop_rpc3+0x3cd>
mov    -0x4(%rbp),%eax
mov    -0x94(%rbp),%ecx
add    -0xc4(%rbp),%ecx
cmp    %ecx,%eax
jge    151d <_prompt_loop_rpc3+0x3cd>
mov    -0x4(%rbp),%eax
sub    -0xc4(%rbp),%eax
cltq
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x1189(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1578 <_prompt_loop_rpc3+0x428>
cmpl   $0x0,-0x4(%rbp)
jne    156e <_prompt_loop_rpc3+0x41e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1569 <_prompt_loop_rpc3+0x419>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x1146(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    152e <_prompt_loop_rpc3+0x3de>
jmp    1573 <_prompt_loop_rpc3+0x423>
jmp    167a <_prompt_loop_rpc3+0x52a>
jmp    1578 <_prompt_loop_rpc3+0x428>
jmp    1657 <_prompt_loop_rpc3+0x507>
lea    -0x90(%rbp),%rdi
lea    0x1115(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    164d <_prompt_loop_rpc3+0x4fd>
mov    -0x4(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jl     15ed <_prompt_loop_rpc3+0x49d>
mov    -0x4(%rbp),%eax
mov    -0x94(%rbp),%ecx
add    -0xc4(%rbp),%ecx
cmp    %ecx,%eax
jge    15ed <_prompt_loop_rpc3+0x49d>
mov    -0x4(%rbp),%eax
sub    -0xc4(%rbp),%eax
cltq
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xa3d(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1648 <_prompt_loop_rpc3+0x4f8>
cmpl   $0x0,-0x4(%rbp)
jne    163e <_prompt_loop_rpc3+0x4ee>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    1639 <_prompt_loop_rpc3+0x4e9>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x9fa(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    15fe <_prompt_loop_rpc3+0x4ae>
jmp    1643 <_prompt_loop_rpc3+0x4f3>
jmp    167a <_prompt_loop_rpc3+0x52a>
jmp    1648 <_prompt_loop_rpc3+0x4f8>
jmp    1652 <_prompt_loop_rpc3+0x502>
jmp    167a <_prompt_loop_rpc3+0x52a>
jmp    1657 <_prompt_loop_rpc3+0x507>
jmp    165c <_prompt_loop_rpc3+0x50c>
jmp    1661 <_prompt_loop_rpc3+0x511>
jmp    1666 <_prompt_loop_rpc3+0x516>
jmp    166b <_prompt_loop_rpc3+0x51b>
jmp    1675 <_prompt_loop_rpc3+0x525>
jmp    1675 <_prompt_loop_rpc3+0x525>
jmp    11d4 <_prompt_loop_rpc3+0x84>
lea    0x1026(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11d4 <_prompt_loop_rpc3+0x84>
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_prompt_loop_rpc3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
lea    0xe8e(%rip),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x7,%ecx
jl     1180 <_prompt_loop_rpc3+0x30>
lea    0x13f4(%rip),%rdi
call   1040 <puts@plt>
lea    0x30(%rsp),%r14
lea    0x145b(%rip),%r15
mov    $0x706c6568,%ebp
lea    0xc(%rsp),%r13
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    11d8 <_prompt_loop_rpc3+0x88>
nopl   0x0(%rax,%rax,1)
mov    %r15,%rdi
call   1040 <puts@plt>
cmp    $0x2,%r12d
je     1200 <_prompt_loop_rpc3+0xb0>
cmp    $0x1,%r12d
je     1250 <_prompt_loop_rpc3+0x100>
test   %r12d,%r12d
jne    1257 <_prompt_loop_rpc3+0x107>
lea    0xe14(%rip),%rbx
jmp    1257 <_prompt_loop_rpc3+0x107>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
sub    $0x8,%rsp
lea    0xebb(%rip),%rdi
lea    0x18(%rsp),%rsi
lea    0x1c(%rsp),%rdx
lea    0x20(%rsp),%rcx
lea    0x24(%rsp),%r8
lea    0x28(%rsp),%r9
xor    %eax,%eax
lea    0x34(%rsp),%rbx
push   %rbx
lea    0x38(%rsp),%rbx
push   %rbx
lea    0x3c(%rsp),%rbx
push   %rbx
call   1050 <printf@plt>
add    $0x20,%rsp
lea    0x10ae(%rip),%rbx
jmp    1257 <_prompt_loop_rpc3+0x107>
nopw   0x0(%rax,%rax,1)
lea    0xdc3(%rip),%rbx
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
test   %rax,%rax
je     1399 <_prompt_loop_rpc3+0x249>
cmp    $0x1,%r12d
je     1380 <_prompt_loop_rpc3+0x230>
cmp    $0x2,%r12d
jne    1437 <_prompt_loop_rpc3+0x2e7>
cmpw   $0x3f,0x30(%rsp)
je     1476 <_prompt_loop_rpc3+0x326>
mov    0x30(%rsp),%eax
xor    %ebp,%eax
movzbl 0x34(%rsp),%ecx
or     %eax,%ecx
je     1476 <_prompt_loop_rpc3+0x326>
mov    0x30(%rsp),%eax
mov    $0x756e656d,%ecx
xor    %ecx,%eax
movzbl 0x34(%rsp),%ecx
or     %eax,%ecx
je     14b9 <_prompt_loop_rpc3+0x369>
mov    0x30(%rsp),%eax
mov    $0x6f676f6c,%ecx
xor    %ecx,%eax
mov    0x33(%rsp),%ecx
mov    $0x74756f,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     1399 <_prompt_loop_rpc3+0x249>
mov    0x30(%rsp),%eax
mov    $0x74617473,%ecx
xor    %ecx,%eax
mov    0x33(%rsp),%ecx
mov    $0x737574,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     14cb <_prompt_loop_rpc3+0x37b>
mov    %r14,%rdi
lea    0x128b(%rip),%rsi
mov    %r13,%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    13b0 <_prompt_loop_rpc3+0x260>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
jbe    14f8 <_prompt_loop_rpc3+0x3a8>
test   %eax,%eax
jne    11d0 <_prompt_loop_rpc3+0x80>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
lea    0x1257(%rip),%rbp
nopl   0x0(%rax,%rax,1)
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %rbp,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x7,%ecx
jl     1340 <_prompt_loop_rpc3+0x1f0>
mov    $0x2,%r12d
mov    $0x706c6568,%ebp
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
nopl   0x0(%rax)
movzwl 0x30(%rsp),%eax
cmp    $0x31,%ax
je     14a7 <_prompt_loop_rpc3+0x357>
cmp    $0x36,%ax
jne    11d0 <_prompt_loop_rpc3+0x80>
mov    $0x3,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
xchg   %ax,%ax
mov    %r14,%rdi
lea    0x11dc(%rip),%rsi
mov    %r13,%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    11d0 <_prompt_loop_rpc3+0x80>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
jbe    150b <_prompt_loop_rpc3+0x3bb>
test   %eax,%eax
jne    11d0 <_prompt_loop_rpc3+0x80>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
lea    0xc0c(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x7,%ecx
jl     1400 <_prompt_loop_rpc3+0x2b0>
mov    $0x2,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
test   %r12d,%r12d
jne    14ec <_prompt_loop_rpc3+0x39c>
movabs $0x68636574796162,%rax
cmp    %rax,0x30(%rsp)
jne    14dd <_prompt_loop_rpc3+0x38d>
lea    0x11cd(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
lea    0xe87(%rip),%rdi
mov    %r14,%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
xor    %r12d,%r12d
test   %rax,%rax
sete   %r12b
or     $0x2,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
mov    $0x2,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
mov    $0x1,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
mov    $0x2,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
lea    0x118d(%rip),%rdi
call   1040 <puts@plt>
xor    %r12d,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
jmp    1531 <_prompt_loop_rpc3+0x3e1>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0x1089(%rip),%rsi
jmp    151c <_prompt_loop_rpc3+0x3cc>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0xae4(%rip),%rsi
call   1030 <strcpy@plt>
mov    $0x2,%r12d
cmp    $0x3,%r12d
jne    11d8 <_prompt_loop_rpc3+0x88>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"Off\00"
@.str.1 = [121 x i8] c"\0D\0A\0D\0A\0D\0A RPC-3 Telnet Host\0D\0A Revision F 5.01, (C) 2001 \0D\0A Bay Technical Associates\0D\0A Unit ID: BT RPC3-20\0D\0A\00"
@.str.2 = [22 x i8] c"\0D\0A Enter password>\00"
@.str.3 = [172 x i8] c"\0D\0A RPC-3 Menu:\0D\0A\0D\0A 1)...Outlet Control\0D\0A 2)...Manage Users\0D\0A 3)...Configuration\0D\0A 4)...Unit Status\0D\0A 5)...Reset Unit\0D\0A 6)...Logout\0D\0A\0D\0A Enter Selection>\00"
@.str.4 = [560 x i8] c" True RMS current: 1.7 Amps\0D\0A Maximum Detected: 2.5 Amps\0D\0A\0D\0A Internal Temperature: 32.0 C\0D\0A\0D\0A Circuit Breaker: On \0D\0A\0D\0A Selection Outlet Outlet Power\0D\0A Number Name Number Status\0D\0A 1 Outlet 1 1 %s \0D\0A 2 Outlet 2 2 %s \0D\0A 3 Outlet 3 3 %s \0D\0A 4 Outlet 4 4 %s \0D\0A 5 Outlet 5 5 %s \0D\0A 6 Outlet 6 6 %s \0D\0A 7 Outlet 7 7 %s \0D\0A 8 Outlet 8 8 %s \0D\0A\0D\0A Type \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.5 = [9 x i8] c" RPC-3>\00"
@.str.6 = [8 x i8] c"baytech\00"
@.str.7 = [73 x i8] c" Option(s) installed:\0D\0A True RMS Current\0D\0A Internal Temperature\0D\0A\0D\0A\0D\0A\00"
@.str.8 = [26 x i8] c" Invalid password.\0D\0A\0D\0A\00"
@.str.9 = [2 x i8] c"1\00"
@.str.10 = [2 x i8] c"6\00"
@.str.11 = [2 x i8] c"?\00"
@.str.12 = [5 x i8] c"help\00"
@.str.13 = [629 x i8] c" RPC3 Command Summary (F 5.01).\0D\0A \22n\22 refers to Selection Number, as displayed in outlet status\0D\0A LOGOUT : terminate session\0D\0A OFF n : turn off outlet \22n\22, do all for n = 0\0D\0A ON n : turn on outlet \22n\22, do all for n = 0\0D\0A REBOOT n : cycle power off/on outlet \22n\22, do all for n = 0\0D\0A RC : display outlet relay control info\0D\0A STATUS : display power status of outlets\0D\0A HELP : display this message\0D\0A CLEAR : Reset the maximum detected current\0D\0A CURRENT : Read the current\0D\0A TEMP : Read current temperature\0D\0A MENU : return to main menu\0D\0A\0D\0A <Strike CR to continue.>\00"
@.str.14 = [5 x i8] c"menu\00"
@.str.15 = [7 x i8] c"logout\00"
@.str.16 = [7 x i8] c"status\00"
@.str.17 = [6 x i8] c"on %d\00"
@.str.18 = [4 x i8] c"On \00"
@.str.19 = [7 x i8] c"off %d\00"
@.str.20 = [21 x i8] c"\0D\0A Input error.\0D\0A\0D\0A\00"
define void @_prompt_loop_rpc3() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca [8 x [4 x i8]]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i32 8, i32* %3
store i32 1, i32* %5
store i32 0, i32* %6
store i8* null, i8** %7
store i32 0, i32* %1
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %1
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %21
12: ; preds = %8
%13 = load i32, i32* %1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %14
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %15, i64 0, i64 0
%17 = call i32 @strcpy(i8* %16, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %12
%19 = load i32, i32* %1
%20 = add nsw i32 %19, 1
store i32 %20, i32* %1
br label %8
21: ; preds = %8
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([121 x i8], [121 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %203, %202, %54, %21
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 3
br i1 %25, label %26, label %205
26: ; preds = %23
%27 = load i32, i32* %6
switch i32 %27, label %49 [
i32 0, label %28
i32 1, label %29
i32 2, label %30
i32 3, label %48
]
28: ; preds = %26
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), i8** %7
br label %49
29: ; preds = %26
store i8* getelementptr inbounds ([172 x i8], [172 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %49
30: ; preds = %26
%31 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 0
%32 = getelementptr inbounds [4 x i8], [4 x i8]* %31, i64 0, i64 0
%33 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 1
%34 = getelementptr inbounds [4 x i8], [4 x i8]* %33, i64 0, i64 0
%35 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 2
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %35, i64 0, i64 0
%37 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 3
%38 = getelementptr inbounds [4 x i8], [4 x i8]* %37, i64 0, i64 0
%39 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 4
%40 = getelementptr inbounds [4 x i8], [4 x i8]* %39, i64 0, i64 0
%41 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 5
%42 = getelementptr inbounds [4 x i8], [4 x i8]* %41, i64 0, i64 0
%43 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 6
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %43, i64 0, i64 0
%45 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 7
%46 = getelementptr inbounds [4 x i8], [4 x i8]* %45, i64 0, i64 0
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([560 x i8], [560 x i8]* @.str.4, i64 0, i64 0), i8* %32, i8* %34, i8* %36, i8* %38, i8* %40, i8* %42, i8* %44, i8* %46)
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %7
br label %49
48: ; preds = %26
br label %49
49: ; preds = %26, %48, %30, %29, %28
%50 = load i8*, i8** %7
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%52 = call i32* @xreadline(i8* %50, i8* %51, i32 128)
%53 = icmp eq i32* %52, null
br i1 %53, label %54, label %55
54: ; preds = %49
store i32 3, i32* %6
br label %23
55: ; preds = %49
%56 = load i32, i32* %6
switch i32 %56, label %202 [
i32 0, label %57
i32 1, label %66
i32 2, label %79
i32 3, label %201
]
57: ; preds = %55
%58 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%59 = call i32 @strcmp(i8* %58, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.6, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %63, label %61
61: ; preds = %57
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %6
br label %65
63: ; preds = %57
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
br label %65
65: ; preds = %63, %61
br label %202
66: ; preds = %55
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %71, label %70
70: ; preds = %66
store i32 2, i32* %6
br label %78
71: ; preds = %66
%72 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %76, label %75
75: ; preds = %71
store i32 3, i32* %6
br label %77
76: ; preds = %71
br label %203
77: ; preds = %75
br label %78
78: ; preds = %77, %70
br label %202
79: ; preds = %55
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %83, label %87
83: ; preds = %79
%84 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%85 = call i32 @strcmp(i8* %84, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0))
%86 = icmp ne i32 %85, 0
br i1 %86, label %93, label %87
87: ; preds = %83, %79
%88 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%89 = call i32* @xreadline(i8* getelementptr inbounds ([629 x i8], [629 x i8]* @.str.13, i64 0, i64 0), i8* %88, i32 128)
%90 = icmp eq i32* %89, null
br i1 %90, label %91, label %92
91: ; preds = %87
store i32 3, i32* %6
br label %92
92: ; preds = %91, %87
br label %200
93: ; preds = %83
%94 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%95 = call i32 @strcmp(i8* %94, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
%96 = icmp ne i32 %95, 0
br i1 %96, label %98, label %97
97: ; preds = %93
store i32 1, i32* %6
br label %199
98: ; preds = %93
%99 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%100 = call i32 @strcmp(i8* %99, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%101 = icmp ne i32 %100, 0
br i1 %101, label %103, label %102
102: ; preds = %98
store i32 3, i32* %6
br label %198
103: ; preds = %98
%104 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%105 = call i32 @strcmp(i8* %104, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0))
%106 = icmp ne i32 %105, 0
br i1 %106, label %108, label %107
107: ; preds = %103
br label %197
108: ; preds = %103
%109 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%110 = call i32 @sscanf(i8* %109, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32* %1)
%111 = icmp eq i32 %110, 1
br i1 %111, label %112, label %151
112: ; preds = %108
%113 = load i32, i32* %1
%114 = load i32, i32* %5
%115 = icmp sge i32 %113, %114
br i1 %115, label %116, label %130
116: ; preds = %112
%117 = load i32, i32* %1
%118 = load i32, i32* %3
%119 = load i32, i32* %5
%120 = add nsw i32 %118, %119
%121 = icmp slt i32 %117, %120
br i1 %121, label %122, label %130
122: ; preds = %116
%123 = load i32, i32* %1
%124 = load i32, i32* %5
%125 = sub nsw i32 %123, %124
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %126
%128 = getelementptr inbounds [4 x i8], [4 x i8]* %127, i64 0, i64 0
%129 = call i32 @strcpy(i8* %128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %150
130: ; preds = %116, %112
%131 = load i32, i32* %1
%132 = icmp eq i32 %131, 0
br i1 %132, label %133, label %148
133: ; preds = %130
store i32 0, i32* %1
br label %134
134: ; preds = %144, %133
%135 = load i32, i32* %1
%136 = load i32, i32* %3
%137 = icmp slt i32 %135, %136
br i1 %137, label %138, label %147
138: ; preds = %134
%139 = load i32, i32* %1
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %140
%142 = getelementptr inbounds [4 x i8], [4 x i8]* %141, i64 0, i64 0
%143 = call i32 @strcpy(i8* %142, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %144
144: ; preds = %138
%145 = load i32, i32* %1
%146 = add nsw i32 %145, 1
store i32 %146, i32* %1
br label %134
147: ; preds = %134
br label %149
148: ; preds = %130
br label %203
149: ; preds = %147
br label %150
150: ; preds = %149, %122
br label %196
151: ; preds = %108
%152 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%153 = call i32 @sscanf(i8* %152, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%154 = icmp eq i32 %153, 1
br i1 %154, label %155, label %194
155: ; preds = %151
%156 = load i32, i32* %1
%157 = load i32, i32* %5
%158 = icmp sge i32 %156, %157
br i1 %158, label %159, label %173
159: ; preds = %155
%160 = load i32, i32* %1
%161 = load i32, i32* %3
%162 = load i32, i32* %5
%163 = add nsw i32 %161, %162
%164 = icmp slt i32 %160, %163
br i1 %164, label %165, label %173
165: ; preds = %159
%166 = load i32, i32* %1
%167 = load i32, i32* %5
%168 = sub nsw i32 %166, %167
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %169
%171 = getelementptr inbounds [4 x i8], [4 x i8]* %170, i64 0, i64 0
%172 = call i32 @strcpy(i8* %171, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %193
173: ; preds = %159, %155
%174 = load i32, i32* %1
%175 = icmp eq i32 %174, 0
br i1 %175, label %176, label %191
176: ; preds = %173
store i32 0, i32* %1
br label %177
177: ; preds = %187, %176
%178 = load i32, i32* %1
%179 = load i32, i32* %3
%180 = icmp slt i32 %178, %179
br i1 %180, label %181, label %190
181: ; preds = %177
%182 = load i32, i32* %1
%183 = sext i32 %182 to i64
%184 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %183
%185 = getelementptr inbounds [4 x i8], [4 x i8]* %184, i64 0, i64 0
%186 = call i32 @strcpy(i8* %185, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %187
187: ; preds = %181
%188 = load i32, i32* %1
%189 = add nsw i32 %188, 1
store i32 %189, i32* %1
br label %177
190: ; preds = %177
br label %192
191: ; preds = %173
br label %203
192: ; preds = %190
br label %193
193: ; preds = %192, %165
br label %195
194: ; preds = %151
br label %203
195: ; preds = %193
br label %196
196: ; preds = %195, %150
br label %197
197: ; preds = %196, %107
br label %198
198: ; preds = %197, %102
br label %199
199: ; preds = %198, %97
br label %200
200: ; preds = %199, %92
br label %202
201: ; preds = %55
br label %202
202: ; preds = %55, %201, %200, %78, %65
br label %23
203: ; preds = %194, %191, %148, %76
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.20, i64 0, i64 0))
br label %23
205: ; preds = %23
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Off\00"
@.str.2 = [22 x i8] c"\0D\0A Enter password>\00"
@.str.3 = [172 x i8] c"\0D\0A RPC-3 Menu:\0D\0A\0D\0A 1)...Outlet Control\0D\0A 2)...Manage Users\0D\0A 3)...Configuration\0D\0A 4)...Unit Status\0D\0A 5)...Reset Unit\0D\0A 6)...Logout\0D\0A\0D\0A Enter Selection>\00"
@.str.4 = [560 x i8] c" True RMS current: 1.7 Amps\0D\0A Maximum Detected: 2.5 Amps\0D\0A\0D\0A Internal Temperature: 32.0 C\0D\0A\0D\0A Circuit Breaker: On \0D\0A\0D\0A Selection Outlet Outlet Power\0D\0A Number Name Number Status\0D\0A 1 Outlet 1 1 %s \0D\0A 2 Outlet 2 2 %s \0D\0A 3 Outlet 3 3 %s \0D\0A 4 Outlet 4 4 %s \0D\0A 5 Outlet 5 5 %s \0D\0A 6 Outlet 6 6 %s \0D\0A 7 Outlet 7 7 %s \0D\0A 8 Outlet 8 8 %s \0D\0A\0D\0A Type \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.5 = [9 x i8] c" RPC-3>\00"
@.str.12 = [5 x i8] c"help\00"
@.str.13 = [629 x i8] c" RPC3 Command Summary (F 5.01).\0D\0A \22n\22 refers to Selection Number, as displayed in outlet status\0D\0A LOGOUT : terminate session\0D\0A OFF n : turn off outlet \22n\22, do all for n = 0\0D\0A ON n : turn on outlet \22n\22, do all for n = 0\0D\0A REBOOT n : cycle power off/on outlet \22n\22, do all for n = 0\0D\0A RC : display outlet relay control info\0D\0A STATUS : display power status of outlets\0D\0A HELP : display this message\0D\0A CLEAR : Reset the maximum detected current\0D\0A CURRENT : Read the current\0D\0A TEMP : Read current temperature\0D\0A MENU : return to main menu\0D\0A\0D\0A <Strike CR to continue.>\00"
@.str.14 = [5 x i8] c"menu\00"
@.str.15 = [7 x i8] c"logout\00"
@.str.16 = [7 x i8] c"status\00"
@.str.17 = [6 x i8] c"on %d\00"
@.str.18 = [4 x i8] c"On \00"
@.str.19 = [7 x i8] c"off %d\00"
@str = [120 x i8] c"\0D\0A\0D\0A\0D\0A RPC-3 Telnet Host\0D\0A Revision F 5.01, (C) 2001 \0D\0A Bay Technical Associates\0D\0A Unit ID: BT RPC3-20\0D\00"
@str.21 = [20 x i8] c"\0D\0A Input error.\0D\0A\0D\00"
@str.22 = [72 x i8] c" Option(s) installed:\0D\0A True RMS Current\0D\0A Internal Temperature\0D\0A\0D\0A\0D\00"
@str.23 = [25 x i8] c" Invalid password.\0D\0A\0D\00"
define void @_prompt_loop_rpc3() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [8 x [4 x i8]]
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 0, i64 0
store i32 0, i32* %1
br label %7
7: ; preds = %0, %7
%8 = phi i32 [ 0, %0 ], [ %13, %7 ]
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %9, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %1
%13 = add nsw i32 %12, 1
store i32 %13, i32* %1
%14 = icmp slt i32 %12, 7
br i1 %14, label %7, label %15
15: ; preds = %7
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([120 x i8], [120 x i8]* @str, i64 0, i64 0))
%17 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 1, i64 0
%18 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 2, i64 0
%19 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 3, i64 0
%20 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 4, i64 0
%21 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 5, i64 0
%22 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 6, i64 0
%23 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 7, i64 0
%24 = bitcast [128 x i8]* %2 to i16*
%25 = bitcast [128 x i8]* %2 to i64*
br label %26
26: ; preds = %15, %114
%27 = phi i8* [ null, %15 ], [ %36, %114 ]
%28 = phi i32 [ 0, %15 ], [ %115, %114 ]
br label %29
29: ; preds = %26, %117
%30 = phi i8* [ %36, %117 ], [ %27, %26 ]
switch i32 %28, label %35 [
i32 2, label %33
i32 0, label %31
i32 1, label %32
]
31: ; preds = %29
br label %35
32: ; preds = %29
br label %35
33: ; preds = %29
%34 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([560 x i8], [560 x i8]* @.str.4, i64 0, i64 0), i8* %6, i8* %17, i8* %18, i8* %19, i8* %20, i8* %21, i8* %22, i8* %23)
br label %35
35: ; preds = %29, %33, %32, %31
%36 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), %33 ], [ getelementptr inbounds ([172 x i8], [172 x i8]* @.str.3, i64 0, i64 0), %32 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), %31 ], [ %30, %29 ]
%37 = call i32* @xreadline(i8* %36, i8* %5, i32 128)
%38 = icmp eq i32* %37, null
br i1 %38, label %114, label %39
39: ; preds = %35
switch i32 %28, label %112 [
i32 0, label %40
i32 1, label %47
i32 2, label %49
]
40: ; preds = %39
%41 = load i64, i64* %25
%42 = icmp eq i64 %41, 29382684974866786
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.22, i64 0, i64 0))
br label %114
45: ; preds = %40
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.23, i64 0, i64 0))
br label %114
47: ; preds = %39
%48 = load i16, i16* %24
switch i16 %48, label %117 [
i16 49, label %112
i16 54, label %114
]
49: ; preds = %39
%50 = load i16, i16* %24
%51 = icmp eq i16 %50, 63
br i1 %51, label %55, label %52
52: ; preds = %49
%53 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i64 5)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %59
55: ; preds = %52, %49
%56 = call i32* @xreadline(i8* getelementptr inbounds ([629 x i8], [629 x i8]* @.str.13, i64 0, i64 0), i8* %5, i32 128)
%57 = icmp eq i32* %56, null
%58 = select i1 %57, i32 3, i32 2
br label %114
59: ; preds = %52
%60 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0), i64 5)
%61 = icmp eq i32 %60, 0
br i1 %61, label %112, label %62
62: ; preds = %59
%63 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0), i64 7)
%64 = icmp eq i32 %63, 0
br i1 %64, label %112, label %65
65: ; preds = %62
%66 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i64 7)
%67 = icmp eq i32 %66, 0
br i1 %67, label %112, label %68
68: ; preds = %65
%69 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32* %1)
%70 = icmp eq i32 %69, 1
br i1 %70, label %71, label %90
71: ; preds = %68
%72 = load i32, i32* %1
%73 = add i32 %72, -1
%74 = icmp ult i32 %73, 8
br i1 %74, label %75, label %79
75: ; preds = %71
%76 = zext i32 %73 to i64
%77 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %76, i64 0
%78 = call i32 @strcpy(i8* %77, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %114
79: ; preds = %71
%80 = icmp eq i32 %72, 0
br i1 %80, label %81, label %117
81: ; preds = %79
store i32 0, i32* %1
br label %82
82: ; preds = %81, %82
%83 = phi i32 [ 0, %81 ], [ %88, %82 ]
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %84, i64 0
%86 = call i32 @strcpy(i8* %85, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
%87 = load i32, i32* %1
%88 = add nsw i32 %87, 1
store i32 %88, i32* %1
%89 = icmp slt i32 %87, 7
br i1 %89, label %82, label %114
90: ; preds = %68
%91 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %117
93: ; preds = %90
%94 = load i32, i32* %1
%95 = add i32 %94, -1
%96 = icmp ult i32 %95, 8
br i1 %96, label %97, label %101
97: ; preds = %93
%98 = zext i32 %95 to i64
%99 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %98, i64 0
%100 = call i32 @strcpy(i8* %99, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %114
101: ; preds = %93
%102 = icmp eq i32 %94, 0
br i1 %102, label %103, label %117
103: ; preds = %101
store i32 0, i32* %1
br label %104
104: ; preds = %103, %104
%105 = phi i32 [ 0, %103 ], [ %110, %104 ]
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %106, i64 0
%108 = call i32 @strcpy(i8* %107, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%109 = load i32, i32* %1
%110 = add nsw i32 %109, 1
store i32 %110, i32* %1
%111 = icmp slt i32 %109, 7
br i1 %111, label %104, label %114
112: ; preds = %39, %65, %59, %62, %47
%113 = phi i32 [ 3, %62 ], [ 1, %59 ], [ 2, %47 ], [ 2, %65 ], [ %28, %39 ]
br label %114
114: ; preds = %104, %82, %47, %35, %112, %45, %43, %97, %75, %55
%115 = phi i32 [ 2, %75 ], [ 2, %97 ], [ 0, %45 ], [ 1, %43 ], [ %58, %55 ], [ %113, %112 ], [ 3, %35 ], [ 3, %47 ], [ 2, %82 ], [ 2, %104 ]
%116 = icmp eq i32 %115, 3
br i1 %116, label %119, label %26
117: ; preds = %47, %90, %101, %79
%118 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.21, i64 0, i64 0))
br label %29
119: ; preds = %114
ret void
}