#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 */
int sumo_chase_state();
int sumo_push_bck_state();
int sumo_push_fwd_state();
int sumo_spin_state();
int sumo_stop_state();
void sumo_mode_loop() {
  int sumo_state = 0;
  while (1) {
    switch (sumo_state) {
    case 0:
      sumo_state = sumo_stop_state();
      break;
    case 1:
      sumo_state = sumo_chase_state();
      break;
    case 2:
      sumo_state = sumo_push_fwd_state();
      break;
    case 3:
      sumo_state = sumo_push_bck_state();
      break;
    case 4:
      sumo_state = sumo_spin_state();
      break;
    }
  }
}


x86 assembly (clang, -O0):
<sumo_mode_loop>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x10(%rbp)
sub    $0x4,%rax
ja     11ca <sumo_mode_loop+0x7a>
mov    -0x10(%rbp),%rax
lea    0xe85(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    $0x0,%al
call   1040 <sumo_stop_state@plt>
mov    %eax,-0x4(%rbp)
jmp    11ca <sumo_mode_loop+0x7a>
mov    $0x0,%al
call   1070 <sumo_chase_state@plt>
mov    %eax,-0x4(%rbp)
jmp    11ca <sumo_mode_loop+0x7a>
mov    $0x0,%al
call   1030 <sumo_push_fwd_state@plt>
mov    %eax,-0x4(%rbp)
jmp    11ca <sumo_mode_loop+0x7a>
mov    $0x0,%al
call   1060 <sumo_push_bck_state@plt>
mov    %eax,-0x4(%rbp)
jmp    11ca <sumo_mode_loop+0x7a>
mov    $0x0,%al
call   1050 <sumo_spin_state@plt>
mov    %eax,-0x4(%rbp)
jmp    115f <sumo_mode_loop+0xf>

x86 assembly (clang, -O2):
<sumo_mode_loop>:
push   %rbx
lea    0xea8(%rip),%rbx
xor    %eax,%eax
jmp    1170 <sumo_mode_loop+0x20>
xor    %eax,%eax
call   1040 <sumo_stop_state@plt>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0x4,%eax
ja     1170 <sumo_mode_loop+0x20>
mov    %eax,%eax
movslq (%rbx,%rax,4),%rax
add    %rbx,%rax
jmp    *%rax
xor    %eax,%eax
call   1070 <sumo_chase_state@plt>
jmp    1170 <sumo_mode_loop+0x20>
xor    %eax,%eax
call   1030 <sumo_push_fwd_state@plt>
jmp    1170 <sumo_mode_loop+0x20>
xor    %eax,%eax
call   1060 <sumo_push_bck_state@plt>
jmp    1170 <sumo_mode_loop+0x20>
xor    %eax,%eax
call   1050 <sumo_spin_state@plt>
jmp    1170 <sumo_mode_loop+0x20>

LLVM IR (-O0):
define void @sumo_mode_loop() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %0, %14
%3 = load i32, i32* %1
switch i32 %3, label %14 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
4: ; preds = %2
%5 = call i32 (...) @sumo_stop_state()
store i32 %5, i32* %1
br label %14
6: ; preds = %2
%7 = call i32 (...) @sumo_chase_state()
store i32 %7, i32* %1
br label %14
8: ; preds = %2
%9 = call i32 (...) @sumo_push_fwd_state()
store i32 %9, i32* %1
br label %14
10: ; preds = %2
%11 = call i32 (...) @sumo_push_bck_state()
store i32 %11, i32* %1
br label %14
12: ; preds = %2
%13 = call i32 (...) @sumo_spin_state()
store i32 %13, i32* %1
br label %14
14: ; preds = %2, %12, %10, %8, %6, %4
br label %2
}

LLVM IR (-O2):
define void @sumo_mode_loop() {
br label %1
1: ; preds = %14, %0
%2 = phi i32 [ 0, %0 ], [ %15, %14 ]
br label %3
3: ; preds = %1, %3
switch i32 %2, label %3 [
i32 0, label %4
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
]
4: ; preds = %3
%5 = tail call i32 (...) @sumo_stop_state()
br label %14
6: ; preds = %3
%7 = tail call i32 (...) @sumo_chase_state()
br label %14
8: ; preds = %3
%9 = tail call i32 (...) @sumo_push_fwd_state()
br label %14
10: ; preds = %3
%11 = tail call i32 (...) @sumo_push_bck_state()
br label %14
12: ; preds = %3
%13 = tail call i32 (...) @sumo_spin_state()
br label %14
14: ; preds = %12, %10, %8, %6, %4
%15 = phi i32 [ %5, %4 ], [ %7, %6 ], [ %9, %8 ], [ %11, %10 ], [ %13, %12 ]
br label %1
}