#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 */
typedef int /*<<< orphan*/ uint32_t;
struct player_t {
  int dummy;
};
struct buffer_t {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ assert(struct player_t *);
scalar_t__ buffer_more(struct buffer_t *);
int buffer_read_uint8(struct buffer_t *);
struct player_t *get_player_by_conn(int /*<<< orphan*/);
int /*<<< orphan*/ update_game();
void game_process_stream_ooo(uint32_t conn, uint32_t index,
                             struct buffer_t *stream) {
  update_game();
  struct player_t *player = get_player_by_conn(conn);
  assert(player);
  while (buffer_more(stream)) {
    switch (buffer_read_uint8(stream)) {
    default:
      return;
    }
  }
}


x86 assembly (clang, -O0):
<game_process_stream_ooo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    $0x0,%al
call   1060 <update_game@plt>
mov    -0x4(%rbp),%edi
call   1050 <get_player_by_conn@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <buffer_more@plt>
cmp    $0x0,%rax
je     119f <game_process_stream_ooo+0x4f>
mov    -0x10(%rbp),%rdi
call   1070 <buffer_read_uint8@plt>
jmp    119f <game_process_stream_ooo+0x4f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<game_process_stream_ooo>:
push   %rbp
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %edi,%ebp
xor    %eax,%eax
call   1060 <update_game@plt>
mov    %ebp,%edi
call   1050 <get_player_by_conn@plt>
mov    %rax,%rdi
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1030 <buffer_more@plt>
test   %rax,%rax
je     1189 <game_process_stream_ooo+0x39>
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1070 <buffer_read_uint8@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.buffer_t = type { i32 }
%struct.player_t = type { i32 }
define void @game_process_stream_ooo(i32 %0, i32 %1, %struct.buffer_t* %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.buffer_t*
%7 = alloca %struct.player_t*
store i32 %0, i32* %4
store i32 %1, i32* %5
store %struct.buffer_t* %2, %struct.buffer_t** %6
%8 = call i32 (...) @update_game()
%9 = load i32, i32* %4
%10 = call %struct.player_t* @get_player_by_conn(i32 %9)
store %struct.player_t* %10, %struct.player_t** %7
%11 = load %struct.player_t*, %struct.player_t** %7
%12 = call i32 @assert(%struct.player_t* %11)
br label %13
13: ; preds = %3
%14 = load %struct.buffer_t*, %struct.buffer_t** %6
%15 = call i64 @buffer_more(%struct.buffer_t* %14)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %13
%18 = load %struct.buffer_t*, %struct.buffer_t** %6
%19 = call i32 @buffer_read_uint8(%struct.buffer_t* %18)
switch i32 %19, label %20 [
]
20: ; preds = %17
br label %21
21: ; preds = %20, %13
ret void
}

LLVM IR (-O2):
%struct.buffer_t = type { i32 }
%struct.player_t = type { i32 }
define void @game_process_stream_ooo(i32 %0, i32 %1, %struct.buffer_t* %2) {
%4 = tail call i32 (...) @update_game()
%5 = tail call %struct.player_t* @get_player_by_conn(i32 %0)
%6 = tail call i32 @assert(%struct.player_t* %5)
%7 = tail call i64 @buffer_more(%struct.buffer_t* %2)
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %3
%10 = tail call i32 @buffer_read_uint8(%struct.buffer_t* %2)
br label %11
11: ; preds = %3, %9
ret void
}