// File: /workspace/github_c_makefile_star2_O2/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 0x8e7c(%rip), %rcx      # 0xe0c0
xorl %eax, %eax
movb %al, (%rcx)
leaq 0x8bb1(%rip), %r13      # 0xde00
movb %al, (%r13)
leaq 0x8a26(%rip), %rax      # 0xdc80
movl $0x20202020, (%rax)     # imm = 0x20202020
movw $0x20, 0x4(%rax)
leaq 0x88ff(%rip), %rax      # 0xdb6c
cmpl $0x0, (%rax)
je 0x52fb
movq %rsi, %r12
movq (%rsi), %r13
cmpb $0x0, (%r13)
je 0x5367
movq %rdx, %rbx
movq %rdi, %r14
pushq $0x2
popq %rsi
movl $0x86, %edi
callq 0x1120
movq %rax, %r15
leaq 0x8e1c(%rip), %rdi      # 0xe0c0
movq %r13, %rsi
callq 0x1080
cmpb $0x0, (%r13)
leaq 0x1(%r13), %r13
jne 0x52ac
movq %r13, (%r12)
cmpb $0x0, (%r14)
je 0x52ee
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x503d
cmpb $0x0, (%r14)
leaq 0x1(%r14), %r14
jne 0x52cf
cmpb $0x0, (%rbx)
je 0x52bb
incq %rbx
movb $0x1, %al
testb %al, %al
je 0x52bb
movb (%rbx), %al
incq %rbx
jmp 0x52e3
movq %r15, %rdi
callq 0x1040
jmp 0x53b7
xorl %r12d, %r12d
leaq 0x84e3(%rip), %r15      # 0xd7e8
leaq 0x4665(%rip), %rbx      # 0x9971
leaq 0x4806(%rip), %r14      # 0x9b19
pushq $0x1
popq %rbp
movq (%r15), %rdi
callq 0x1100
cmpl $-0x1, %eax
je 0x5367
cmpl $0xa, %eax
je 0x5375
cmpq $0x84, %r12
ja 0x533e
leaq 0x8d88(%rip), %rcx      # 0xe0c0
movb %al, (%rcx,%r12)
jmp 0x5362
movb $0x1, (%r13)
movq %rbx, %rdi
movq %r14, %rsi
movl %ebp, %edx
callq 0x1ddf
movq (%r15), %rdi
callq 0x1100
cmpl $-0x1, %eax
je 0x5362
cmpl $0xa, %eax
jne 0x5350
incq %r12
jmp 0x5316
leaq 0x8d52(%rip), %rax      # 0xe0c0
movb $0x0, (%rax)
pushq $-0x1
jmp 0x53be
leaq 0x87ec(%rip), %rax      # 0xdb68
movl (%rax), %ecx
testl %ecx, %ecx
je 0x53a9
leal 0x1(%rcx), %edx
movl %edx, (%rax)
cmpl $0x1, %ecx
jne 0x53a6
leaq 0x45f8(%rip), %rdi      # 0x998b
leaq 0x477f(%rip), %rsi      # 0x9b19
xorl %r12d, %r12d
xorl %edx, %edx
callq 0x1ddf
jmp 0x53a9
xorl %r12d, %r12d
movl %r12d, %eax
leaq 0x8d0d(%rip), %rcx      # 0xe0c0
movb $0x0, (%rcx,%rax)
callq 0x4c00
pushq $0xa
popq %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop