// File: /workspace/github_cpp_makefile_star2_O1/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 0x501b7(%rip), %r12     # 0x64848
movq %r12, 0x10(%rsp)
movq 0x96663(%rip), %r15     # 0xaad00
movq %r15, 0x28(%rsp)
movq $-0x4000, %rbx          # imm = 0xC000
addq 0x501e8(%rip), %rbx     # 0x64898
movq %rbx, 0x30(%rsp)
movq 0x50184(%rip), %r14     # 0x64840
movq %r14, 0x40(%rsp)
movq $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x50277(%rip), %r13     # 0x64950
movq %r13, 0x48(%rsp)
movq 0x50273(%rip), %rbp     # 0x64958
movq %rbp, 0x50(%rsp)
leaq 0x5034f(%rip), %rdi     # 0x64a40
movq %rbx, %rsi
callq 0x3bf2
movq 0x50340(%rip), %rax     # 0x64a40
shlq $0x17, %rax
sarq $0x17, %rax
orq $0x840000, %rax         # imm = 0x840000
movq %rax, 0x925f3(%rip)     # 0xa6d08
cmpb $0x1, 0x50264(%rip)     # 0x64980
jne 0x14734
movq 0xa8c33(%rip), %rdi     # 0xbd358
leaq 0x8(%rsp), %rsi
movl $0xa, %ecx
rep  movsq (%rsi), %es:(%rdi)
jmp 0x14763
shlq $0xc, %r12
incq %r12
movq 0xa8c16(%rip), %rax     # 0xbd358
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 0xa8bf6(%rip), %rsi     # 0xbd360
leaq 0xa8be7(%rip), %rdi     # 0xbd358
movq 0xa8bc8(%rip), %rdx     # 0xbd340
movq 0xa8bc9(%rip), %rcx     # 0xbd348
callq 0x1b9ac
movq 0x500bd(%rip), %rax     # 0x64848
shlq $0x18, %rax
movabsq $-0x7000000000, %rsi    # imm = 0xFFFFFF9000000000
addq %rax, %rsi
leaq 0x5029d(%rip), %rdi     # 0x64a40
callq 0x3bf2
cmpq $0x0, 0x96550(%rip)     # 0xaad00
jle 0x1480e
xorl %r14d, %r14d
leaq 0x96554(%rip), %r15     # 0xaad10
leaq 0x5027d(%rip), %rbx     # 0x64a40
movabsq $0x7fff000000, %r12     # imm = 0x7FFF000000
leaq 0x5652c(%rip), %r13     # 0x6ad00
movq 0x8(%r15,%r14,8), %rax
movq 0x50260(%rip), %rsi     # 0x64a40
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 0x3bf2
incq %r14
cmpq 0x964f4(%rip), %r14     # 0xaad00
jl 0x147d4
movq 0x50033(%rip), %rax     # 0x64848
leaq -0x1(%rax), %rcx
movq %rcx, 0x50028(%rip)     # 0x64848
cmpq $0x7801, %rax           # imm = 0x7801
jl 0x1487a
movl $0x77ff, %r15d          # imm = 0x77FF
leaq 0x924cb(%rip), %rbx     # 0xa6d00
leaq 0xa8b1c(%rip), %r14     # 0xbd358
movq 0xa8b1d(%rip), %rsi     # 0xbd360
cmpq 0xa8b1e(%rip), %rsi     # 0xbd368
je 0x1485f
movq (%rbx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8b03(%rip)     # 0xbd360
jmp 0x1486a
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1ada0
incq %r15
addq $0x8, %rbx
cmpq 0x4ffd0(%rip), %r15     # 0x64848
jl 0x1483c
cmpq $0x0, 0x9647e(%rip)     # 0xaad00
jle 0x148d3
leaq 0x9676d(%rip), %rbx     # 0xaaff8
xorl %r15d, %r15d
leaq 0xa8ac3(%rip), %r14     # 0xbd358
movq 0xa8ac4(%rip), %rsi     # 0xbd360
cmpq 0xa8ac5(%rip), %rsi     # 0xbd368
je 0x148b8
movq (%rbx), %rax
movq %rax, (%rsi)
addq $0x8, %rsi
movq %rsi, 0xa8aaa(%rip)     # 0xbd360
jmp 0x148c3
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1ada0
incq %r15
addq $0x8, %rbx
cmpq 0x9642f(%rip), %r15     # 0xaad00
jl 0x14895
cmpb $0x1, 0x500b5(%rip)     # 0x6498f
jne 0x14922
movq 0x4ffdd(%rip), %rsi     # 0x648c0
decq %rsi
leaq 0x8af2(%rip), %rdi      # 0x1d3df
xorl %eax, %eax
callq 0x3030
movl $0x1, %r14d
leaq 0x8943(%rip), %rbx      # 0x1d244
movq (%rsp,%r14,8), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3030
incq %r14
cmpq $0xb, %r14
jne 0x14901
movl $0xa, %edi
callq 0x3330
movq 0x4ff27(%rip), %rax     # 0x64850
leaq 0x542d0(%rip), %rcx     # 0x68c00
movq $0x0, (%rcx,%rax,8)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq