#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*/ bell();
int /*<<< orphan*/ choose_race();
int /*<<< orphan*/ clear_from(int);
int /*<<< orphan*/ get_ahw();
int /*<<< orphan*/ get_all_stats();
int /*<<< orphan*/ get_class();
int /*<<< orphan*/ get_history();
int /*<<< orphan*/ get_money();
int /*<<< orphan*/ get_name();
int /*<<< orphan*/ get_sex();
char inkey();
int /*<<< orphan*/ move_cursor(int, int);
int /*<<< orphan*/ pause_exit(int, int);
int /*<<< orphan*/ print_history();
int /*<<< orphan*/ put_buffer(char *, int, int);
int /*<<< orphan*/ put_character();
int /*<<< orphan*/ put_misc1();
int /*<<< orphan*/ put_misc2();
int /*<<< orphan*/ put_misc3();
int /*<<< orphan*/ put_stats();
void create_character() {
  register int exit_flag = 1;
  register char c;
  put_character();
  choose_race();
  get_sex();
  get_all_stats();
  get_history();
  get_ahw();
  print_history();
  put_misc1();
  put_stats();
  clear_from(20);
  put_buffer("Hit space to reroll or ESC to accept characteristics: ", 20, 2);
  do {
    move_cursor(20, 56);
    c = inkey();
    if (c == '\033')
      exit_flag = 0;
    else if (c == ' ') {
      get_all_stats();
      get_history();
      get_ahw();
      print_history();
      put_misc1();
      put_stats();
    } else
      bell();
  } while (exit_flag == 1);
  get_class();
  get_money();
  put_stats();
  put_misc2();
  put_misc3();
  get_name();
  pause_exit(23, 2);
}


x86 assembly (clang, -O0):
<create_character>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x1,-0x4(%rbp)
mov    $0x0,%al
call   1100 <put_character@plt>
mov    $0x0,%al
call   10a0 <choose_race@plt>
mov    $0x0,%al
call   1090 <get_sex@plt>
mov    $0x0,%al
call   1040 <get_all_stats@plt>
mov    $0x0,%al
call   1150 <get_history@plt>
mov    $0x0,%al
call   1140 <get_ahw@plt>
mov    $0x0,%al
call   10e0 <print_history@plt>
mov    $0x0,%al
call   10b0 <put_misc1@plt>
mov    $0x0,%al
call   1080 <put_stats@plt>
mov    $0x14,%edi
call   1060 <clear_from@plt>
lea    0xd61(%rip),%rdi
mov    $0x14,%esi
mov    $0x2,%edx
call   10d0 <put_buffer@plt>
mov    $0x14,%edi
mov    $0x38,%esi
call   10f0 <move_cursor@plt>
mov    $0x0,%al
call   1120 <inkey@plt>
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x1b,%eax
jne    12e0 <create_character+0xa0>
movl   $0x0,-0x4(%rbp)
jmp    1328 <create_character+0xe8>
movsbl -0x5(%rbp),%eax
cmp    $0x20,%eax
jne    131c <create_character+0xdc>
mov    $0x0,%al
call   1040 <get_all_stats@plt>
mov    $0x0,%al
call   1150 <get_history@plt>
mov    $0x0,%al
call   1140 <get_ahw@plt>
mov    $0x0,%al
call   10e0 <print_history@plt>
mov    $0x0,%al
call   10b0 <put_misc1@plt>
mov    $0x0,%al
call   1080 <put_stats@plt>
jmp    1323 <create_character+0xe3>
mov    $0x0,%al
call   1030 <bell@plt>
jmp    1328 <create_character+0xe8>
jmp    132d <create_character+0xed>
cmpl   $0x1,-0x4(%rbp)
je     12ae <create_character+0x6e>
mov    $0x0,%al
call   1110 <get_class@plt>
mov    $0x0,%al
call   1050 <get_money@plt>
mov    $0x0,%al
call   1080 <put_stats@plt>
mov    $0x0,%al
call   1130 <put_misc2@plt>
mov    $0x0,%al
call   10c0 <put_misc3@plt>
mov    $0x0,%al
call   1160 <get_name@plt>
mov    $0x17,%edi
mov    $0x2,%esi
call   1070 <pause_exit@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_character>:
push   %rax
xor    %eax,%eax
call   1100 <put_character@plt>
xor    %eax,%eax
call   10a0 <choose_race@plt>
xor    %eax,%eax
call   1090 <get_sex@plt>
xor    %eax,%eax
call   1040 <get_all_stats@plt>
xor    %eax,%eax
call   1150 <get_history@plt>
xor    %eax,%eax
call   1140 <get_ahw@plt>
xor    %eax,%eax
call   10e0 <print_history@plt>
xor    %eax,%eax
call   10b0 <put_misc1@plt>
xor    %eax,%eax
call   1080 <put_stats@plt>
mov    $0x14,%edi
call   1060 <clear_from@plt>
lea    0xd6f(%rip),%rdi
mov    $0x14,%esi
mov    $0x2,%edx
call   10d0 <put_buffer@plt>
jmp    12da <create_character+0x9a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <get_all_stats@plt>
xor    %eax,%eax
call   1150 <get_history@plt>
xor    %eax,%eax
call   1140 <get_ahw@plt>
xor    %eax,%eax
call   10e0 <print_history@plt>
xor    %eax,%eax
call   10b0 <put_misc1@plt>
xor    %eax,%eax
call   1080 <put_stats@plt>
mov    $0x14,%edi
mov    $0x38,%esi
call   10f0 <move_cursor@plt>
xor    %eax,%eax
call   1120 <inkey@plt>
cmp    $0x20,%al
je     12b0 <create_character+0x70>
cmp    $0x1b,%al
je     1301 <create_character+0xc1>
xor    %eax,%eax
call   1030 <bell@plt>
jmp    12da <create_character+0x9a>
xor    %eax,%eax
call   1110 <get_class@plt>
xor    %eax,%eax
call   1050 <get_money@plt>
xor    %eax,%eax
call   1080 <put_stats@plt>
xor    %eax,%eax
call   1130 <put_misc2@plt>
xor    %eax,%eax
call   10c0 <put_misc3@plt>
xor    %eax,%eax
call   1160 <get_name@plt>
mov    $0x17,%edi
mov    $0x2,%esi
pop    %rax
jmp    1070 <pause_exit@plt>

