#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ *xreadline(char *, char *, int);
void _prompt_loop_rpc28_nc(void) {
  int i;
  char buf[128];
  int num_plugs = 20;
  char plug[20][4];
  int plug_origin = 1;
  int logged_in = 1;
  int seq = 0;
  for (i = 0; i < num_plugs; i++)
    strcpy(plug[i], "Off");
  printf(
      "RPC-28 Series\n(C) 2000 by BayTech\nF3.01\n\nOption(s) Installed:\nTrue "
      "RMS Current\nInternal Temperature\nTrue RMS Voltage\n\n");
  while (logged_in) {
    if (xreadline((seq++ % 2) ? "RPC-28>" : "RPC-28A>", buf, sizeof(buf)) ==
        NULL)
      break;
    if (strlen(buf) == 0) {
      continue;
    } else if (!strcmp(buf, "logoff") || !strcmp(buf, "logout") ||
               !strcmp(buf, "exit")) {
      break;
    } else if (!strcmp(buf, "help")) {
      printf(
          "\r\nOn n <cr>     --Turn on an Outlet, n=0,1...20,all\r\nOff n <cr> "
          "   --Turn off an Outlet, n=0,1...20,all\r\nReboot n <cr> --Reboot "
          "an Outlet, n=0,1...20,all\r\nStatus <cr>   --RPC-28 "
          "Status\r\nConfig <cr>   --Enter configuration mode\r\nLock n <cr>   "
          "--Locks Outlet(s) state, n=0,1...20,all\r\nUnlock n <cr> --Unlock "
          "Outlet(s) state, n=0,1...20,all\r\nCurrent <cr>  --Display True RMS "
          "Current\r\nClear <cr>    --Reset the maximum detected "
          "current\r\nTemp <cr>     --Read current temperature\r\nVoltage <cr> "
          " --Display True RMS Voltage\r\nLogout <cr>   --Logoff\r\nLogoff "
          "<cr>   --Logoff\r\nExit <cr>     --Logoff\r\nPassword <cr> "
          "--Changes the current user password\r\nWhoami <cr>   --Displays the "
          "current user name\r\nUnitid <cr>   --Displays the unit ID\r\nHelp "
          "<cr>     --This Command\r\n\r\n\r\nType \"Help\" for a list of "
          "commands\r\n\r\n");
    } else if (!strcmp(buf, "temp"))
      printf("\r\nInternal Temperature:  30.0 C\r\n\r\nType \"Help\" for a "
             "list of commands\r\n\r\n");
    else if (!strcmp(buf, "voltage"))
      printf("\r\n                    Outlet  1-10         Outlet 11-21 "
             "\r\nTrue RMS Voltage:   118.0 Volts     :    118.7 Volts "
             "\r\n\r\nType \"Help\" for a list of commands\r\n\r\n");
    else if (!strcmp(buf, "current"))
      printf("\r\n                    Outlet  1-10         Outlet 11-21 "
             "\r\nTrue RMS Current:     5.5 Amps      :      0.1 "
             "Amps\r\nMaximum Detected:     6.9 Amps      :      2.8 "
             "Amps\r\n\r\nType \"Help\" for a list of commands\r\n\r\n");
    else if (!strcmp(buf, "status")) {
      printf("\r\n                    Outlet  1-10         Outlet 11-21 \r\n   "
             "Average Power:     619 Watts     :        5 Watts \r\nTrue RMS "
             "Voltage:   117.9 Volts     :    118.8 Volts \r\nTrue RMS "
             "Current:     5.4 Amps      :      0.1 Amps\r\nMaximum Detected:  "
             "   6.9 Amps      :      2.8 Amps\r\n Circuit Breaker:       Good "
             "       :        Good  \r\n\r\nInternal Temperature:  30.0 "
             "C\r\n\r\n\r\n 1)...Outlet  1       : %s           2)...Outlet  2 "
             "      : %s          \r\n 3)...Outlet  3       : %s           "
             "4)...Outlet  4       : %s          \r\n 5)...Outlet  5       : "
             "%s           6)...Outlet  6       : %s          \r\n 7)...Outlet "
             " 7       : %s           8)...Outlet  8       : %s          \r\n "
             "9)...Outlet  9       : %s          10)...Outlet 10       : %s    "
             "      \r\n11)...Outlet 11       : %s          12)...Outlet 12    "
             "   : %s          \r\n13)...Outlet 13       : %s          "
             "14)...Outlet 14       : %s          \r\n15)...Outlet 15       : "
             "%s          16)...Outlet 16       : %s          \r\n17)...Outlet "
             "17       : %s          18)...Outlet 18       : %s          "
             "\r\n19)...Outlet 19       : %s          20)...Outlet 20       : "
             "%s          \r\n\r\nType \"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], plug[8], plug[9], plug[10], plug[11], plug[12], plug[13],
             plug[14], plug[15], plug[16], plug[17], plug[18], plug[19]);
    } 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 if (sscanf(buf, "reboot %d", &i) == 1) {
      if (i == 0 || (i >= plug_origin && i < num_plugs + plug_origin)) {
        printf("\r\nRebooting...  ");
        for (i = 9; i >= 0; i--) {
          printf("%d", i);
          fflush(stdout);
          sleep(1);
        }
        printf("\r\n");
      } else
        goto err;
    } else
      goto err;
    continue;
  err:
    printf("Input error\r\n\r\n");
  }
}


