#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_rpc3_nc(void) {
  int i;
  char buf[128];
  int num_plugs = 8;
  char plug[8][4];
  int plug_origin = 1;
  int logged_in = 1;
  for (i = 0; i < num_plugs; i++)
    strcpy(plug[i], "Off");
  printf("\r\n\r\nRPC3-NC Series\r\n(C) 2002 by "
         "BayTech\r\nF4.00\r\n\r\nOption(s) Installed:\r\nTrue RMS "
         "Current\r\nInternal Temperature\r\nTrue RMS Voltage\r\n\r\n");
  while (logged_in) {
    if (xreadline("RPC3-NC>", 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...8,all\r\nOff n <cr>  "
          "  --Turn off an Outlet, n=0,1...8,all\r\nReboot n <cr> --Reboot an "
          "Outlet, n=0,1...8,all\r\nStatus <cr>   --RPC3-NC Status\r\nConfig "
          "<cr>   --Enter configuration mode\r\nLock n <cr>   --Locks "
          "Outlet(s) state, n=0,1...8,all\r\nUnlock n <cr> --Unlock Outlet(s) "
          "state, n=0,1...8,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:  38.5 C\r\n\r\nType \"Help\" for a "
             "list of commands\r\n\r\n");
    else if (!strcmp(buf, "voltage"))
      printf("\r\n\r\nTrue RMS Voltage:   120.5 Volts \r\n\r\nType \"Help\" "
             "for a list of commands\r\n\r\n");
    else if (!strcmp(buf, "current"))
      printf(
          "\r\n\r\nTrue RMS Current:     2.9 Amps\r\nMaximum Detected:     4.3 "
          "Amps\r\n\r\n\r\nType \"Help\" for a list of commands\r\n\r\n");
    else if (!strcmp(buf, "status")) {
      printf("\r\n\r\n   Average Power:     338 Watts\r\nTrue RMS Voltage:   "
             "120.9 Volts\r\nTrue RMS Current:     2.9 Amps\r\nMaximum "
             "Detected:     4.3 Amps\r\n Circuit Breaker:       "
             "Good\r\n\r\nInternal Temperature:  40.0 C\r\n\r\n\r\n "
             "1)...Outlet  1       : %s          \r\n 2)...Outlet  2       : "
             "%s          \r\n 3)...Outlet  3       : %s          \r\n "
             "4)...Outlet  4       : %s          \r\n 5)...Outlet  5       : "
             "%s          \r\n 6)...Outlet  6       : %s          \r\n "
             "7)...Outlet  7       : %s          \r\n 8)...Outlet  8       : "
             "%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]);
    } 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_rpc3_nc>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
movl   $0x8,-0x94(%rbp)
movl   $0x1,-0xc4(%rbp)
movl   $0x1,-0xc8(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    11eb <_prompt_loop_rpc3_nc+0x6b>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xe28(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b0 <_prompt_loop_rpc3_nc+0x30>
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0xc8(%rbp)
je     169b <_prompt_loop_rpc3_nc+0x51b>
lea    -0x90(%rbp),%rsi
lea    0xe75(%rip),%rdi
mov    $0x80,%edx
call   1060 <xreadline@plt>
cmp    $0x0,%rax
jne    122d <_prompt_loop_rpc3_nc+0xad>
jmp    169b <_prompt_loop_rpc3_nc+0x51b>
lea    -0x90(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jne    1248 <_prompt_loop_rpc3_nc+0xc8>
jmp    11f9 <_prompt_loop_rpc3_nc+0x79>
lea    -0x90(%rbp),%rdi
lea    0xe3c(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     129c <_prompt_loop_rpc3_nc+0x11c>
lea    -0x90(%rbp),%rdi
lea    0xe27(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
je     129c <_prompt_loop_rpc3_nc+0x11c>
lea    -0x90(%rbp),%rdi
lea    0xe12(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12a1 <_prompt_loop_rpc3_nc+0x121>
jmp    169b <_prompt_loop_rpc3_nc+0x51b>
lea    -0x90(%rbp),%rdi
lea    0xdf6(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12d0 <_prompt_loop_rpc3_nc+0x150>
lea    0xde6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1679 <_prompt_loop_rpc3_nc+0x4f9>
lea    -0x90(%rbp),%rdi
lea    0x10e7(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    12ff <_prompt_loop_rpc3_nc+0x17f>
lea    0x10d7(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1674 <_prompt_loop_rpc3_nc+0x4f4>
lea    -0x90(%rbp),%rdi
lea    0x1107(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    132e <_prompt_loop_rpc3_nc+0x1ae>
lea    0x10fa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    166f <_prompt_loop_rpc3_nc+0x4ef>
lea    -0x90(%rbp),%rdi
lea    0x112f(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    135d <_prompt_loop_rpc3_nc+0x1dd>
lea    0x1122(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    166a <_prompt_loop_rpc3_nc+0x4ea>
lea    -0x90(%rbp),%rdi
lea    0x1177(%rip),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%eax
jne    13ee <_prompt_loop_rpc3_nc+0x26e>
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    0x1115(%rip),%rdi
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1665 <_prompt_loop_rpc3_nc+0x4e5>
lea    -0x90(%rbp),%rdi
lea    0x130f(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    14be <_prompt_loop_rpc3_nc+0x33e>
mov    -0x4(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jl     145e <_prompt_loop_rpc3_nc+0x2de>
mov    -0x4(%rbp),%eax
mov    -0x94(%rbp),%ecx
add    -0xc4(%rbp),%ecx
cmp    %ecx,%eax
jge    145e <_prompt_loop_rpc3_nc+0x2de>
mov    -0x4(%rbp),%eax
sub    -0xc4(%rbp),%eax
cltq
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x12bd(%rip),%rsi
call   1030 <strcpy@plt>
jmp    14b9 <_prompt_loop_rpc3_nc+0x339>
cmpl   $0x0,-0x4(%rbp)
jne    14af <_prompt_loop_rpc3_nc+0x32f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    14aa <_prompt_loop_rpc3_nc+0x32a>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0x127a(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    146f <_prompt_loop_rpc3_nc+0x2ef>
jmp    14b4 <_prompt_loop_rpc3_nc+0x334>
jmp    1688 <_prompt_loop_rpc3_nc+0x508>
jmp    14b9 <_prompt_loop_rpc3_nc+0x339>
jmp    1660 <_prompt_loop_rpc3_nc+0x4e0>
lea    -0x90(%rbp),%rdi
lea    0x1249(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    158e <_prompt_loop_rpc3_nc+0x40e>
mov    -0x4(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jl     152e <_prompt_loop_rpc3_nc+0x3ae>
mov    -0x4(%rbp),%eax
mov    -0x94(%rbp),%ecx
add    -0xc4(%rbp),%ecx
cmp    %ecx,%eax
jge    152e <_prompt_loop_rpc3_nc+0x3ae>
mov    -0x4(%rbp),%eax
sub    -0xc4(%rbp),%eax
cltq
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xadc(%rip),%rsi
call   1030 <strcpy@plt>
jmp    1589 <_prompt_loop_rpc3_nc+0x409>
cmpl   $0x0,-0x4(%rbp)
jne    157f <_prompt_loop_rpc3_nc+0x3ff>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    157a <_prompt_loop_rpc3_nc+0x3fa>
movslq -0x4(%rbp),%rax
lea    -0xc0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    0xa99(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    153f <_prompt_loop_rpc3_nc+0x3bf>
jmp    1584 <_prompt_loop_rpc3_nc+0x404>
jmp    1688 <_prompt_loop_rpc3_nc+0x508>
jmp    1589 <_prompt_loop_rpc3_nc+0x409>
jmp    165b <_prompt_loop_rpc3_nc+0x4db>
lea    -0x90(%rbp),%rdi
lea    0x1180(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1090 <sscanf@plt>
cmp    $0x1,%eax
jne    1651 <_prompt_loop_rpc3_nc+0x4d1>
cmpl   $0x0,-0x4(%rbp)
je     15de <_prompt_loop_rpc3_nc+0x45e>
mov    -0x4(%rbp),%eax
cmp    -0xc4(%rbp),%eax
jl     1647 <_prompt_loop_rpc3_nc+0x4c7>
mov    -0x4(%rbp),%eax
mov    -0x94(%rbp),%ecx
add    -0xc4(%rbp),%ecx
cmp    %ecx,%eax
jge    1647 <_prompt_loop_rpc3_nc+0x4c7>
lea    0x1141(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x9,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1634 <_prompt_loop_rpc3_nc+0x4b4>
mov    -0x4(%rbp),%esi
lea    0x1130(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x29cb(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
jmp    15f3 <_prompt_loop_rpc3_nc+0x473>
lea    0xa4b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    164c <_prompt_loop_rpc3_nc+0x4cc>
jmp    1688 <_prompt_loop_rpc3_nc+0x508>
jmp    1656 <_prompt_loop_rpc3_nc+0x4d6>
jmp    1688 <_prompt_loop_rpc3_nc+0x508>
jmp    165b <_prompt_loop_rpc3_nc+0x4db>
jmp    1660 <_prompt_loop_rpc3_nc+0x4e0>
jmp    1665 <_prompt_loop_rpc3_nc+0x4e5>
jmp    166a <_prompt_loop_rpc3_nc+0x4ea>
jmp    166f <_prompt_loop_rpc3_nc+0x4ef>
jmp    1674 <_prompt_loop_rpc3_nc+0x4f4>
jmp    1679 <_prompt_loop_rpc3_nc+0x4f9>
jmp    167e <_prompt_loop_rpc3_nc+0x4fe>
jmp    1683 <_prompt_loop_rpc3_nc+0x503>
jmp    11f9 <_prompt_loop_rpc3_nc+0x79>
lea    0x10ac(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11f9 <_prompt_loop_rpc3_nc+0x79>
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_prompt_loop_rpc3_nc>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%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    $0x7,%ecx
jl     11a0 <_prompt_loop_rpc3_nc+0x30>
lea    0x10ba(%rip),%rdi
call   1040 <puts@plt>
lea    0xe2f(%rip),%rdi
lea    0x30(%rsp),%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
test   %rax,%rax
je     156b <_prompt_loop_rpc3_nc+0x3fb>
lea    0xe10(%rip),%r14
lea    0x30(%rsp),%r12
mov    $0x6f676f6c,%r15d
mov    $0x66666f,%r13d
lea    0x104d(%rip),%rbx
mov    0x2dcd(%rip),%rbp
jmp    1245 <_prompt_loop_rpc3_nc+0xd5>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x10e0(%rip),%rdi
call   1040 <puts@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x80,%edx
call   1060 <xreadline@plt>
test   %rax,%rax
je     156b <_prompt_loop_rpc3_nc+0x3fb>
cmpb   $0x0,0x30(%rsp)
je     122c <_prompt_loop_rpc3_nc+0xbc>
mov    0x30(%rsp),%eax
xor    %r15d,%eax
mov    0x33(%rsp),%ecx
xor    %r13d,%ecx
or     %eax,%ecx
je     156b <_prompt_loop_rpc3_nc+0x3fb>
mov    0x30(%rsp),%eax
xor    %r15d,%eax
mov    0x33(%rsp),%ecx
mov    $0x74756f,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     156b <_prompt_loop_rpc3_nc+0x3fb>
mov    0x30(%rsp),%eax
mov    $0x74697865,%ecx
xor    %ecx,%eax
movzbl 0x34(%rsp),%ecx
or     %eax,%ecx
je     156b <_prompt_loop_rpc3_nc+0x3fb>
mov    0x30(%rsp),%eax
mov    $0x706c6568,%ecx
xor    %ecx,%eax
movzbl 0x34(%rsp),%ecx
or     %eax,%ecx
je     1220 <_prompt_loop_rpc3_nc+0xb0>
mov    0x30(%rsp),%eax
mov    $0x706d6574,%ecx
xor    %ecx,%eax
movzbl 0x34(%rsp),%ecx
or     %eax,%ecx
je     12ef <_prompt_loop_rpc3_nc+0x17f>
mov    0x30(%rsp),%rax
movabs $0x746e6572727563,%rcx
cmp    %rcx,%rax
je     12fb <_prompt_loop_rpc3_nc+0x18b>
movabs $0x656761746c6f76,%rcx
cmp    %rcx,%rax
jne    1307 <_prompt_loop_rpc3_nc+0x197>
lea    0x1380(%rip),%rdi
jmp    1227 <_prompt_loop_rpc3_nc+0xb7>
lea    0x132b(%rip),%rdi
jmp    1227 <_prompt_loop_rpc3_nc+0xb7>
lea    0x13b6(%rip),%rdi
jmp    1227 <_prompt_loop_rpc3_nc+0xb7>
mov    0x30(%rsp),%eax
mov    $0x74617473,%ecx
xor    %ecx,%eax
mov    0x33(%rsp),%ecx
mov    $0x737574,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     136c <_prompt_loop_rpc3_nc+0x1fc>
lea    0xcd8(%rip),%r13
mov    %rbx,%rbp
mov    %r12,%rdi
lea    0xf1e(%rip),%rsi
lea    0xc(%rsp),%rbx
mov    %rbx,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    13be <_prompt_loop_rpc3_nc+0x24e>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
ja     1410 <_prompt_loop_rpc3_nc+0x2a0>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %rbp,%rbx
mov    %rbp,%rsi
jmp    13f9 <_prompt_loop_rpc3_nc+0x289>
sub    $0x8,%rsp
lea    0xcba(%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,%r11
lea    0x34(%rsp),%rbp
push   %rbp
mov    %rbx,%rbp
lea    0x38(%rsp),%rbx
push   %rbx
lea    0x3c(%rsp),%rbx
push   %rbx
mov    %rbp,%rbx
mov    %r11,%rbp
call   1050 <printf@plt>
add    $0x20,%rsp
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
mov    %r12,%rdi
lea    0xe95(%rip),%rsi
mov    %rbx,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
jne    1467 <_prompt_loop_rpc3_nc+0x2f7>
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
cmp    $0x7,%ecx
mov    %rbp,%rbx
ja     1503 <_prompt_loop_rpc3_nc+0x393>
mov    %ecx,%eax
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    $0x66666f,%r13d
mov    0x2bd5(%rip),%rbp
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
test   %eax,%eax
mov    %rbp,%rbx
mov    $0x66666f,%r13d
jne    150d <_prompt_loop_rpc3_nc+0x39d>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
mov    0x2bae(%rip),%rbp
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     1440 <_prompt_loop_rpc3_nc+0x2d0>
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
mov    %r12,%rdi
lea    0xdf3(%rip),%rsi
mov    %rbx,%rdx
call   1080 <sscanf@plt>
cmp    $0x1,%eax
mov    %rbp,%rbx
mov    $0x66666f,%r13d
jne    150d <_prompt_loop_rpc3_nc+0x39d>
cmpl   $0x8,0xc(%rsp)
ja     150d <_prompt_loop_rpc3_nc+0x39d>
lea    0xdd5(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movl   $0x9,0xc(%rsp)
mov    $0x9,%esi
lea    0xdcb(%rip),%rbx
mov    0x2b25(%rip),%rbp
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x0(%rbp),%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     14c0 <_prompt_loop_rpc3_nc+0x350>
lea    0xe13(%rip),%rdi
call   1040 <puts@plt>
lea    0xd5b(%rip),%rbx
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
test   %eax,%eax
mov    $0x66666f,%r13d
je     1525 <_prompt_loop_rpc3_nc+0x3b5>
lea    0x1212(%rip),%rdi
call   1040 <puts@plt>
mov    0x2ac0(%rip),%rbp
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
movl   $0x0,0xc(%rsp)
xor    %eax,%eax
mov    0x2aaa(%rip),%rbp
cs nopw 0x0(%rax,%rax,1)
cltq
lea    (%rsp,%rax,4),%rdi
add    $0x10,%rdi
lea    0xaaf(%rip),%rsi
call   1030 <strcpy@plt>
mov    0xc(%rsp),%ecx
lea    0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
cmp    $0x7,%ecx
jl     1540 <_prompt_loop_rpc3_nc+0x3d0>
jmp    122c <_prompt_loop_rpc3_nc+0xbc>
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 = [133 x i8] c"\0D\0A\0D\0ARPC3-NC Series\0D\0A(C) 2002 by BayTech\0D\0AF4.00\0D\0A\0D\0AOption(s) Installed:\0D\0ATrue RMS Current\0D\0AInternal Temperature\0D\0ATrue RMS Voltage\0D\0A\0D\0A\00"
@.str.2 = [9 x i8] c"RPC3-NC>\00"
@.str.3 = [7 x i8] c"logoff\00"
@.str.4 = [7 x i8] c"logout\00"
@.str.5 = [5 x i8] c"exit\00"
@.str.6 = [5 x i8] c"help\00"
@.str.7 = [795 x i8] c"\0D\0AOn n <cr> --Turn on an Outlet, n=0,1...8,all\0D\0AOff n <cr> --Turn off an Outlet, n=0,1...8,all\0D\0AReboot n <cr> --Reboot an Outlet, n=0,1...8,all\0D\0AStatus <cr> --RPC3-NC Status\0D\0AConfig <cr> --Enter configuration mode\0D\0ALock n <cr> --Locks Outlet(s) state, n=0,1...8,all\0D\0AUnlock n <cr> --Unlock Outlet(s) state, n=0,1...8,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.8 = [5 x i8] c"temp\00"
@.str.9 = [74 x i8] c"\0D\0AInternal Temperature: 38.5 C\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.10 = [8 x i8] c"voltage\00"
@.str.11 = [79 x i8] c"\0D\0A\0D\0ATrue RMS Voltage: 120.5 Volts \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.12 = [8 x i8] c"current\00"
@.str.13 = [111 x i8] c"\0D\0A\0D\0ATrue RMS Current: 2.9 Amps\0D\0AMaximum Detected: 4.3 Amps\0D\0A\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.14 = [7 x i8] c"status\00"
@.str.15 = [546 x i8] c"\0D\0A\0D\0A Average Power: 338 Watts\0D\0ATrue RMS Voltage: 120.9 Volts\0D\0ATrue RMS Current: 2.9 Amps\0D\0AMaximum Detected: 4.3 Amps\0D\0A Circuit Breaker: Good\0D\0A\0D\0AInternal Temperature: 40.0 C\0D\0A\0D\0A\0D\0A 1)...Outlet 1 : %s \0D\0A 2)...Outlet 2 : %s \0D\0A 3)...Outlet 3 : %s \0D\0A 4)...Outlet 4 : %s \0D\0A 5)...Outlet 5 : %s \0D\0A 6)...Outlet 6 : %s \0D\0A 7)...Outlet 7 : %s \0D\0A 8)...Outlet 8 : %s \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.16 = [6 x i8] c"on %d\00"
@.str.17 = [4 x i8] c"On \00"
@.str.18 = [7 x i8] c"off %d\00"
@.str.19 = [10 x i8] c"reboot %d\00"
@.str.20 = [17 x i8] c"\0D\0ARebooting... \00"
@.str.21 = [4 x i8] c"\08%d\00"
@stdout = global i32 0
@.str.22 = [3 x i8] c"\0D\0A\00"
@.str.23 = [16 x i8] c"Input error\0D\0A\0D\0A\00"
define void @_prompt_loop_rpc3_nc() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca [8 x [4 x i8]]
%5 = alloca i32
%6 = alloca i32
store i32 8, i32* %3
store i32 1, i32* %5
store i32 1, i32* %6
store i32 0, i32* %1
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %1
%9 = load i32, i32* %3
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %20
11: ; preds = %7
%12 = load i32, i32* %1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %13
%15 = getelementptr inbounds [4 x i8], [4 x i8]* %14, i64 0, i64 0
%16 = call i32 @strcpy(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %11
%18 = load i32, i32* %1
%19 = add nsw i32 %18, 1
store i32 %19, i32* %1
br label %7
20: ; preds = %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([133 x i8], [133 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %226, %225, %34, %20
%23 = load i32, i32* %6
%24 = icmp ne i32 %23, 0
br i1 %24, label %25, label %228
25: ; preds = %22
%26 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%27 = call i32* @xreadline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %26, i32 128)
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %30
29: ; preds = %25
br label %228
30: ; preds = %25
%31 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%32 = call i64 @strlen(i8* %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %35
34: ; preds = %30
br label %22
35: ; preds = %30
%36 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%37 = call i32 @strcmp(i8* %36, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %47
39: ; preds = %35
%40 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%41 = call i32 @strcmp(i8* %40, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %47
43: ; preds = %39
%44 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%45 = call i32 @strcmp(i8* %44, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %43, %39, %35
br label %228
48: ; preds = %43
%49 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%50 = call i32 @strcmp(i8* %49, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%51 = icmp ne i32 %50, 0
br i1 %51, label %54, label %52
52: ; preds = %48
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([795 x i8], [795 x i8]* @.str.7, i64 0, i64 0))
br label %223
54: ; preds = %48
%55 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%56 = call i32 @strcmp(i8* %55, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%57 = icmp ne i32 %56, 0
br i1 %57, label %60, label %58
58: ; preds = %54
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.9, i64 0, i64 0))
br label %222
60: ; preds = %54
%61 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%62 = call i32 @strcmp(i8* %61, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.10, i64 0, i64 0))
%63 = icmp ne i32 %62, 0
br i1 %63, label %66, label %64
64: ; preds = %60
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.11, i64 0, i64 0))
br label %221
66: ; preds = %60
%67 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%68 = call i32 @strcmp(i8* %67, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0))
%69 = icmp ne i32 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([111 x i8], [111 x i8]* @.str.13, i64 0, i64 0))
br label %220
72: ; preds = %66
%73 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%74 = call i32 @strcmp(i8* %73, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%75 = icmp ne i32 %74, 0
br i1 %75, label %94, label %76
76: ; preds = %72
%77 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 0
%78 = getelementptr inbounds [4 x i8], [4 x i8]* %77, i64 0, i64 0
%79 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 1
%80 = getelementptr inbounds [4 x i8], [4 x i8]* %79, i64 0, i64 0
%81 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 2
%82 = getelementptr inbounds [4 x i8], [4 x i8]* %81, i64 0, i64 0
%83 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 3
%84 = getelementptr inbounds [4 x i8], [4 x i8]* %83, i64 0, i64 0
%85 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 4
%86 = getelementptr inbounds [4 x i8], [4 x i8]* %85, i64 0, i64 0
%87 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 5
%88 = getelementptr inbounds [4 x i8], [4 x i8]* %87, i64 0, i64 0
%89 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 6
%90 = getelementptr inbounds [4 x i8], [4 x i8]* %89, i64 0, i64 0
%91 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 7
%92 = getelementptr inbounds [4 x i8], [4 x i8]* %91, i64 0, i64 0
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([546 x i8], [546 x i8]* @.str.15, i64 0, i64 0), i8* %78, i8* %80, i8* %82, i8* %84, i8* %86, i8* %88, i8* %90, i8* %92)
br label %219
94: ; preds = %72
%95 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%96 = call i32 @sscanf(i8* %95, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32* %1)
%97 = icmp eq i32 %96, 1
br i1 %97, label %98, label %137
98: ; preds = %94
%99 = load i32, i32* %1
%100 = load i32, i32* %5
%101 = icmp sge i32 %99, %100
br i1 %101, label %102, label %116
102: ; preds = %98
%103 = load i32, i32* %1
%104 = load i32, i32* %3
%105 = load i32, i32* %5
%106 = add nsw i32 %104, %105
%107 = icmp slt i32 %103, %106
br i1 %107, label %108, label %116
108: ; preds = %102
%109 = load i32, i32* %1
%110 = load i32, i32* %5
%111 = sub nsw i32 %109, %110
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %112
%114 = getelementptr inbounds [4 x i8], [4 x i8]* %113, i64 0, i64 0
%115 = call i32 @strcpy(i8* %114, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %136
116: ; preds = %102, %98
%117 = load i32, i32* %1
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %134
119: ; preds = %116
store i32 0, i32* %1
br label %120
120: ; preds = %130, %119
%121 = load i32, i32* %1
%122 = load i32, i32* %3
%123 = icmp slt i32 %121, %122
br i1 %123, label %124, label %133
124: ; preds = %120
%125 = load i32, i32* %1
%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.17, i64 0, i64 0))
br label %130
130: ; preds = %124
%131 = load i32, i32* %1
%132 = add nsw i32 %131, 1
store i32 %132, i32* %1
br label %120
133: ; preds = %120
br label %135
134: ; preds = %116
br label %226
135: ; preds = %133
br label %136
136: ; preds = %135, %108
br label %218
137: ; preds = %94
%138 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%139 = call i32 @sscanf(i8* %138, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32* %1)
%140 = icmp eq i32 %139, 1
br i1 %140, label %141, label %180
141: ; preds = %137
%142 = load i32, i32* %1
%143 = load i32, i32* %5
%144 = icmp sge i32 %142, %143
br i1 %144, label %145, label %159
145: ; preds = %141
%146 = load i32, i32* %1
%147 = load i32, i32* %3
%148 = load i32, i32* %5
%149 = add nsw i32 %147, %148
%150 = icmp slt i32 %146, %149
br i1 %150, label %151, label %159
151: ; preds = %145
%152 = load i32, i32* %1
%153 = load i32, i32* %5
%154 = sub nsw i32 %152, %153
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %4, i64 0, i64 %155
%157 = getelementptr inbounds [4 x i8], [4 x i8]* %156, i64 0, i64 0
%158 = call i32 @strcpy(i8* %157, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %179
159: ; preds = %145, %141
%160 = load i32, i32* %1
%161 = icmp eq i32 %160, 0
br i1 %161, label %162, label %177
162: ; preds = %159
store i32 0, i32* %1
br label %163
163: ; preds = %173, %162
%164 = load i32, i32* %1
%165 = load i32, i32* %3
%166 = icmp slt i32 %164, %165
br i1 %166, label %167, label %176
167: ; preds = %163
%168 = load i32, i32* %1
%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 %173
173: ; preds = %167
%174 = load i32, i32* %1
%175 = add nsw i32 %174, 1
store i32 %175, i32* %1
br label %163
176: ; preds = %163
br label %178
177: ; preds = %159
br label %226
178: ; preds = %176
br label %179
179: ; preds = %178, %151
br label %217
180: ; preds = %137
%181 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%182 = call i32 @sscanf(i8* %181, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%183 = icmp eq i32 %182, 1
br i1 %183, label %184, label %215
184: ; preds = %180
%185 = load i32, i32* %1
%186 = icmp eq i32 %185, 0
br i1 %186, label %197, label %187
187: ; preds = %184
%188 = load i32, i32* %1
%189 = load i32, i32* %5
%190 = icmp sge i32 %188, %189
br i1 %190, label %191, label %213
191: ; preds = %187
%192 = load i32, i32* %1
%193 = load i32, i32* %3
%194 = load i32, i32* %5
%195 = add nsw i32 %193, %194
%196 = icmp slt i32 %192, %195
br i1 %196, label %197, label %213
197: ; preds = %191, %184
%198 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0))
store i32 9, i32* %1
br label %199
199: ; preds = %208, %197
%200 = load i32, i32* %1
%201 = icmp sge i32 %200, 0
br i1 %201, label %202, label %211
202: ; preds = %199
%203 = load i32, i32* %1
%204 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i32 %203)
%205 = load i32, i32* @stdout
%206 = call i32 @fflush(i32 %205)
%207 = call i32 @sleep(i32 1)
br label %208
208: ; preds = %202
%209 = load i32, i32* %1
%210 = add nsw i32 %209, -1
store i32 %210, i32* %1
br label %199
211: ; preds = %199
%212 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
br label %214
213: ; preds = %191, %187
br label %226
214: ; preds = %211
br label %216
215: ; preds = %180
br label %226
216: ; preds = %214
br label %217
217: ; preds = %216, %179
br label %218
218: ; preds = %217, %136
br label %219
219: ; preds = %218, %76
br label %220
220: ; preds = %219, %70
br label %221
221: ; preds = %220, %64
br label %222
222: ; preds = %221, %58
br label %223
223: ; preds = %222, %52
br label %224
224: ; preds = %223
br label %225
225: ; preds = %224
br label %22
226: ; preds = %215, %213, %177, %134
%227 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.23, i64 0, i64 0))
br label %22
228: ; preds = %47, %29, %22
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"Off\00"
@.str.2 = [9 x i8] c"RPC3-NC>\00"
@.str.3 = [7 x i8] c"logoff\00"
@.str.4 = [7 x i8] c"logout\00"
@.str.5 = [5 x i8] c"exit\00"
@.str.6 = [5 x i8] c"help\00"
@.str.8 = [5 x i8] c"temp\00"
@.str.14 = [7 x i8] c"status\00"
@.str.15 = [546 x i8] c"\0D\0A\0D\0A Average Power: 338 Watts\0D\0ATrue RMS Voltage: 120.9 Volts\0D\0ATrue RMS Current: 2.9 Amps\0D\0AMaximum Detected: 4.3 Amps\0D\0A Circuit Breaker: Good\0D\0A\0D\0AInternal Temperature: 40.0 C\0D\0A\0D\0A\0D\0A 1)...Outlet 1 : %s \0D\0A 2)...Outlet 2 : %s \0D\0A 3)...Outlet 3 : %s \0D\0A 4)...Outlet 4 : %s \0D\0A 5)...Outlet 5 : %s \0D\0A 6)...Outlet 6 : %s \0D\0A 7)...Outlet 7 : %s \0D\0A 8)...Outlet 8 : %s \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\0A\00"
@.str.16 = [6 x i8] c"on %d\00"
@.str.17 = [4 x i8] c"On \00"
@.str.18 = [7 x i8] c"off %d\00"
@.str.19 = [10 x i8] c"reboot %d\00"
@.str.20 = [17 x i8] c"\0D\0ARebooting... \00"
@.str.21 = [4 x i8] c"\08%d\00"
@stdout = global i32 0
@str = [132 x i8] c"\0D\0A\0D\0ARPC3-NC Series\0D\0A(C) 2002 by BayTech\0D\0AF4.00\0D\0A\0D\0AOption(s) Installed:\0D\0ATrue RMS Current\0D\0AInternal Temperature\0D\0ATrue RMS Voltage\0D\0A\0D\00"
@str.24 = [794 x i8] c"\0D\0AOn n <cr> --Turn on an Outlet, n=0,1...8,all\0D\0AOff n <cr> --Turn off an Outlet, n=0,1...8,all\0D\0AReboot n <cr> --Reboot an Outlet, n=0,1...8,all\0D\0AStatus <cr> --RPC3-NC Status\0D\0AConfig <cr> --Enter configuration mode\0D\0ALock n <cr> --Locks Outlet(s) state, n=0,1...8,all\0D\0AUnlock n <cr> --Unlock Outlet(s) state, n=0,1...8,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.25 = [73 x i8] c"\0D\0AInternal Temperature: 38.5 C\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.26 = [78 x i8] c"\0D\0A\0D\0ATrue RMS Voltage: 120.5 Volts \0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.27 = [110 x i8] c"\0D\0A\0D\0ATrue RMS Current: 2.9 Amps\0D\0AMaximum Detected: 4.3 Amps\0D\0A\0D\0A\0D\0AType \22Help\22 for a list of commands\0D\0A\0D\00"
@str.28 = [15 x i8] c"Input error\0D\0A\0D\00"
@str.29 = [2 x i8] c"\0D\00"
define void @_prompt_loop_rpc3_nc() {
%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 ([132 x i8], [132 x i8]* @str, i64 0, i64 0))
%17 = call i32* @xreadline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %5, i32 128)
%18 = icmp eq i32* %17, null
br i1 %18, label %129, label %19
19: ; preds = %15
%20 = bitcast [128 x i8]* %2 to i64*
%21 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 1, i64 0
%22 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 2, i64 0
%23 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 3, i64 0
%24 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 4, i64 0
%25 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 5, i64 0
%26 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 6, i64 0
%27 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 7, i64 0
br label %28
28: ; preds = %19, %124
%29 = load i8, i8* %5
%30 = icmp eq i8 %29, 0
br i1 %30, label %124, label %31
31: ; preds = %28
%32 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%33 = icmp eq i32 %32, 0
br i1 %33, label %129, label %34
34: ; preds = %31
%35 = 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)
%36 = icmp eq i32 %35, 0
br i1 %36, label %129, label %37
37: ; preds = %34
%38 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i64 5)
%39 = icmp eq i32 %38, 0
br i1 %39, label %129, label %40
40: ; preds = %37
%41 = 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)
%42 = icmp eq i32 %41, 0
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([794 x i8], [794 x i8]* @str.24, i64 0, i64 0))
br label %124
45: ; preds = %40
%46 = call i32 @bcmp(i8* dereferenceable(5) %5, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0), i64 5)
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([73 x i8], [73 x i8]* @str.25, i64 0, i64 0))
br label %124
50: ; preds = %45
%51 = load i64, i64* %20
switch i64 %51, label %56 [
i64 28542640910528374, label %52
i64 32772479289292131, label %54
]
52: ; preds = %50
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.26, i64 0, i64 0))
br label %124
54: ; preds = %50
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([110 x i8], [110 x i8]* @str.27, i64 0, i64 0))
br label %124
56: ; preds = %50
%57 = call i32 @bcmp(i8* dereferenceable(7) %5, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i64 7)
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %56
%60 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([546 x i8], [546 x i8]* @.str.15, i64 0, i64 0), i8* %6, i8* %21, i8* %22, i8* %23, i8* %24, i8* %25, i8* %26, i8* %27)
br label %124
61: ; preds = %56
%62 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.16, i64 0, i64 0), i32* %1)
%63 = icmp eq i32 %62, 1
br i1 %63, label %64, label %83
64: ; preds = %61
%65 = load i32, i32* %1
%66 = add i32 %65, -1
%67 = icmp ult i32 %66, 8
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = zext i32 %66 to i64
%70 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %69, i64 0
%71 = call i32 @strcpy(i8* %70, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
br label %124
72: ; preds = %64
%73 = icmp eq i32 %65, 0
br i1 %73, label %74, label %127
74: ; preds = %72
store i32 0, i32* %1
br label %75
75: ; preds = %74, %75
%76 = phi i32 [ 0, %74 ], [ %81, %75 ]
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %77, i64 0
%79 = call i32 @strcpy(i8* %78, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0))
%80 = load i32, i32* %1
%81 = add nsw i32 %80, 1
store i32 %81, i32* %1
%82 = icmp slt i32 %80, 7
br i1 %82, label %75, label %124
83: ; preds = %61
%84 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i32* %1)
%85 = icmp eq i32 %84, 1
br i1 %85, label %86, label %105
86: ; preds = %83
%87 = load i32, i32* %1
%88 = add i32 %87, -1
%89 = icmp ult i32 %88, 8
br i1 %89, label %90, label %94
90: ; preds = %86
%91 = zext i32 %88 to i64
%92 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %91, i64 0
%93 = call i32 @strcpy(i8* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
br label %124
94: ; preds = %86
%95 = icmp eq i32 %87, 0
br i1 %95, label %96, label %127
96: ; preds = %94
store i32 0, i32* %1
br label %97
97: ; preds = %96, %97
%98 = phi i32 [ 0, %96 ], [ %103, %97 ]
%99 = sext i32 %98 to i64
%100 = getelementptr inbounds [8 x [4 x i8]], [8 x [4 x i8]]* %3, i64 0, i64 %99, i64 0
%101 = call i32 @strcpy(i8* %100, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%102 = load i32, i32* %1
%103 = add nsw i32 %102, 1
store i32 %103, i32* %1
%104 = icmp slt i32 %102, 7
br i1 %104, label %97, label %124
105: ; preds = %83
%106 = call i32 @sscanf(i8* %5, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i32* %1)
%107 = icmp eq i32 %106, 1
%108 = load i32, i32* %1
%109 = icmp ult i32 %108, 9
%110 = select i1 %107, i1 %109, i1 false
br i1 %110, label %111, label %127
111: ; preds = %105
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0))
store i32 9, i32* %1
br label %113
113: ; preds = %111, %113
%114 = phi i32 [ 9, %111 ], [ %120, %113 ]
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0), i32 %114)
%116 = load i32, i32* @stdout
%117 = call i32 @fflush(i32 %116)
%118 = call i32 @sleep(i32 1)
%119 = load i32, i32* %1
%120 = add nsw i32 %119, -1
store i32 %120, i32* %1
%121 = icmp sgt i32 %119, 0
br i1 %121, label %113, label %122
122: ; preds = %113
%123 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.29, i64 0, i64 0))
br label %124
124: ; preds = %97, %75, %43, %52, %59, %122, %90, %68, %54, %48, %127, %28
%125 = call i32* @xreadline(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %5, i32 128)
%126 = icmp eq i32* %125, null
br i1 %126, label %129, label %28
127: ; preds = %105, %94, %72
%128 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.28, i64 0, i64 0))
br label %124
129: ; preds = %124, %37, %34, %31, %15
ret void
}