LLVM IR (-O0):
@.str = [55 x i8] c"Hit space to reroll or ESC to accept characteristics: \00"
define void @create_character() {
%1 = alloca i32
%2 = alloca i8
store i32 1, i32* %1
%3 = call i32 (...) @put_character()
%4 = call i32 (...) @choose_race()
%5 = call i32 (...) @get_sex()
%6 = call i32 (...) @get_all_stats()
%7 = call i32 (...) @get_history()
%8 = call i32 (...) @get_ahw()
%9 = call i32 (...) @print_history()
%10 = call i32 (...) @put_misc1()
%11 = call i32 (...) @put_stats()
%12 = call i32 @clear_from(i32 20)
%13 = call i32 @put_buffer(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 20, i32 2)
br label %14
14: ; preds = %36, %0
%15 = call i32 @move_cursor(i32 20, i32 56)
%16 = call signext i8 (...) @inkey()
store i8 %16, i8* %2
%17 = load i8, i8* %2
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 27
br i1 %19, label %20, label %21
20: ; preds = %14
store i32 0, i32* %1
br label %35
21: ; preds = %14
%22 = load i8, i8* %2
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 32
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = call i32 (...) @get_all_stats()
%27 = call i32 (...) @get_history()
%28 = call i32 (...) @get_ahw()
%29 = call i32 (...) @print_history()
%30 = call i32 (...) @put_misc1()
%31 = call i32 (...) @put_stats()
br label %34
32: ; preds = %21
%33 = call i32 (...) @bell()
br label %34
34: ; preds = %32, %25
br label %35
35: ; preds = %34, %20
br label %36
36: ; preds = %35
%37 = load i32, i32* %1
%38 = icmp eq i32 %37, 1
br i1 %38, label %14, label %39
39: ; preds = %36
%40 = call i32 (...) @get_class()
%41 = call i32 (...) @get_money()
%42 = call i32 (...) @put_stats()
%43 = call i32 (...) @put_misc2()
%44 = call i32 (...) @put_misc3()
%45 = call i32 (...) @get_name()
%46 = call i32 @pause_exit(i32 23, i32 2)
ret void
}

LLVM IR (-O2):
@.str = [55 x i8] c"Hit space to reroll or ESC to accept characteristics: \00"
define void @create_character() {
%1 = tail call i32 (...) @put_character()
%2 = tail call i32 (...) @choose_race()
%3 = tail call i32 (...) @get_sex()
%4 = tail call i32 (...) @get_all_stats()
%5 = tail call i32 (...) @get_history()
%6 = tail call i32 (...) @get_ahw()
%7 = tail call i32 (...) @print_history()
%8 = tail call i32 (...) @put_misc1()
%9 = tail call i32 (...) @put_stats()
%10 = tail call i32 @clear_from(i32 20)
%11 = tail call i32 @put_buffer(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str, i64 0, i64 0), i32 20, i32 2)
br label %12
12: ; preds = %24, %0
%13 = tail call i32 @move_cursor(i32 20, i32 56)
%14 = tail call signext i8 (...) @inkey()
switch i8 %14, label %22 [
i8 27, label %25
i8 32, label %15
]
15: ; preds = %12
%16 = tail call i32 (...) @get_all_stats()
%17 = tail call i32 (...) @get_history()
%18 = tail call i32 (...) @get_ahw()
%19 = tail call i32 (...) @print_history()
%20 = tail call i32 (...) @put_misc1()
%21 = tail call i32 (...) @put_stats()
br label %24
22: ; preds = %12
%23 = tail call i32 (...) @bell()
br label %24
24: ; preds = %22, %15
br label %12
25: ; preds = %12
%26 = tail call i32 (...) @get_class()
%27 = tail call i32 (...) @get_money()
%28 = tail call i32 (...) @put_stats()
%29 = tail call i32 (...) @put_misc2()
%30 = tail call i32 (...) @put_misc3()
%31 = tail call i32 (...) @get_name()
%32 = tail call i32 @pause_exit(i32 23, i32 2)
ret void
}