#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ printf(char *);
scalar_t__ scanf(char *, char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char commands[30];
  int helper = 1, count = 1, k;
  int output[100];
  output[0] = 1;
  while (scanf("%s", commands) != EOF) {
    if (helper == 1 && strcmp(commands, "button_clicked") == 0) {
      helper = 2;
      output[count] = helper;
    } else if (helper == 2 && strcmp(commands, "button_clicked") == 0) {
      helper = 6;
      output[count] = helper;
    } else if (helper == 2 && strcmp(commands, "cycle_complete") == 0) {
      helper = 3;
      output[count] = helper;
    } else if (helper == 4 && strcmp(commands, "button_clicked") == 0) {
      helper = 5;
      output[count] = helper;
    } else if (helper == 4 && strcmp(commands, "cycle_complete") == 0) {
      helper = 1;
      output[count] = helper;
    } else if (helper == 6 && strcmp(commands, "button_clicked") == 0) {
      helper = 4;
      output[count] = helper;
    } else if (helper == 5 && strcmp(commands, "button_clicked") == 0) {
      helper = 2;
      output[count] = helper;
    } else if (helper == 3 && strcmp(commands, "button_clicked") == 0) {
      helper = 4;
      output[count] = helper;
    }
    count++;
  }
  for (k = 0; k <= count; k++) {
    if (output[k] == 1) {
      printf("Door: CLOSED\n");
    }
    if (output[k] == 2) {
      printf("Door: OPENING\n");
    }
    if (output[k] == 3) {
      printf("Door: OPEN\n");
    }
    if (output[k] == 4) {
      printf("Door: CLOSING\n");
    }
    if (output[k] == 5) {
      printf("Door: STOPPED_WHILE_CLOSING\n");
    }
    if (output[k] == 6) {
      printf("Door: STOPPED_WHILE_OPENING\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x1,-0x38(%rbp)
movl   $0x1,-0x1d0(%rbp)
lea    -0x30(%rbp),%rsi
lea    0xe9b(%rip),%rdi
call   1050 <scanf@plt>
mov    0x2e77(%rip),%rcx
cmp    (%rcx),%rax
je     1396 <main+0x266>
cmpl   $0x1,-0x34(%rbp)
jne    11b8 <main+0x88>
lea    -0x30(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11b8 <main+0x88>
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    1388 <main+0x258>
cmpl   $0x2,-0x34(%rbp)
jne    11f6 <main+0xc6>
lea    -0x30(%rbp),%rdi
lea    0xe36(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f6 <main+0xc6>
movl   $0x6,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    1383 <main+0x253>
cmpl   $0x2,-0x34(%rbp)
jne    1234 <main+0x104>
lea    -0x30(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1234 <main+0x104>
movl   $0x3,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    137e <main+0x24e>
cmpl   $0x4,-0x34(%rbp)
jne    1272 <main+0x142>
lea    -0x30(%rbp),%rdi
lea    0xdba(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1272 <main+0x142>
movl   $0x5,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    1379 <main+0x249>
cmpl   $0x4,-0x34(%rbp)
jne    12b0 <main+0x180>
lea    -0x30(%rbp),%rdi
lea    0xd8b(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12b0 <main+0x180>
movl   $0x1,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    1374 <main+0x244>
cmpl   $0x6,-0x34(%rbp)
jne    12ee <main+0x1be>
lea    -0x30(%rbp),%rdi
lea    0xd3e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12ee <main+0x1be>
movl   $0x4,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    136f <main+0x23f>
cmpl   $0x5,-0x34(%rbp)
jne    132c <main+0x1fc>
lea    -0x30(%rbp),%rdi
lea    0xd00(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    132c <main+0x1fc>
movl   $0x2,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    136a <main+0x23a>
cmpl   $0x3,-0x34(%rbp)
jne    1365 <main+0x235>
lea    -0x30(%rbp),%rdi
lea    0xcc2(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1365 <main+0x235>
movl   $0x4,-0x34(%rbp)
mov    -0x34(%rbp),%ecx
movslq -0x38(%rbp),%rax
mov    %ecx,-0x1d0(%rbp,%rax,4)
jmp    136a <main+0x23a>
jmp    136f <main+0x23f>
jmp    1374 <main+0x244>
jmp    1379 <main+0x249>
jmp    137e <main+0x24e>
jmp    1383 <main+0x253>
jmp    1388 <main+0x258>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    115a <main+0x2a>
movl   $0x0,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x38(%rbp),%eax
jg     1470 <main+0x340>
movslq -0x3c(%rbp),%rax
cmpl   $0x1,-0x1d0(%rbp,%rax,4)
01
jne    13c7 <main+0x297>
lea    0xc5f(%rip),%rdi
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
cmpl   $0x2,-0x1d0(%rbp,%rax,4)
02
jne    13e5 <main+0x2b5>
lea    0xc4f(%rip),%rdi
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
cmpl   $0x3,-0x1d0(%rbp,%rax,4)
03
jne    1403 <main+0x2d3>
lea    0xc40(%rip),%rdi
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
cmpl   $0x4,-0x1d0(%rbp,%rax,4)
04
jne    1421 <main+0x2f1>
lea    0xc2e(%rip),%rdi
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
cmpl   $0x5,-0x1d0(%rbp,%rax,4)
05
jne    143f <main+0x30f>
lea    0xc1f(%rip),%rdi
call   1030 <printf@plt>
movslq -0x3c(%rbp),%rax
cmpl   $0x6,-0x1d0(%rbp,%rax,4)
06
jne    145d <main+0x32d>
lea    0xc1e(%rip),%rdi
call   1030 <printf@plt>
jmp    1462 <main+0x332>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    139d <main+0x26d>
xor    %eax,%eax
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1b8,%rsp
movl   $0x1,0x20(%rsp)
lea    0xee0(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
mov    0x2e89(%rip),%r13
mov    $0x2,%ebx
cmp    0x0(%r13),%rax
je     12e6 <main+0x1b6>
mov    $0x1,%r15d
mov    $0x2,%ebp
lea    0xeb0(%rip),%r14
mov    %rsp,%rbx
lea    0xe76(%rip),%r12
jmp    11b0 <main+0x80>
mov    $0x4,%r15d
mov    %r15d,0x1c(%rsp,%rbp,4)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
add    $0x1,%rbp
cmp    0x0(%r13),%rax
je     12e4 <main+0x1b4>
lea    -0x1(%r15),%eax
cmp    $0x5,%eax
ja     1197 <main+0x67>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
jmp    *%rax
mov    %rbx,%rdi
lea    0xe67(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x1,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
jmp    12a0 <main+0x170>
mov    %rbx,%rdi
lea    0xe48(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12ce <main+0x19e>
mov    %rbx,%rdi
lea    0xe3f(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x2,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
mov    $0x3,%r15d
jmp    1192 <main+0x62>
mov    %rbx,%rdi
lea    0xe0b(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x3,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
jmp    118c <main+0x5c>
mov    %rbx,%rdi
lea    0xde8(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     12d9 <main+0x1a9>
mov    %rbx,%rdi
lea    0xddf(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x4,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
mov    $0x1,%r15d
jmp    1192 <main+0x62>
mov    %rbx,%rdi
lea    0xda7(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x5,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
mov    $0x2,%r15d
jmp    1192 <main+0x62>
mov    %rbx,%rdi
lea    0xd7e(%rip),%rsi
call   1040 <strcmp@plt>
mov    $0x6,%r15d
test   %rax,%rax
jne    1197 <main+0x67>
jmp    118c <main+0x5c>
mov    $0x6,%r15d
jmp    1192 <main+0x62>
mov    $0x5,%r15d
jmp    1192 <main+0x62>
mov    %ebp,%ebx
mov    $0x1,%eax
mov    $0x1,%ebp
lea    0xd21(%rip),%r14
nopw   0x0(%rax,%rax,1)
add    $0xffffffff,%eax
cmp    $0x5,%eax
ja     1316 <main+0x1e6>
cltq
movslq (%r14,%rax,4),%rdi
add    %r14,%rdi
call   1030 <puts@plt>
cmp    %rbp,%rbx
je     1325 <main+0x1f5>
mov    0x20(%rsp,%rbp,4),%eax
add    $0x1,%rbp
jmp    1300 <main+0x1d0>
xor    %eax,%eax
add    $0x1b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [15 x i8] c"button_clicked\00"
@.str.2 = [15 x i8] c"cycle_complete\00"
@.str.3 = [14 x i8] c"Door: CLOSED\0A\00"
@.str.4 = [15 x i8] c"Door: OPENING\0A\00"
@.str.5 = [12 x i8] c"Door: OPEN\0A\00"
@.str.6 = [15 x i8] c"Door: CLOSING\0A\00"
@.str.7 = [29 x i8] c"Door: STOPPED_WHILE_CLOSING\0A\00"
@.str.8 = [29 x i8] c"Door: STOPPED_WHILE_OPENING\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [30 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100 x i32]
store i32 0, i32* %1
store i32 1, i32* %3
store i32 1, i32* %4
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 0
store i32 1, i32* %7
br label %8
8: ; preds = %116, %0
%9 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%10 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = load i64, i64* @EOF
%12 = icmp ne i64 %10, %11
br i1 %12, label %13, label %119
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%18 = call i64 @strcmp(i8* %17, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %20, label %25
20: ; preds = %16
store i32 2, i32* %3
%21 = load i32, i32* %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %23
store i32 %21, i32* %24
br label %116
25: ; preds = %16, %13
%26 = load i32, i32* %3
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%30 = call i64 @strcmp(i8* %29, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %37
32: ; preds = %28
store i32 6, i32* %3
%33 = load i32, i32* %3
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %35
store i32 %33, i32* %36
br label %115
37: ; preds = %28, %25
%38 = load i32, i32* %3
%39 = icmp eq i32 %38, 2
br i1 %39, label %40, label %49
40: ; preds = %37
%41 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%42 = call i64 @strcmp(i8* %41, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %44, label %49
44: ; preds = %40
store i32 3, i32* %3
%45 = load i32, i32* %3
%46 = load i32, i32* %4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %47
store i32 %45, i32* %48
br label %114
49: ; preds = %40, %37
%50 = load i32, i32* %3
%51 = icmp eq i32 %50, 4
br i1 %51, label %52, label %61
52: ; preds = %49
%53 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%54 = call i64 @strcmp(i8* %53, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%55 = icmp eq i64 %54, 0
br i1 %55, label %56, label %61
56: ; preds = %52
store i32 5, i32* %3
%57 = load i32, i32* %3
%58 = load i32, i32* %4
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %59
store i32 %57, i32* %60
br label %113
61: ; preds = %52, %49
%62 = load i32, i32* %3
%63 = icmp eq i32 %62, 4
br i1 %63, label %64, label %73
64: ; preds = %61
%65 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %64
store i32 1, i32* %3
%69 = load i32, i32* %3
%70 = load i32, i32* %4
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %71
store i32 %69, i32* %72
br label %112
73: ; preds = %64, %61
%74 = load i32, i32* %3
%75 = icmp eq i32 %74, 6
br i1 %75, label %76, label %85
76: ; preds = %73
%77 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%79 = icmp eq i64 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %76
store i32 4, i32* %3
%81 = load i32, i32* %3
%82 = load i32, i32* %4
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %83
store i32 %81, i32* %84
br label %111
85: ; preds = %76, %73
%86 = load i32, i32* %3
%87 = icmp eq i32 %86, 5
br i1 %87, label %88, label %97
88: ; preds = %85
%89 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%90 = call i64 @strcmp(i8* %89, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%91 = icmp eq i64 %90, 0
br i1 %91, label %92, label %97
92: ; preds = %88
store i32 2, i32* %3
%93 = load i32, i32* %3
%94 = load i32, i32* %4
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %95
store i32 %93, i32* %96
br label %110
97: ; preds = %88, %85
%98 = load i32, i32* %3
%99 = icmp eq i32 %98, 3
br i1 %99, label %100, label %109
100: ; preds = %97
%101 = getelementptr inbounds [30 x i8], [30 x i8]* %2, i64 0, i64 0
%102 = call i64 @strcmp(i8* %101, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%103 = icmp eq i64 %102, 0
br i1 %103, label %104, label %109
104: ; preds = %100
store i32 4, i32* %3
%105 = load i32, i32* %3
%106 = load i32, i32* %4
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %107
store i32 %105, i32* %108
br label %109
109: ; preds = %104, %100, %97
br label %110
110: ; preds = %109, %92
br label %111
111: ; preds = %110, %80
br label %112
112: ; preds = %111, %68
br label %113
113: ; preds = %112, %56
br label %114
114: ; preds = %113, %44
br label %115
115: ; preds = %114, %32
br label %116
116: ; preds = %115, %20
%117 = load i32, i32* %4
%118 = add nsw i32 %117, 1
store i32 %118, i32* %4
br label %8
119: ; preds = %8
store i32 0, i32* %5
br label %120
120: ; preds = %173, %119
%121 = load i32, i32* %5
%122 = load i32, i32* %4
%123 = icmp sle i32 %121, %122
br i1 %123, label %124, label %176
124: ; preds = %120
%125 = load i32, i32* %5
%126 = sext i32 %125 to i64
%127 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %126
%128 = load i32, i32* %127
%129 = icmp eq i32 %128, 1
br i1 %129, label %130, label %132
130: ; preds = %124
%131 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
br label %132
132: ; preds = %130, %124
%133 = load i32, i32* %5
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = icmp eq i32 %136, 2
br i1 %137, label %138, label %140
138: ; preds = %132
%139 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
br label %140
140: ; preds = %138, %132
%141 = load i32, i32* %5
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %142
%144 = load i32, i32* %143
%145 = icmp eq i32 %144, 3
br i1 %145, label %146, label %148
146: ; preds = %140
%147 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
br label %148
148: ; preds = %146, %140
%149 = load i32, i32* %5
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %150
%152 = load i32, i32* %151
%153 = icmp eq i32 %152, 4
br i1 %153, label %154, label %156
154: ; preds = %148
%155 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %156
156: ; preds = %154, %148
%157 = load i32, i32* %5
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %158
%160 = load i32, i32* %159
%161 = icmp eq i32 %160, 5
br i1 %161, label %162, label %164
162: ; preds = %156
%163 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
br label %164
164: ; preds = %162, %156
%165 = load i32, i32* %5
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [100 x i32], [100 x i32]* %6, i64 0, i64 %166
%168 = load i32, i32* %167
%169 = icmp eq i32 %168, 6
br i1 %169, label %170, label %172
170: ; preds = %164
%171 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0))
br label %172
172: ; preds = %170, %164
br label %173
173: ; preds = %172
%174 = load i32, i32* %5
%175 = add nsw i32 %174, 1
store i32 %175, i32* %5
br label %120
176: ; preds = %120
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.1 = [15 x i8] c"button_clicked\00"
@.str.2 = [15 x i8] c"cycle_complete\00"
@str = [28 x i8] c"Door: STOPPED_WHILE_OPENING\00"
@str.9 = [28 x i8] c"Door: STOPPED_WHILE_CLOSING\00"
@str.10 = [14 x i8] c"Door: CLOSING\00"
@str.11 = [11 x i8] c"Door: OPEN\00"
@str.12 = [14 x i8] c"Door: OPENING\00"
@str.13 = [13 x i8] c"Door: CLOSED\00"
@reltable.main = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @str.13 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @str.12 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([11 x i8]* @str.11 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.main to i64)) to i32)]
define i32 @main() {
%1 = alloca [30 x i8]
%2 = alloca [100 x i32]
%3 = getelementptr inbounds [30 x i8], [30 x i8]* %1, i64 0, i64 0
%4 = bitcast [100 x i32]* %2 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
store i32 1, i32* %5
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%7 = load i64, i64* @EOF
%8 = icmp eq i64 %6, %7
br i1 %8, label %12, label %14
9: ; preds = %44
%10 = add i64 %15, 2
%11 = and i64 %10, 4294967295
br label %12
12: ; preds = %9, %0
%13 = phi i64 [ 2, %0 ], [ %11, %9 ]
br label %50
14: ; preds = %0, %44
%15 = phi i64 [ %46, %44 ], [ 1, %0 ]
%16 = phi i32 [ %45, %44 ], [ 1, %0 ]
switch i32 %16, label %44 [
i32 1, label %17
i32 2, label %20
i32 4, label %26
i32 6, label %32
i32 5, label %35
i32 3, label %38
]
17: ; preds = %14
%18 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i64 %18, 0
br i1 %19, label %41, label %44
20: ; preds = %14
%21 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i64 %21, 0
br i1 %22, label %41, label %23
23: ; preds = %20
%24 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%25 = icmp eq i64 %24, 0
br i1 %25, label %41, label %44
26: ; preds = %14
%27 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%28 = icmp eq i64 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %26
%30 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%31 = icmp eq i64 %30, 0
br i1 %31, label %41, label %44
32: ; preds = %14
%33 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %41, label %44
35: ; preds = %14
%36 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i64 %36, 0
br i1 %37, label %41, label %44
38: ; preds = %14
%39 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38, %35, %32, %29, %26, %23, %20, %17
%42 = phi i32 [ 2, %17 ], [ 6, %20 ], [ 3, %23 ], [ 5, %26 ], [ 1, %29 ], [ 4, %32 ], [ 2, %35 ], [ 4, %38 ]
%43 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %15
store i32 %42, i32* %43
br label %44
44: ; preds = %41, %14, %23, %17, %29, %35, %32, %38
%45 = phi i32 [ 3, %38 ], [ 6, %32 ], [ 5, %35 ], [ 4, %29 ], [ 1, %17 ], [ 2, %23 ], [ %16, %14 ], [ %42, %41 ]
%46 = add nuw i64 %15, 1
%47 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %3)
%48 = load i64, i64* @EOF
%49 = icmp eq i64 %47, %48
br i1 %49, label %9, label %14
50: ; preds = %63, %12
%51 = phi i32 [ 1, %12 ], [ %65, %63 ]
%52 = phi i64 [ 0, %12 ], [ %61, %63 ]
%53 = add i32 %51, -1
%54 = icmp ult i32 %53, 6
br i1 %54, label %55, label %60
55: ; preds = %50
%56 = sext i32 %53 to i64
%57 = shl i64 %56, 2
%58 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.main to i8*), i64 %57)
%59 = call i32 @puts(i8* dereferenceable(1) %58)
br label %60
60: ; preds = %50, %55
%61 = add nuw nsw i64 %52, 1
%62 = icmp eq i64 %61, %13
br i1 %62, label %66, label %63
63: ; preds = %60
%64 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %61
%65 = load i32, i32* %64
br label %50
66: ; preds = %60
ret i32 0
}