// File: /workspace/github_c_makefile_star2_O1/tabemann[P]attoforth/src/runtime/inner.c
// Function: af_global_init
af_global_t* af_global_init(int argc, char** argv) {
  af_global_t* global = malloc(sizeof(af_global_t));
  if(!global) {
    return NULL;
  }
  if(!(global->forth_wordlist = malloc(sizeof(af_wordlist_t)))) {
    free(global);
    return NULL;
  }
  if(!(global->io_wordlist = malloc(sizeof(af_wordlist_t)))) {
    free(global);
    return NULL;
  }
  if(!(global->task_wordlist = malloc(sizeof(af_wordlist_t)))) {
    free(global);
    return NULL;
  }
  global->first_task = NULL;
  global->current_task = NULL;
  global->tasks_active_count = 0;
  global->task_count = 0;
  if(!af_cond_init(&global->cond)) {
    free(global->task_wordlist);
    free(global->io_wordlist);
    free(global->forth_wordlist);
    free(global);
    return NULL;
  }
  if(pthread_mutex_init(&global->mutex, NULL)) {
    af_cond_destroy(&global->cond);
    free(global->task_wordlist);
    free(global->io_wordlist);
    free(global->forth_wordlist);
    free(global);
    return NULL;
  }
  global->first_of_all_words = NULL;
  global->forth_wordlist->first_word = NULL;
  global->io_wordlist->first_word = NULL;
  global->task_wordlist->first_word = NULL;
  global->default_data_stack_count = 1024;
  global->default_float_stack_count = 1024;
  global->default_return_stack_count = 1024;
  global->default_data_stack_base_room_count = 16;
  global->default_float_stack_base_room_count = 16;
  global->default_return_stack_base_room_count = 16;
  global->min_guaranteed_data_space_size = 1024;
  global->default_data_space_size = 130048;
  global->default_cycles_before_yield = 1024 * 16;
  global->max_cycles_before_yield = 1024 * 64;
  global->max_extra_cycles = 1024 * 128;
  global->default_wordlist_order_max_count = 128;
  global->task_local_space_size = 512;
  global->task_local_space_size_allocated = 0;
  global->do_trace = FALSE;
  if(!(global->default_task_local_space_base =
       malloc(global->task_local_space_size * sizeof(af_byte_t)))) {
    pthread_mutex_destroy(&global->mutex);
    af_cond_destroy(&global->cond);
    free(global->task_wordlist);
    free(global->io_wordlist);
    free(global->forth_wordlist);
    free(global);
    return NULL;
  }
  global->builtin_literal_runtime = NULL;
  global->builtin_f_literal_runtime = NULL;
  global->builtin_exit = NULL;
  global->default_abort = NULL;
  if(!(af_io_init(&global->io, global))) {
    free(global->default_task_local_space_base);
    pthread_mutex_destroy(&global->mutex);
    af_cond_destroy(&global->cond);
    free(global->task_wordlist);
    free(global->io_wordlist);
    free(global->forth_wordlist);
    free(global);
    return NULL;
  }
  global->argc = argc;
  global->argv = (af_byte_t**)argv;
  global->atomic_task = NULL;
  global->handler_task = NULL;
  return global;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x228, %edi            # imm = 0x228
callq 0x2220
testq %rax, %rax
je 0x2780
movq %rax, %rbx
movl $0x8, %edi
callq 0x2220
movq %rax, 0x1b8(%rbx)
testq %rax, %rax
je 0x2778
movl $0x8, %edi
callq 0x2220
movq %rax, 0x1c0(%rbx)
testq %rax, %rax
je 0x2778
movl $0x8, %edi
callq 0x2220
movq %rax, 0x1c8(%rbx)
testq %rax, %rax
je 0x2778
leaq 0x20(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq %r15, %rdi
callq 0xbd8c
testq %rax, %rax
je 0x2754
leaq 0x80(%rbx), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x2300
testl %eax, %eax
jne 0x274c
xorl %eax, %eax
movq %rax, 0x190(%rbx)
movq 0x1b8(%rbx), %rcx
movq %rax, (%rcx)
movq 0x1c0(%rbx), %rcx
movq %rax, (%rcx)
movq 0x1c8(%rbx), %rcx
movq %rax, (%rcx)
movl $0x400, %ecx            # imm = 0x400
movq %rcx, 0x128(%rbx)
movq %rcx, 0x130(%rbx)
movq %rcx, 0x138(%rbx)
movl $0x10, %edx
movq %rdx, 0x140(%rbx)
movq %rdx, 0x148(%rbx)
movq %rdx, 0x150(%rbx)
movq %rcx, 0x158(%rbx)
movq $0x1fc00, 0x160(%rbx) # imm = 0x1FC00
movq $0x4000, 0x168(%rbx) # imm = 0x4000
movq $0x10000, 0x170(%rbx) # imm = 0x10000
movq $0x20000, 0x178(%rbx) # imm = 0x20000
movq $0x80, 0x1d0(%rbx)
movl $0x200, %ecx            # imm = 0x200
movq %rcx, 0x1d8(%rbx)
movq %rax, 0x1e0(%rbx)
movq %rax, 0x200(%rbx)
movl $0x200, %edi            # imm = 0x200
callq 0x2220
movq %rax, 0x1e8(%rbx)
testq %rax, %rax
je 0x2744
xorl %eax, %eax
movq %rax, 0x198(%rbx)
movq %rax, 0x1a8(%rbx)
movq %rbx, %rdi
addq $0xa8, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x180(%rbx)
movq %rbx, %rsi
callq 0xbe40
testq %rax, %rax
je 0x2738
movslq %ebp, %rax
movq %rax, 0x208(%rbx)
movq %r14, 0x210(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x218(%rbx)
jmp 0x2782
movq 0x1e8(%rbx), %rdi
callq 0x2050
movq %r12, %rdi
callq 0x2140
movq %r15, %rdi
callq 0xbddc
movq 0x1c8(%rbx), %rdi
callq 0x2050
movq 0x1c0(%rbx), %rdi
callq 0x2050
movq 0x1b8(%rbx), %rdi
callq 0x2050
movq %rbx, %rdi
callq 0x2050
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq