// File: /workspace/github_c_makefile_star2_O0/mist64[P]cbmbasic/runtime.c
// Function: CHRIN
static void
CHRIN() {
	if ((!interactive) && (readycount==2)) {
		exit(0);
	}
	if (kernal_input != 0) {
		if (feof(kernal_files[kernal_input])) {
			kernal_status |= KERN_ST_EOF;
			kernal_status |= KERN_ST_TIME_OUT_READ;
			A = 13;
		} else {
			if (kernal_files_next[kernal_input] == EOF)
				kernal_files_next[kernal_input] = fgetc(kernal_files[kernal_input]);
			A = kernal_files_next[kernal_input];
			kernal_files_next[kernal_input] = fgetc(kernal_files[kernal_input]);
			if (kernal_files_next[kernal_input] == EOF)
				kernal_status |= KERN_ST_EOF;
		}
	} else if (!input_file) {
		A = getchar(); /* stdin */
		if (A=='\n') A = '\r';
	} else {
		if (fakerun) {
			A = run[fakerun_index++];
			if (fakerun_index==sizeof(run))
				input_file = 0; /* switch to stdin */
		} else {
			A = fgetc(input_file);
			if ((A==255)&&(readycount==1)) {
				fakerun = 1;
				fakerun_index = 0;
				A = run[fakerun_index++];
			}
			if (A=='\n') A = '\r';
		}
	}
	C = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x0, 0x1e189(%rip)     # 0x5ab94
jne 0x3ca1d
cmpl $0x2, 0x1e17c(%rip)     # 0x5ab90
jne 0x3ca1d
xorl %edi, %edi
callq 0x11f0
movzbl 0x1e0a5(%rip), %eax     # 0x5aac9
cmpl $0x0, %eax
je 0x3cb37
movzbl 0x1e095(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e093(%rip), %rax     # 0x5aad0
movq (%rax,%rcx,8), %rdi
callq 0x1150
cmpl $0x0, %eax
je 0x3ca7a
movzbl 0x1e06e(%rip), %eax     # 0x5aac0
orl $0x40, %eax
movb %al, 0x1e065(%rip)      # 0x5aac0
movzbl 0x1e05e(%rip), %eax     # 0x5aac0
orl $0x2, %eax
movb %al, 0x1e055(%rip)      # 0x5aac0
leaq 0x1e043(%rip), %rax     # 0x5aab5
movb $0xd, (%rax)
jmp 0x3cb32
movzbl 0x1e048(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e0c6(%rip), %rax     # 0x5ab50
cmpl $-0x1, (%rax,%rcx,4)
jne 0x3cabe
movzbl 0x1e032(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e030(%rip), %rax     # 0x5aad0
movq (%rax,%rcx,8), %rdi
callq 0x1100
movl %eax, %edx
movzbl 0x1e017(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e095(%rip), %rax     # 0x5ab50
movl %edx, (%rax,%rcx,4)
movzbl 0x1e004(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e082(%rip), %rax     # 0x5ab50
movl (%rax,%rcx,4), %eax
movb %al, %cl
leaq 0x1dfdb(%rip), %rax     # 0x5aab5
movb %cl, (%rax)
movzbl 0x1dfe6(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1dfe4(%rip), %rax     # 0x5aad0
movq (%rax,%rcx,8), %rdi
callq 0x1100
movl %eax, %edx
movzbl 0x1dfcb(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e049(%rip), %rax     # 0x5ab50
movl %edx, (%rax,%rcx,4)
movzbl 0x1dfb8(%rip), %eax     # 0x5aac9
movl %eax, %ecx
leaq 0x1e036(%rip), %rax     # 0x5ab50
cmpl $-0x1, (%rax,%rcx,4)
jne 0x3cb30
movzbl 0x1df99(%rip), %eax     # 0x5aac0
orl $0x40, %eax
movb %al, 0x1df90(%rip)      # 0x5aac0
jmp 0x3cb32
jmp 0x3cc47
cmpq $0x0, 0x1e059(%rip)     # 0x5ab98
jne 0x3cb6f
callq 0x1140
movb %al, %cl
leaq 0x1df66(%rip), %rax     # 0x5aab5
movb %cl, (%rax)
leaq 0x1df5d(%rip), %rax     # 0x5aab5
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x3cb6a
leaq 0x1df4e(%rip), %rax     # 0x5aab5
movb $0xd, (%rax)
jmp 0x3cc45
cmpl $0x0, 0x1e03a(%rip)     # 0x5abb0
je 0x3cbbc
movl 0x1e036(%rip), %eax     # 0x5abb4
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x1e02b(%rip)     # 0x5abb4
movslq %eax, %rcx
leaq 0x2f39(%rip), %rax      # 0x3facc
movb (%rax,%rcx), %cl
leaq 0x1df18(%rip), %rax     # 0x5aab5
movb %cl, (%rax)
movslq 0x1e00e(%rip), %rax     # 0x5abb4
cmpq $0x4, %rax
jne 0x3cbb7
movq $0x0, 0x1dfe1(%rip) # 0x5ab98
jmp 0x3cc43
movq 0x1dfd5(%rip), %rdi     # 0x5ab98
callq 0x1100
movb %al, %cl
leaq 0x1dee4(%rip), %rax     # 0x5aab5
movb %cl, (%rax)
leaq 0x1dedb(%rip), %rax     # 0x5aab5
movzbl (%rax), %eax
cmpl $0xff, %eax
jne 0x3cc28
cmpl $0x1, 0x1dfa5(%rip)     # 0x5ab90
jne 0x3cc28
movl $0x1, 0x1dfb9(%rip)     # 0x5abb0
movl $0x0, 0x1dfb3(%rip)     # 0x5abb4
movl 0x1dfad(%rip), %eax     # 0x5abb4
movl %eax, %ecx
addl $0x1, %ecx
movl %ecx, 0x1dfa2(%rip)     # 0x5abb4
movslq %eax, %rcx
leaq 0x2eb0(%rip), %rax      # 0x3facc
movb (%rax,%rcx), %cl
leaq 0x1de8f(%rip), %rax     # 0x5aab5
movb %cl, (%rax)
leaq 0x1de86(%rip), %rax     # 0x5aab5
movzbl (%rax), %eax
cmpl $0xa, %eax
jne 0x3cc41
leaq 0x1de77(%rip), %rax     # 0x5aab5
movb $0xd, (%rax)
jmp 0x3cc43
jmp 0x3cc45
jmp 0x3cc47
leaq 0x1de68(%rip), %rax     # 0x5aab6
movb $0x0, (%rax)
popq %rbp
retq
nopw %cs:(%rax,%rax)