// File: /workspace/github_cpp_makefile_star2_O3/besm6[P]pascal-re/pascompl.cc
// Function: main
int main(int argc, char **argv)
{
    // Data Initializations moved here
    blockBegSys = Bits(LABELSY, CONSTSY, TYPESY, VARSY) + Bits(FUNCSY, PROCSY, BEGINSY);
    statBegSys = Bits(BEGINSY, IFSY, CASESY, REPEATSY) + Bits(WHILESY, FORSY, WITHSY) +
        Bits(GOTOSY, SELECTSY);
    statEndSys = Bits(SEMICOLON, ENDSY, ELSESY, UNTILSY);
    lvalOpSet = Bits(GETELT, GETVAR, op36, op37) + Bits(GETFIELD, DEREF, FILEPTR);

    funcInsn[fnABS] = KAMX;
    funcInsn[fnTRUNC] = KADD+ZERO;
    funcInsn[fnODD] = KAAX+E1;
    funcInsn[fnORD] = KAOX+ZERO;
    funcInsn[fnCHR] = KAAX+MANTISSA;
    funcInsn[fnSUCC] = KARX+E1;
    funcInsn[fnPRED] = KSUB+E1;
    funcInsn[fnSQR] = macro + mcSQRR;
    funcInsn[fnROUND] = macro + mcROUND;
    funcInsn[fnCARD] = macro + mcCARD;
    funcInsn[fnMINEL] = macro + mcMINEL;
    funcInsn[fnPTR] = KAAX+MANTISSA;
    funcInsn[fnABSI] = KAMX;
    funcInsn[fnSQRI] = macro + mcSQRI;

    for (int i = 0; i < 128; ++i) {
        charSymTabBase[i] = NOSY;
        chrClassTabBase[i] = NOOP;
    }
    for (int i = 0; i < 10; ++i) {
        charSymTabBase[i+'0'] = INTCONST;
        chrClassTabBase[i+'0'] = ALNUM;
    }
    for (int i = 0; i < 26; ++i) {
        charSymTabBase[i+'A'] = IDENT;
        chrClassTabBase[i+'A'] = ALNUM;
        charSymTabBase[i+'a'] = IDENT;
        chrClassTabBase[i+'a'] = ALNUM;
    }

    // Allow Cyrillics except Ъ which does not have a TEXT code
    for (int i = 0; i < 31; ++i) {
        charSymTabBase[i+0300] = IDENT;
        chrClassTabBase[i+0300] = ALNUM;
        charSymTabBase[i+0340] = IDENT;
        chrClassTabBase[i+0340] = ALNUM;
    }
    charSymTabBase['\''] = CHARCONST;
    charSymTabBase['_'] = REALCONST;
    charSymTabBase['<'] = LTSY;
    charSymTabBase['>'] = GTSY;
    chrClassTabBase['+'] = PLUSOP;
    chrClassTabBase['-'] = MINUSOP;
    chrClassTabBase['*'] = MUL;
    chrClassTabBase['/'] = RDIVOP;
    chrClassTabBase['='] = EQOP;
    chrClassTabBase['&'] = AMPERS;
    chrClassTabBase['>'] = GTOP;
    chrClassTabBase['<'] = LTOP;
    chrClassTabBase['#'] = NEOP;
    chrClassTabBase['='] = EQOP;
    charSymTabBase['+'] = ADDOP;
    charSymTabBase['-'] = ADDOP;
    charSymTabBase['*'] = MULOP;
    charSymTabBase['/'] = MULOP;
    charSymTabBase['&'] = MULOP;
    charSymTabBase[','] = COMMA;
    charSymTabBase['.'] = PERIOD;
    charSymTabBase['@'] = ARROW;
    charSymTabBase['^'] = ARROW;
    charSymTabBase['('] = LPAREN;
    charSymTabBase[')'] = RPAREN;
    charSymTabBase[';'] = SEMICOLON;
    charSymTabBase['['] = LBRACK;
    charSymTabBase[']'] = RBRACK;
    charSymTabBase['#'] = RELOP;
    charSymTabBase['='] = RELOP;
    charSymTabBase[':'] = COLON;
    charSymTabBase['~'] = NOTSY;
    charSymTabBase['{'] = LBRACE;
    charSymTabBase['}'] = RBRACE;

    iAddOpMap[PLUSOP] = INTPLUS;
    iAddOpMap[MINUSOP] = INTMINUS;
    setOpMap[PLUSOP] = SETOR;
    setOpMap[MINUSOP] = SETSUB;
    iMulOpMap[MUL] = IMULOP;
    iMulOpMap[RDIVOP] = IDIVROP;
    setOpMap[MUL] = SETAND;
    setOpMap[RDIVOP] = SETXOR;

    // Main program starts here

    // L0 by default: no listing, only errors
    PASINFOR.listMode = 0;
    initOptions(argc, argv);
    if (PASINFOR.listMode != 0)
        printf("%s\n", boilerplate);
    curInsnTemplate = 0;
    initTables();
    litExternal = toText("EXTERNAL");
    litForward = toText("FORWARD");
    litFortran = toText("FORTRAN");
    litOct = toText("OCT");
    PASINPUT = ugetc(pasinput);
    try {
        programme(curInsnTemplate, hashTravPtr);
    } catch (int foo) {
        if (foo == 9999) goto L9999;
    }
    if (errors) {
L9999:  printf(" IN %ld LINES %ld ERRORS\n", lineCnt-1, totalErrors);
        exit(1);
    } else {
        finalize();
        // Dump CHILD here
        FILE *f = fopen(outFileName, "w");
        if (f == NULL) {
            fprintf(stderr, "%s: Cannot open output file\n", progname);
            perror(outFileName);
            exit(-1);
        }
        if (stdArrayFmt) {
            int words = 0;
            for (int i = 1; i < entryPtCnt; ++i) {
                write_stdarray_word(f, words, entryPtTable[i]);
            }
            for (size_t i = 0; i < CHILD.size(); ++i) {
                write_stdarray_word(f, words, CHILD[i]);
            }
            while (words++ % 16 != 0)
                fprintf(f, "`%016lo\n", 0l);
        } else {
            fwrite("BESM6\0", 6, 1, f);
            for (size_t i = 7; i < CHILD.size(); ++i) {
                for (int j = 40; j >= 0; j -= 8)
                    fputc((CHILD[i] >> j) & 0xFF, f);
            }
        }
        fclose(f);
        exit(0);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq $0xfc10000, 0x4f407(%rip) # imm = 0xFC10000
movq $0x1fe01, 0x4f404(%rip) # imm = 0x1FE01
movabsq $0x1000001c0, %rax      # imm = 0x1000001C0
movq %rax, 0x4f3e3(%rip)     # 0x647d0
movq $0xf7000, 0x4f3f8(%rip) # imm = 0xF7000
movl $0x7000, %eax           # imm = 0x7000
movq %rax, 0x53ee4(%rip)     # 0x692e8
movq $0x104009, 0x53ee1(%rip) # imm = 0x104009
movq $0x109008, 0x53ede(%rip) # imm = 0x109008
movq $0x10d009, 0x53edb(%rip) # imm = 0x10D009
movl $0x10900c, %ecx         # imm = 0x10900C
movq %rcx, 0x53ed7(%rip)     # 0x69308
movq $0x10b008, 0x53ed4(%rip) # imm = 0x10B008
movq $0x105008, 0x53ed1(%rip) # imm = 0x105008
movq $0x100000c, 0x53ee6(%rip) # imm = 0x100000C
movq $0x100000b, 0x53ee3(%rip) # imm = 0x100000B
movq $0x1000017, 0x53ee0(%rip) # imm = 0x1000017
movq $0x100000f, 0x53edd(%rip) # imm = 0x100000F
movq %rcx, 0x53ede(%rip)     # 0x69358
movq %rax, 0x53edf(%rip)     # 0x69360
movq $0x100000d, 0x53edc(%rip) # imm = 0x100000D
xorl %edx, %edx
leaq 0x5493b(%rip), %rcx     # 0x69dd0
movaps 0x6c34(%rip), %xmm0     # 0x1c0d0
leaq 0x5412d(%rip), %rax     # 0x695d0
movaps 0x6c36(%rip), %xmm1     # 0x1c0e0
movaps %xmm0, (%rdx,%rcx)
movaps %xmm1, (%rdx,%rax)
addq $0x10, %rdx
cmpq $0x200, %rdx            # imm = 0x200
jne 0x154aa
xorl %edx, %edx
movl $0x1, 0xc0(%rcx,%rdx,4)
movl $0x25, 0xc0(%rax,%rdx,4)
incq %rdx
cmpq $0xa, %rdx
jne 0x154c1
xorps %xmm0, %xmm0
movups %xmm0, 0x54a3a(%rip)    # 0x69f24
movups %xmm0, 0x54a23(%rip)    # 0x69f14
movups %xmm0, 0x54a0c(%rip)    # 0x69f04
movups %xmm0, 0x549f5(%rip)    # 0x69ef4
movups %xmm0, 0x549de(%rip)    # 0x69ee4
movups %xmm0, 0x549c7(%rip)    # 0x69ed4
xorl %ecx, %ecx
movq %rcx, 0x54a1e(%rip)     # 0x69f34
movups %xmm0, 0x54a37(%rip)    # 0x69f54
movups %xmm0, 0x54a40(%rip)    # 0x69f64
movups %xmm0, 0x54a49(%rip)    # 0x69f74
movups %xmm0, 0x54a52(%rip)    # 0x69f84
movups %xmm0, 0x54a5b(%rip)    # 0x69f94
movups %xmm0, 0x54a64(%rip)    # 0x69fa4
movq %rcx, 0x54a6d(%rip)     # 0x69fb4
movq $-0x1a, %rcx
movl $0x25, %edx
movl %edx, 0x16c(%rax,%rcx,4)
movl %edx, 0x1ec(%rax,%rcx,4)
incq %rcx
jne 0x15553
xorps %xmm0, %xmm0
movups %xmm0, 0x54bcc(%rip)    # 0x6a13c
movaps %xmm0, 0x54bb9(%rip)    # 0x6a130
movaps %xmm0, 0x54ba2(%rip)    # 0x6a120
movaps %xmm0, 0x54b8b(%rip)    # 0x6a110
movaps %xmm0, 0x54b74(%rip)    # 0x6a100
movaps %xmm0, 0x54b5d(%rip)    # 0x6a0f0
movaps %xmm0, 0x54b46(%rip)    # 0x6a0e0
movaps %xmm0, 0x54b2f(%rip)    # 0x6a0d0
movaps %xmm0, 0x54ba8(%rip)    # 0x6a150
movaps %xmm0, 0x54bb1(%rip)    # 0x6a160
movaps %xmm0, 0x54bba(%rip)    # 0x6a170
movaps %xmm0, 0x54bc3(%rip)    # 0x6a180
movaps %xmm0, 0x54bcc(%rip)    # 0x6a190
movaps %xmm0, 0x54bd5(%rip)    # 0x6a1a0
movaps %xmm0, 0x54bde(%rip)    # 0x6a1b0
movups %xmm0, 0x54be3(%rip)    # 0x6a1bc
movq $-0x1f, %rcx
movl $0x25, %edx
movl %edx, 0x37c(%rax,%rcx,4)
movl %edx, 0x3fc(%rax,%rcx,4)
incq %rcx
jne 0x155e5
movl $0x2, %eax
movl %eax, 0x54949(%rip)     # 0x69f4c
movl $0x5, 0x548bb(%rip)     # 0x69ec8
movl $0x6, %ecx
movl %ecx, 0x5406c(%rip)     # 0x69684
movabsq $0x500000000, %rdx      # imm = 0x500000000
movq %rdx, 0x5404f(%rip)     # 0x69678
movl $0x1, 0x54059(%rip)     # 0x6968c
movl %eax, 0x5402f(%rip)     # 0x69668
movl $0xc, 0x54085(%rip)     # 0x696c8
movabsq $0x90000000a, %rax      # imm = 0x90000000A
movq %rax, 0x5406c(%rip)     # 0x696c0
movl $0x8, %eax
movl %eax, 0x53ffd(%rip)     # 0x6965c
movaps 0x6a8a(%rip), %xmm0     # 0x1c0f0
movups %xmm0, 0x5480b(%rip)    # 0x69e78
movabsq $0x900000010, %rdx      # imm = 0x900000010
movq %rdx, 0x5480a(%rip)     # 0x69e88
movl $0x11, 0x54848(%rip)    # 0x69ed0
movaps 0x6a71(%rip), %xmm0     # 0x1c100
movups %xmm0, 0x547d2(%rip)    # 0x69e68
movl %eax, 0x548a0(%rip)     # 0x69f3c
movabsq $0x110000000d, %rax     # imm = 0x110000000D
movq %rax, 0x54897(%rip)     # 0x69f44
movl $0xb, 0x547a5(%rip)     # 0x69e5c
movaps 0x6a52(%rip), %xmm0     # 0x1c110
movups %xmm0, 0x547f3(%rip)    # 0x69eb8
movl %ecx, 0x548fd(%rip)     # 0x69fc8
movl $0x32, 0x548e7(%rip)    # 0x69fbc
movl $0x33, 0x548e5(%rip)    # 0x69fc4
movabsq $0x1600000015, %rax     # imm = 0x1600000015
movq %rax, 0x53454(%rip)     # 0x68b44
movabsq $0x1400000013, %rax     # imm = 0x1400000013
movq %rax, 0x53383(%rip)     # 0x68a84
movabsq $0x100000000f, %rax     # imm = 0x100000000F
movq %rax, 0x5329e(%rip)     # 0x689b0
movabsq $0x1200000011, %rax     # imm = 0x1200000011
movq %rax, 0x5334d(%rip)     # 0x68a70
movq $0x0, 0xa7c32(%rip) # 0xbd360
callq 0x14f40
cmpq $0x0, 0xa7c25(%rip)     # 0xbd360
je 0x15749
movq 0xeb24(%rip), %rdi      # 0x24268
callq 0x3370
movq $0x0, 0x4f10c(%rip) # 0x64860
leaq 0x8(%rsp), %rdi
callq 0x191b2
movb $0x45, %sil
xorl %ecx, %ecx
leaq 0xa7ac6(%rip), %rax     # 0xbd230
leaq 0x7e37(%rip), %rdx      # 0x1d5a8
xorl %edi, %edi
movq %rcx, %r8
shlq $0x6, %r8
movzbl %sil, %ecx
movsbq (%rcx,%rax), %rcx
orq %r8, %rcx
movb 0x1(%rdi,%rdx), %sil
incq %rdi
cmpq $0x8, %rdi
jne 0x15773
movq %rcx, 0x4f2e5(%rip)     # 0x64a80
movb $0x46, %dil
movl $0x1, %ecx
xorl %esi, %esi
leaq 0x7a70(%rip), %rdx      # 0x1d21c
movq %rsi, %r8
shlq $0x6, %r8
movzbl %dil, %esi
movsbq (%rsi,%rax), %rsi
orq %r8, %rsi
movb (%rcx,%rdx), %dil
incq %rcx
cmpq $0x8, %rcx
jne 0x157ac
movq %rsi, 0x4f2b5(%rip)     # 0x64a88
movb $0x46, %dil
movl $0x1, %ecx
xorl %esi, %esi
leaq 0x7dcd(%rip), %rdx      # 0x1d5b1
movq %rsi, %r8
shlq $0x6, %r8
movzbl %dil, %esi
movsbq (%rsi,%rax), %rsi
orq %r8, %rsi
movb (%rcx,%rdx), %dil
incq %rcx
cmpq $0x8, %rcx
jne 0x157e4
movq %rsi, 0x4f285(%rip)     # 0x64a90
movb $0x4f, %dil
movl $0x1, %ecx
xorl %esi, %esi
leaq 0x7d9d(%rip), %rdx      # 0x1d5b9
movq %rsi, %r8
shlq $0x6, %r8
movzbl %dil, %esi
movsbq (%rsi,%rax), %rsi
orq %r8, %rsi
movb (%rcx,%rdx), %dil
incq %rcx
cmpq $0x4, %rcx
jne 0x1581c
movq %rsi, 0x4f235(%rip)     # 0x64a78
movq 0xef66(%rip), %rdi      # 0x247b0
callq 0x695a
movb %al, 0xef63(%rip)       # 0x247b8
movq 0x4f144(%rip), %rdx     # 0x649a0
leaq 0x4effd(%rip), %rsi     # 0x64860
leaq 0x18(%rsp), %rdi
callq 0x1356c
addq $-0x8, 0xa7b03(%rip)    # 0xbd378
jmp 0x1588e
movq %rax, %rdi
callq 0x30d0
movl (%rax), %ebx
callq 0x33d0
cmpl $0x270f, %ebx           # imm = 0x270F
je 0x15897
cmpb $0x1, 0x4f0e1(%rip)     # 0x64976
jne 0x158c0
movq 0x4f012(%rip), %rsi     # 0x648b0
decq %rsi
movq 0x4f000(%rip), %rdx     # 0x648a8
leaq 0x7d0e(%rip), %rdi      # 0x1d5bd
xorl %eax, %eax
callq 0x3030
movl $0x1, %edi
callq 0x32f0
callq 0x149e3
movq 0xe994(%rip), %rdi      # 0x24260
leaq 0x780e(%rip), %rsi      # 0x1d0e1
callq 0x32d0
testq %rax, %rax
jne 0x15912
movq 0xe6f4(%rip), %rax      # 0x23fd8
movq (%rax), %rdi
movq 0xa7a9a(%rip), %rdx     # 0xbd388
leaq 0x7ce2(%rip), %rsi      # 0x1d5d7
xorl %eax, %eax
callq 0x3340
movq 0xe95d(%rip), %rdi      # 0x24260
callq 0x31f0
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x32f0
movq %rax, %rbx
cmpb $0x1, 0x4f054(%rip)     # 0x64970
jne 0x159dc
movl $0x0, 0x4(%rsp)
cmpq $0x2, 0x4ef0e(%rip)     # 0x64840
jl 0x15961
movl $0x1, %r15d
leaq 0x532af(%rip), %r12     # 0x68bf0
leaq 0x4(%rsp), %r14
movq (%r12,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14ce8
incq %r15
cmpq %r15, 0x4eee1(%rip)     # 0x64840
jg 0x15946
movq 0xa79e0(%rip), %rax     # 0xbd348
cmpq %rax, 0xa79e1(%rip)     # 0xbd350
je 0x159a5
xorl %r15d, %r15d
leaq 0x4(%rsp), %r14
movq (%rax,%r15,8), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14ce8
incq %r15
movq 0xa79be(%rip), %rcx     # 0xbd350
movq 0xa79af(%rip), %rax     # 0xbd348
subq %rax, %rcx
sarq $0x3, %rcx
cmpq %rcx, %r15
jb 0x15979
movl 0x4(%rsp), %ebp
testb $0xf, %bpl
je 0x15a55
incl %ebp
leaq 0x7b0d(%rip), %r14      # 0x1d4c9
movl %ebp, %r15d
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x3340
incl %r15d
testb $0xf, %bpl
movl %r15d, %ebp
jne 0x159bf
jmp 0x15a55
leaq 0x6ee1(%rip), %rdi      # 0x1c8c4
movl $0x6, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x3480
movq 0xa7954(%rip), %rax     # 0xbd350
subq 0xa7945(%rip), %rax     # 0xbd348
cmpq $0x39, %rax
jb 0x15a55
movl $0x7, %r15d
movl $0x28, %r14d
movq 0xa792c(%rip), %rax     # 0xbd348
movq (%rax,%r15,8), %rax
movl %r14d, %ecx
sarq %cl, %rax
movzbl %al, %edi
movq %rbx, %rsi
callq 0x3310
addq $-0x8, %r14
cmpq $-0x8, %r14
jne 0x15a15
incq %r15
movq 0xa790b(%rip), %rax     # 0xbd350
subq 0xa78fc(%rip), %rax     # 0xbd348
sarq $0x3, %rax
cmpq %rax, %r15
jb 0x15a0f
movq %rbx, %rdi
callq 0x3240
xorl %edi, %edi
callq 0x32f0