#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 /*<<< orphan*/ FS460_play_begin();
int /*<<< orphan*/ FS460_play_run(int);
int /*<<< orphan*/ diagonal(int);
void diagonal_bump(void) {
  static int mode = 0;
  FS460_play_begin();
  switch (mode++) {
  default:
    mode = 1;
  case 0:
    diagonal(0);
    break;
  case 1:
    diagonal(-1);
    break;
  case 2:
    diagonal(1);
    break;
  }
  FS460_play_run(0x0001);
}


x86 assembly (clang, -O0):
<diagonal_bump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
call   1050 <FS460_play_begin@plt>
mov    0x2ef7(%rip),%eax
mov    %eax,-0x4(%rbp)
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,0x2ee9(%rip)
test   %eax,%eax
je     118c <diagonal_bump+0x5c>
jmp    1160 <diagonal_bump+0x30>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
je     1198 <diagonal_bump+0x68>
jmp    1171 <diagonal_bump+0x41>
mov    -0x4(%rbp),%eax
sub    $0x2,%eax
je     11a7 <diagonal_bump+0x77>
jmp    1182 <diagonal_bump+0x52>
movl   $0x1,0x2eb0(%rip)
xor    %edi,%edi
call   1030 <diagonal@plt>
jmp    11b1 <diagonal_bump+0x81>
mov    $0xffffffff,%edi
call   1030 <diagonal@plt>
jmp    11b1 <diagonal_bump+0x81>
mov    $0x1,%edi
call   1030 <diagonal@plt>
mov    $0x1,%edi
call   1040 <FS460_play_run@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<diagonal_bump>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <FS460_play_begin@plt>
movslq 0x2efb(%rip),%rax
lea    0x1(%rax),%ecx
mov    %ecx,0x2ef2(%rip)
cmp    $0x3,%rax
jae    115c <diagonal_bump+0x2c>
lea    0xea9(%rip),%rcx
mov    (%rcx,%rax,4),%ebx
jmp    1166 <diagonal_bump+0x36>
movl   $0x1,0x2ed6(%rip)
mov    %ebx,%edi
call   1030 <diagonal@plt>
mov    $0x1,%edi
pop    %rbx
jmp    1040 <FS460_play_run@plt>

LLVM IR (-O0):
@diagonal_bump.mode = internal global i32 0
define void @diagonal_bump() {
%1 = call i32 (...) @FS460_play_begin()
%2 = load i32, i32* @diagonal_bump.mode
%3 = add nsw i32 %2, 1
store i32 %3, i32* @diagonal_bump.mode
switch i32 %2, label %4 [
i32 0, label %5
i32 1, label %7
i32 2, label %9
]
4: ; preds = %0
store i32 1, i32* @diagonal_bump.mode
br label %5
5: ; preds = %0, %4
%6 = call i32 @diagonal(i32 0)
br label %11
7: ; preds = %0
%8 = call i32 @diagonal(i32 -1)
br label %11
9: ; preds = %0
%10 = call i32 @diagonal(i32 1)
br label %11
11: ; preds = %9, %7, %5
%12 = call i32 @FS460_play_run(i32 1)
ret void
}

LLVM IR (-O2):
@diagonal_bump.mode = internal unnamed_addr global i32 0
@switch.table.diagonal_bump = [3 x i32] [i32 0, i32 -1, i32 1]
define void @diagonal_bump() {
%1 = tail call i32 (...) @FS460_play_begin()
%2 = load i32, i32* @diagonal_bump.mode
%3 = add nsw i32 %2, 1
store i32 %3, i32* @diagonal_bump.mode
%4 = icmp ult i32 %2, 3
br i1 %4, label %6, label %5
5: ; preds = %0
store i32 1, i32* @diagonal_bump.mode
br label %10
6: ; preds = %0
%7 = sext i32 %2 to i64
%8 = getelementptr inbounds [3 x i32], [3 x i32]* @switch.table.diagonal_bump, i64 0, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %6, %5
%11 = phi i32 [ 0, %5 ], [ %9, %6 ]
%12 = tail call i32 @diagonal(i32 %11)
%13 = tail call i32 @FS460_play_run(i32 1)
ret void
}