// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x20, %rsp
movl %edi, -0x4(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %eax
cmpl -0x4(%rbp), %eax
jge 0x2a329
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9fbb(%rip), %rsi      # 0x34170
movl $0x2, %edx
callq 0x3050
cmpl $0x0, %eax
jne 0x2a1e0
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
addq $0x2, %rax
movq %rax, 0x1a4c5(%rip)     # 0x446a0
jmp 0x2a319
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9f80(%rip), %rsi      # 0x34173
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a209
movb $0x1, 0x1a4a4(%rip)     # 0x446a8
jmp 0x2a317
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9f5a(%rip), %rsi      # 0x34176
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a235
movl $0x3, 0x116f4(%rip)     # 0x3b924
jmp 0x2a315
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9f31(%rip), %rsi      # 0x34179
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a261
movl $0x0, 0x116c8(%rip)     # 0x3b924
jmp 0x2a313
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9f09(%rip), %rsi      # 0x3417d
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a28d
movl $0x1, 0x1169c(%rip)     # 0x3b924
jmp 0x2a311
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9ee1(%rip), %rsi      # 0x34181
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a2b6
movl $0x2, 0x11670(%rip)     # 0x3b924
jmp 0x2a30f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0x9ebc(%rip), %rsi      # 0x34185
callq 0x30f0
cmpl $0x0, %eax
jne 0x2a2df
movl $0x3, 0x11647(%rip)     # 0x3b924
jmp 0x2a30d
movq 0xed12(%rip), %rax      # 0x38ff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x9e8d(%rip), %rsi      # 0x34189
movb $0x0, %al
callq 0x3100
movl $0x1, %edi
callq 0x3180
jmp 0x2a30f
jmp 0x2a311
jmp 0x2a313
jmp 0x2a315
jmp 0x2a317
jmp 0x2a319
jmp 0x2a31b
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a196
testb $0x1, 0x1a378(%rip)     # 0x446a8
je 0x2a33c
movl $0x0, 0x115e8(%rip)     # 0x3b924
testb $0x1, 0x1a365(%rip)     # 0x446a8
je 0x2a355
leaq 0x9e50(%rip), %rdi      # 0x3419c
movb $0x0, %al
callq 0x30b0
jmp 0x2a363
movq 0x11464(%rip), %rdi     # 0x3b7c0
movb $0x0, %al
callq 0x1a890
movl $0x0, -0x14(%rbp)
cmpl $0x8, -0x14(%rbp)
jge 0x2a39e
movl -0x14(%rbp), %esi
leaq 0x9e3d(%rip), %rdi      # 0x341b7
movb $0x0, %al
callq 0x1afc0
movq %rax, %rdx
movslq -0x14(%rbp), %rcx
leaq 0x1a321(%rip), %rax     # 0x446b0
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a36a
movl $0x0, -0x14(%rbp)
cmpl $0x20, -0x14(%rbp)
jge 0x2a3f8
movl $0x51, %edi
movl $0x5, %esi
callq 0x25020
movq %rax, %rdx
movslq -0x14(%rbp), %rcx
leaq 0x1a328(%rip), %rax     # 0x446f0
movq %rdx, (%rax,%rcx,8)
movl $0x51, %edi
movl $0x1, %esi
callq 0x25020
movq %rax, %rdx
movslq -0x14(%rbp), %rcx
leaq 0x1a407(%rip), %rax     # 0x447f0
movq %rdx, (%rax,%rcx,8)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a3a5
movl $0x0, -0x14(%rbp)
cmpl $0x20, -0x14(%rbp)
jge 0x2a449
movl -0x14(%rbp), %esi
leaq 0x9dae(%rip), %rdi      # 0x341bd
movb $0x0, %al
callq 0x1afc0
movq %rax, %rcx
movslq -0x14(%rbp), %rdx
leaq 0x1a2cc(%rip), %rax     # 0x446f0
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movslq -0x14(%rbp), %rcx
leaq 0x1a2ba(%rip), %rax     # 0x446f0
movq (%rax,%rcx,8), %rax
movb $0x5a, 0x8(%rax)
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2a3ff
addq $0x20, %rsp
popq %rbp
retq
nop