// File: besm6[P]pascal-re/pascompl.cc
// Function: addCurValToFCST()
int64_t addCurValToFCST()
{
    int64_t ret;
    int64_t low, high, mid;
    low = 1;
    if (FcstTotal == 0) {
        ret = FcstCnt;
        FcstTotal = 1;
        constVals[1] = curVal;
        constNums[1] = FcstCnt;
        toFCST();
    } else {
        high = FcstTotal;
        do {
            mid = (low + high) / 2;
            if (curVal.m == constVals[mid].m) {
              return constNums[mid];
            }
            if (curVal.a < constVals[mid].a)
                high = mid - 1;
            else
                low = mid + 1;
        } while (low <= high);
        ret = FcstCnt;
        if (FcstTotal != MAXLIT) {
            if (curVal.a < constVals[mid].a)
                high = mid;
            else
                high = mid + 1;
            for (mid = FcstTotal; mid >= high; --mid) {
                low = mid + 1;
                constVals[low] = constVals[mid];
                constNums[low] = constNums[mid];
            }
            FcstTotal = FcstTotal + 1;
            constVals[high] = curVal;
            constNums[high] = FcstCnt;
        };
        toFCST();
    }
    return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x30, %rsp
movq $0x1, -0x18(%rbp)
cmpq $0x0, 0x77e68(%rip)     # 0x7fff0
jne 0x81c6
movq 0x77d5f(%rip), %rax     # 0x7fef0
movq %rax, -0x10(%rbp)
movq $0x1, 0x77e50(%rip) # 0x7fff0
movq 0x77f49(%rip), %rax     # 0x800f0
movq %rax, 0xbe7da(%rip)     # 0xc6988
movq 0x77d3b(%rip), %rax     # 0x7fef0
movq %rax, 0xbf77c(%rip)     # 0xc7938
callq 0x8140
jmp 0x8373
movq 0x77e23(%rip), %rax     # 0x7fff0
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
addq -0x20(%rbp), %rax
movl $0x2, %ecx
cqto
idivq %rcx
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rcx
leaq 0xbe78e(%rip), %rax     # 0xc6980
movq (%rax,%rcx,8), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
leaq 0x77eeb(%rip), %rdi     # 0x800f0
callq 0x1e420
testb $0x1, %al
jne 0x8210
jmp 0x8228
movq -0x28(%rbp), %rcx
leaq 0xbf715(%rip), %rax     # 0xc7930
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
jmp 0x837b
movq -0x28(%rbp), %rax
leaq 0xbe74d(%rip), %rsi     # 0xc6980
shlq $0x3, %rax
addq %rax, %rsi
leaq 0x77eaf(%rip), %rdi     # 0x800f0
callq 0x1e460
testb $0x1, %al
jne 0x824c
jmp 0x825a
movq -0x28(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x8266
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x8268
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jle 0x81d1
movq 0x77c73(%rip), %rax     # 0x7fef0
movq %rax, -0x10(%rbp)
cmpq $0x1f4, 0x77d64(%rip) # imm = 0x1F4
je 0x836e
movq -0x28(%rbp), %rax
leaq 0xbe6e3(%rip), %rsi     # 0xc6980
shlq $0x3, %rax
addq %rax, %rsi
leaq 0x77e45(%rip), %rdi     # 0x800f0
callq 0x1e460
testb $0x1, %al
jne 0x82b6
jmp 0x82c0
movq -0x28(%rbp), %rax
movq %rax, -0x20(%rbp)
jmp 0x82cc
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
movq 0x77d1d(%rip), %rax     # 0x7fff0
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
cmpq -0x20(%rbp), %rax
jl 0x8330
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
movq -0x28(%rbp), %rdx
movq -0x18(%rbp), %rcx
leaq 0xbe684(%rip), %rax     # 0xc6980
movq (%rax,%rdx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rcx
leaq 0xbf621(%rip), %rax     # 0xc7930
movq (%rax,%rcx,8), %rdx
movq -0x18(%rbp), %rcx
leaq 0xbf612(%rip), %rax     # 0xc7930
movq %rdx, (%rax,%rcx,8)
movq -0x28(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x82d7
movq 0x77cb9(%rip), %rax     # 0x7fff0
addq $0x1, %rax
movq %rax, 0x77cae(%rip)     # 0x7fff0
movq -0x20(%rbp), %rcx
leaq 0xbe633(%rip), %rax     # 0xc6980
movq 0x77d9c(%rip), %rdx     # 0x800f0
movq %rdx, (%rax,%rcx,8)
movq 0x77b91(%rip), %rdx     # 0x7fef0
movq -0x20(%rbp), %rcx
leaq 0xbf5c6(%rip), %rax     # 0xc7930
movq %rdx, (%rax,%rcx,8)
callq 0x8140
movq -0x10(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x30, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)