#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;

/* Variables and functions */
int /*<<< orphan*/ extrakt_even_bits(int /*<<< orphan*/);
int /*<<< orphan*/ extrakt_odd_bits(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ remove_new_line(char *);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
uint32_t begin_game(uint32_t number) {
  uint32_t newNumber = 0;
  char commands[12];
  fgets(commands, 12, stdin);
  remove_new_line(commands);
  if (strcmp(commands, "Game Over!") == 0) {
    return number;
  }
  while (strcmp(commands, "Game Over!") != 0) {
    if (strcmp(commands, "Odd") == 0) {
      newNumber = extrakt_odd_bits(number);
    } else {
      newNumber = extrakt_even_bits(number);
    }
    number = newNumber;
    fgets(commands, 12, stdin);
    remove_new_line(commands);
  }
  return newNumber;
}


x86 assembly (clang, -O0):
<begin_game>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    -0x18(%rbp),%rdi
mov    0x2e7b(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%esi
call   1030 <fgets@plt>
lea    -0x18(%rbp),%rdi
call   1070 <remove_new_line@plt>
lea    -0x18(%rbp),%rdi
lea    0xe73(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11a7 <begin_game+0x57>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    122c <begin_game+0xdc>
jmp    11ac <begin_game+0x5c>
lea    -0x18(%rbp),%rdi
lea    0xe49(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1226 <begin_game+0xd6>
lea    -0x18(%rbp),%rdi
lea    0xe3a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11f0 <begin_game+0xa0>
mov    -0x8(%rbp),%edi
call   1060 <extrakt_odd_bits@plt>
mov    %eax,-0xc(%rbp)
jmp    11fb <begin_game+0xab>
mov    -0x8(%rbp),%edi
call   1050 <extrakt_even_bits@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
mov    0x2ddc(%rip),%rax
mov    (%rax),%edx
mov    $0xc,%esi
call   1030 <fgets@plt>
lea    -0x18(%rbp),%rdi
call   1070 <remove_new_line@plt>
jmp    11ac <begin_game+0x5c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<begin_game>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %edi,%ebp
mov    0x2e83(%rip),%r12
mov    (%r12),%edx
lea    0x4(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <fgets@plt>
mov    %rbx,%rdi
call   1070 <remove_new_line@plt>
lea    0xe76(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121b <begin_game+0xcb>
lea    0xe5e(%rip),%rsi
lea    0x4(%rsp),%rdi
call   1040 <strcmp@plt>
test   %rax,%rax
je     1219 <begin_game+0xc9>
lea    0xe53(%rip),%r14
lea    0x4(%rsp),%rbx
lea    0xe3c(%rip),%r15
jmp    1200 <begin_game+0xb0>
cs nopw 0x0(%rax,%rax,1)
call   1050 <extrakt_even_bits@plt>
mov    %eax,%ebp
mov    (%r12),%edx
mov    %rbx,%rdi
mov    $0xc,%esi
call   1030 <fgets@plt>
mov    %rbx,%rdi
call   1070 <remove_new_line@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
je     121b <begin_game+0xcb>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <strcmp@plt>
mov    %ebp,%edi
test   %rax,%rax
jne    11d0 <begin_game+0x80>
call   1060 <extrakt_odd_bits@plt>
jmp    11d5 <begin_game+0x85>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [11 x i8] c"Game Over!\00"
@.str.1 = [4 x i8] c"Odd\00"
define i32 @begin_game(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [12 x i8]
store i32 %0, i32* %3
store i32 0, i32* %4
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %6, i32 12, i32 %7)
%9 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%10 = call i32 @remove_new_line(i8* %9)
%11 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%12 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %1
%15 = load i32, i32* %3
store i32 %15, i32* %2
br label %40
16: ; preds = %1
br label %17
17: ; preds = %31, %16
%18 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i64 %19, 0
br i1 %20, label %21, label %38
21: ; preds = %17
%22 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%23 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %28
25: ; preds = %21
%26 = load i32, i32* %3
%27 = call i32 @extrakt_odd_bits(i32 %26)
store i32 %27, i32* %4
br label %31
28: ; preds = %21
%29 = load i32, i32* %3
%30 = call i32 @extrakt_even_bits(i32 %29)
store i32 %30, i32* %4
br label %31
31: ; preds = %28, %25
%32 = load i32, i32* %4
store i32 %32, i32* %3
%33 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%34 = load i32, i32* @stdin
%35 = call i32 @fgets(i8* %33, i32 12, i32 %34)
%36 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%37 = call i32 @remove_new_line(i8* %36)
br label %17
38: ; preds = %17
%39 = load i32, i32* %4
store i32 %39, i32* %2
br label %40
40: ; preds = %38, %14
%41 = load i32, i32* %2
ret i32 %41
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [11 x i8] c"Game Over!\00"
@.str.1 = [4 x i8] c"Odd\00"
define i32 @begin_game(i32 %0) {
%2 = alloca [12 x i8]
%3 = getelementptr inbounds [12 x i8], [12 x i8]* %2, i64 0, i64 0
%4 = load i32, i32* @stdin
%5 = call i32 @fgets(i8* %3, i32 12, i32 %4)
%6 = call i32 @remove_new_line(i8* %3)
%7 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %27, label %9
9: ; preds = %1
%10 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
br i1 %11, label %27, label %12
12: ; preds = %9, %20
%13 = phi i32 [ %21, %20 ], [ %0, %9 ]
%14 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %12
%17 = call i32 @extrakt_odd_bits(i32 %13)
br label %20
18: ; preds = %12
%19 = call i32 @extrakt_even_bits(i32 %13)
br label %20
20: ; preds = %18, %16
%21 = phi i32 [ %17, %16 ], [ %19, %18 ]
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %3, i32 12, i32 %22)
%24 = call i32 @remove_new_line(i8* %3)
%25 = call i64 @strcmp(i8* %3, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %12
27: ; preds = %20, %9, %1
%28 = phi i32 [ %0, %1 ], [ 0, %9 ], [ %21, %20 ]
ret i32 %28
}