x86 assembly (clang, -O0):
<_prompt_loop_rpc28_nc>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1a8,%rsp
movl   $0x14,-0xb4(%rbp)
movl   $0x1,-0x114(%rbp)
movl   $0x1,-0x118(%rbp)
movl   $0x0,-0x11c(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    11fe <_prompt_loop_rpc28_nc+0x7e>
movslq -0x2c(%rbp),%rax
lea    -0x110(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xe15(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c3 <_prompt_loop_rpc28_nc+0x43>
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x118(%rbp)
je     17f7 <_prompt_loop_rpc28_nc+0x677>
mov    -0x11c(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x11c(%rbp)
mov    $0x2,%ecx
cltd
idiv   %ecx
lea    0xe4a(%rip),%rdi
lea    0xe3b(%rip),%rax
cmp    $0x0,%edx
cmovne %rax,%rdi
lea    -0xb0(%rbp),%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
cmp    $0x0,%rax
jne    1267 <_prompt_loop_rpc28_nc+0xe7>
jmp    17f7 <_prompt_loop_rpc28_nc+0x677>
lea    -0xb0(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jne    1282 <_prompt_loop_rpc28_nc+0x102>
jmp    120c <_prompt_loop_rpc28_nc+0x8c>
lea    -0xb0(%rbp),%rdi
lea    0xdfc(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     12d6 <_prompt_loop_rpc28_nc+0x156>
lea    -0xb0(%rbp),%rdi
lea    0xde7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     12d6 <_prompt_loop_rpc28_nc+0x156>
lea    -0xb0(%rbp),%rdi
lea    0xdd2(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12db <_prompt_loop_rpc28_nc+0x15b>
jmp    17f7 <_prompt_loop_rpc28_nc+0x677>
lea    -0xb0(%rbp),%rdi
lea    0xdb6(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    130a <_prompt_loop_rpc28_nc+0x18a>
lea    0xda6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17d5 <_prompt_loop_rpc28_nc+0x655>
lea    -0xb0(%rbp),%rdi
lea    0x10ab(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1339 <_prompt_loop_rpc28_nc+0x1b9>
lea    0x109b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17d0 <_prompt_loop_rpc28_nc+0x650>
lea    -0xb0(%rbp),%rdi
lea    0x10cb(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1368 <_prompt_loop_rpc28_nc+0x1e8>
lea    0x10be(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17cb <_prompt_loop_rpc28_nc+0x64b>
lea    -0xb0(%rbp),%rdi
lea    0x113e(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    1397 <_prompt_loop_rpc28_nc+0x217>
lea    0x1131(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17c6 <_prompt_loop_rpc28_nc+0x646>
lea    -0xb0(%rbp),%rdi
lea    0x11e4(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    154a <_prompt_loop_rpc28_nc+0x3ca>
lea    -0x110(%rbp),%rsi
lea    -0x110(%rbp),%rdx
add    $0x4,%rdx
lea    -0x110(%rbp),%rcx
add    $0x8,%rcx
lea    -0x110(%rbp),%r8
add    $0xc,%r8
lea    -0x110(%rbp),%r9
add    $0x10,%r9
lea    -0x110(%rbp),%rax
add    $0x14,%rax
lea    -0x110(%rbp),%rdi
add    $0x18,%rdi
mov    %rdi,-0x158(%rbp)
lea    -0x110(%rbp),%rdi
add    $0x1c,%rdi
mov    %rdi,-0x150(%rbp)
lea    -0x110(%rbp),%rdi
add    $0x20,%rdi
mov    %rdi,-0x148(%rbp)
lea    -0x110(%rbp),%rdi
add    $0x24,%rdi
mov    %rdi,-0x140(%rbp)
lea    -0x110(%rbp),%rdi
add    $0x28,%rdi
mov    %rdi,-0x138(%rbp)
lea    -0x110(%rbp),%rdi
add    $0x2c,%rdi
mov    %rdi,-0x130(%rbp)
lea    -0x110(%rbp),%r13
add    $0x30,%r13
lea    -0x110(%rbp),%r12
add    $0x34,%r12
lea    -0x110(%rbp),%r15
add    $0x38,%r15
lea    -0x110(%rbp),%r14
add    $0x3c,%r14
lea    -0x110(%rbp),%rbx
add    $0x40,%rbx
lea    -0x110(%rbp),%r11
add    $0x44,%r11
lea    -0x110(%rbp),%r10
add    $0x48,%r10
lea    -0x110(%rbp),%rdi
add    $0x4c,%rdi
mov    %rdi,-0x128(%rbp)
lea    0x10cd(%rip),%rdi
mov    %rax,(%rsp)
mov    -0x158(%rbp),%rax
mov    %rax,0x8(%rsp)
mov    -0x150(%rbp),%rax
mov    %rax,0x10(%rsp)
mov    -0x148(%rbp),%rax
mov    %rax,0x18(%rsp)
mov    -0x140(%rbp),%rax
mov    %rax,0x20(%rsp)
mov    -0x138(%rbp),%rax
mov    %rax,0x28(%rsp)
mov    -0x130(%rbp),%rax
mov    %rax,0x30(%rsp)
mov    -0x128(%rbp),%rax
mov    %r13,0x38(%rsp)
mov    %r12,0x40(%rsp)
mov    %r15,0x48(%rsp)
mov    %r14,0x50(%rsp)
mov    %rbx,0x58(%rsp)
mov    %r11,0x60(%rsp)
mov    %r10,0x68(%rsp)
mov    %rax,0x70(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17c1 <_prompt_loop_rpc28_nc+0x641>
lea    -0xb0(%rbp),%rdi
lea    0x14b1(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    161a <_prompt_loop_rpc28_nc+0x49a>
mov    -0x2c(%rbp),%eax
cmp    -0x114(%rbp),%eax
jl     15ba <_prompt_loop_rpc28_nc+0x43a>
mov    -0x2c(%rbp),%eax
mov    -0xb4(%rbp),%ecx
add    -0x114(%rbp),%ecx
cmp    %ecx,%eax
jge    15ba <_prompt_loop_rpc28_nc+0x43a>
mov    -0x2c(%rbp),%eax
sub    -0x114(%rbp),%eax
cltq
lea    -0x110(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x145f(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1615 <_prompt_loop_rpc28_nc+0x495>
cmpl   $0x0,-0x2c(%rbp)
jne    160b <_prompt_loop_rpc28_nc+0x48b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    1606 <_prompt_loop_rpc28_nc+0x486>
movslq -0x2c(%rbp),%rax
lea    -0x110(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x141c(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    15cb <_prompt_loop_rpc28_nc+0x44b>
jmp    1610 <_prompt_loop_rpc28_nc+0x490>
jmp    17e4 <_prompt_loop_rpc28_nc+0x664>
jmp    1615 <_prompt_loop_rpc28_nc+0x495>
jmp    17bc <_prompt_loop_rpc28_nc+0x63c>
lea    -0xb0(%rbp),%rdi
lea    0x13eb(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    16ea <_prompt_loop_rpc28_nc+0x56a>
mov    -0x2c(%rbp),%eax
cmp    -0x114(%rbp),%eax
jl     168a <_prompt_loop_rpc28_nc+0x50a>
mov    -0x2c(%rbp),%eax
mov    -0xb4(%rbp),%ecx
add    -0x114(%rbp),%ecx
cmp    %ecx,%eax
jge    168a <_prompt_loop_rpc28_nc+0x50a>
mov    -0x2c(%rbp),%eax
sub    -0x114(%rbp),%eax
cltq
lea    -0x110(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x980(%rip),%rsi
call   1030 <strcpy@plt>
jmp    16e5 <_prompt_loop_rpc28_nc+0x565>
cmpl   $0x0,-0x2c(%rbp)
jne    16db <_prompt_loop_rpc28_nc+0x55b>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xb4(%rbp),%eax
jge    16d6 <_prompt_loop_rpc28_nc+0x556>
movslq -0x2c(%rbp),%rax
lea    -0x110(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x93d(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    169b <_prompt_loop_rpc28_nc+0x51b>
jmp    16e0 <_prompt_loop_rpc28_nc+0x560>
jmp    17e4 <_prompt_loop_rpc28_nc+0x664>
jmp    16e5 <_prompt_loop_rpc28_nc+0x565>
jmp    17b7 <_prompt_loop_rpc28_nc+0x637>
lea    -0xb0(%rbp),%rdi
lea    0x1322(%rip),%rsi
lea    -0x2c(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    17ad <_prompt_loop_rpc28_nc+0x62d>
cmpl   $0x0,-0x2c(%rbp)
je     173a <_prompt_loop_rpc28_nc+0x5ba>
mov    -0x2c(%rbp),%eax
cmp    -0x114(%rbp),%eax
jl     17a3 <_prompt_loop_rpc28_nc+0x623>
mov    -0x2c(%rbp),%eax
mov    -0xb4(%rbp),%ecx
add    -0x114(%rbp),%ecx
cmp    %ecx,%eax
jge    17a3 <_prompt_loop_rpc28_nc+0x623>
lea    0x12e3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x9,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jl     1790 <_prompt_loop_rpc28_nc+0x610>
mov    -0x2c(%rbp),%esi
lea    0x12d2(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x286f(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x2c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x2c(%rbp)
jmp    174f <_prompt_loop_rpc28_nc+0x5cf>
lea    0x12af(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    17a8 <_prompt_loop_rpc28_nc+0x628>
jmp    17e4 <_prompt_loop_rpc28_nc+0x664>
jmp    17b2 <_prompt_loop_rpc28_nc+0x632>
jmp    17e4 <_prompt_loop_rpc28_nc+0x664>
jmp    17b7 <_prompt_loop_rpc28_nc+0x637>
jmp    17bc <_prompt_loop_rpc28_nc+0x63c>
jmp    17c1 <_prompt_loop_rpc28_nc+0x641>
jmp    17c6 <_prompt_loop_rpc28_nc+0x646>
jmp    17cb <_prompt_loop_rpc28_nc+0x64b>
jmp    17d0 <_prompt_loop_rpc28_nc+0x650>
jmp    17d5 <_prompt_loop_rpc28_nc+0x655>
jmp    17da <_prompt_loop_rpc28_nc+0x65a>
jmp    17df <_prompt_loop_rpc28_nc+0x65f>
jmp    120c <_prompt_loop_rpc28_nc+0x8c>
lea    0x124e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    120c <_prompt_loop_rpc28_nc+0x8c>
add    $0x1a8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

x86 assembly (clang, -O2):
<_prompt_loop_rpc28_nc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xe8,%rsp
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
lea    0xe6e(%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    $0x13,%ecx
jl     11a0 <_prompt_loop_rpc28_nc+0x30>
lea    0x1319(%rip),%rdi
call   1040 <puts@plt>
lea    0xe37(%rip),%rdi
lea    0x60(%rsp),%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
test   %rax,%rax
je     15ab <_prompt_loop_rpc28_nc+0x43b>
mov    $0x1,%r14d
mov    $0x66666f,%ebx
lea    0xc(%rsp),%r12
lea    0x12da(%rip),%rbp
mov    0x2dd5(%rip),%r13
jmp    125d <_prompt_loop_rpc28_nc+0xed>
nopl   (%rax)
lea    0x1341(%rip),%rdi
call   1040 <puts@plt>
mov    %rbp,%r15
mov    %r12,%rbp
lea    0x1(%r14),%r12d
test   $0x1,%r14b
lea    0xdd3(%rip),%rdi
lea    0xdd4(%rip),%rax
cmove  %rax,%rdi
lea    0x60(%rsp),%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
mov    %r12d,%r14d
mov    %rbp,%r12
mov    %r15,%rbp
test   %rax,%rax
je     15ab <_prompt_loop_rpc28_nc+0x43b>
cmpb   $0x0,0x60(%rsp)
je     121c <_prompt_loop_rpc28_nc+0xac>
mov    0x60(%rsp),%eax
mov    $0x6f676f6c,%ecx
xor    %ecx,%eax
mov    0x63(%rsp),%ecx
xor    %ebx,%ecx
or     %eax,%ecx
je     15ab <_prompt_loop_rpc28_nc+0x43b>
mov    0x60(%rsp),%eax
mov    $0x6f676f6c,%ecx
xor    %ecx,%eax
mov    0x63(%rsp),%ecx
mov    $0x74756f,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     15ab <_prompt_loop_rpc28_nc+0x43b>
mov    0x60(%rsp),%eax
mov    $0x74697865,%ecx
xor    %ecx,%eax
movzbl 0x64(%rsp),%ecx
or     %eax,%ecx
je     15ab <_prompt_loop_rpc28_nc+0x43b>
mov    0x60(%rsp),%eax
mov    $0x706c6568,%ecx
xor    %ecx,%eax
movzbl 0x64(%rsp),%ecx
or     %eax,%ecx
je     1210 <_prompt_loop_rpc28_nc+0xa0>
mov    0x60(%rsp),%eax
mov    $0x706d6574,%ecx
xor    %ecx,%eax
movzbl 0x64(%rsp),%ecx
or     %eax,%ecx
je     130e <_prompt_loop_rpc28_nc+0x19e>
mov    0x60(%rsp),%rax
movabs $0x746e6572727563,%rcx
cmp    %rcx,%rax
je     131a <_prompt_loop_rpc28_nc+0x1aa>
movabs $0x656761746c6f76,%rcx
cmp    %rcx,%rax
jne    1326 <_prompt_loop_rpc28_nc+0x1b6>
lea    0x15b6(%rip),%rdi
jmp    1217 <_prompt_loop_rpc28_nc+0xa7>
lea    0x1561(%rip),%rdi
jmp    1217 <_prompt_loop_rpc28_nc+0xa7>
lea    0x1637(%rip),%rdi
jmp    1217 <_prompt_loop_rpc28_nc+0xa7>
mov    0x60(%rsp),%eax
mov    $0x74617473,%ecx
xor    %ecx,%eax
mov    0x63(%rsp),%ecx
mov    $0x737574,%edx
xor    %edx,%ecx
or     %eax,%ecx
lea    0x60(%rsp),%rbx
je     1390 <_prompt_loop_rpc28_nc+0x220>
mov    %rbx,%rdi
lea    0x1163(%rip),%rsi
mov    %r12,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1444 <_prompt_loop_rpc28_nc+0x2d4>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x13,%ecx
ja     148f <_prompt_loop_rpc28_nc+0x31f>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0x1137(%rip),%rsi
call   1030 <strcpy@plt>
mov    $0x66666f,%ebx
jmp    121c <_prompt_loop_rpc28_nc+0xac>
sub    $0x8,%rsp
lea    0xc9e(%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
mov    %rbp,%r10
lea    0x64(%rsp),%rbp
push   %rbp
lea    0x68(%rsp),%rbx
push   %rbx
lea    0x6c(%rsp),%rbp
push   %rbp
lea    0x70(%rsp),%rbp
push   %rbp
lea    0x74(%rsp),%rbp
push   %rbp
lea    0x78(%rsp),%rbp
push   %rbp
lea    0x7c(%rsp),%rbp
push   %rbp
lea    0x80(%rsp),%rbp
push   %rbp
lea    0x84(%rsp),%rbp
push   %rbp
lea    0x88(%rsp),%rbp
push   %rbp
lea    0x8c(%rsp),%rbp
push   %rbp
lea    0x90(%rsp),%rbp
push   %rbp
lea    0x94(%rsp),%rbp
push   %rbp
lea    0x98(%rsp),%rbp
push   %rbp
lea    0x9c(%rsp),%rbp
push   %rbp
mov    %r10,%rbp
call   1050 <printf@plt>
add    $0x80,%rsp
mov    $0x66666f,%ebx
jmp    121c <_prompt_loop_rpc28_nc+0xac>
mov    %rbx,%rdi
lea    0x106e(%rip),%rsi
mov    %r12,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    14db <_prompt_loop_rpc28_nc+0x36b>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x13,%ecx
mov    $0x66666f,%ebx
ja     1558 <_prompt_loop_rpc28_nc+0x3e8>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0xb7b(%rip),%rsi
call   1030 <strcpy@plt>
jmp    121c <_prompt_loop_rpc28_nc+0xac>
test   %eax,%eax
mov    $0x66666f,%ebx
jne    155c <_prompt_loop_rpc28_nc+0x3ec>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0xff7(%rip),%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x13,%ecx
jl     14b0 <_prompt_loop_rpc28_nc+0x340>
jmp    121c <_prompt_loop_rpc28_nc+0xac>
mov    %rbx,%rdi
lea    0xfde(%rip),%rsi
mov    %r12,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
mov    $0x66666f,%ebx
jne    155c <_prompt_loop_rpc28_nc+0x3ec>
cmpl   $0x14,0xc(%rsp)
ja     155c <_prompt_loop_rpc28_nc+0x3ec>
lea    0xfc8(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x9,0xc(%rsp)
mov    $0x9,%esi
nopl   0x0(%rax)
mov    %rbp,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%r13),%edi
call   1070 <fflush@plt>
mov    $0x1,%edi
call   1090 <sleep@plt>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%esi
mov    %esi,0xc(%rsp)
test   %eax,%eax
jg     1520 <_prompt_loop_rpc28_nc+0x3b0>
lea    0x14de(%rip),%rdi
jmp    1217 <_prompt_loop_rpc28_nc+0xa7>
test   %eax,%eax
je     1568 <_prompt_loop_rpc28_nc+0x3f8>
lea    0x14c1(%rip),%rdi
jmp    1217 <_prompt_loop_rpc28_nc+0xa7>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0xa6f(%rip),%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x13,%ecx
jl     1580 <_prompt_loop_rpc28_nc+0x410>
jmp    121c <_prompt_loop_rpc28_nc+0xac>
add    $0xe8,%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 = [119 x i8] c"RPC-28 Series\0A(C) 2000 by BayTech\0AF3.01\0A\0AOption(s) Installed:\0ATrue RMS Current\0AInternal Temperature\0ATrue RMS Voltage\0A\0A\00"
@.str.2 = [8 x i8] c"RPC-28>\00"
@.str.3 = [9 x i8] c"RPC-28A>\00"
@.str.4 = [7 x i8] c"logoff\00"
@.str.5 = [7 x i8] c"logout\00"
@.str.6 = [5 x i8] c"exit\00"
@.str.7 = [5 x i8] c"help\00"
@.str.8 = [799 x i8] c"\0D\0AOn n <cr> --Turn on an Outlet, n=0,1...20,all\0D\0AOff n <cr> --Turn off an Outlet, n=0,1...20,all\0D\0AReboot n <cr> --Reboot an Outlet, n=0,1...20,all\0D\0AStatus <cr> --RPC-28 Status\0D\0AConfig <cr> --Enter configuration mode\0D\0ALock n <cr> --Locks Outlet(s) state, n=0,1...20,all\0D\0AUnlock n <cr> --Unlock Outlet(s) state, n=0,1...20,all\0D\0ACurrent <cr> --Display True RMS Current\0D\0AClear <cr> --Reset the maximum detected current\0D\0ATemp <cr> --Read current temperature\0D\0AVoltage <cr> --Display True RMS Voltage\0D\0ALogout <cr> --Logoff\0D\0ALogoff <cr> --Logoff\0D\0AExit <cr> --Logoff\0D\0APassword <cr> --Changes the current user password\0D\0AWhoami <cr> --Displays the current user name\0D\0AUnitid <cr> --Displays the unit ID\0D\0AHelp <cr> --This Command\0D\0A\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.9 = [5 x i8] c"temp\00"
@.str.10 = [74 x i8] c"\0D\0AInternal Temperature: 30.0 C\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.11 = [8 x i8] c"voltage\00"
@.str.12 = [154 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0ATrue RMS Voltage: 118.0 Volts : 118.7 Volts \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.13 = [8 x i8] c"current\00"
@.str.14 = [205 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0ATrue RMS Current: 5.5 Amps : 0.1 Amps\0D\0AMaximum Detected: 6.9 Amps : 2.8 Amps\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.15 = [7 x i8] c"status\00"
@.str.16 = [1145 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0A Average Power: 619 Watts : 5 Watts \0D\0ATrue RMS Voltage: 117.9 Volts : 118.8 Volts \0D\0ATrue RMS Current: 5.4 Amps : 0.1 Amps\0D\0AMaximum Detected: 6.9 Amps : 2.8 Amps\0D\0A Circuit Breaker: Good : Good \0D\0A\0D\0AInternal Temperature: 30.0 C\0D\0A\0D\0A\0D\0A 1)...Outlet 1 : %s 2)...Outlet 2 : %s \0D\0A 3)...Outlet 3 : %s 4)...Outlet 4 : %s \0D\0A 5)...Outlet 5 : %s 6)...Outlet 6 : %s \0D\0A 7)...Outlet 7 : %s 8)...Outlet 8 : %s \0D\0A 9)...Outlet 9 : %s 10)...Outlet 10 : %s \0D\0A11)...Outlet 11 : %s 12)...Outlet 12 : %s \0D\0A13)...Outlet 13 : %s 14)...Outlet 14 : %s \0D\0A15)...Outlet 15 : %s 16)...Outlet 16 : %s \0D\0A17)...Outlet 17 : %s 18)...Outlet 18 : %s \0D\0A19)...Outlet 19 : %s 20)...Outlet 20 : %s \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\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 = [10 x i8] c"reboot %d\00"
@.str.21 = [17 x i8] c"\0D\0ARebooting... \00"
@.str.22 = [4 x i8] c"\08%d\00"
@stdout = global i32 0
@.str.23 = [3 x i8] c"\0D\0A\00"
@.str.24 = [16 x i8] c"Input error\0D\0A\0D\0A\00"
define void @_prompt_loop_rpc28_nc() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca [20 x [4 x i8]]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 20, i32* %3
store i32 1, i32* %5
store i32 1, i32* %6
store i32 0, i32* %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 [20 x [4 x i8]], [20 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 ([119 x i8], [119 x i8]* @.str.1, i64 0, i64 0))
br label %23
23: ; preds = %257, %256, %41, %21
%24 = load i32, i32* %6
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %259
26: ; preds = %23
%27 = load i32, i32* %7
%28 = add nsw i32 %27, 1
store i32 %28, i32* %7
%29 = srem i32 %27, 2
%30 = icmp ne i32 %29, 0
%31 = zext i1 %30 to i64
%32 = select i1 %30, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0)
%33 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%34 = call i32* @xreadline(i8* %32, i8* %33, i32 128)
%35 = icmp eq i32* %34, null
br i1 %35, label %36, label %37
36: ; preds = %26
br label %259
37: ; preds = %26
%38 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%39 = call i64 @strlen(i8* %38)
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %37
br label %23
42: ; preds = %37
%43 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%44 = call i32 @strcmp(i8* %43, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%45 = icmp ne i32 %44, 0
br i1 %45, label %46, label %54
46: ; preds = %42
%47 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%48 = call i32 @strcmp(i8* %47, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%52 = call i32 @strcmp(i8* %51, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%53 = icmp ne i32 %52, 0
br i1 %53, label %55, label %54
54: ; preds = %50, %46, %42
br label %259
55: ; preds = %50
%56 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%57 = call i32 @strcmp(i8* %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%58 = icmp ne i32 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %55
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([799 x i8], [799 x i8]* @.str.8, i64 0, i64 0))
br label %254
61: ; preds = %55
%62 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%63 = call i32 @strcmp(i8* %62, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0))
%64 = icmp ne i32 %63, 0
br i1 %64, label %67, label %65
65: ; preds = %61
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.10, i64 0, i64 0))
br label %253
67: ; preds = %61
%68 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%70 = icmp ne i32 %69, 0
br i1 %70, label %73, label %71
71: ; preds = %67
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([154 x i8], [154 x i8]* @.str.12, i64 0, i64 0))
br label %252
73: ; preds = %67
%74 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%75 = call i32 @strcmp(i8* %74, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0))
%76 = icmp ne i32 %75, 0
br i1 %76, label %79, label %77
77: ; preds = %73
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([205 x i8], [205 x i8]* @.str.14, i64 0, i64 0))
br label %251
79: ; preds = %73
%80 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%81 = call i32 @strcmp(i8* %80, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.15, i64 0, i64 0))
%82 = icmp ne i32 %81, 0
br i1 %82, label %125, label %83
83: ; preds = %79
%84 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 0
%85 = getelementptr inbounds [4 x i8], [4 x i8]* %84, i64 0, i64 0
%86 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 1
%87 = getelementptr inbounds [4 x i8], [4 x i8]* %86, i64 0, i64 0
%88 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 2
%89 = getelementptr inbounds [4 x i8], [4 x i8]* %88, i64 0, i64 0
%90 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 3
%91 = getelementptr inbounds [4 x i8], [4 x i8]* %90, i64 0, i64 0
%92 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 4
%93 = getelementptr inbounds [4 x i8], [4 x i8]* %92, i64 0, i64 0
%94 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 5
%95 = getelementptr inbounds [4 x i8], [4 x i8]* %94, i64 0, i64 0
%96 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 6
%97 = getelementptr inbounds [4 x i8], [4 x i8]* %96, i64 0, i64 0
%98 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 7
%99 = getelementptr inbounds [4 x i8], [4 x i8]* %98, i64 0, i64 0
%100 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 8
%101 = getelementptr inbounds [4 x i8], [4 x i8]* %100, i64 0, i64 0
%102 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 9
%103 = getelementptr inbounds [4 x i8], [4 x i8]* %102, i64 0, i64 0
%104 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 10
%105 = getelementptr inbounds [4 x i8], [4 x i8]* %104, i64 0, i64 0
%106 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 11
%107 = getelementptr inbounds [4 x i8], [4 x i8]* %106, i64 0, i64 0
%108 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 12
%109 = getelementptr inbounds [4 x i8], [4 x i8]* %108, i64 0, i64 0
%110 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 13
%111 = getelementptr inbounds [4 x i8], [4 x i8]* %110, i64 0, i64 0
%112 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 14
%113 = getelementptr inbounds [4 x i8], [4 x i8]* %112, i64 0, i64 0
%114 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 15
%115 = getelementptr inbounds [4 x i8], [4 x i8]* %114, i64 0, i64 0
%116 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 16
%117 = getelementptr inbounds [4 x i8], [4 x i8]* %116, i64 0, i64 0
%118 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 17
%119 = getelementptr inbounds [4 x i8], [4 x i8]* %118, i64 0, i64 0
%120 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 18
%121 = getelementptr inbounds [4 x i8], [4 x i8]* %120, i64 0, i64 0
%122 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 19
%123 = getelementptr inbounds [4 x i8], [4 x i8]* %122, i64 0, i64 0
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([1145 x i8], [1145 x i8]* @.str.16, i64 0, i64 0), i8* %85, i8* %87, i8* %89, i8* %91, i8* %93, i8* %95, i8* %97, i8* %99, i8* %101, i8* %103, i8* %105, i8* %107, i8* %109, i8* %111, i8* %113, i8* %115, i8* %117, i8* %119, i8* %121, i8* %123)
br label %250
125: ; preds = %79
%126 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%127 = call i32 @sscanf(i8* %126, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32* %1)
%128 = icmp eq i32 %127, 1
br i1 %128, label %129, label %168
129: ; preds = %125
%130 = load i32, i32* %1
%131 = load i32, i32* %5
%132 = icmp sge i32 %130, %131
br i1 %132, label %133, label %147
133: ; preds = %129
%134 = load i32, i32* %1
%135 = load i32, i32* %3
%136 = load i32, i32* %5
%137 = add nsw i32 %135, %136
%138 = icmp slt i32 %134, %137
br i1 %138, label %139, label %147
139: ; preds = %133
%140 = load i32, i32* %1
%141 = load i32, i32* %5
%142 = sub nsw i32 %140, %141
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 %143
%145 = getelementptr inbounds [4 x i8], [4 x i8]* %144, i64 0, i64 0
%146 = call i32 @strcpy(i8* %145, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %167
147: ; preds = %133, %129
%148 = load i32, i32* %1
%149 = icmp eq i32 %148, 0
br i1 %149, label %150, label %165
150: ; preds = %147
store i32 0, i32* %1
br label %151
151: ; preds = %161, %150
%152 = load i32, i32* %1
%153 = load i32, i32* %3
%154 = icmp slt i32 %152, %153
br i1 %154, label %155, label %164
155: ; preds = %151
%156 = load i32, i32* %1
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 %157
%159 = getelementptr inbounds [4 x i8], [4 x i8]* %158, i64 0, i64 0
%160 = call i32 @strcpy(i8* %159, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %161
161: ; preds = %155
%162 = load i32, i32* %1
%163 = add nsw i32 %162, 1
store i32 %163, i32* %1
br label %151
164: ; preds = %151
br label %166
165: ; preds = %147
br label %257
166: ; preds = %164
br label %167
167: ; preds = %166, %139
br label %249
168: ; preds = %125
%169 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%170 = call i32 @sscanf(i8* %169, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%171 = icmp eq i32 %170, 1
br i1 %171, label %172, label %211
172: ; preds = %168
%173 = load i32, i32* %1
%174 = load i32, i32* %5
%175 = icmp sge i32 %173, %174
br i1 %175, label %176, label %190
176: ; preds = %172
%177 = load i32, i32* %1
%178 = load i32, i32* %3
%179 = load i32, i32* %5
%180 = add nsw i32 %178, %179
%181 = icmp slt i32 %177, %180
br i1 %181, label %182, label %190
182: ; preds = %176
%183 = load i32, i32* %1
%184 = load i32, i32* %5
%185 = sub nsw i32 %183, %184
%186 = sext i32 %185 to i64
%187 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 %186
%188 = getelementptr inbounds [4 x i8], [4 x i8]* %187, i64 0, i64 0
%189 = call i32 @strcpy(i8* %188, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %210
190: ; preds = %176, %172
%191 = load i32, i32* %1
%192 = icmp eq i32 %191, 0
br i1 %192, label %193, label %208
193: ; preds = %190
store i32 0, i32* %1
br label %194
194: ; preds = %204, %193
%195 = load i32, i32* %1
%196 = load i32, i32* %3
%197 = icmp slt i32 %195, %196
br i1 %197, label %198, label %207
198: ; preds = %194
%199 = load i32, i32* %1
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %4, i64 0, i64 %200
%202 = getelementptr inbounds [4 x i8], [4 x i8]* %201, i64 0, i64 0
%203 = call i32 @strcpy(i8* %202, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %204
204: ; preds = %198
%205 = load i32, i32* %1
%206 = add nsw i32 %205, 1
store i32 %206, i32* %1
br label %194
207: ; preds = %194
br label %209
208: ; preds = %190
br label %257
209: ; preds = %207
br label %210
210: ; preds = %209, %182
br label %248
211: ; preds = %168
%212 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%213 = call i32 @sscanf(i8* %212, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32* %1)
%214 = icmp eq i32 %213, 1
br i1 %214, label %215, label %246
215: ; preds = %211
%216 = load i32, i32* %1
%217 = icmp eq i32 %216, 0
br i1 %217, label %228, label %218
218: ; preds = %215
%219 = load i32, i32* %1
%220 = load i32, i32* %5
%221 = icmp sge i32 %219, %220
br i1 %221, label %222, label %244
222: ; preds = %218
%223 = load i32, i32* %1
%224 = load i32, i32* %3
%225 = load i32, i32* %5
%226 = add nsw i32 %224, %225
%227 = icmp slt i32 %223, %226
br i1 %227, label %228, label %244
228: ; preds = %222, %215
%229 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i64 0, i64 0))
store i32 9, i32* %1
br label %230
230: ; preds = %239, %228
%231 = load i32, i32* %1
%232 = icmp sge i32 %231, 0
br i1 %232, label %233, label %242
233: ; preds = %230
%234 = load i32, i32* %1
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i32 %234)
%236 = load i32, i32* @stdout
%237 = call i32 @fflush(i32 %236)
%238 = call i32 @sleep(i32 1)
br label %239
239: ; preds = %233
%240 = load i32, i32* %1
%241 = add nsw i32 %240, -1
store i32 %241, i32* %1
br label %230
242: ; preds = %230
%243 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.23, i64 0, i64 0))
br label %245
244: ; preds = %222, %218
br label %257
245: ; preds = %242
br label %247
246: ; preds = %211
br label %257
247: ; preds = %245
br label %248
248: ; preds = %247, %210
br label %249
249: ; preds = %248, %167
br label %250
250: ; preds = %249, %83
br label %251
251: ; preds = %250, %77
br label %252
252: ; preds = %251, %71
br label %253
253: ; preds = %252, %65
br label %254
254: ; preds = %253, %59
br label %255
255: ; preds = %254
br label %256
256: ; preds = %255
br label %23
257: ; preds = %246, %244, %208, %165
%258 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.24, i64 0, i64 0))
br label %23
259: ; preds = %54, %36, %23
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Off\00"
@.str.2 = [8 x i8] c"RPC-28>\00"
@.str.3 = [9 x i8] c"RPC-28A>\00"
@.str.4 = [7 x i8] c"logoff\00"
@.str.5 = [7 x i8] c"logout\00"
@.str.6 = [5 x i8] c"exit\00"
@.str.7 = [5 x i8] c"help\00"
@.str.9 = [5 x i8] c"temp\00"
@.str.15 = [7 x i8] c"status\00"
@.str.16 = [1145 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0A Average Power: 619 Watts : 5 Watts \0D\0ATrue RMS Voltage: 117.9 Volts : 118.8 Volts \0D\0ATrue RMS Current: 5.4 Amps : 0.1 Amps\0D\0AMaximum Detected: 6.9 Amps : 2.8 Amps\0D\0A Circuit Breaker: Good : Good \0D\0A\0D\0AInternal Temperature: 30.0 C\0D\0A\0D\0A\0D\0A 1)...Outlet 1 : %s 2)...Outlet 2 : %s \0D\0A 3)...Outlet 3 : %s 4)...Outlet 4 : %s \0D\0A 5)...Outlet 5 : %s 6)...Outlet 6 : %s \0D\0A 7)...Outlet 7 : %s 8)...Outlet 8 : %s \0D\0A 9)...Outlet 9 : %s 10)...Outlet 10 : %s \0D\0A11)...Outlet 11 : %s 12)...Outlet 12 : %s \0D\0A13)...Outlet 13 : %s 14)...Outlet 14 : %s \0D\0A15)...Outlet 15 : %s 16)...Outlet 16 : %s \0D\0A17)...Outlet 17 : %s 18)...Outlet 18 : %s \0D\0A19)...Outlet 19 : %s 20)...Outlet 20 : %s \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\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 = [10 x i8] c"reboot %d\00"
@.str.21 = [17 x i8] c"\0D\0ARebooting... \00"
@.str.22 = [4 x i8] c"\08%d\00"
@stdout = global i32 0
@str = [118 x i8] c"RPC-28 Series\0A(C) 2000 by BayTech\0AF3.01\0A\0AOption(s) Installed:\0ATrue RMS Current\0AInternal Temperature\0ATrue RMS Voltage\0A\00"
@str.25 = [798 x i8] c"\0D\0AOn n <cr> --Turn on an Outlet, n=0,1...20,all\0D\0AOff n <cr> --Turn off an Outlet, n=0,1...20,all\0D\0AReboot n <cr> --Reboot an Outlet, n=0,1...20,all\0D\0AStatus <cr> --RPC-28 Status\0D\0AConfig <cr> --Enter configuration mode\0D\0ALock n <cr> --Locks Outlet(s) state, n=0,1...20,all\0D\0AUnlock n <cr> --Unlock Outlet(s) state, n=0,1...20,all\0D\0ACurrent <cr> --Display True RMS Current\0D\0AClear <cr> --Reset the maximum detected current\0D\0ATemp <cr> --Read current temperature\0D\0AVoltage <cr> --Display True RMS Voltage\0D\0ALogout <cr> --Logoff\0D\0ALogoff <cr> --Logoff\0D\0AExit <cr> --Logoff\0D\0APassword <cr> --Changes the current user password\0D\0AWhoami <cr> --Displays the current user name\0D\0AUnitid <cr> --Displays the unit ID\0D\0AHelp <cr> --This Command\0D\0A\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.26 = [73 x i8] c"\0D\0AInternal Temperature: 30.0 C\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.27 = [153 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0ATrue RMS Voltage: 118.0 Volts : 118.7 Volts \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.28 = [204 x i8] c"\0D\0A Outlet 1-10 Outlet 11-21 \0D\0ATrue RMS Current: 5.5 Amps : 0.1 Amps\0D\0AMaximum Detected: 6.9 Amps : 2.8 Amps\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.29 = [15 x i8] c"Input error\0D\0A\0D\00"
@str.30 = [2 x i8] c"\0D\00"
define void @_prompt_loop_rpc28_nc() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [20 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 [20 x [4 x i8]], [20 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 [20 x [4 x i8]], [20 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, 19
br i1 %14, label %7, label %15
15: ; preds = %7
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([118 x i8], [118 x i8]* @str, i64 0, i64 0))
%17 = call i32* @xreadline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* %5, i32 128)
%18 = icmp eq i32* %17, null
br i1 %18, label %146, label %19
19: ; preds = %15
%20 = bitcast [128 x i8]* %2 to i64*
%21 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 1, i64 0
%22 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 2, i64 0
%23 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 3, i64 0
%24 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 4, i64 0
%25 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 5, i64 0
%26 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 6, i64 0
%27 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 7, i64 0
%28 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 8, i64 0
%29 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 9, i64 0
%30 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 10, i64 0
%31 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 11, i64 0
%32 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 12, i64 0
%33 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 13, i64 0
%34 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 14, i64 0
%35 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 15, i64 0
%36 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 16, i64 0
%37 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 17, i64 0
%38 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 18, i64 0
%39 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 19, i64 0
br label %40
40: ; preds = %19, %137
%41 = phi i32 [ 1, %19 ], [ %138, %137 ]
%42 = load i8, i8* %5
%43 = icmp eq i8 %42, 0
br i1 %43, label %137, label %44
44: ; preds = %40
%45 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i64 7)
%46 = icmp eq i32 %45, 0
br i1 %46, label %146, label %47
47: ; preds = %44
%48 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i64 7)
%49 = icmp eq i32 %48, 0
br i1 %49, label %146, label %50
50: ; preds = %47
%51 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0), i64 5)
%52 = icmp eq i32 %51, 0
br i1 %52, label %146, label %53
53: ; preds = %50
%54 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i64 5)
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %58
56: ; preds = %53
%57 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([798 x i8], [798 x i8]* @str.25, i64 0, i64 0))
br label %137
58: ; preds = %53
%59 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.9, i64 0, i64 0), i64 5)
%60 = icmp eq i32 %59, 0
br i1 %60, label %61, label %63
61: ; preds = %58
%62 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.26, i64 0, i64 0))
br label %137
63: ; preds = %58
%64 = load i64, i64* %20
switch i64 %64, label %69 [
i64 28542640910528374, label %65
i64 32772479289292131, label %67
]
65: ; preds = %63
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([153 x i8], [153 x i8]* @str.27, i64 0, i64 0))
br label %137
67: ; preds = %63
%68 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([204 x i8], [204 x i8]* @str.28, i64 0, i64 0))
br label %137
69: ; preds = %63
%70 = 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)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %74
72: ; preds = %69
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([1145 x i8], [1145 x i8]* @.str.16, i64 0, i64 0), i8* %6, i8* %21, i8* %22, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27, i8* %28, i8* %29, i8* %30, i8* %31, i8* %32, i8* %33, i8* %34, i8* %35, i8* %36, i8* %37, i8* %38, i8* %39)
br label %137
74: ; preds = %69
%75 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0), i32* %1)
%76 = icmp eq i32 %75, 1
br i1 %76, label %77, label %96
77: ; preds = %74
%78 = load i32, i32* %1
%79 = add i32 %78, -1
%80 = icmp ult i32 %79, 20
br i1 %80, label %81, label %85
81: ; preds = %77
%82 = zext i32 %79 to i64
%83 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 %82, i64 0
%84 = call i32 @strcpy(i8* %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
br label %137
85: ; preds = %77
%86 = icmp eq i32 %78, 0
br i1 %86, label %87, label %144
87: ; preds = %85
store i32 0, i32* %1
br label %88
88: ; preds = %87, %88
%89 = phi i32 [ 0, %87 ], [ %94, %88 ]
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 %90, i64 0
%92 = call i32 @strcpy(i8* %91, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.18, i64 0, i64 0))
%93 = load i32, i32* %1
%94 = add nsw i32 %93, 1
store i32 %94, i32* %1
%95 = icmp slt i32 %93, 19
br i1 %95, label %88, label %137
96: ; preds = %74
%97 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%98 = icmp eq i32 %97, 1
br i1 %98, label %99, label %118
99: ; preds = %96
%100 = load i32, i32* %1
%101 = add i32 %100, -1
%102 = icmp ult i32 %101, 20
br i1 %102, label %103, label %107
103: ; preds = %99
%104 = zext i32 %101 to i64
%105 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 %104, i64 0
%106 = call i32 @strcpy(i8* %105, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %137
107: ; preds = %99
%108 = icmp eq i32 %100, 0
br i1 %108, label %109, label %144
109: ; preds = %107
store i32 0, i32* %1
br label %110
110: ; preds = %109, %110
%111 = phi i32 [ 0, %109 ], [ %116, %110 ]
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [20 x [4 x i8]], [20 x [4 x i8]]* %3, i64 0, i64 %112, i64 0
%114 = call i32 @strcpy(i8* %113, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%115 = load i32, i32* %1
%116 = add nsw i32 %115, 1
store i32 %116, i32* %1
%117 = icmp slt i32 %115, 19
br i1 %117, label %110, label %137
118: ; preds = %96
%119 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.20, i64 0, i64 0), i32* %1)
%120 = icmp eq i32 %119, 1
%121 = load i32, i32* %1
%122 = icmp ult i32 %121, 21
%123 = select i1 %120, i1 %122, i1 false
br i1 %123, label %124, label %144
124: ; preds = %118
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.21, i64 0, i64 0))
store i32 9, i32* %1
br label %126
126: ; preds = %124, %126
%127 = phi i32 [ 9, %124 ], [ %133, %126 ]
%128 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i32 %127)
%129 = load i32, i32* @stdout
%130 = call i32 @fflush(i32 %129)
%131 = call i32 @sleep(i32 1)
%132 = load i32, i32* %1
%133 = add nsw i32 %132, -1
store i32 %133, i32* %1
%134 = icmp sgt i32 %132, 0
br i1 %134, label %126, label %135
135: ; preds = %126
%136 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.30, i64 0, i64 0))
br label %137
137: ; preds = %110, %88, %56, %65, %72, %135, %103, %81, %67, %61, %144, %40
%138 = add nuw nsw i32 %41, 1
%139 = and i32 %41, 1
%140 = icmp eq i32 %139, 0
%141 = select i1 %140, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0)
%142 = call i32* @xreadline(i8* %141, i8* %5, i32 128)
%143 = icmp eq i32* %142, null
br i1 %143, label %146, label %40
144: ; preds = %118, %107, %85
%145 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.29, i64 0, i64 0))
br label %137
146: ; preds = %137, %50, %47, %44, %15
ret void
}