// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x30, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl $0x1, -0x20(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
callq 0x1700
movq 0xf360(%rip), %rax      # 0x106a0
cmpb $0x0, (%rax)
je 0x14f3
movl $0x0, -0x1c(%rbp)
movq 0xf349(%rip), %rax      # 0x106a0
movslq -0x1c(%rbp), %rcx
movsbl (%rax,%rcx), %edi
callq 0x1080
movslq -0x1c(%rbp), %rdx
leaq 0xf341(%rip), %rcx      # 0x106b0
movb %al, (%rcx,%rdx)
cmpb $0x0, %al
je 0x1383
jmp 0x1378
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x1350
leaq 0xf326(%rip), %rdi      # 0x106b0
leaq 0xbcd3(%rip), %rsi      # 0xd064
callq 0x2280
movq 0xf39b(%rip), %rdi      # 0x10738
leaq 0xbcc5(%rip), %rsi      # 0xd069
leaq 0xbcc5(%rip), %rdx      # 0xd070
leaq 0xf2fe(%rip), %rcx      # 0x106b0
movb $0x0, %al
callq 0x1120
leaq 0xf2f0(%rip), %rdi      # 0x106b0
callq 0x10a0
movl %eax, -0x1c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jle 0x1440
movslq -0x1c(%rbp), %rcx
leaq 0xf2d7(%rip), %rax      # 0x106b0
movsbl (%rax,%rcx), %eax
cmpl $0x5c, %eax
je 0x140a
movslq -0x1c(%rbp), %rcx
leaq 0xf2c3(%rip), %rax      # 0x106b0
movsbl (%rax,%rcx), %eax
cmpl $0x5d, %eax
je 0x140a
movslq -0x1c(%rbp), %rcx
leaq 0xf2af(%rip), %rax      # 0x106b0
movsbl (%rax,%rcx), %eax
cmpl $0x3a, %eax
jne 0x1433
leaq 0xf32f(%rip), %rdi      # 0x10740
leaq 0xf298(%rip), %rsi      # 0x106b0
callq 0x1070
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movslq %eax, %rcx
leaq 0xf313(%rip), %rax      # 0x10740
movb $0x0, (%rax,%rcx)
jmp 0x1440
jmp 0x1435
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x13c8
cmpl $0x0, -0x20(%rbp)
je 0x1480
leaq 0xf263(%rip), %rdi      # 0x106b0
leaq 0xbddf(%rip), %rsi      # 0xd233
callq 0x11a0
movq %rax, 0xf368(%rip)      # 0x107c8
cmpq $0x0, %rax
jne 0x147e
leaq 0xbc24(%rip), %rdi      # 0xd091
leaq 0xf23c(%rip), %rsi      # 0x106b0
movl $0x4, %edx
callq 0x22f0
jmp 0x14ba
movq 0xf341(%rip), %rdx      # 0x107c8
leaq 0xf222(%rip), %rdi      # 0x106b0
leaq 0xbd9e(%rip), %rsi      # 0xd233
callq 0x10e0
cmpq $0x0, %rax
jne 0x14b8
leaq 0xbbea(%rip), %rdi      # 0xd091
leaq 0xf202(%rip), %rsi      # 0x106b0
movl $0x4, %edx
callq 0x22f0
jmp 0x14ba
jmp 0x14bc
movq 0xf1dd(%rip), %rax      # 0x106a0
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, 0xf1cf(%rip)      # 0x106a0
cmpb $0x0, (%rax)
je 0x14d8
jmp 0x14bc
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rdi
movq %rdx, %rsi
callq 0xb280
movl $0x0, -0x20(%rbp)
jmp 0x1339
movl $0x2, 0xf2d3(%rip)      # 0x107d0
movq $0x3b9aca00, -0x18(%rbp) # imm = 0x3B9ACA00
movq 0xf2cc(%rip), %rcx      # 0x107d8
xorl %eax, %eax
cmpq -0x18(%rbp), %rcx
movb %al, -0x21(%rbp)
je 0x1529
movl 0xf2b3(%rip), %eax      # 0x107d0
cmpl 0xf2bd(%rip), %eax      # 0x107e0
setle %al
movb %al, -0x21(%rbp)
movb -0x21(%rbp), %al
testb $0x1, %al
jne 0x1535
jmp 0x165f
movl $0x2, 0xf2a5(%rip)      # 0x107e4
cmpl $0x0, 0xf2a2(%rip)      # 0x107e8
je 0x1580
movl 0xf282(%rip), %esi      # 0x107d0
leaq 0xbb57(%rip), %rdi      # 0xd0ac
movb $0x0, %al
callq 0x10d0
cmpl $0x2, 0xf26d(%rip)      # 0x107d0
jle 0x157e
movq 0xf26c(%rip), %rsi      # 0x107d8
subq -0x18(%rbp), %rsi
leaq 0xbb49(%rip), %rdi      # 0xd0c0
movb $0x0, %al
callq 0x10d0
jmp 0x1580
movq 0xf251(%rip), %rax      # 0x107d8
movq %rax, -0x18(%rbp)
movl $0x0, 0xf257(%rip)      # 0x107ec
movl $0x0, 0xf251(%rip)      # 0x107f0
movl $0x0, 0xf24b(%rip)      # 0x107f4
movl $0x0, 0xf245(%rip)      # 0x107f8
movq $0x0, 0xf242(%rip) # 0x10800
movl $0x0, 0xf240(%rip)      # 0x10808
movq $0x0, 0xf205(%rip) # 0x107d8
movb $0x41, 0xf235(%rip)     # 0x1080f
movb $0x41, 0xf22d(%rip)     # 0x1080e
movb $0x41, 0xf225(%rip)     # 0x1080d
movb $0x41, 0xf21d(%rip)     # 0x1080c
cmpl $0x0, 0xf21a(%rip)      # 0x10810
je 0x1630
movq 0xf219(%rip), %rdi      # 0x10818
callq 0x1090
leaq 0xf215(%rip), %rdi      # 0x10820
leaq 0xbac2(%rip), %rsi      # 0xd0d4
callq 0x11a0
movq %rax, 0xf1fa(%rip)      # 0x10818
movq 0xf1f3(%rip), %rdi      # 0x10818
xorl %eax, %eax
movl %eax, %esi
xorl %edx, %edx
callq 0x1180
movb $0x0, %al
callq 0xb8c0
movl 0xf193(%rip), %eax      # 0x107d0
addl $0x1, %eax
movl %eax, 0xf18a(%rip)      # 0x107d0
cmpl $0x3, 0xf25b(%rip)      # 0x108a8
je 0x165a
movq 0xf182(%rip), %rax      # 0x107d8
movq %rax, -0x18(%rbp)
jmp 0x1505
cmpl $0x0, 0xf1aa(%rip)      # 0x10810
je 0x16b3
movq 0xf191(%rip), %rax      # 0x10800
addq $0x5, %rax
movl %eax, %edi
xorl %esi, %esi
callq 0xaaa0
movq 0xf195(%rip), %rdi      # 0x10818
movl 0xf16f(%rip), %edx      # 0x107f8
movl 0xf169(%rip), %ecx      # 0x107f8
sarl $0x8, %ecx
andl $0xff, %ecx
movl 0xf15a(%rip), %eax      # 0x107f8
andl $0xff, %eax
addl %eax, %ecx
leaq 0xba2b(%rip), %rsi      # 0xd0d7
movb $0x0, %al
callq 0x1120
cmpl $0x0, 0xf1f2(%rip)      # 0x108ac
je 0x16dc
movb $0x0, %al
callq 0xa070
cmpl $0x0, 0xf1e6(%rip)      # 0x108b0
je 0x16da
movb $0x0, %al
callq 0xcae0
movb $0x0, %al
callq 0x7f60
jmp 0x16dc
movq 0xf055(%rip), %rdi      # 0x10738
callq 0x1090
leaq 0xf1d1(%rip), %rdi      # 0x108c0
callq 0x1050
movl $0x1, %eax
addq $0x30, %rsp
popq %rbp
retq
nop