// File: /workspace/github_c_makefile_star2_O3/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
movq %rdi, %rbx
movb $0x1, %al
movb %al, 0xe286(%rip)       # 0x131a8
xorl %r14d, %r14d
movq %r14, 0xe284(%rip)      # 0x131b0
movb %al, 0xe286(%rip)       # 0x131b8
movq $0x1, 0xe283(%rip) # 0x131c0
movq %r14, 0xed8(%rdi)
movq %rsi, (%rdi)
movq %rdx, 0x8(%rdi)
movq $-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)
movq %r14, 0x168(%rdi)
movb $0x0, 0xa99(%rdi)
movslq 0xe1ec(%rip), %rdi      # 0x13198
shlq $0x3, %rdi
callq *%rsi
movq %rax, 0x18(%rbx)
movslq 0xe1db(%rip), %rdi      # 0x13198
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)
movl %r14d, 0xa94(%rbx)
movl %r14d, 0x50(%rbx)
movq %rbx, %rdi
movl $0x3, %esi
callq 0x536b
cmpl $0x3, %eax
jne 0x5355
movb $0x0, 0xa98(%rbx)
movq 0x90(%rbx), %rax
movq %rax, 0x48(%rbx)
movq %rax, 0x40(%rbx)
movl $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 0x6480
movq %rax, 0xf8(%rbx)
movq 0x90(%rbx), %rsi
movq %rbx, %rdi
callq 0x54c1
movq 0x38(%rbx), %rax
movq %rax, 0x100(%rbx)
leaq 0x83e7(%rip), %rsi      # 0xd4a3
movq %rbx, %rdi
callq 0x4909
movq 0x38(%rbx), %rsi
movq 0xb0(%rbx), %rcx
movq %rbx, %rdi
movq %rax, %rdx
callq 0x5e7f
leaq 0x83c7(%rip), %rsi      # 0xd4a8
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x83fc(%rip), %rsi      # 0xd4f0
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x83a8(%rip), %rsi      # 0xd4af
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x839c(%rip), %rsi      # 0xd4b6
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x838c(%rip), %rsi      # 0xd4b9
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x86d2(%rip), %rsi      # 0xd812
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x836c(%rip), %rsi      # 0xd4bf
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x835d(%rip), %rsi      # 0xd4c3
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x834f(%rip), %rsi      # 0xd4c8
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x8b90(%rip), %rsi      # 0xdd1c
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x8330(%rip), %rsi      # 0xd4cf
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x8323(%rip), %rsi      # 0xd4d5
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x84e1(%rip), %rsi      # 0xd6a6
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x8301(%rip), %rsi      # 0xd4d9
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x82fa(%rip), %rsi      # 0xd4e5
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0x8523(%rip), %rsi      # 0xd721
movq %rbx, %rdi
callq 0x49cf
orb $0x10, 0x1(%rax)
leaq 0xc317(%rip), %r15      # 0x11528
xorl %r12d, %r12d
movq (%r15), %rsi
testq %rsi, %rsi
je 0x5259
movq %rbx, %rdi
callq 0x4909
movq %rax, %r14
movq 0x90(%rbx), %rdx
movq %rbx, %rdi
movq %rdx, %rsi
callq 0x4689
movl $0x4004, (%rax)         # imm = 0x4004
movq %r12, 0x10(%rax)
movb $0x1, 0x8(%rax)
movq 0x38(%rbx), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movq %rax, %rcx
callq 0x5e7f
incq %r12
addq $0x20, %r15
cmpq $0xbd, %r12
jne 0x5214
leaq 0x8238(%rip), %rsi      # 0xd4a8
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x110(%rbx)
leaq 0x826a(%rip), %rsi      # 0xd4f0
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x118(%rbx)
leaq 0x824f(%rip), %rsi      # 0xd4eb
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x120(%rbx)
leaq 0x8244(%rip), %rsi      # 0xd4f6
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x128(%rbx)
leaq 0x8236(%rip), %rsi      # 0xd4fe
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x130(%rbx)
leaq 0x8231(%rip), %rsi      # 0xd50f
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x138(%rbx)
leaq 0x821e(%rip), %rsi      # 0xd512
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x140(%rbx)
leaq 0x8215(%rip), %rsi      # 0xd51f
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x148(%rbx)
leaq 0x820c(%rip), %rsi      # 0xd52c
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x150(%rbx)
leaq 0x8203(%rip), %rsi      # 0xd539
movq %rbx, %rdi
callq 0x4909
movq %rax, 0x158(%rbx)
xorl %r14d, %r14d
cmpb $0x0, 0xa99(%rbx)
sete %r14b
jmp 0x535c
movb $0x1, 0xa99(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq