// File: /workspace/github_c_makefile_star2_O3/mist64[P]cbm6502asm/src/line.c
// Function: get_line
int get_line(char *macprmbgn, char **maclinptr, char *macargbgn) {
        /*
            get a line from current source or include file
            or from the expansion of the current macro
        */
	int i, c;
	char *macprmptr, *macargptr, *maclinp;

	error_field[5] = error = line[0] = 0;
	error_field[0] = error_field[1] = error_field[2] = error_field[3] =
	        error_field[4] = ' ';
	if (macrolevel) {
		c = '\n';
		maclinp = *maclinptr; /* address of next line of macro def */
		                      /*
		                              expand current macro
		                      */
		if (*maclinp) {       /* if more lines left of this macro */
			char *subbed;
			subbed = (char *)calloc(LINELENG, 2);
			strcpy(line, maclinp); /* copy the line */
			while (*maclinp++)
				; /* point to start of next line */
			*maclinptr =
			        maclinp; /* for next call to this function */
			                 /*
			                         make substitutions
			                 */
			macprmptr = macprmbgn; /* start of parameter list */
			macargptr = macargbgn; /* start of argument list */
			while (*macprmptr) {   /* check if any parameters remain
				                */
				macsubst(macprmptr, macargptr,
				         subbed); /* make substitutions */
				while (*macprmptr++)
					; /* next parameter */
				if (*macargptr)
					while (*macargptr++)
						; /* next argument */
			}
			free(subbed);
		} else
			c = EOF;
	} else
		/*
		        read source line
		*/
		for (i = 0; (c = fgetc(file_src)) != EOF; i++)
			if (c != '\n')
				if (i < LINELENG - 1)
					line[i] = c;
				else {
					error_msg("Error reading source file",
					          "", error = 1);
					for (c = fgetc(file_src);
					     c != EOF && c != '\n';
					     c = fgetc(file_src))
						;
				}
			else {
				if (endflag) {
					i = 0;
					if (endflag++ ==
					    1) /* only display error once */
						error_msg(
						        "Additional input "
						        "after end statement "
						        "ignored",
						        "", 0);
				}
				line[i] = 0; /* terminate line */
				break;
			}

	if (c == EOF)
		line[0] = 0;
	else
		parselin();
	return (c);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
leaq 0x8a3b(%rip), %r15      # 0xe0b0
xorl %eax, %eax
movb %al, (%r15)
leaq 0x876f(%rip), %r13      # 0xddf0
movb %al, (%r13)
leaq 0x85e4(%rip), %rax      # 0xdc70
movl $0x20202020, (%rax)     # imm = 0x20202020
movw $0x20, 0x4(%rax)
leaq 0x84bd(%rip), %rax      # 0xdb5c
cmpl $0x0, (%rax)
je 0x5733
movq %rsi, %r12
movq (%rsi), %r13
cmpb $0x0, (%r13)
je 0x579a
movq %rdx, %rbx
movq %rdi, %r14
movl $0x86, %edi
movl $0x2, %esi
callq 0x1120
movq %rax, %r15
leaq 0x89d8(%rip), %rdi      # 0xe0b0
movq %r13, %rsi
callq 0x1080
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0x56e0
movq %r13, (%r12)
cmpb $0x0, (%r14)
je 0x5726
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x53eb
cmpb $0x0, (%r14)
leaq 0x1(%r14), %r14
jne 0x5703
cmpb $0x0, (%rbx)
je 0x56ef
incq %rbx
movq %rbx, %rax
leaq 0x1(%rax), %rbx
cmpb $0x0, (%rax)
movq %rbx, %rax
jne 0x5718
jmp 0x56ef
movq %r15, %rdi
callq 0x1040
jmp 0x57e1
xorl %r12d, %r12d
leaq 0x809b(%rip), %rbp      # 0xd7d8
leaq 0x524b(%rip), %rbx      # 0xa98f
leaq 0x53ec(%rip), %r14      # 0xab37
movq (%rbp), %rdi
callq 0x1100
cmpl $-0x1, %eax
je 0x579a
cmpl $0xa, %eax
je 0x57a5
cmpq $0x84, %r12
ja 0x576d
movb %al, (%r15,%r12)
jmp 0x5795
movb $0x1, (%r13)
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq 0x1e8b
movq (%rbp), %rdi
callq 0x1100
cmpl $-0x1, %eax
je 0x5795
cmpl $0xa, %eax
jne 0x5782
incq %r12
jmp 0x574b
movb $0x0, (%r15)
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x57eb
leaq 0x83ac(%rip), %rax      # 0xdb58
movl (%rax), %ecx
testl %ecx, %ecx
je 0x57d9
leal 0x1(%rcx), %edx
movl %edx, (%rax)
cmpl $0x1, %ecx
jne 0x57d6
leaq 0x51e6(%rip), %rdi      # 0xa9a9
leaq 0x536d(%rip), %rsi      # 0xab37
xorl %r12d, %r12d
xorl %edx, %edx
callq 0x1e8b
jmp 0x57d9
xorl %r12d, %r12d
movl %r12d, %eax
movb $0x0, (%r15,%rax)
callq 0x4f3c
movl $0xa, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop