// File: besm6[P]pascal-re/pascompl.cc
// Function: initOptions(int, char**)
void initOptions(int argc, char **argv)
{
    PASINFOR.startOffset -= 040000;
    commentModeCH = ' ';
    lineNesting = 0;
    maxLineLen = 120;
    CH = ' ';
    linePos = 0;
    prevErrPos = 0;
    errsInLine = 0;
    lineCnt = 1;
    checkFortran = false;
    bool110z = false;
    int93z = 1;
    int92z = 1;
    moduleOffset = 16384;
    lineStartOffset = 16384;
    int94z = 1;
    parsingParam = false;
    dataCheck = false;
    heapSize = 100;
    bool49z = true;
    atEOL = false;
    doPMD = true; // not (42 in curVal.m);
    checkTypes = true;
    fixMult = true;
    fuzzReals = true;
    pseudoZ = true;
    checkBounds = true; // not (44 in curVal.m);
    declExternal = false;
    errors = false;
    allowCompat = false;
    fileBufSize = 1;
    charEncoding = 2;
    chain = NULL;
    longSymCnt = 0;
    extSymAdornment = 0;
    symTabCnt = 0;
    stdArrayFmt = false;

    // Get base name of the program.
    progname = strrchr(argv[0], '/');
    progname = progname ? progname+1 : argv[0];

    for (;;) {
        switch (getopt(argc, argv, "vVhPe:p:t:c:r:m:y:u:f:a:d:k:b:s:l:")) {
        case EOF:
            break;
        case 'a':
            charEncoding = strtoul(optarg, 0, 0);
            if (charEncoding > 2) {
                fprintf(stderr, "%s: Bad option -a\n", progname);
                exit(-1);
            }
            continue;
        case 'b':
            fileBufSize = strtoul(optarg, 0, 0);
            if (fileBufSize > 4) {
                fprintf(stderr, "%s: Bad option -b\n", progname);
                exit(-1);
            }
            continue;
        case 'c':
            checkTypes = (optarg[0] == '+');
            continue;
        case 'd':
            curVal.i = strtoul(optarg, 0, 0);
            if (curVal.i > 15) {
                fprintf(stderr, "%s: Bad option -d\n", progname);
                exit(-1);
            }
            optSflags.m = optSflags.m * BitRange(0, 40) + curVal.m * BitRange(41, 47);
            continue;
        case 'e':
            declExternal = (optarg[0] == '+');
            continue;
        case 'f':
            checkFortran = (optarg[0] == '+');
            continue;
        case 'k':
            heapSize = strtoul(optarg, 0, 0);
            if (heapSize > 23) {
                fprintf(stderr, "%s: Bad option -k\n", progname);
                exit(-1);
            }
            continue;
        case 'l':
            PASINFOR.listMode = strtoul(optarg, 0, 0);
            if (PASINFOR.listMode > 3) {
                fprintf(stderr, "%s: Bad option -l\n", progname);
                exit(-1);
            }
            continue;
        case 'm':
            fixMult = (optarg[0] == '+');
            continue;
        case 'P':
            stdArrayFmt = true;
            continue;
        case 'p':
            doPMD = (optarg[0] == '+');
            continue;
        case 'r':
            fuzzReals = (optarg[0] == '+');
            continue;
        case 's':
            curVal.i = strtoul(optarg, 0, 0);
            if (curVal.i > 9) {
                fprintf(stderr, "%s: Bad option -s\n", progname);
                exit(-1);
            }
            if (curVal.i == 3) {
                lineCnt = 1;
            } else if (4 <= curVal.i && curVal.i <= 9) {
                optSflags.m = optSflags.m + Bits(curVal.i - 3);
            } else {
                extSymAdornment = curVal.i;
            }
            continue;
        case 't':
            checkBounds = (optarg[0] == '+');
            continue;
        case 'u':
            maxLineLen = (optarg[0] == '+') ? 72 : 120;
            continue;
        case 'y':
            allowCompat = (optarg[0] == '+');
            continue;
        case 'v':
            printf("%s\n", boilerplate);
            exit(0);
        case 'V':
            ++verbose;
            continue;
        default:
            usage();
        }
        break;
    }
    argc -= optind;
    argv += optind;
    if (argc < 1 || argc > 2)
        usage();

    // Open input file on stdin.
    if (strcmp(argv[0], "-") != 0) {
        if (freopen(argv[0], "r", stdin) == NULL) {
            fprintf(stderr, "%s: Cannot open input file\n", progname);
            perror(argv[0]);
            exit(-1);
        }
    }

    // Open output file on stdout.
    if (argc > 1) {
        outFileName = argv[1];
        unlink(outFileName);
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movq 0xbc1e2(%rip), %rax     # 0xd8a28
subq $0x4000, %rax           # imm = 0x4000
movq %rax, 0xbc1d5(%rip)     # 0xd8a28
movb $0x20, 0x6377e(%rip)    # 0x7ffd8
movq $0x0, 0x63783(%rip) # 0x7ffe8
movq $0x78, 0x636b8(%rip) # 0x7ff28
movb $0x20, 0x63762(%rip)    # 0x7ffd9
movq $0x0, 0x636ae(%rip) # 0x7ff30
movq $0x0, 0x636ab(%rip) # 0x7ff38
movq $0x0, 0x636a8(%rip) # 0x7ff40
movq $0x1, 0x636cd(%rip) # 0x7ff70
movb $0x0, 0x63796(%rip)     # 0x80040
movb $0x0, 0x6378c(%rip)     # 0x8003d
movq $0x1, 0x6374c(%rip) # 0x80008
movq $0x1, 0x63739(%rip) # 0x80000
movq $0x4000, 0x63676(%rip) # imm = 0x4000
movq $0x4000, 0x63673(%rip) # imm = 0x4000
movq $0x1, 0x63728(%rip) # 0x80010
movb $0x0, 0x635c9(%rip)     # 0x7feb8
movb $0x0, 0x635c5(%rip)     # 0x7febb
movq $0x64, 0x6368f(%rip) # 0x7ff90
movb $0x1, 0x635b2(%rip)     # 0x7feba
movb $0x0, 0x63722(%rip)     # 0x80031
movb $0x1, 0x63723(%rip)     # 0x80039
movb $0x1, 0x63715(%rip)     # 0x80032
movb $0x1, 0x63718(%rip)     # 0x8003c
movb $0x1, 0x63710(%rip)     # 0x8003b
movb $0x1, 0x6370c(%rip)     # 0x8003e
movb $0x1, 0x63701(%rip)     # 0x8003a
movb $0x0, 0x636f7(%rip)     # 0x80037
movb $0x0, 0x636ef(%rip)     # 0x80036
movb $0x0, 0x636f1(%rip)     # 0x8003f
movq $0x1, 0x635af(%rip) # 0x7ff08
movq $0x2, 0x636bc(%rip) # 0x80020
movq $0x0, 0x63771(%rip) # 0x800e0
movq $0x0, 0xa9a36(%rip) # 0xc63b0
movq $0x0, 0x63803(%rip) # 0x80188
movq $0x0, 0x63838(%rip) # 0x801c8
movb $0x0, 0x63699(%rip)     # 0x80030
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movl $0x2f, %esi
callq 0x4350
movq %rax, 0xbc099(%rip)     # 0xd8a48
cmpq $0x0, 0xbc091(%rip)     # 0xd8a48
je 0x1c9ca
movq 0xbc088(%rip), %rax     # 0xd8a48
addq $0x1, %rax
movq %rax, -0x50(%rbp)
jmp 0x1c9d5
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, 0xbc068(%rip)     # 0xd8a48
movl -0x4(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x163c9(%rip), %rdx     # 0x32db7
callq 0x4070
incl %eax
movl %eax, %ecx
movq %rcx, -0x58(%rbp)
subl $0x7a, %eax
ja 0x1cea1
movq -0x58(%rbp), %rax
leaq 0x14c81(%rip), %rcx     # 0x31690
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
jmp 0x1cea6
movq 0x22574(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, 0x635e7(%rip)     # 0x80020
cmpq $0x2, 0x635df(%rip)     # 0x80020
jle 0x1ca6c
movq 0x2258e(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbff4(%rip), %rdx     # 0xd8a48
leaq 0x1637f(%rip), %rsi     # 0x32dda
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
jmp 0x1c9e0
movq 0x22520(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, 0x6347b(%rip)     # 0x7ff08
cmpq $0x4, 0x63473(%rip)     # 0x7ff08
jle 0x1cac0
movq 0x2253a(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbfa0(%rip), %rdx     # 0xd8a48
leaq 0x1633e(%rip), %rsi     # 0x32ded
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
jmp 0x1c9e0
movq 0x224cc(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x63552(%rip)      # 0x80032
jmp 0x1c9e0
movq 0x224ac(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, %rsi
leaq 0x635ec(%rip), %rdi     # 0x800f0
callq 0x4ad0
leaq 0x635e0(%rip), %rdi     # 0x800f0
callq 0x1dfb0
cmpq $0xf, %rax
jle 0x1cb44
movq 0x224b6(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbf1c(%rip), %rdx     # 0xd8a48
leaq 0x162cd(%rip), %rsi     # 0x32e00
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
xorl %eax, %eax
movl %eax, %edi
movl $0x28, %esi
callq 0x4a60
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rsi
leaq 0x635cf(%rip), %rdi     # 0x80130
callq 0x1e580
movq %rax, -0x20(%rbp)
movl $0x29, %edi
movl $0x2f, %esi
callq 0x4a60
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rsi
leaq 0x63568(%rip), %rdi     # 0x800f0
callq 0x1e580
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rsi
leaq -0x20(%rbp), %rdi
callq 0x1db20
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, 0x63583(%rip)     # 0x80130
jmp 0x1c9e0
movq 0x223df(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x6346a(%rip)      # 0x80037
jmp 0x1c9e0
movq 0x223bf(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x63453(%rip)      # 0x80040
jmp 0x1c9e0
movq 0x2239f(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, 0x63382(%rip)     # 0x7ff90
cmpq $0x17, 0x6337a(%rip)    # 0x7ff90
jle 0x1cc41
movq 0x223b9(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbe1f(%rip), %rdx     # 0xd8a48
leaq 0x161e3(%rip), %rsi     # 0x32e13
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
jmp 0x1c9e0
movq 0x2234b(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, 0xbbdbe(%rip)     # 0xd8a20
cmpq $0x3, 0xbbdb6(%rip)     # 0xd8a20
jle 0x1cc95
movq 0x22365(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbdcb(%rip), %rdx     # 0xd8a48
leaq 0x161a2(%rip), %rsi     # 0x32e26
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
jmp 0x1c9e0
movq 0x222f7(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x63387(%rip)      # 0x8003c
jmp 0x1c9e0
movb $0x1, 0x6336f(%rip)     # 0x80030
jmp 0x1c9e0
movq 0x222cb(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x63358(%rip)      # 0x80039
jmp 0x1c9e0
movq 0x222ab(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x6333a(%rip)      # 0x8003b
jmp 0x1c9e0
movq 0x2228b(%rip), %rax     # 0x3ef98
movq (%rax), %rdi
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x40b0
movq %rax, %rsi
leaq 0x633cb(%rip), %rdi     # 0x800f0
callq 0x4ad0
leaq 0x633bf(%rip), %rdi     # 0x800f0
callq 0x1dfb0
cmpq $0x9, %rax
jle 0x1cd65
movq 0x22295(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbcfb(%rip), %rdx     # 0xd8a48
leaq 0x160e5(%rip), %rsi     # 0x32e39
movb $0x0, %al
callq 0x4430
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
leaq 0x63384(%rip), %rdi     # 0x800f0
callq 0x1dfb0
cmpq $0x3, %rax
jne 0x1cd84
movq $0x1, 0x631ee(%rip) # 0x7ff70
jmp 0x1ce01
leaq 0x63365(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, %rcx
movl $0x4, %eax
cmpq %rcx, %rax
jg 0x1cdec
leaq 0x6334c(%rip), %rdi     # 0x800f0
callq 0x1dfb0
cmpq $0x9, %rax
jg 0x1cdec
leaq 0x6333a(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, %rdi
subq $0x3, %rdi
callq 0x48e0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rsi
leaq 0x6335a(%rip), %rdi     # 0x80130
callq 0x1db20
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq %rax, 0x63346(%rip)     # 0x80130
jmp 0x1cdff
leaq 0x632fd(%rip), %rdi     # 0x800f0
callq 0x1dfb0
movq %rax, 0x63389(%rip)     # 0x80188
jmp 0x1ce01
jmp 0x1c9e0
movq 0x2218b(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x63219(%rip)      # 0x8003a
jmp 0x1c9e0
movq 0x2216b(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %edx
movl $0x78, %eax
movl $0x48, %ecx
cmpl $0x2b, %edx
cmovel %ecx, %eax
cltq
movq %rax, 0x630dc(%rip)     # 0x7ff28
jmp 0x1c9e0
movq 0x22140(%rip), %rax     # 0x3ef98
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2b, %eax
sete %al
andb $0x1, %al
movb %al, 0x631d3(%rip)      # 0x8003f
jmp 0x1c9e0
movq 0x22460(%rip), %rsi     # 0x3f2d8
leaq 0x154b4(%rip), %rdi     # 0x32333
movb $0x0, %al
callq 0x4030
xorl %edi, %edi
callq 0x43a0
movl 0x631b1(%rip), %eax     # 0x80044
addl $0x1, %eax
movl %eax, 0x631a8(%rip)     # 0x80044
jmp 0x1c9e0
callq 0x1c5c0
jmp 0x1cea8
movq 0x22131(%rip), %rax     # 0x3efe0
movl (%rax), %ecx
movl -0x4(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x4(%rbp)
movq 0x22120(%rip), %rax     # 0x3efe0
movl (%rax), %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
cmpl $0x1, -0x4(%rbp)
jl 0x1cee0
cmpl $0x2, -0x4(%rbp)
jle 0x1cee5
callq 0x1c5c0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x14e66(%rip), %rsi     # 0x31d59
callq 0x4420
cmpl $0x0, %eax
je 0x1cf57
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq 0x220ad(%rip), %rax     # 0x3efb8
movq (%rax), %rdx
leaq 0x151f1(%rip), %rsi     # 0x32106
callq 0x4310
cmpq $0x0, %rax
jne 0x1cf55
movq 0x220b1(%rip), %rax     # 0x3efd8
movq (%rax), %rdi
movq 0xbbb17(%rip), %rdx     # 0xd8a48
leaq 0x15f14(%rip), %rsi     # 0x32e4c
movb $0x0, %al
callq 0x4430
movq -0x10(%rbp), %rax
movq (%rax), %rdi
callq 0x4240
movl $0xffffffff, %edi       # imm = 0xFFFFFFFF
callq 0x43a0
jmp 0x1cf57
cmpl $0x1, -0x4(%rbp)
jle 0x1cf78
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x22364(%rip)     # 0x3f2d0
movq 0x2235d(%rip), %rdi     # 0x3f2d0
callq 0x4120
addq $0x60, %rsp
popq %rbp
retq
nop