// File: besm6[P]pascal-re/pascompl.cc
// Function: allocSymtab(long)
int64_t allocSymtab(int64_t newSym)
{
    int64_t ret = symTabPos;

    if (symTabCnt == 0) {
        symTabCnt = 1;
        symTabArray[1] = newSym;
        symTabIndex[1] = symTabPos;
    } else {
        int64_t low = 1;
        int64_t high = symTabCnt;
        int64_t mid;

        do {
            mid = (low + high) / 2;
            if (newSym == symTabArray[mid]) {
                return symTabIndex[mid];
            }
            if (newSym < symTabArray[mid])
                high = mid - 1;
            else
                low = mid + 1;
        } while (high >= low);

        if (symTabCnt >= SYMTAB_MAX) {
            error(50); /* errSymbolTableOverflow */
        } else {
            if (newSym < symTabArray[mid])
                high = mid;
            else
                high = mid + 1;
            for (mid = symTabCnt; mid >= high; --mid) {
                low = mid + 1;
                symTabArray[low] = symTabArray[mid];
                symTabIndex[low] = symTabIndex[mid];
            }
            symTabCnt = symTabCnt + 1;
            symTabArray[high] = newSym;
            symTabIndex[high] = symTabPos;
        }
    }
    putToSymTab(newSym);
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq %rdi, -0x10(%rbp)
movq 0x77b55(%rip), %rax     # 0x7fef8
movq %rax, -0x18(%rbp)
cmpq $0x0, 0x77e19(%rip)     # 0x801c8
jne 0x83da
movq $0x1, 0x77e0c(%rip) # 0x801c8
movq -0x10(%rbp), %rax
movq %rax, 0x77e11(%rip)     # 0x801d8
movq 0x77b2a(%rip), %rax     # 0x7fef8
movq %rax, 0x79d53(%rip)     # 0x82128
jmp 0x855a
movq $0x1, -0x20(%rbp)
movq 0x77ddf(%rip), %rax     # 0x801c8
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
addq -0x28(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rdx
leaq 0x77dbe(%rip), %rcx     # 0x801d0
cmpq (%rcx,%rdx,8), %rax
jne 0x8430
movq -0x30(%rbp), %rcx
leaq 0x79cfd(%rip), %rax     # 0x82120
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x856b
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rdx
leaq 0x77d91(%rip), %rcx     # 0x801d0
cmpq (%rcx,%rdx,8), %rax
jge 0x8453
movq -0x30(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x845f
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8461
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jge 0x83ed
cmpq $0x3e8, 0x77d52(%rip) # imm = 0x3E8
jl 0x8487
movl $0x32, %edi
callq 0x7b40
jmp 0x8558
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rdx
leaq 0x77d3a(%rip), %rcx     # 0x801d0
cmpq (%rcx,%rdx,8), %rax
jge 0x84a6
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x84b2
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
movq 0x77d0f(%rip), %rax     # 0x801c8
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
cmpq -0x28(%rbp), %rax
jl 0x851d
movq -0x30(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x77cf2(%rip), %rax     # 0x801d0
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rcx
leaq 0x77ce3(%rip), %rax     # 0x801d0
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rcx
leaq 0x79c24(%rip), %rax     # 0x82120
movq (%rax,%rcx,8), %rdx
movq -0x20(%rbp), %rcx
leaq 0x79c15(%rip), %rax     # 0x82120
movq %rdx, (%rax,%rcx,8)
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x84bd
movq 0x77ca4(%rip), %rax     # 0x801c8
addq $0x1, %rax
movq %rax, 0x77c99(%rip)     # 0x801c8
movq -0x10(%rbp), %rdx
movq -0x28(%rbp), %rcx
leaq 0x77c92(%rip), %rax     # 0x801d0
movq %rdx, (%rax,%rcx,8)
movq 0x779af(%rip), %rdx     # 0x7fef8
movq -0x28(%rbp), %rcx
leaq 0x79bcc(%rip), %rax     # 0x82120
movq %rdx, (%rax,%rcx,8)
jmp 0x855a
movq -0x10(%rbp), %rdi
callq 0x7f50
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)