// File: /workspace/github_c_makefile_star2_O0/tabemann[P]attoforth/src/runtime/prim.c
// Function: af_prim_base_interpreter
void af_prim_base_interpreter(af_task_t* task) {
  af_global_t* global = task->global;
  task->interpreter_pointer = &global->base_interpreter_code[0];
  if(af_parse_name_available(global, task)) {
    af_cell_t length;
    af_byte_t* text = af_parse_name(global, task, &length);
    /* char* print_text = malloc(length + 1); */
    /* memcpy(print_text, text, length); */
    /* print_text[length] = '\0'; */
    /* if(task->is_compiling) { */
    /*   printf("Compiling name: %s\n", print_text) */
    /* } else { */
    /*   printf("Evaluating name: %s\n", print_text); */
    /* } */
    af_word_t* word = af_lookup(global, task, text, length);
    if(word) {
      if(task->is_compiling && !(word->flags & AF_WORD_IMMEDIATE)) {
	af_compiled_t* slot = af_allot(global, task,
				       sizeof(af_compiled_t));
	if(slot) {
	  slot->compiled_call = word;
	}
      } else if(!task->is_compiling && (word->flags & AF_WORD_COMPILE_ONLY)) {
	char* buffer = malloc(length + 1);
	memcpy(buffer, text, length);
	buffer[length] = 0;
	printf("%s: ", buffer);
	free(buffer);
	af_handle_compile_only(global, task);
      } else {
	AF_WORD_EXECUTE(task, word);
      }
    } else {
      af_sign_cell_t result;
      if(af_parse_number(global, task->base, text, (size_t)length, &result)) {
	if(task->is_compiling) {
	  af_compiled_t* slot = af_allot(global, task,
					 sizeof(af_compiled_t) * 2);
	  if(slot) {
	    slot->compiled_call = global->builtin_literal_runtime;
	    (slot + 1)->compiled_sign_cell = result;
	  }
	} else {
	  if(--task->data_stack_current >= task->data_stack_top) {
	    *task->data_stack_current = (af_cell_t)result;
	  } else {
	    af_handle_data_stack_overflow(global, task);
	  }
	}
      } else {
	af_float_t float_result;
	if(af_parse_float(global, text, (size_t)length, &float_result)) {
	  if(task->is_compiling) {
	    af_compiled_t* slot = af_allot(global, task,
					   sizeof(af_compiled_t) +
					   sizeof(af_float_t));
	    if(slot) {
	      slot->compiled_call = global->builtin_f_literal_runtime;
	      *(af_float_t*)(&(slot + 1)->compiled_cell) = float_result;
	    }
	  } else {
	    if(--task->float_stack_current >= task->float_stack_top) {
	      *task->float_stack_current = float_result;
	    } else {
	      af_handle_float_stack_overflow(global, task);
	    }
	  }
	} else {
	  af_2cell_t result2;
	  if(af_parse_2number(global, task->base, text, (size_t)length,
			      &result2)) {
	    if(task->is_compiling) {
	      af_compiled_t* slot = af_allot(global, task,
					     sizeof(af_compiled_t) * 4);
	      if(slot) {
		slot->compiled_call = global->builtin_literal_runtime;
		(slot + 1)->compiled_cell =
		  (af_cell_t)(result2 &
			      ((~(af_2cell_t)0) >> (sizeof(af_cell_t) << 3)));
		(slot + 2)->compiled_call = global->builtin_literal_runtime;
		(slot + 3)->compiled_cell =
		  (af_cell_t)(result2 >> (sizeof(af_cell_t) << 3));
	      }
	    } else {
	      if((task->data_stack_current - 2) >= task->data_stack_top) {
		*(--task->data_stack_current) =
		  (af_cell_t)(result2 &
			      ((~(af_2cell_t)0) >> (sizeof(af_cell_t) << 3)));
		*(--task->data_stack_current) =
		  (af_cell_t)(result2 >> (sizeof(af_cell_t) << 3));
	      } else {
		af_handle_data_stack_overflow(global, task);
	      }
	    }
	  } else {
	    char* buffer = malloc(length + 1);
	    memcpy(buffer, text, length);
	    buffer[length] = 0;
	    printf("%s: ", buffer);
	    free(buffer);
	    af_handle_parse_error(global, task);
	  }
	}
      }
    }
  } else {
    af_kill(global, task);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rcx
addq $0x1f0, %rcx            # imm = 0x1F0
movq -0x8(%rbp), %rax
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x5620
cmpq $0x0, %rax
je 0x1685c
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
leaq -0x18(%rbp), %rdx
callq 0x57b0
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
callq 0x4990
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
je 0x1658f
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x164e7
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
andq $0x1, %rax
cmpq $0x0, %rax
jne 0x164e7
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x8, %edx
callq 0x47e0
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
je 0x164e2
movq -0x28(%rbp), %rcx
movq -0x30(%rbp), %rax
movq %rcx, (%rax)
jmp 0x1658a
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
jne 0x1655c
movq -0x28(%rbp), %rax
movq 0x18(%rax), %rax
andq $0x4, %rax
cmpq $0x0, %rax
je 0x1655c
movq -0x18(%rbp), %rdi
addq $0x1, %rdi
callq 0x21f0
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x21c0
movq -0x38(%rbp), %rax
movq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x38(%rbp), %rsi
leaq 0x4573(%rip), %rdi      # 0x1aab0
movb $0x0, %al
callq 0x2120
movq -0x38(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4560
jmp 0x16588
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x40(%rbp), %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0xf8(%rax)
movq -0x40(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rdi
callq *%rax
jmp 0x1658a
jmp 0x1685a
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x50(%rbp), %r8
callq 0x4a30
cmpq $0x0, %rax
je 0x16640
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x16601
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x10, %edx
callq 0x47e0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x165ff
movq -0x10(%rbp), %rax
movq 0x180(%rax), %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x8(%rax)
jmp 0x1663b
movq -0x8(%rbp), %rcx
movq 0x60(%rcx), %rax
addq $-0x8, %rax
movq %rax, 0x60(%rcx)
movq -0x8(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jb 0x1662c
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
movq %rcx, (%rax)
jmp 0x16639
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4260
jmp 0x1663b
jmp 0x16858
movq -0x10(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
leaq -0x60(%rbp), %rcx
callq 0x4d60
cmpq $0x0, %rax
je 0x166ed
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x166a9
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x10, %edx
callq 0x47e0
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x166a7
movq -0x10(%rbp), %rax
movq 0x188(%rax), %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movsd -0x60(%rbp), %xmm0
movq -0x68(%rbp), %rax
movsd %xmm0, 0x8(%rax)
jmp 0x166e8
movq -0x8(%rbp), %rcx
movq 0x68(%rcx), %rax
addq $-0x8, %rax
movq %rax, 0x68(%rcx)
movq -0x8(%rbp), %rcx
cmpq 0x80(%rcx), %rax
jb 0x166d9
movsd -0x60(%rbp), %xmm0
movq -0x8(%rbp), %rax
movq 0x68(%rax), %rax
movsd %xmm0, (%rax)
jmp 0x166e6
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x42a0
jmp 0x166e8
jmp 0x16856
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xf0(%rax), %rsi
movq -0x20(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq -0x80(%rbp), %r8
callq 0x4ea0
cmpq $0x0, %rax
je 0x167ef
movq -0x8(%rbp), %rax
cmpq $0x0, 0x40(%rax)
je 0x16790
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
movl $0x20, %edx
callq 0x47e0
movq %rax, -0x88(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x1678e
movq -0x10(%rbp), %rax
movq 0x180(%rax), %rcx
movq -0x88(%rbp), %rax
movq %rcx, (%rax)
movq -0x80(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x180(%rax), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x78(%rbp), %rcx
movq -0x88(%rbp), %rax
movq %rcx, 0x18(%rax)
jmp 0x167ed
movq -0x8(%rbp), %rax
movq 0x60(%rax), %rax
addq $-0x10, %rax
movq -0x8(%rbp), %rcx
cmpq 0x78(%rcx), %rax
jb 0x167de
movq -0x80(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x60(%rdx), %rax
movq %rax, %rsi
addq $-0x8, %rsi
movq %rsi, 0x60(%rdx)
movq %rcx, -0x8(%rax)
movq -0x78(%rbp), %rcx
movq -0x8(%rbp), %rdx
movq 0x60(%rdx), %rax
movq %rax, %rsi
addq $-0x8, %rsi
movq %rsi, 0x60(%rdx)
movq %rcx, -0x8(%rax)
jmp 0x167eb
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4260
jmp 0x167ed
jmp 0x16854
movq -0x18(%rbp), %rdi
addq $0x1, %rdi
callq 0x21f0
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rdi
movq -0x20(%rbp), %rsi
movq -0x18(%rbp), %rdx
callq 0x21c0
movq -0x90(%rbp), %rax
movq -0x18(%rbp), %rcx
movb $0x0, (%rax,%rcx)
movq -0x90(%rbp), %rsi
leaq 0x427c(%rip), %rdi      # 0x1aab0
movb $0x0, %al
callq 0x2120
movq -0x90(%rbp), %rdi
callq 0x2040
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x4460
jmp 0x16856
jmp 0x16858
jmp 0x1685a
jmp 0x16869
movq -0x10(%rbp), %rdi
movq -0x8(%rbp), %rsi
callq 0x3c60
addq $0x90, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)