// File: 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
movq %rsp, %rbp
subq $0xc0, %rsp
movq $0x1, -0x68(%rbp)
movq 0x63d5e(%rip), %rax     # 0x7fef8
subq $0x7800, %rax           # imm = 0x7800
subq $0x1, %rax
movq %rax, -0x60(%rbp)
movq 0xaa201(%rip), %rax     # 0xc63b0
movq %rax, -0x48(%rbp)
movq 0x63d8e(%rip), %rax     # 0x7ff48
subq $0x4000, %rax           # imm = 0x4000
movq %rax, -0x40(%rbp)
movq 0x63d25(%rip), %rax     # 0x7fef0
movq %rax, -0x30(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x38(%rbp)
movq 0x63e12(%rip), %rax     # 0x80000
movq %rax, -0x28(%rbp)
movq 0x63e0f(%rip), %rax     # 0x80008
movq %rax, -0x20(%rbp)
movq 0x63d44(%rip), %rsi     # 0x7ff48
subq $0x4000, %rsi           # imm = 0x4000
leaq 0x63ede(%rip), %rdi     # 0x800f0
callq 0x4ad0
leaq 0x63ed2(%rip), %rdi     # 0x800f0
callq 0x1dfb0
orq $0x840000, %rax         # imm = 0x840000
movq %rax, 0xa6188(%rip)     # 0xc23b8
testb $0x1, 0x63df9(%rip)     # 0x80030
je 0x1c285
movq $0x0, -0x78(%rbp)
cmpq $0xa, -0x78(%rbp)
jae 0x1c280
movq -0x78(%rbp), %rax
movq -0x68(%rbp,%rax,8), %rax
movq %rax, -0xa8(%rbp)
movq -0x78(%rbp), %rsi
leaq 0xbc7a5(%rip), %rdi     # 0xd8a08
callq 0x24160
movq -0xa8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x1c241
jmp 0x1c328
movq -0x68(%rbp), %rax
movq -0x60(%rbp), %rcx
shlq $0xc, %rcx
orq %rcx, %rax
movq %rax, -0xc0(%rbp)
leaq 0xbc766(%rip), %rdi     # 0xd8a08
movl $0x7, %esi
callq 0x24160
movq -0xc0(%rbp), %rcx
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
shlq $0x1e, %rax
movq -0x28(%rbp), %rcx
shlq $0xf, %rcx
orq %rcx, %rax
orq -0x20(%rbp), %rax
movq %rax, -0xb8(%rbp)
leaq 0xbc72d(%rip), %rdi     # 0xd8a08
movl $0x8, %esi
callq 0x24160
movq -0xb8(%rbp), %rcx
movq %rcx, (%rax)
movq -0x30(%rbp), %rax
shlq $0x1e, %rax
movq -0x38(%rbp), %rcx
shlq $0xf, %rcx
orq %rcx, %rax
orq -0x40(%rbp), %rax
movq %rax, -0xb0(%rbp)
leaq 0xbc6f4(%rip), %rdi     # 0xd8a08
movl $0x9, %esi
callq 0x24160
movq -0xb0(%rbp), %rcx
movq %rcx, (%rax)
leaq 0xbc6d9(%rip), %rdi     # 0xd8a08
callq 0x24230
movq %rax, -0x88(%rbp)
leaq -0x80(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x24260
leaq 0xbc69e(%rip), %rdi     # 0xd89f0
callq 0x242a0
movq %rax, -0x90(%rbp)
leaq 0xbc68b(%rip), %rdi     # 0xd89f0
callq 0x24230
movq %rax, -0x98(%rbp)
movq -0x80(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x98(%rbp), %rcx
leaq 0xbc67e(%rip), %rdi     # 0xd8a08
callq 0x24180
movq %rax, -0xa0(%rbp)
movq 0x63b5b(%rip), %rsi     # 0x7fef8
subq $0x7000, %rsi           # imm = 0x7000
shlq $0x18, %rsi
leaq 0x63d41(%rip), %rdi     # 0x800f0
callq 0x4ad0
movq $0x1, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq 0xa9fe9(%rip), %rax     # 0xc63b0
jg 0x1c437
movq -0x10(%rbp), %rcx
leaq 0xa9fec(%rip), %rax     # 0xc63c0
movq (%rax,%rcx,8), %rax
movq %rax, -0x8(%rbp)
movabsq $0x7fff000000, %rdx     # imm = 0x7FFF000000
andq 0x63d03(%rip), %rdx     # 0x800f0
movq -0x8(%rbp), %rcx
leaq 0x69fb8(%rip), %rax     # 0x863b0
orq (%rax,%rcx,8), %rdx
leaq 0x69fad(%rip), %rax     # 0x863b0
movq %rdx, (%rax,%rcx,8)
leaq 0x63ce2(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, %rsi
addq $0x1000000, %rsi        # imm = 0x1000000
leaq 0x63ccc(%rip), %rdi     # 0x800f0
callq 0x4ad0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1c3bc
movq 0x63aba(%rip), %rax     # 0x7fef8
subq $0x1, %rax
movq %rax, 0x63aaf(%rip)     # 0x7fef8
movq $0x7800, -0x10(%rbp)    # imm = 0x7800
movq -0x10(%rbp), %rax
cmpq 0x63a9c(%rip), %rax     # 0x7fef8
jg 0x1c48a
movq -0x10(%rbp), %rax
leaq 0x69f47(%rip), %rsi     # 0x863b0
shlq $0x3, %rax
addq %rax, %rsi
leaq 0xbc591(%rip), %rdi     # 0xd8a08
callq 0x1e3b0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1c451
movq $0x1, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpq 0xa9f13(%rip), %rax     # 0xc63b0
jg 0x1c4cb
movq -0x10(%rbp), %rax
leaq 0xaa1f6(%rip), %rsi     # 0xc66a0
shlq $0x3, %rax
addq %rax, %rsi
leaq 0xbc550(%rip), %rdi     # 0xd8a08
callq 0x1e3b0
movq -0x10(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x1c492
testb $0x1, 0x63b6d(%rip)     # 0x8003f
je 0x1c52b
movq 0x63a95(%rip), %rsi     # 0x7ff70
subq $0x1, %rsi
leaq 0x15f88(%rip), %rdi     # 0x3246e
movb $0x0, %al
callq 0x4030
movq $0x1, -0x8(%rbp)
cmpq $0xa, -0x8(%rbp)
jg 0x1c521
movq -0x8(%rbp), %rax
movq -0x70(%rbp,%rax,8), %rsi
leaq 0x15dc0(%rip), %rdi     # 0x322cc
movb $0x0, %al
callq 0x4030
movq -0x8(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x8(%rbp)
jmp 0x1c4f5
movl $0xa, %edi
callq 0x4410
movq 0x639ce(%rip), %rcx     # 0x7ff00
leaq 0x67d77(%rip), %rax     # 0x842b0
movq $0x0, (%rax,%rcx,8)
addq $0xc0, %rsp
popq %rbp
retq
nopw (%rax,%rax)