// File: /workspace/github_cpp_makefile_star2_O3/besm6[P]pascal-re/pascompl.cc
// Function: finalize()
void finalize()
{
    int64_t idx, cnt;
    int64_t sizes[11]; // array [1..10] of @Integer;

    sizes[1] = 1;
    sizes[2] = symTabPos - 074000 - 1;
    sizes[5] = longSymCnt;
    sizes[6] = moduleOffset - 040000;
    sizes[8] = FcstCnt;
    sizes[3] = 0;
    sizes[4] = 0;
    sizes[7] = 0;
    sizes[9] = int92z;
    sizes[10] = int93z;
    curVal.i = moduleOffset - 040000;
    symTab[074001] = 041000000 | curVal.i;
    if (stdArrayFmt) {
        // Copying the sizes array to the output literally.
        for (size_t i = 0; i < 10; ++i) {
            CHILD[i] = sizes[i+1];
        }
    } else {
        // Forming the compact form of the module header.
        CHILD[7] = sizes[1] | (sizes[2] << 12);
        CHILD[8] = sizes[5] << 30 | sizes[9] << 15 | sizes[10];
        CHILD[9] = sizes[8] << 30 | sizes[7] << 15 | sizes[6];
    }
    /*
    reset(FCST);
    while not eof(FCST) do {
        write(CHILD, FCST@);
        get(FCST);
    };
    */
    CHILD.insert(CHILD.end(), FCST.begin(), FCST.end());
    curVal.i = (symTabPos - 070000L) * 0100000000L;
    for (cnt = 1; cnt <= longSymCnt; ++cnt) {
        idx = longSymTabBase[cnt];
        symTab[idx] |= curVal.ii & leftAddr;
        curVal.i = (curVal.i + 0100000000L);
    }
    symTabPos = symTabPos - 1;
    for (cnt = 074000; cnt <= symTabPos; ++cnt)
        CHILD.push_back(symTab[cnt]);
    for (cnt = 1; cnt <= longSymCnt; ++cnt)
        CHILD.push_back(longSyms[cnt]);
    if (allowCompat) {
        printf("%6ld LINES STRUCTURE ", lineCnt - 1);
        for (idx=1; idx <=10; ++idx)
            printf("%ld ", sizes[idx]);
        putchar('\n');
    }
    entryPtTable[entryPtCnt] = 0;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq $0x1, 0x8(%rsp)
movq $-0x7801, %r12          # imm = 0x87FF
addq 0x4fe30(%rip), %r12     # 0x64838
movq %r12, 0x10(%rsp)
movq 0x962dc(%rip), %r15     # 0xaacf0
movq %r15, 0x28(%rsp)
movq $-0x4000, %rbx          # imm = 0xC000
addq 0x4fe61(%rip), %rbx     # 0x64888
movq %rbx, 0x30(%rsp)
movq 0x4fdfd(%rip), %r14     # 0x64830
movq %r14, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x4fef0(%rip), %r13     # 0x64940
movq %r13, 0x48(%rsp)
movq 0x4feec(%rip), %rbp     # 0x64948
movq %rbp, 0x50(%rsp)
leaq 0x4ffc8(%rip), %rdi     # 0x64a30
movq %rbx, %rsi
callq 0x3c48
movq 0x4ffb9(%rip), %rax     # 0x64a30
shlq $0x17, %rax
sarq $0x17, %rax
orq $0x840000, %rax         # imm = 0x840000
movq %rax, 0x9226c(%rip)     # 0xa6cf8
cmpb $0x1, 0x4fedd(%rip)     # 0x64970
jne 0x14aab
leaq 0x8(%rsp), %rsi
movq 0xa88a7(%rip), %rdi     # 0xbd348
movl $0xa, %ecx
rep  movsq (%rsi), %es:(%rdi)
jmp 0x14ada
shlq $0xc, %r12
incq %r12
movq 0xa888f(%rip), %rax     # 0xbd348
movq %r12, 0x38(%rax)
shlq $0x1e, %r15
shlq $0xf, %r13
orq %r15, %r13
orq %rbp, %r13
movq %r13, 0x40(%rax)
shlq $0x1e, %r14
orq %rbx, %r14
movq %r14, 0x48(%rax)
movq 0xa886f(%rip), %rsi     # 0xbd350
leaq 0xa8860(%rip), %rdi     # 0xbd348
movq 0xa8841(%rip), %rdx     # 0xbd330
movq 0xa8842(%rip), %rcx     # 0xbd338
callq 0x1bdbe
movq 0x4fd36(%rip), %rax     # 0x64838
shlq $0x18, %rax
movabsq $-0x7000000000, %rsi    # imm = 0xFFFFFF9000000000
addq %rax, %rsi
leaq 0x4ff16(%rip), %rdi     # 0x64a30
callq 0x3c48
movq 0x961ca(%rip), %rax     # 0xaacf0
testq %rax, %rax
jle 0x14b8a
xorl %r14d, %r14d
leaq 0x961cb(%rip), %r15     # 0xaad00
leaq 0x4fef4(%rip), %rbx     # 0x64a30
movabsq $0x7fff000000, %r12     # imm = 0x7FFF000000
leaq 0x561a3(%rip), %r13     # 0x6acf0
movq 0x8(%r15,%r14,8), %rax
movq 0x4fed7(%rip), %rsi     # 0x64a30
movq %rsi, %rcx
andq %r12, %rcx
orq %rcx, (%r13,%rax,8)
shlq $0x17, %rsi
sarq $0x17, %rsi
addq $0x1000000, %rsi        # imm = 0x1000000
movq %rbx, %rdi
callq 0x3c48
movq 0x9616e(%rip), %rax     # 0xaacf0
incq %r14
cmpq %rax, %r14
jl 0x14b4d
movq 0x4fca7(%rip), %rcx     # 0x64838
leaq -0x1(%rcx), %rdx
movq %rdx, 0x4fc9c(%rip)     # 0x64838
cmpq $0x7801, %rcx           # imm = 0x7801
jl 0x14c0f
movq 0xa87a4(%rip), %rsi     # 0xbd350
movl $0x77ff, %r15d          # imm = 0x77FF
leaq 0x92137(%rip), %rbx     # 0xa6cf0
movq 0xa8798(%rip), %rax     # 0xbd358
leaq 0xa8781(%rip), %r14     # 0xbd348
cmpq %rax, %rsi
je 0x14bdf
movq (%rbx), %rcx
movq %rcx, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8773(%rip)     # 0xbd350
jmp 0x14bf8
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1b17a
movq 0xa875f(%rip), %rsi     # 0xbd350
movq 0xa8760(%rip), %rax     # 0xbd358
incq %r15
addq $0x8, %rbx
cmpq 0x4fc32(%rip), %r15     # 0x64838
jl 0x14bc7
movq 0x960e1(%rip), %rax     # 0xaacf0
testq %rax, %rax
jle 0x14c74
movq 0xa8735(%rip), %rsi     # 0xbd350
leaq 0x963c6(%rip), %rbx     # 0xaafe8
movq 0xa872f(%rip), %rax     # 0xbd358
xorl %r15d, %r15d
leaq 0xa8715(%rip), %r14     # 0xbd348
cmpq %rax, %rsi
je 0x14c4b
movq (%rbx), %rcx
movq %rcx, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8707(%rip)     # 0xbd350
jmp 0x14c64
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1b17a
movq 0xa86f3(%rip), %rsi     # 0xbd350
movq 0xa86f4(%rip), %rax     # 0xbd358
incq %r15
addq $0x8, %rbx
cmpq 0x9607e(%rip), %r15     # 0xaacf0
jl 0x14c33
cmpb $0x1, 0x4fd04(%rip)     # 0x6497f
jne 0x14cc3
movq 0x4fc2c(%rip), %rsi     # 0x648b0
decq %rsi
leaq 0x8811(%rip), %rdi      # 0x1d49f
xorl %eax, %eax
callq 0x3030
movl $0x1, %r14d
leaq 0x8662(%rip), %rbx      # 0x1d304
movq (%rsp,%r14,8), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3030
incq %r14
cmpq $0xb, %r14
jne 0x14ca2
movl $0xa, %edi
callq 0x3330
movq 0x4fb76(%rip), %rax     # 0x64840
leaq 0x53f1f(%rip), %rcx     # 0x68bf0
movq $0x0, (%rcx,%rax,8)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq