// File: /workspace/github_c_makefile_star2_O2/RodionGork[P]tinyscheme/scheme.c
// Function: scheme_init_custom_alloc
int scheme_init_custom_alloc(scheme * sc, func_alloc malloc,
    func_dealloc free) {
  int i, n = sizeof(dispatch_table) / sizeof(dispatch_table[0]);
  pointer x;

  num_zero.is_fixnum = 1;
  num_zero.value.ivalue = 0;
  num_one.is_fixnum = 1;
  num_one.value.ivalue = 1;

#if USE_INTERFACE
  sc->vptr = &vtbl;
#endif
  sc->gensym_cnt = 0;
  sc->malloc = malloc;
  sc->free = free;
  sc->last_cell_seg = -1;
  sc->backchar = -1;
  sc->sink = &sc->_sink;
  sc->NIL = &sc->_NIL;
  sc->T = &sc->_HASHT;
  sc->F = &sc->_HASHF;
  sc->EOF_OBJ = &sc->_EOF_OBJ;
  sc->free_cell = &sc->_NIL;
  sc->fcells = 0;
  sc->no_memory = 0;
  sc->alloc_seg = sc->malloc(sizeof(*(sc->alloc_seg)) * cell_nsegment);
  sc->cell_seg = sc->malloc(sizeof(*(sc->cell_seg)) * cell_nsegment);
  sc->strbuff = sc->malloc(STRBUFF_INITIAL_SIZE);
  sc->strbuff_size = STRBUFF_INITIAL_SIZE;
  sc->inport = sc->NIL;
  sc->outport = sc->NIL;
  sc->save_inport = sc->NIL;
  sc->loadport = sc->NIL;
  sc->nesting = 0;
  sc->interactive_repl = 0;

  if (alloc_cellseg(sc, FIRST_CELLSEGS) != FIRST_CELLSEGS) {
    sc->no_memory = 1;
    return 0;
  }
  sc->gc_verbose = 0;
  dump_stack_initialize(sc);
  sc->code = sc->NIL;
  sc->tracing = 0;

  /* init sc->NIL */
  typeflag(sc->NIL) = (T_ATOM | MARK);
  car(sc->NIL) = cdr(sc->NIL) = sc->NIL;
  /* init T */
  typeflag(sc->T) = (T_ATOM | MARK);
  car(sc->T) = cdr(sc->T) = sc->T;
  /* init F */
  typeflag(sc->F) = (T_ATOM | MARK);
  car(sc->F) = cdr(sc->F) = sc->F;
  /* init sink */
  typeflag(sc->sink) = (T_PAIR | MARK);
  car(sc->sink) = sc->NIL;
  /* init c_nest */
  sc->c_nest = sc->NIL;

  sc->oblist = oblist_initial_value(sc);
  /* init global_env */
  new_frame_in_env(sc, sc->NIL);
  sc->global_env = sc->envir;
  /* init else */
  x = mk_symbol(sc, "else");
  new_slot_in_env(sc, x, sc->T);

  assign_syntax(sc, "lambda");
  assign_syntax(sc, "quote");
  assign_syntax(sc, "define");
  assign_syntax(sc, "if");
  assign_syntax(sc, "begin");
  assign_syntax(sc, "set!");
  assign_syntax(sc, "let");
  assign_syntax(sc, "let*");
  assign_syntax(sc, "letrec");
  assign_syntax(sc, "cond");
  assign_syntax(sc, "delay");
  assign_syntax(sc, "and");
  assign_syntax(sc, "or");
  assign_syntax(sc, "cons-stream");
  assign_syntax(sc, "macro");
  assign_syntax(sc, "case");

  for (i = 0; i < n; i++) {
    if (dispatch_table[i].name != 0) {
      assign_proc(sc, (enum scheme_opcodes) i, dispatch_table[i].name);
    }
  }

  /* initialization of global pointers to special symbols */
  sc->LAMBDA = mk_symbol(sc, "lambda");
  sc->QUOTE = mk_symbol(sc, "quote");
  sc->QQUOTE = mk_symbol(sc, "quasiquote");
  sc->UNQUOTE = mk_symbol(sc, "unquote");
  sc->UNQUOTESP = mk_symbol(sc, "unquote-splicing");
  sc->FEED_TO = mk_symbol(sc, "=>");
  sc->COLON_HOOK = mk_symbol(sc, "*colon-hook*");
  sc->ERROR_HOOK = mk_symbol(sc, "*error-hook*");
  sc->SHARP_HOOK = mk_symbol(sc, "*sharp-hook*");
  sc->COMPILE_HOOK = mk_symbol(sc, "*compile-hook*");

  return !sc->no_memory;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, %al
movb %al, 0xd3d9(%rip)       # 0x121a8
andq $0x0, 0xd3d9(%rip)      # 0x121b0
movq %rdi, %rbx
movb %al, 0xd3d8(%rip)       # 0x121b8
movq $0x1, 0xd3d5(%rip) # 0x121c0
andq $0x0, 0xed8(%rdi)
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
orq $-0x1, 0x28(%rdi)
leaq 0x58(%rdi), %rax
movq %rax, 0x70(%rdi)
leaq 0x78(%rdi), %rax
movq %rax, 0x90(%rdi)
leaq 0x98(%rdi), %rcx
movq %rcx, 0xb0(%rdi)
leaq 0xb8(%rdi), %rcx
movq %rcx, 0xd0(%rdi)
leaq 0xd8(%rdi), %rcx
movq %rcx, 0xf0(%rdi)
movq %rax, 0x160(%rdi)
andq $0x0, 0x168(%rdi)
movb $0x0, 0xa99(%rdi)
movslq 0xd33f(%rip), %rdi      # 0x12198
shlq $0x3, %rdi
callq *%rsi
movq %rax, 0x18(%rbx)
movslq 0xd32e(%rip), %rdi      # 0x12198
shlq $0x3, %rdi
callq *(%rbx)
movq %rax, 0x20(%rbx)
movl $0x80, %edi
callq *(%rbx)
movq %rax, 0xea0(%rbx)
movl $0x80, 0xea8(%rbx)
movq 0x90(%rbx), %xmm0
pshufd $0x44, %xmm0, %xmm0     # xmm0 = xmm0[0,1,0,1]
movdqu %xmm0, 0x180(%rbx)
movdqu %xmm0, 0x170(%rbx)
andl $0x0, 0xa94(%rbx)
andl $0x0, 0x50(%rbx)
pushq $0x3
popq %rsi
movq %rbx, %rdi
callq 0x51cd
cmpl $0x3, %eax
jne 0x50cb
movb $0x0, 0xa98(%rbx)
movq 0x90(%rbx), %rax
movq %rax, 0x48(%rbx)
movq %rax, 0x40(%rbx)
andl $0x0, 0x14(%rbx)
movl $0xc000, %ecx           # imm = 0xC000
movl %ecx, (%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x8(%rax)
movq 0xb0(%rbx), %rax
movl %ecx, (%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x8(%rax)
movq 0xd0(%rbx), %rax
movl %ecx, (%rax)
movq %rax, 0x10(%rax)
movq %rax, 0x8(%rax)
movq 0x70(%rbx), %rax
movl $0x8005, (%rax)         # imm = 0x8005
movq 0x90(%rbx), %rcx
movq %rcx, 0x8(%rax)
movq %rcx, 0x108(%rbx)
movq %rbx, %rdi
movl $0x1cd, %esi            # imm = 0x1CD
callq 0x6234
movq %rax, 0xf8(%rbx)
movq 0x90(%rbx), %rsi
movq %rbx, %rdi
callq 0x5313
movq 0x38(%rbx), %rax
movq %rax, 0x100(%rbx)
leaq 0x750f(%rip), %rsi      # 0xc473
movq %rbx, %rdi
callq 0x484c
movq 0xb0(%rbx), %rdx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x5359
leaq 0x74f3(%rip), %rsi      # 0xc478
movq %rbx, %rdi
callq 0x5368
leaq 0x752c(%rip), %rsi      # 0xc4c0
movq %rbx, %rdi
callq 0x5368
leaq 0x74dc(%rip), %rsi      # 0xc47f
movq %rbx, %rdi
callq 0x5368
leaq 0x74d4(%rip), %rsi      # 0xc486
movq %rbx, %rdi
callq 0x5368
leaq 0x74c8(%rip), %rsi      # 0xc489
movq %rbx, %rdi
callq 0x5368
leaq 0x7812(%rip), %rsi      # 0xc7e2
movq %rbx, %rdi
callq 0x5368
leaq 0x74b0(%rip), %rsi      # 0xc48f
movq %rbx, %rdi
callq 0x5368
leaq 0x74a5(%rip), %rsi      # 0xc493
movq %rbx, %rdi
callq 0x5368
leaq 0x749b(%rip), %rsi      # 0xc498
movq %rbx, %rdi
callq 0x5368
leaq 0x7ce0(%rip), %rsi      # 0xccec
movq %rbx, %rdi
callq 0x5368
leaq 0x7484(%rip), %rsi      # 0xc49f
movq %rbx, %rdi
callq 0x5368
leaq 0x747b(%rip), %rsi      # 0xc4a5
movq %rbx, %rdi
callq 0x5368
leaq 0x763d(%rip), %rsi      # 0xc676
movq %rbx, %rdi
callq 0x5368
leaq 0x7461(%rip), %rsi      # 0xc4a9
movq %rbx, %rdi
callq 0x5368
leaq 0x745e(%rip), %rsi      # 0xc4b5
movq %rbx, %rdi
callq 0x5368
leaq 0x768b(%rip), %rsi      # 0xc6f1
movq %rbx, %rdi
callq 0x5368
leaq 0xb4b3(%rip), %r15      # 0x10528
xorl %r12d, %r12d
cmpq $0xbd, %r12
je 0x50d9
movq (%r15), %rsi
testq %rsi, %rsi
je 0x50c2
movq %rbx, %rdi
callq 0x484c
movq %rax, %r14
movq 0x90(%rbx), %rdx
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x4617
movl $0x4004, (%rax)         # imm = 0x4004
movq %r12, 0x10(%rax)
movb $0x1, 0x8(%rax)
movq %rbx, %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5359
incq %r12
addq $0x20, %r15
jmp 0x5078
movb $0x1, 0xa99(%rbx)
xorl %eax, %eax
jmp 0x51c1
leaq 0x7398(%rip), %rsi      # 0xc478
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x110(%rbx)
leaq 0x73ca(%rip), %rsi      # 0xc4c0
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x118(%rbx)
leaq 0x73af(%rip), %rsi      # 0xc4bb
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x120(%rbx)
leaq 0x73a4(%rip), %rsi      # 0xc4c6
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x128(%rbx)
leaq 0x7396(%rip), %rsi      # 0xc4ce
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x130(%rbx)
leaq 0x7391(%rip), %rsi      # 0xc4df
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x138(%rbx)
leaq 0x737e(%rip), %rsi      # 0xc4e2
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x140(%rbx)
leaq 0x7375(%rip), %rsi      # 0xc4ef
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x148(%rbx)
leaq 0x736c(%rip), %rsi      # 0xc4fc
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x150(%rbx)
leaq 0x7363(%rip), %rsi      # 0xc509
movq %rbx, %rdi
callq 0x484c
movq %rax, 0x158(%rbx)
xorl %eax, %eax
cmpb $0x0, 0xa99(%rbx)
sete %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq