// File: /workspace/github_c_makefile_star2_O0/RodionGork[P]tinyscheme/scheme.c
// Function: alloc_cellseg
static int alloc_cellseg(scheme * sc, int n) {
  pointer newp;
  pointer last;
  pointer p;
  char *cp;
  long i;
  int k;
  int adj = ADJ;

  if (adj < sizeof(struct cell)) {
    adj = sizeof(struct cell);
  }
  for (k = 0; k < n; k++) {
    if (sc->last_cell_seg >= cell_nsegment - 1)
      return k;
    cp = (char *) sc->malloc(cell_segsize * sizeof(struct cell) + adj);
    if (cp == 0)
      return k;
    i = ++sc->last_cell_seg;
    sc->alloc_seg[i] = cp;
    /* adjust in TYPE_BITS-bit boundary */
    if (((unsigned long) cp) % adj != 0) {
      cp = (char *) (adj * ((unsigned long) cp / adj + 1));
    }
    /* insert new segment in address order */
    newp = (pointer) cp;
    sc->cell_seg[i] = newp;
    while (i > 0 && sc->cell_seg[i - 1] > sc->cell_seg[i]) {
      p = sc->cell_seg[i];
      sc->cell_seg[i] = sc->cell_seg[i - 1];
      sc->cell_seg[--i] = p;
    }
    sc->fcells += cell_segsize;
    last = newp + cell_segsize - 1;
    for (p = newp; p <= last; p++) {
      typeflag(p) = 0;
      cdr(p) = p + 1;
      car(p) = sc->NIL;
    }
    /* insert new cells in address order on free list */
    if (sc->free_cell == sc->NIL || p < sc->free_cell) {
      cdr(last) = sc->free_cell;
      sc->free_cell = newp;
    } else {
      p = sc->free_cell;
      while (cdr(p) != sc->NIL && newp > cdr(p))
        p = cdr(p);
      cdr(last) = cdr(p);
      cdr(p) = newp;
    }
  }
  return n;
}

// Assembly:
subq $0x58, %rsp
movq %rdi, 0x48(%rsp)
movl %esi, 0x44(%rsp)
movl $0x20, 0x10(%rsp)
movslq 0x10(%rsp), %rax
cmpq $0x18, %rax
jae 0x60f8
movl $0x18, 0x10(%rsp)
movl $0x0, 0x14(%rsp)
movl 0x14(%rsp), %eax
cmpl 0x44(%rsp), %eax
jge 0x6418
movq 0x48(%rsp), %rax
movl 0x28(%rax), %eax
movl 0x15074(%rip), %ecx     # 0x1b190
subl $0x1, %ecx
cmpl %ecx, %eax
jl 0x6130
movl 0x14(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x6420
movq 0x48(%rsp), %rax
movq (%rax), %rax
movslq 0x16801(%rip), %rcx     # 0x1c940
imulq $0x18, %rcx, %rdi
movslq 0x10(%rsp), %rcx
addq %rcx, %rdi
callq *%rax
movq %rax, 0x20(%rsp)
cmpq $0x0, 0x20(%rsp)
jne 0x6167
movl 0x14(%rsp), %eax
movl %eax, 0x54(%rsp)
jmp 0x6420
movq 0x48(%rsp), %rcx
movl 0x28(%rcx), %eax
addl $0x1, %eax
movl %eax, 0x28(%rcx)
cltq
movq %rax, 0x18(%rsp)
movq 0x20(%rsp), %rdx
movq 0x48(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
xorl %edx, %edx
divq %rcx
cmpq $0x0, %rdx
je 0x61d6
movslq 0x10(%rsp), %rax
movq %rax, 0x8(%rsp)
movq 0x20(%rsp), %rax
movslq 0x10(%rsp), %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rcx
movq 0x8(%rsp), %rax
addq $0x1, %rcx
imulq %rcx, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rax
movq %rax, 0x38(%rsp)
movq 0x38(%rsp), %rdx
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
xorl %eax, %eax
cmpq $0x0, 0x18(%rsp)
movb %al, 0x7(%rsp)
jle 0x6234
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rax
movq 0x48(%rsp), %rcx
movq 0x20(%rcx), %rcx
movq 0x18(%rsp), %rdx
cmpq (%rcx,%rdx,8), %rax
seta %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x623e
jmp 0x62a6
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, 0x28(%rsp)
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq 0x28(%rsp), %rdx
movq 0x48(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x18(%rsp), %rcx
movq %rcx, %rsi
addq $-0x1, %rsi
movq %rsi, 0x18(%rsp)
movq %rdx, -0x8(%rax,%rcx,8)
jmp 0x61f7
movslq 0x16693(%rip), %rcx     # 0x1c940
movq 0x48(%rsp), %rax
addq 0x168(%rax), %rcx
movq %rcx, 0x168(%rax)
movq 0x38(%rsp), %rax
movslq 0x16674(%rip), %rcx     # 0x1c940
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
addq $-0x18, %rax
movq %rax, 0x30(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
cmpq 0x30(%rsp), %rax
ja 0x6334
movq 0x28(%rsp), %rax
movl $0x0, (%rax)
movq 0x28(%rsp), %rcx
addq $0x18, %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x48(%rsp), %rax
movq 0x90(%rax), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
movq 0x28(%rsp), %rax
addq $0x18, %rax
movq %rax, 0x28(%rsp)
jmp 0x62e6
movq 0x48(%rsp), %rax
movq 0x160(%rax), %rax
movq 0x48(%rsp), %rcx
cmpq 0x90(%rcx), %rax
je 0x6361
movq 0x28(%rsp), %rax
movq 0x48(%rsp), %rcx
cmpq 0x160(%rcx), %rax
jae 0x6389
movq 0x48(%rsp), %rax
movq 0x160(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rcx
movq 0x48(%rsp), %rax
movq %rcx, 0x160(%rax)
jmp 0x6406
movq 0x48(%rsp), %rax
movq 0x160(%rax), %rax
movq %rax, 0x28(%rsp)
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x48(%rsp), %rdx
xorl %eax, %eax
cmpq 0x90(%rdx), %rcx
movb %al, 0x6(%rsp)
je 0x63cc
movq 0x38(%rsp), %rax
movq 0x28(%rsp), %rcx
cmpq 0x10(%rcx), %rax
seta %al
movb %al, 0x6(%rsp)
movb 0x6(%rsp), %al
testb $0x1, %al
jne 0x63d6
jmp 0x63e6
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rax
movq %rax, 0x28(%rsp)
jmp 0x639a
movq 0x28(%rsp), %rax
movq 0x10(%rax), %rcx
movq 0x30(%rsp), %rax
movq %rcx, 0x10(%rax)
movq 0x38(%rsp), %rcx
movq 0x28(%rsp), %rax
movq %rcx, 0x10(%rax)
jmp 0x6408
movl 0x14(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x14(%rsp)
jmp 0x6100
movl 0x44(%rsp), %eax
movl %eax, 0x54(%rsp)
movl 0x54(%rsp), %eax
addq $0x58, %rsp
retq
nopl (%rax)