// File: /workspace/github_cpp_makefile_star2_O2/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 0x51e6d(%rip), %r12     # 0x63838
movq %r12, 0x10(%rsp)
movq 0x98319(%rip), %r15     # 0xa9cf0
movq %r15, 0x28(%rsp)
movq $-0x4000, %rbx          # imm = 0xC000
addq 0x51e9e(%rip), %rbx     # 0x63888
movq %rbx, 0x30(%rsp)
movq 0x51e3a(%rip), %r14     # 0x63830
movq %r14, 0x40(%rsp)
andq $0x0, 0x38(%rsp)
xorps %xmm0, %xmm0
movups %xmm0, 0x18(%rsp)
movq 0x51f30(%rip), %r13     # 0x63940
movq %r13, 0x48(%rsp)
movq 0x51f2c(%rip), %rbp     # 0x63948
movq %rbp, 0x50(%rsp)
leaq 0x52008(%rip), %rdi     # 0x63a30
movq %rbx, %rsi
callq 0x381c
movq 0x51ff9(%rip), %rax     # 0x63a30
shlq $0x17, %rax
sarq $0x17, %rax
orq $0x840000, %rax         # imm = 0x840000
movq %rax, 0x942ac(%rip)     # 0xa5cf8
cmpb $0x1, 0x51f1d(%rip)     # 0x63970
jne 0x11a72
movq 0xaa8ec(%rip), %rax     # 0xbc348
xorl %ecx, %ecx
cmpq $0xa, %rcx
je 0x11aa1
movq 0x8(%rsp,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
incq %rcx
jmp 0x11a5e
shlq $0xc, %r12
incq %r12
movq 0xaa8c8(%rip), %rax     # 0xbc348
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 0xaa8a8(%rip), %rsi     # 0xbc350
leaq 0xaa899(%rip), %rdi     # 0xbc348
movq 0xaa87a(%rip), %rdx     # 0xbc330
movq 0xaa87b(%rip), %rcx     # 0xbc338
callq 0x15bf8
movq 0x51d6f(%rip), %rax     # 0x63838
shlq $0x18, %rax
movabsq $-0x7000000000, %rsi    # imm = 0xFFFFFF9000000000
addq %rax, %rsi
leaq 0x51f4f(%rip), %rbx     # 0x63a30
movq %rbx, %rdi
callq 0x381c
pushq $0x1
popq %r14
leaq 0x9820c(%rip), %r15     # 0xa9d00
movabsq $0x7fff000000, %r12     # imm = 0x7FFF000000
leaq 0x581eb(%rip), %r13     # 0x69cf0
cmpq 0x981e4(%rip), %r14     # 0xa9cf0
jg 0x11b40
movq (%r15,%r14,8), %rax
movq 0x51f17(%rip), %rsi     # 0x63a30
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 0x381c
incq %r14
jmp 0x11b05
movq 0x51cf1(%rip), %rax     # 0x63838
decq %rax
movq %rax, 0x51ce7(%rip)     # 0x63838
movl $0x7800, %r15d          # imm = 0x7800
leaq 0x94192(%rip), %rbx     # 0xa5cf0
leaq 0xaa7e3(%rip), %r14     # 0xbc348
cmpq %rax, %r15
jg 0x11b85
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12c32
incq %r15
movq 0x51cb9(%rip), %rax     # 0x63838
addq $0x8, %rbx
jmp 0x11b65
pushq $0x1
popq %r15
leaq 0x98458(%rip), %rbx     # 0xa9fe8
leaq 0xaa7b1(%rip), %r14     # 0xbc348
cmpq 0x98152(%rip), %r15     # 0xa9cf0
jg 0x11bb4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x12c32
incq %r15
addq $0x8, %rbx
jmp 0x11b97
cmpb $0x1, 0x51dc4(%rip)     # 0x6397f
jne 0x11c01
movq 0x51cec(%rip), %rsi     # 0x638b0
decq %rsi
leaq 0x8841(%rip), %rdi      # 0x1a40f
xorl %eax, %eax
callq 0x3030
pushq $0x1
popq %r14
leaq 0x8694(%rip), %rbx      # 0x1a274
cmpq $0xb, %r14
je 0x11bf9
movq (%rsp,%r14,8), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x3030
incq %r14
jmp 0x11be0
pushq $0xa
popq %rdi
callq 0x3320
movq 0x51c38(%rip), %rax     # 0x63840
leaq 0x55fe1(%rip), %rcx     # 0x67bf0
andq $0x0, (%rcx,%rax,8)
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq