#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*/ execCallback(unsigned char);
scalar_t__ get_next_controllable(unsigned char *);
scalar_t__ input_buffer_get(unsigned char *);
int /*<<< orphan*/ make_transition(unsigned char);
int /*<<< orphan*/ update_input();
void SCT_run_step() {
  update_input();
  unsigned char event;
  while (input_buffer_get(&event)) {
    make_transition(event);
    execCallback(event);
  }
  if (get_next_controllable(&event)) {
    make_transition(event);
    execCallback(event);
  }
}


x86 assembly (clang, -O0):
<SCT_run_step>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1060 <update_input@plt>
lea    -0x1(%rbp),%rdi
call   1040 <input_buffer_get@plt>
cmp    $0x0,%rax
je     1189 <SCT_run_step+0x39>
movzbl -0x1(%rbp),%edi
call   1050 <make_transition@plt>
movzbl -0x1(%rbp),%edi
call   1070 <execCallback@plt>
jmp    115f <SCT_run_step+0xf>
lea    -0x1(%rbp),%rdi
call   1030 <get_next_controllable@plt>
cmp    $0x0,%rax
je     11ae <SCT_run_step+0x5e>
movzbl -0x1(%rbp),%edi
call   1050 <make_transition@plt>
movzbl -0x1(%rbp),%edi
call   1070 <execCallback@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SCT_run_step>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1060 <update_input@plt>
lea    0xf(%rsp),%rdi
call   1040 <input_buffer_get@plt>
test   %rax,%rax
je     1191 <SCT_run_step+0x41>
lea    0xf(%rsp),%rbx
movzbl 0xf(%rsp),%edi
call   1050 <make_transition@plt>
movzbl 0xf(%rsp),%edi
call   1070 <execCallback@plt>
mov    %rbx,%rdi
call   1040 <input_buffer_get@plt>
test   %rax,%rax
jne    1170 <SCT_run_step+0x20>
lea    0xf(%rsp),%rdi
call   1030 <get_next_controllable@plt>
test   %rax,%rax
je     11b4 <SCT_run_step+0x64>
movzbl 0xf(%rsp),%edi
call   1050 <make_transition@plt>
movzbl 0xf(%rsp),%edi
call   1070 <execCallback@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @SCT_run_step() {
%1 = alloca i8
%2 = call i32 (...) @update_input()
br label %3
3: ; preds = %6, %0
%4 = call i64 @input_buffer_get(i8* %1)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i8, i8* %1
%8 = call i32 @make_transition(i8 zeroext %7)
%9 = load i8, i8* %1
%10 = call i32 @execCallback(i8 zeroext %9)
br label %3
11: ; preds = %3
%12 = call i64 @get_next_controllable(i8* %1)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %11
%15 = load i8, i8* %1
%16 = call i32 @make_transition(i8 zeroext %15)
%17 = load i8, i8* %1
%18 = call i32 @execCallback(i8 zeroext %17)
br label %19
19: ; preds = %14, %11
ret void
}

LLVM IR (-O2):
define void @SCT_run_step() {
%1 = alloca i8
%2 = tail call i32 (...) @update_input()
%3 = call i64 @input_buffer_get(i8* %1)
%4 = icmp eq i64 %3, 0
br i1 %4, label %12, label %5
5: ; preds = %0, %5
%6 = load i8, i8* %1
%7 = call i32 @make_transition(i8 zeroext %6)
%8 = load i8, i8* %1
%9 = call i32 @execCallback(i8 zeroext %8)
%10 = call i64 @input_buffer_get(i8* %1)
%11 = icmp eq i64 %10, 0
br i1 %11, label %12, label %5
12: ; preds = %5, %0
%13 = call i64 @get_next_controllable(i8* %1)
%14 = icmp eq i64 %13, 0
br i1 %14, label %20, label %15
15: ; preds = %12
%16 = load i8, i8* %1
%17 = call i32 @make_transition(i8 zeroext %16)
%18 = load i8, i8* %1
%19 = call i32 @execCallback(i8 zeroext %18)
br label %20
20: ; preds = %15, %12
ret void
}