// File: /workspace/github_c_makefile_star2_O2/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 0x263c
movq %rax, %rbx
pushq $0x8
popq %rdi
callq 0x2220
movq %rax, 0x1b8(%rbx)
testq %rax, %rax
je 0x2634
pushq $0x8
popq %rdi
callq 0x2220
movq %rax, 0x1c0(%rbx)
testq %rax, %rax
je 0x2634
pushq $0x8
popq %rdi
callq 0x2220
movq %rax, 0x1c8(%rbx)
testq %rax, %rax
je 0x2634
leaq 0x20(%rbx), %r15
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rbx)
movups %xmm0, (%rbx)
movq %r15, %rdi
callq 0xb978
testq %rax, %rax
je 0x2610
leaq 0x80(%rbx), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x2300
testl %eax, %eax
jne 0x2608
andq $0x0, 0x190(%rbx)
movq 0x1b8(%rbx), %rax
andq $0x0, (%rax)
movq 0x1c0(%rbx), %rax
andq $0x0, (%rax)
movq 0x1c8(%rbx), %rax
andq $0x0, (%rax)
movl $0x400, %eax            # imm = 0x400
movq %rax, 0x128(%rbx)
movq %rax, 0x130(%rbx)
movq %rax, 0x138(%rbx)
pushq $0x10
popq %rcx
movq %rcx, 0x140(%rbx)
movq %rcx, 0x148(%rbx)
movq %rcx, 0x150(%rbx)
movq %rax, 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, %eax            # imm = 0x200
movq %rax, 0x1d8(%rbx)
andq $0x0, 0x1e0(%rbx)
andq $0x0, 0x200(%rbx)
movl $0x200, %edi            # imm = 0x200
callq 0x2220
movq %rax, 0x1e8(%rbx)
testq %rax, %rax
je 0x2600
andq $0x0, 0x198(%rbx)
andq $0x0, 0x1a8(%rbx)
movq %rbx, %rdi
addq $0xa8, %rdi
xorps %xmm0, %xmm0
movups %xmm0, 0x180(%rbx)
movq %rbx, %rsi
callq 0xba24
testq %rax, %rax
je 0x25f4
movslq %ebp, %rax
movq %rax, 0x208(%rbx)
movq %r14, 0x210(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x218(%rbx)
jmp 0x263e
movq 0x1e8(%rbx), %rdi
callq 0x2050
movq %r12, %rdi
callq 0x2140
movq %r15, %rdi
callq 0xb9c2
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