// File: /workspace/github_c_makefile_star2_O1/Oric4ever[P]lcc65/6502/build/../src/gen.c
// Function: progbeg
void progbeg(int argc,char *argv[]) {
    int i;
    for(i=1;i<argc;i++) {
        if (strncmp(argv[i],"-N",2)==0) {
            NamePrefix=argv[i]+2;
        } else if (strcmp(argv[i],"-G")==0) {
            graph_output=true;
        } else if (strcmp(argv[i],"-O")==0) {
            optimizelevel=3;
        } else if (strcmp(argv[i],"-O0")==0) {
            optimizelevel=0;    /* no optimization */
        } else if (strcmp(argv[i],"-O1")==0) {
            optimizelevel=1;    /* remove ADDR and CNST leaves */
        } else if (strcmp(argv[i],"-O2")==0) {
            optimizelevel=2;    /* allocate register variables */
                                /* and do some easy opt. (INC...) */
        } else if (strcmp(argv[i],"-O3")==0) {
            optimizelevel=3;    /* optimizes INDIR, ASGN ... */
        } else {
            fprintf(stderr,"Unknown option %s\n",argv[i]);
            exit(1);
        }
    }
    if (graph_output) optimizelevel=0;
    if (graph_output) printf("digraph Frontend_output {\n");
    else print(version);

    /* 8 virtual registers */
    for (i=0;i<8;i++) regname[i]=stringf("reg%d",i);

    /* No spilling for simplicity purpose:
     * 32 temporaries for integer/pointer expressions, 32 for float expresssions.
     * => it should be nearly impossible to have such a complex expression
     * that we run out of temporaries (a compilation error will be raised in such
     * a pathological case).
     * All 32 integer/pointer temporaries in page zero,
     * and all 32 floating-point temporaries on stack frame.
     * => the runtime has to declare enough temporaries in zero page,
     * previous versions only used tmp0-tmp7...
     */
    for (i=0;i<32;i++) {
        temp[i]     = newtemp(STATIC,I);
        flt_temp[i] = newtemp(STATIC,F);
    }
    for (i=0;i<32;i++) {
        temp[i]->x.name=stringf("tmp%d",i);
        temp[i]->x.adrmode='Z';
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x2, %edi
jl 0x1a58c
movq %rsi, %rbx
movl %edi, %r13d
movl $0x1, %r12d
leaq 0x7a25(%rip), %r14      # 0x21ed0
leaq 0x7a21(%rip), %r15      # 0x21ed3
movq (%rbx,%r12,8), %rbp
movl $0x2, %edx
movq %rbp, %rdi
movq %r14, %rsi
callq 0x3050
testl %eax, %eax
je 0x1a548
movq %rbp, %rdi
movq %r15, %rsi
callq 0x3110
testl %eax, %eax
je 0x1a555
movq %rbp, %rdi
leaq 0x79f3(%rip), %rsi      # 0x21ed6
callq 0x3110
testl %eax, %eax
je 0x1a53c
movq %rbp, %rdi
leaq 0x79e3(%rip), %rsi      # 0x21ed9
callq 0x3110
testl %eax, %eax
je 0x1a55e
movq %rbp, %rdi
leaq 0x79d4(%rip), %rsi      # 0x21edd
callq 0x3110
testl %eax, %eax
je 0x1a56a
movq %rbp, %rdi
leaq 0x79c5(%rip), %rsi      # 0x21ee1
callq 0x3110
testl %eax, %eax
je 0x1a576
movq %rbp, %rdi
leaq 0x79b6(%rip), %rsi      # 0x21ee5
callq 0x3110
testl %eax, %eax
jne 0x1a669
movl $0x3, 0xf282(%rip)      # 0x297c8
jmp 0x1a580
addq $0x2, %rbp
movq %rbp, 0x17eed(%rip)     # 0x32440
jmp 0x1a580
movb $0x1, 0x17eec(%rip)     # 0x32448
jmp 0x1a580
movl $0x0, 0xf260(%rip)      # 0x297c8
jmp 0x1a580
movl $0x1, 0xf254(%rip)      # 0x297c8
jmp 0x1a580
movl $0x2, 0xf248(%rip)      # 0x297c8
incq %r12
cmpq %r12, %r13
jne 0x1a4b2
cmpb $0x1, 0x17eb5(%rip)     # 0x32448
jne 0x1a5ad
movl $0x0, 0xf229(%rip)      # 0x297c8
leaq 0x8206(%rip), %rdi      # 0x227ac
callq 0x3060
jmp 0x1a5bb
movq 0xf20c(%rip), %rdi      # 0x297c0
xorl %eax, %eax
callq 0x1187e
leaq 0x17e8e(%rip), %r15     # 0x32450
leaq 0x7933(%rip), %rbx      # 0x21efc
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x11c7f
movq %rax, (%r15)
incq %r14
addq $0x8, %r15
cmpq $0x8, %r14
jne 0x1a5cc
xorl %ebx, %ebx
leaq 0x17e9e(%rip), %r15     # 0x32490
leaq 0x17f97(%rip), %r14     # 0x32590
movl $0x51, %edi
movl $0x5, %esi
callq 0x177df
movq %rax, (%rbx,%r15)
movl $0x51, %edi
movl $0x1, %esi
callq 0x177df
movq %rax, (%rbx,%r14)
addq $0x8, %rbx
cmpq $0x100, %rbx            # imm = 0x100
jne 0x1a5f9
leaq 0x78cf(%rip), %rbx      # 0x21f02
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
xorl %eax, %eax
callq 0x11c7f
movq (%r15), %rcx
movq %rax, (%rcx)
movb $0x5a, 0x8(%rcx)
incq %r14
addq $0x8, %r15
cmpq $0x20, %r14
jne 0x1a636
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbp, %rdi
callq 0x3314