// File: /workspace/github_c_makefile_star2_O2/mist64[P]cbm6502asm/src/asm.c
// Function: main
int main(int argc, char *argv[]) {
	long oldbytes;
	int i, first = TRUE;
	open_files(argc, argv); /* get command line */
	while (*src) {          /* as long as there are more src files */
		for (i = 0; (srcfile[i] = toupper(src[i])); i++)
			;
		appendef(srcfile, ".src");
		fprintf(file_tmp, "%sF%s\n", STATLINE, srcfile);
		for (i = strlen(srcfile); i > 0;
		     i--) /* extract path, if any for tmp file */
			if (srcfile[i] == '\\' || srcfile[i] == ']' ||
			    srcfile[i] == ':') {
				strcpy(defipath,
				       srcfile);     /* copy src file name */
				defipath[i + 1] = 0; /* terminate after path */
				break;
			}
		if (first) {
			if ((file_src = fopen(srcfile, "r")) == NULL)
				error_msg("error opening source file:", srcfile,
				          4);
		} else if (!freopen(srcfile, "r", file_src))
			error_msg("error opening source file:", srcfile, 4);
		while (*src++)
			; /* point to next file */
		pass1((char *)NULL, (char **)NULL,
		      (char *)NULL); /* pass1 processor */
		first = FALSE;
	}
	curpass = 2;
	oldbytes = 1000000000L; /* for word rel. branch compression */
	while (codebytes != oldbytes &&
	       curpass <= maxpass) { /* if no change in obj length */
		pass = 2;
		if (prnerrcon) { /* check if ok to print to console */
			printf("\nstarting pass %d.\n", curpass);
			if (curpass > 2)
				printf("  %ld byte change.\n",
				       codebytes - oldbytes);
		}
		oldbytes = codebytes; /* save for next compare */
		binlin = binadr = binptr = chksum = 0;
		codebytes = errcount = loc_cntr = 0;
		lbn[0] = lbn[1] = lbn[2] = lbn[3] =
		        'A'; /* reinitial local block number */
		if (emitobj) {
			fclose(file_obj);                /* close obj file */
			file_obj = fopen(objfile, "w+"); /* reopen it */
			fseek(file_obj, 0L, 0);          /* position at beginning of file */
		}
		pass2(); /* pass2 processor */
		curpass++;
		if (cputype != 3)             /* check cputype (/cx switch) */
			oldbytes = codebytes; /* don't repeat if no word
			                         relative inst */
	}
	if (emitobj) { /* close obj file */
		outhex((unsigned int)(loc_cntr + 5),
		       (char)0); /* number of lines */
		fprintf(file_obj, ";00%04X%04X\n", binlin,
		        (255 & binlin >> 8) + (binlin & 255));
	}
	if (emitlst) {               /* list file requested? */
		clean_list();        /* output list file */
		if (prnsymtab) {     /* symbol table requested? */
			list_sym();  /* output symbol table */
			macro_tab(); /* output macro table */
		}
	}
	fclose(file_tmp); /* close temporary file */
	remove(tmpdev);   /* delete temporary file */
	return (1);       /* close files, release memory, exit */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x164c
xorl %r12d, %r12d
leaq 0xc36a(%rip), %rbx      # 0xd6d0
leaq 0xc3f3(%rip), %r13      # 0xd760
movabsq $0xc00000001, %r15      # imm = 0xC00000001
leaq 0x7eb0(%rip), %rbp      # 0x922e
movq 0xc33b(%rip), %r14      # 0xd6c0
cmpb $0x0, (%r14)
je 0x148b
callq 0x1030
xorl %ecx, %ecx
movq (%rax), %rdx
movsbq (%r14,%rcx), %rsi
movb (%rdx,%rsi,4), %dl
movb %dl, (%rcx,%rbx)
incq %rcx
testb %dl, %dl
jne 0x1396
movq %rbx, %rdi
leaq 0x82c1(%rip), %rsi      # 0x9676
callq 0x1d9c
movq 0xc397(%rip), %rdi      # 0xd758
leaq 0x7c9c(%rip), %rsi      # 0x9064
leaq 0x7c9c(%rip), %rdx      # 0x906b
movq %rbx, %rcx
xorl %eax, %eax
callq 0x1140
movq %rbx, %rdi
callq 0x10b0
movq %rax, %r14
movl %r14d, %eax
incl %r14d
addq %r13, %r14
testl %eax, %eax
jle 0x141a
movzbl (%rax,%rbx), %ecx
addl $-0x3a, %ecx
cmpl $0x23, %ecx
ja 0x1403
btq %rcx, %r15
jb 0x140b
decq %rax
decq %r14
jmp 0x13ed
movq %r13, %rdi
movq %rbx, %rsi
callq 0x1080
movb $0x0, (%r14)
testb $0x1, %r12b
je 0x1434
movq 0xc3c1(%rip), %rdx      # 0xd7e8
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x10f0
jmp 0x1446
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x11d0
movq %rax, 0xc3a2(%rip)      # 0xd7e8
testq %rax, %rax
jne 0x145d
leaq 0x7c3a(%rip), %rdi      # 0x908c
movq %rbx, %rsi
pushq $0x4
popq %rdx
callq 0x1ddf
movq 0xc25c(%rip), %rax      # 0xd6c0
incq %rax
movq %rax, 0xc252(%rip)      # 0xd6c0
cmpb $0x0, -0x1(%rax)
leaq 0x1(%rax), %rax
jne 0x1467
xorl %edi, %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x7649
movb $0x1, %r12b
jmp 0x137e
movl $0x2, 0xc35b(%rip)      # 0xd7f0
movl $0x3b9aca00, %r13d      # imm = 0x3B9ACA00
pushq $0x2
popq %rsi
movq 0xc353(%rip), %r12      # 0xd7f8
xorl %ebp, %ebp
leaq 0xc392(%rip), %rbx      # 0xd840
leaq 0x7c1a(%rip), %r14      # 0x90cf
leaq 0x7beb(%rip), %r15      # 0x90a7
cmpq %r13, %r12
je 0x15b7
cmpl 0xc335(%rip), %esi      # 0xd800
jg 0x15b7
movl $0x2, 0xc329(%rip)      # 0xd804
cmpl $0x0, 0xc326(%rip)      # 0xd808
je 0x1519
movq %r15, %rdi
xorl %eax, %eax
callq 0x10e0
cmpl $0x3, 0xc2fb(%rip)      # 0xd7f0
movq 0xc2fc(%rip), %r12      # 0xd7f8
jl 0x1519
subq %r13, %r12
leaq 0x7bb3(%rip), %rdi      # 0x90bb
movq %r12, %rsi
xorl %eax, %eax
callq 0x10e0
movq 0xc2df(%rip), %r12      # 0xd7f8
andl $0x0, 0xc2ec(%rip)      # 0xd80c
andl $0x0, 0xc2e9(%rip)      # 0xd810
andl $0x0, 0xc2e6(%rip)      # 0xd814
andl $0x0, 0xc2e3(%rip)      # 0xd818
andq $0x0, 0xc2e3(%rip)      # 0xd820
andl $0x0, 0xc2e4(%rip)      # 0xd828
andq $0x0, 0xc2ac(%rip)      # 0xd7f8
movl $0x41414141, 0xc2d6(%rip) # imm = 0x41414141
cmpl %ebp, 0xc2d4(%rip)      # 0xd830
je 0x1588
movq 0xc2d3(%rip), %rdi      # 0xd838
callq 0x10a0
movq %rbx, %rdi
movq %r14, %rsi
callq 0x11d0
movq %rax, 0xc2bc(%rip)      # 0xd838
movq %rax, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11b0
xorl %eax, %eax
callq 0x7af0
movl 0xc25b(%rip), %esi      # 0xd7f0
incl %esi
movl %esi, 0xc253(%rip)      # 0xd7f0
cmpl $0x3, 0xc324(%rip)      # 0xd8c8
movq %r12, %r13
movq 0xc24a(%rip), %r12      # 0xd7f8
cmovneq %r12, %r13
jmp 0x14bc
cmpl $0x0, 0xc272(%rip)      # 0xd830
je 0x15fb
movl 0xc25a(%rip), %edi      # 0xd820
addl $0x5, %edi
xorl %esi, %esi
callq 0x71aa
movq 0xc261(%rip), %rdi      # 0xd838
movl 0xc23b(%rip), %edx      # 0xd818
movl %edx, %eax
shrl $0x8, %eax
movl $0xff, %ecx
andl %ecx, %eax
andl %edx, %ecx
addl %eax, %ecx
leaq 0x7ade(%rip), %rsi      # 0x90d2
xorl %eax, %eax
callq 0x1140
cmpl $0x0, 0xc2ca(%rip)      # 0xd8cc
je 0x1622
xorl %eax, %eax
callq 0x6a20
cmpl $0x0, 0xc2be(%rip)      # 0xd8d0
je 0x1622
xorl %eax, %eax
callq 0x8599
xorl %eax, %eax
callq 0x5747
movq 0xc12f(%rip), %rdi      # 0xd758
callq 0x10a0
leaq 0xc2ab(%rip), %rdi      # 0xd8e0
callq 0x1060
pushq $0x1
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq