#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*/ exit(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int sscanf(char *, char *, int *);
int /*<<< orphan*/ strcmp(char *, char *);
scalar_t__ strlen(char *);
int /*<<< orphan*/ *xreadline(char *, char *, int);
void _prompt_loop(void) {
  int i;
  char buf[128];
  int num_plugs = 48;
  int plug[48];
  int plug_origin = 1;
  for (i = 0; i < num_plugs; i++) {
    plug[i] = 0;
  }
  while (1) {
    if (xreadline("", buf, sizeof(buf)) == NULL)
      break;
    if (strlen(buf) == 0) {
    } else if (!strcmp(buf, "exprange on")) {
    } else if (!strcmp(buf, "exprange off")) {
    } else if (!strcmp(buf, "status")) {
      for (i = 0; i < num_plugs; i++)
        printf("plug %d: %s\n", i + plug_origin, plug[i] ? "on" : "off");
    } else if (sscanf(buf, "status %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      printf("plug %d: %s\n", i + plug_origin, plug[i] ? "on" : "off");
    } else if (sscanf(buf, "on %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 1;
    } else if (sscanf(buf, "off %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 0;
    } else if (sscanf(buf, "cycle %d", &i) == 1) {
      i -= plug_origin;
      if (i < 0 || i >= num_plugs)
        break;
      plug[i] = 0;
      sleep(2);
      plug[i] = 1;
    } else
      break;
    printf("swpdu> ");
  }
  printf("Error, exiting");
  exit(1);
}


x86 assembly (clang, -O0):
<_prompt_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x170,%rsp
movl   $0x30,-0x94(%rbp)
movl   $0x1,-0x164(%rbp)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    11c2 <_prompt_loop+0x52>
movslq -0x4(%rbp),%rax
movl   $0x0,-0x160(%rbp,%rax,4)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1196 <_prompt_loop+0x26>
jmp    11c7 <_prompt_loop+0x57>
lea    -0x90(%rbp),%rsi
lea    0xe57(%rip),%rdi
mov    $0x80,%edx
call   1050 <xreadline@plt>
cmp    $0x0,%rax
jne    11ee <_prompt_loop+0x7e>
jmp    14c3 <_prompt_loop+0x353>
lea    -0x90(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
jne    1209 <_prompt_loop+0x99>
jmp    14b0 <_prompt_loop+0x340>
lea    -0x90(%rbp),%rdi
lea    0xde9(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    122a <_prompt_loop+0xba>
jmp    14ab <_prompt_loop+0x33b>
lea    -0x90(%rbp),%rdi
lea    0xdd4(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    124b <_prompt_loop+0xdb>
jmp    14a6 <_prompt_loop+0x336>
lea    -0x90(%rbp),%rdi
lea    0xdc0(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    12c7 <_prompt_loop+0x157>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jge    12c2 <_prompt_loop+0x152>
mov    -0x4(%rbp),%esi
add    -0x164(%rbp),%esi
movslq -0x4(%rbp),%rax
mov    -0x160(%rbp,%rax,4),%ecx
lea    0xd7d(%rip),%rdx
lea    0xd6a(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    126e <_prompt_loop+0xfe>
jmp    14a1 <_prompt_loop+0x331>
lea    -0x90(%rbp),%rdi
lea    0xd58(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    134f <_prompt_loop+0x1df>
mov    -0x164(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     130e <_prompt_loop+0x19e>
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jl     1313 <_prompt_loop+0x1a3>
jmp    14c3 <_prompt_loop+0x353>
mov    -0x4(%rbp),%esi
add    -0x164(%rbp),%esi
movslq -0x4(%rbp),%rax
mov    -0x160(%rbp,%rax,4),%ecx
lea    0xce7(%rip),%rdx
lea    0xcd4(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    149c <_prompt_loop+0x32c>
lea    -0x90(%rbp),%rdi
lea    0xcda(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    13af <_prompt_loop+0x23f>
mov    -0x164(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1396 <_prompt_loop+0x226>
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jl     139b <_prompt_loop+0x22b>
jmp    14c3 <_prompt_loop+0x353>
movslq -0x4(%rbp),%rax
movl   $0x1,-0x160(%rbp,%rax,4)
jmp    1497 <_prompt_loop+0x327>
lea    -0x90(%rbp),%rdi
lea    0xc80(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    140f <_prompt_loop+0x29f>
mov    -0x164(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     13f6 <_prompt_loop+0x286>
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jl     13fb <_prompt_loop+0x28b>
jmp    14c3 <_prompt_loop+0x353>
movslq -0x4(%rbp),%rax
movl   $0x0,-0x160(%rbp,%rax,4)
jmp    1492 <_prompt_loop+0x322>
lea    -0x90(%rbp),%rdi
lea    0xc27(%rip),%rsi
lea    -0x4(%rbp),%rdx
call   1070 <sscanf@plt>
cmp    $0x1,%eax
jne    1488 <_prompt_loop+0x318>
mov    -0x164(%rbp),%ecx
mov    -0x4(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1456 <_prompt_loop+0x2e6>
mov    -0x4(%rbp),%eax
cmp    -0x94(%rbp),%eax
jl     145b <_prompt_loop+0x2eb>
jmp    14c3 <_prompt_loop+0x353>
movslq -0x4(%rbp),%rax
movl   $0x0,-0x160(%rbp,%rax,4)
mov    $0x2,%edi
call   1090 <sleep@plt>
movslq -0x4(%rbp),%rax
movl   $0x1,-0x160(%rbp,%rax,4)
jmp    148d <_prompt_loop+0x31d>
jmp    14c3 <_prompt_loop+0x353>
jmp    1492 <_prompt_loop+0x322>
jmp    1497 <_prompt_loop+0x327>
jmp    149c <_prompt_loop+0x32c>
jmp    14a1 <_prompt_loop+0x331>
jmp    14a6 <_prompt_loop+0x336>
jmp    14ab <_prompt_loop+0x33b>
jmp    14b0 <_prompt_loop+0x340>
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11c7 <_prompt_loop+0x57>
lea    0xb8b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<_prompt_loop>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x158,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x140(%rsp)
movaps %xmm0,0x130(%rsp)
movaps %xmm0,0x120(%rsp)
movaps %xmm0,0x110(%rsp)
movaps %xmm0,0x100(%rsp)
movaps %xmm0,0xf0(%rsp)
movaps %xmm0,0xe0(%rsp)
movaps %xmm0,0xd0(%rsp)
movaps %xmm0,0xc0(%rsp)
movaps %xmm0,0xb0(%rsp)
movaps %xmm0,0xa0(%rsp)
movaps %xmm0,0x90(%rsp)
movl   $0x30,0xc(%rsp)
lea    0xe59(%rip),%rdi
lea    0x10(%rsp),%rsi
mov    $0x80,%edx
call   1040 <xreadline@plt>
test   %rax,%rax
jne    11ff <_prompt_loop+0xaf>
lea    0xe67(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
movabs $0x65676e6172707865,%rbp
6e 67 65
lea    0xe1c(%rip),%rbx
lea    0x10(%rsp),%r13
lea    0xdf9(%rip),%r15
lea    0xde6(%rip),%r14
lea    0xdf6(%rip),%r12
jmp    1287 <_prompt_loop+0x137>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
add    $0xffffffcf,%ecx
cmp    $0xffffffd0,%ecx
lea    0x10(%rsp),%r13
jb     11e7 <_prompt_loop+0x97>
mov    %eax,%eax
movl   $0x1,0x90(%rsp,%rax,4)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    $0x80,%edx
call   1040 <xreadline@plt>
test   %rax,%rax
je     11e7 <_prompt_loop+0x97>
cmpb   $0x0,0x10(%rsp)
je     1260 <_prompt_loop+0x110>
mov    0x10(%rsp),%rax
xor    %rbp,%rax
mov    0x18(%rsp),%ecx
xor    $0x6e6f20,%rcx
or     %rax,%rcx
je     1260 <_prompt_loop+0x110>
mov    0x10(%rsp),%rax
xor    %rbp,%rax
mov    0x15(%rsp),%rcx
movabs $0x66666f2065676e,%rdx
xor    %rdx,%rcx
or     %rax,%rcx
je     1260 <_prompt_loop+0x110>
mov    0x10(%rsp),%eax
mov    $0x74617473,%ecx
xor    %ecx,%eax
mov    0x13(%rsp),%ecx
mov    $0x737574,%edx
xor    %edx,%ecx
or     %eax,%ecx
je     133b <_prompt_loop+0x1eb>
mov    %r13,%rdi
lea    0xd44(%rip),%rsi
lea    0xc(%rsp),%r13
mov    %r13,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    1384 <_prompt_loop+0x234>
mov    0xc(%rsp),%esi
lea    -0x1(%rsi),%eax
mov    %eax,0xc(%rsp)
lea    -0x31(%rsi),%ecx
cmp    $0xffffffd0,%ecx
lea    0x10(%rsp),%r13
jb     11e7 <_prompt_loop+0x97>
mov    %eax,%eax
cmpl   $0x0,0x90(%rsp,%rax,4)
mov    %r14,%rdx
cmove  %r15,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1260 <_prompt_loop+0x110>
movl   $0x0,0xc(%rsp)
xor    %esi,%esi
cs nopw 0x0(%rax,%rax,1)
nop
movslq %esi,%rax
add    $0x1,%esi
cmpl   $0x0,0x90(%rsp,%rax,4)
mov    %r14,%rdx
cmove  %r15,%rdx
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
lea    0x1(%rax),%esi
mov    %esi,0xc(%rsp)
cmp    $0x2f,%eax
jl     1350 <_prompt_loop+0x200>
jmp    1260 <_prompt_loop+0x110>
lea    0x10(%rsp),%rdi
lea    0xca7(%rip),%rsi
mov    %r13,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
je     122c <_prompt_loop+0xdc>
lea    0x10(%rsp),%rdi
lea    0xc90(%rip),%rsi
mov    %r13,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
jne    13e8 <_prompt_loop+0x298>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
add    $0xffffffcf,%ecx
cmp    $0xffffffd0,%ecx
lea    0x10(%rsp),%r13
jb     11e7 <_prompt_loop+0x97>
mov    %eax,%eax
movl   $0x0,0x90(%rsp,%rax,4)
jmp    1260 <_prompt_loop+0x110>
lea    0x10(%rsp),%rdi
lea    0xc50(%rip),%rsi
mov    %r13,%rdx
call   1050 <sscanf@plt>
cmp    $0x1,%eax
lea    0x10(%rsp),%r13
jne    11e7 <_prompt_loop+0x97>
mov    0xc(%rsp),%ecx
lea    -0x1(%rcx),%eax
mov    %eax,0xc(%rsp)
add    $0xffffffcf,%ecx
cmp    $0xffffffd0,%ecx
jb     11e7 <_prompt_loop+0x97>
mov    %eax,%eax
movl   $0x0,0x90(%rsp,%rax,4)
mov    $0x2,%edi
call   1070 <sleep@plt>
movslq 0xc(%rsp),%rax
jmp    1246 <_prompt_loop+0xf6>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [12 x i8] c"exprange on\00"
@.str.2 = [13 x i8] c"exprange off\00"
@.str.3 = [7 x i8] c"status\00"
@.str.4 = [13 x i8] c"plug %d: %s\0A\00"
@.str.5 = [3 x i8] c"on\00"
@.str.6 = [4 x i8] c"off\00"
@.str.7 = [10 x i8] c"status %d\00"
@.str.8 = [6 x i8] c"on %d\00"
@.str.9 = [7 x i8] c"off %d\00"
@.str.10 = [9 x i8] c"cycle %d\00"
@.str.11 = [8 x i8] c"swpdu> \00"
@.str.12 = [15 x i8] c"Error, exiting\00"
define void @_prompt_loop() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca i32
%4 = alloca [48 x i32]
%5 = alloca i32
store i32 48, i32* %3
store i32 1, i32* %5
store i32 0, i32* %1
br label %6
6: ; preds = %14, %0
%7 = load i32, i32* %1
%8 = load i32, i32* %3
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %17
10: ; preds = %6
%11 = load i32, i32* %1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %12
store i32 0, i32* %13
br label %14
14: ; preds = %10
%15 = load i32, i32* %1
%16 = add nsw i32 %15, 1
store i32 %16, i32* %1
br label %6
17: ; preds = %6
br label %18
18: ; preds = %17, %159
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%20 = call i32* @xreadline(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %19, i32 128)
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %23
22: ; preds = %18
br label %161
23: ; preds = %18
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%25 = call i64 @strlen(i8* %24)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %23
br label %159
28: ; preds = %23
%29 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%30 = call i32 @strcmp(i8* %29, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp ne i32 %30, 0
br i1 %31, label %33, label %32
32: ; preds = %28
br label %158
33: ; preds = %28
%34 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp ne i32 %35, 0
br i1 %36, label %38, label %37
37: ; preds = %33
br label %157
38: ; preds = %33
%39 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%40 = call i32 @strcmp(i8* %39, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%41 = icmp ne i32 %40, 0
br i1 %41, label %63, label %42
42: ; preds = %38
store i32 0, i32* %1
br label %43
43: ; preds = %59, %42
%44 = load i32, i32* %1
%45 = load i32, i32* %3
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %62
47: ; preds = %43
%48 = load i32, i32* %1
%49 = load i32, i32* %5
%50 = add nsw i32 %48, %49
%51 = load i32, i32* %1
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %52
%54 = load i32, i32* %53
%55 = icmp ne i32 %54, 0
%56 = zext i1 %55 to i64
%57 = select i1 %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %50, i8* %57)
br label %59
59: ; preds = %47
%60 = load i32, i32* %1
%61 = add nsw i32 %60, 1
store i32 %61, i32* %1
br label %43
62: ; preds = %43
br label %156
63: ; preds = %38
%64 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%65 = call i32 @sscanf(i8* %64, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%66 = icmp eq i32 %65, 1
br i1 %66, label %67, label %90
67: ; preds = %63
%68 = load i32, i32* %5
%69 = load i32, i32* %1
%70 = sub nsw i32 %69, %68
store i32 %70, i32* %1
%71 = load i32, i32* %1
%72 = icmp slt i32 %71, 0
br i1 %72, label %77, label %73
73: ; preds = %67
%74 = load i32, i32* %1
%75 = load i32, i32* %3
%76 = icmp sge i32 %74, %75
br i1 %76, label %77, label %78
77: ; preds = %73, %67
br label %161
78: ; preds = %73
%79 = load i32, i32* %1
%80 = load i32, i32* %5
%81 = add nsw i32 %79, %80
%82 = load i32, i32* %1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %83
%85 = load i32, i32* %84
%86 = icmp ne i32 %85, 0
%87 = zext i1 %86 to i64
%88 = select i1 %86, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %81, i8* %88)
br label %155
90: ; preds = %63
%91 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%92 = call i32 @sscanf(i8* %91, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%93 = icmp eq i32 %92, 1
br i1 %93, label %94, label %109
94: ; preds = %90
%95 = load i32, i32* %5
%96 = load i32, i32* %1
%97 = sub nsw i32 %96, %95
store i32 %97, i32* %1
%98 = load i32, i32* %1
%99 = icmp slt i32 %98, 0
br i1 %99, label %104, label %100
100: ; preds = %94
%101 = load i32, i32* %1
%102 = load i32, i32* %3
%103 = icmp sge i32 %101, %102
br i1 %103, label %104, label %105
104: ; preds = %100, %94
br label %161
105: ; preds = %100
%106 = load i32, i32* %1
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %107
store i32 1, i32* %108
br label %154
109: ; preds = %90
%110 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%111 = call i32 @sscanf(i8* %110, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%112 = icmp eq i32 %111, 1
br i1 %112, label %113, label %128
113: ; preds = %109
%114 = load i32, i32* %5
%115 = load i32, i32* %1
%116 = sub nsw i32 %115, %114
store i32 %116, i32* %1
%117 = load i32, i32* %1
%118 = icmp slt i32 %117, 0
br i1 %118, label %123, label %119
119: ; preds = %113
%120 = load i32, i32* %1
%121 = load i32, i32* %3
%122 = icmp sge i32 %120, %121
br i1 %122, label %123, label %124
123: ; preds = %119, %113
br label %161
124: ; preds = %119
%125 = load i32, i32* %1
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %126
store i32 0, i32* %127
br label %153
128: ; preds = %109
%129 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%130 = call i32 @sscanf(i8* %129, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%131 = icmp eq i32 %130, 1
br i1 %131, label %132, label %151
132: ; preds = %128
%133 = load i32, i32* %5
%134 = load i32, i32* %1
%135 = sub nsw i32 %134, %133
store i32 %135, i32* %1
%136 = load i32, i32* %1
%137 = icmp slt i32 %136, 0
br i1 %137, label %142, label %138
138: ; preds = %132
%139 = load i32, i32* %1
%140 = load i32, i32* %3
%141 = icmp sge i32 %139, %140
br i1 %141, label %142, label %143
142: ; preds = %138, %132
br label %161
143: ; preds = %138
%144 = load i32, i32* %1
%145 = sext i32 %144 to i64
%146 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %145
store i32 0, i32* %146
%147 = call i32 @sleep(i32 2)
%148 = load i32, i32* %1
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds [48 x i32], [48 x i32]* %4, i64 0, i64 %149
store i32 1, i32* %150
br label %152
151: ; preds = %128
br label %161
152: ; preds = %143
br label %153
153: ; preds = %152, %124
br label %154
154: ; preds = %153, %105
br label %155
155: ; preds = %154, %78
br label %156
156: ; preds = %155, %62
br label %157
157: ; preds = %156, %37
br label %158
158: ; preds = %157, %32
br label %159
159: ; preds = %158, %27
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
br label %18
161: ; preds = %151, %142, %123, %104, %77, %22
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%163 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [12 x i8] c"exprange on\00"
@.str.2 = [13 x i8] c"exprange off\00"
@.str.3 = [7 x i8] c"status\00"
@.str.4 = [13 x i8] c"plug %d: %s\0A\00"
@.str.5 = [3 x i8] c"on\00"
@.str.6 = [4 x i8] c"off\00"
@.str.7 = [10 x i8] c"status %d\00"
@.str.8 = [6 x i8] c"on %d\00"
@.str.9 = [7 x i8] c"off %d\00"
@.str.10 = [9 x i8] c"cycle %d\00"
@.str.11 = [8 x i8] c"swpdu> \00"
@.str.12 = [15 x i8] c"Error, exiting\00"
define void @_prompt_loop() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca [48 x i32]
%4 = bitcast [48 x i32]* %3 to i8*
%5 = bitcast i32* %1 to i8*
%6 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
store i32 48, i32* %1
%7 = call i32* @xreadline(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6, i32 128)
%8 = icmp eq i32* %7, null
br i1 %8, label %90, label %9
9: ; preds = %0, %86
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 0
br i1 %11, label %86, label %12
12: ; preds = %9
%13 = call i32 @bcmp(i8* dereferenceable(12) %6, i8* dereferenceable(12) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i64 12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %86, label %15
15: ; preds = %12
%16 = call i32 @bcmp(i8* dereferenceable(13) %6, i8* dereferenceable(13) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i64 13)
%17 = icmp eq i32 %16, 0
br i1 %17, label %86, label %18
18: ; preds = %15
%19 = call i32 @bcmp(i8* dereferenceable(7) %6, i8* dereferenceable(7) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i64 7)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %34
21: ; preds = %18
store i32 0, i32* %1
br label %22
22: ; preds = %21, %22
%23 = phi i32 [ 0, %21 ], [ %32, %22 ]
%24 = add nsw i32 %23, 1
%25 = sext i32 %23 to i64
%26 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
%28 = icmp eq i32 %27, 0
%29 = select i1 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %24, i8* %29)
%31 = load i32, i32* %1
%32 = add nsw i32 %31, 1
store i32 %32, i32* %1
%33 = icmp slt i32 %31, 47
br i1 %33, label %22, label %86
34: ; preds = %18
%35 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i32* %1)
%36 = icmp eq i32 %35, 1
br i1 %36, label %37, label %49
37: ; preds = %34
%38 = load i32, i32* %1
%39 = add nsw i32 %38, -1
store i32 %39, i32* %1
%40 = add i32 %38, -49
%41 = icmp ult i32 %40, -48
br i1 %41, label %90, label %42
42: ; preds = %37
%43 = zext i32 %39 to i64
%44 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %43
%45 = load i32, i32* %44
%46 = icmp eq i32 %45, 0
%47 = select i1 %46, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0)
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32 %38, i8* %47)
br label %86
49: ; preds = %34
%50 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32* %1)
%51 = icmp eq i32 %50, 1
br i1 %51, label %52, label %60
52: ; preds = %49
%53 = load i32, i32* %1
%54 = add nsw i32 %53, -1
store i32 %54, i32* %1
%55 = add i32 %53, -49
%56 = icmp ult i32 %55, -48
br i1 %56, label %90, label %57
57: ; preds = %52
%58 = zext i32 %54 to i64
%59 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %58
store i32 1, i32* %59
br label %86
60: ; preds = %49
%61 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32* %1)
%62 = icmp eq i32 %61, 1
br i1 %62, label %63, label %71
63: ; preds = %60
%64 = load i32, i32* %1
%65 = add nsw i32 %64, -1
store i32 %65, i32* %1
%66 = add i32 %64, -49
%67 = icmp ult i32 %66, -48
br i1 %67, label %90, label %68
68: ; preds = %63
%69 = zext i32 %65 to i64
%70 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %69
store i32 0, i32* %70
br label %86
71: ; preds = %60
%72 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i32* %1)
%73 = icmp eq i32 %72, 1
br i1 %73, label %74, label %90
74: ; preds = %71
%75 = load i32, i32* %1
%76 = add nsw i32 %75, -1
store i32 %76, i32* %1
%77 = add i32 %75, -49
%78 = icmp ult i32 %77, -48
br i1 %78, label %90, label %79
79: ; preds = %74
%80 = zext i32 %76 to i64
%81 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %80
store i32 0, i32* %81
%82 = call i32 @sleep(i32 2)
%83 = load i32, i32* %1
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [48 x i32], [48 x i32]* %3, i64 0, i64 %84
store i32 1, i32* %85
br label %86
86: ; preds = %22, %12, %57, %79, %68, %42, %15, %9
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0))
%88 = call i32* @xreadline(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8* %6, i32 128)
%89 = icmp eq i32* %88, null
br i1 %89, label %90, label %9
90: ; preds = %86, %37, %52, %63, %74, %71, %0
%91 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.12, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
}