#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*/ bump_detect_back();
scalar_t__ bump_detect_front();
scalar_t__ line_detect();
scalar_t__ side_detect();
int sumo_push_bck_state() {
  while (1) {
    if (!bump_detect_back())
      return 0;
    if (bump_detect_front())
      return 2;
    if (line_detect())
      return 0;
    if (side_detect())
      return 4;
  }
}


x86 assembly (clang, -O0):
<sumo_push_bck_state>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <bump_detect_back@plt>
cmp    $0x0,%eax
jne    1164 <sumo_push_bck_state+0x24>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <sumo_push_bck_state+0x80>
mov    $0x0,%al
call   1030 <bump_detect_front@plt>
cmp    $0x0,%rax
je     1181 <sumo_push_bck_state+0x41>
movl   $0x2,-0x4(%rbp)
jmp    11c0 <sumo_push_bck_state+0x80>
mov    $0x0,%al
call   1040 <line_detect@plt>
cmp    $0x0,%rax
je     119e <sumo_push_bck_state+0x5e>
movl   $0x0,-0x4(%rbp)
jmp    11c0 <sumo_push_bck_state+0x80>
mov    $0x0,%al
call   1050 <side_detect@plt>
cmp    $0x0,%rax
je     11bb <sumo_push_bck_state+0x7b>
movl   $0x4,-0x4(%rbp)
jmp    11c0 <sumo_push_bck_state+0x80>
jmp    1148 <sumo_push_bck_state+0x8>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumo_push_bck_state>:
push   %rbx
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
xor    %eax,%eax
call   1060 <bump_detect_back@plt>
test   %eax,%eax
je     1186 <sumo_push_bck_state+0x46>
xor    %eax,%eax
call   1030 <bump_detect_front@plt>
test   %rax,%rax
jne    118a <sumo_push_bck_state+0x4a>
xor    %eax,%eax
call   1040 <line_detect@plt>
test   %rax,%rax
jne    118f <sumo_push_bck_state+0x4f>
xor    %eax,%eax
call   1050 <side_detect@plt>
test   %rax,%rax
je     1150 <sumo_push_bck_state+0x10>
mov    $0x4,%ebx
jmp    118f <sumo_push_bck_state+0x4f>
xor    %ebx,%ebx
jmp    118f <sumo_push_bck_state+0x4f>
mov    $0x2,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sumo_push_bck_state() {
%1 = alloca i32
br label %2
2: ; preds = %0, %18
%3 = call i32 (...) @bump_detect_back()
%4 = icmp ne i32 %3, 0
br i1 %4, label %6, label %5
5: ; preds = %2
store i32 0, i32* %1
br label %19
6: ; preds = %2
%7 = call i64 (...) @bump_detect_front()
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6
store i32 2, i32* %1
br label %19
10: ; preds = %6
%11 = call i64 (...) @line_detect()
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
store i32 0, i32* %1
br label %19
14: ; preds = %10
%15 = call i64 (...) @side_detect()
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %18
17: ; preds = %14
store i32 4, i32* %1
br label %19
18: ; preds = %14
br label %2
19: ; preds = %17, %13, %9, %5
%20 = load i32, i32* %1
ret i32 %20
}

LLVM IR (-O2):
define i32 @sumo_push_bck_state() {
br label %1
1: ; preds = %10, %0
%2 = tail call i32 (...) @bump_detect_back()
%3 = icmp eq i32 %2, 0
br i1 %3, label %13, label %4
4: ; preds = %1
%5 = tail call i64 (...) @bump_detect_front()
%6 = icmp eq i64 %5, 0
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = tail call i64 (...) @line_detect()
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = tail call i64 (...) @side_detect()
%12 = icmp eq i64 %11, 0
br i1 %12, label %1, label %13
13: ; preds = %10, %7, %4, %1
%14 = phi i32 [ 0, %1 ], [ 2, %4 ], [ 0, %7 ], [ 4, %10 ]
ret i32 %14
}