	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function readchar
_readchar:                              ## @readchar
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edi, %r14d
	movq	_monitor_desc@GOTPCREL(%rip), %r15
	movq	_current_monitor@GOTPCREL(%rip), %r12
	movq	_MO_HANDLE_NL@GOTPCREL(%rip), %r13
	jmp	LBB0_1
	.p2align	4, 0x90
LBB0_20:                                ##   in Loop: Header=BB0_1 Depth=1
	movl	$3, _readchar.state(%rip)
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %edi
	movl	%r14d, %esi
	callq	_serial_readchar
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_4
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	andl	$127, %ebx
	movq	_monitor_debug_p@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_remote_debug@GOTPCREL(%rip), %rcx
	orq	(%rcx), %rax
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movb	%bl, -42(%rbp)
	movb	$0, -41(%rbp)
	leaq	L_.str(%rip), %rdi
	leaq	-42(%rbp), %rsi
	leaq	L_.str.1(%rip), %rdx
	callq	_puts_debug
LBB0_4:                                 ##   in Loop: Header=BB0_1 Depth=1
	movq	(%r12), %rax
	movl	(%r13), %ecx
	testl	%ecx, (%rax)
	je	LBB0_13
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	_readchar.state(%rip), %eax
	cmpl	$13, %ebx
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$1, %eax
	je	LBB0_20
LBB0_7:                                 ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$10, %ebx
	jne	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	cmpl	$2, %eax
	je	LBB0_20
LBB0_9:
	cmpl	$13, %ebx
	jne	LBB0_11
## %bb.10:
	movl	$2, _readchar.state(%rip)
	jmp	LBB0_18
LBB0_11:
	cmpl	$10, %ebx
	jne	LBB0_12
## %bb.17:
	movl	$1, _readchar.state(%rip)
LBB0_18:
	movl	$13, %ebx
	jmp	LBB0_19
LBB0_12:
	movl	$0, _readchar.state(%rip)
LBB0_13:
	testl	%ebx, %ebx
	jns	LBB0_19
## %bb.14:
	movq	_SERIAL_TIMEOUT@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_16
## %bb.15:
	leaq	L_.str.2(%rip), %rdi
	callq	_error
LBB0_16:
	leaq	L_.str.3(%rip), %rdi
	callq	_perror_with_name
LBB0_19:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
.zerofill __DATA,__bss,_readchar.state,4,2 ## @readchar.state
	.comm	_monitor_desc,4,2               ## @monitor_desc
	.comm	_monitor_debug_p,8,3            ## @monitor_debug_p
	.comm	_remote_debug,8,3               ## @remote_debug
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"read -->"

L_.str.1:                               ## @.str.1
	.asciz	"<--"

	.comm	_current_monitor,8,3            ## @current_monitor
	.comm	_MO_HANDLE_NL,4,2               ## @MO_HANDLE_NL
	.comm	_SERIAL_TIMEOUT,4,2             ## @SERIAL_TIMEOUT
L_.str.2:                               ## @.str.2
	.asciz	"Timeout reading from remote system."

L_.str.3:                               ## @.str.3
	.asciz	"remote-monitor"

	.comm	_in_monitor_wait,8,3            ## @in_monitor_wait
	.no_dead_strip	_readchar
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function readchar
_readchar:                              ; @readchar
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x0
Lloh0:
	adrp	x24, _monitor_desc@GOTPAGE
Lloh1:
	ldr	x24, [x24, _monitor_desc@GOTPAGEOFF]
Lloh2:
	adrp	x25, _monitor_debug_p@GOTPAGE
Lloh3:
	ldr	x25, [x25, _monitor_debug_p@GOTPAGEOFF]
Lloh4:
	adrp	x26, _remote_debug@GOTPAGE
Lloh5:
	ldr	x26, [x26, _remote_debug@GOTPAGEOFF]
Lloh6:
	adrp	x27, _current_monitor@GOTPAGE
Lloh7:
	ldr	x27, [x27, _current_monitor@GOTPAGEOFF]
	adrp	x23, _readchar.state@PAGE
Lloh8:
	adrp	x28, _MO_HANDLE_NL@GOTPAGE
Lloh9:
	ldr	x28, [x28, _MO_HANDLE_NL@GOTPAGEOFF]
	mov	w21, #3
Lloh10:
	adrp	x22, l_.str.1@PAGE
Lloh11:
	add	x22, x22, l_.str.1@PAGEOFF
	b	LBB0_2
LBB0_1:                                 ;   in Loop: Header=BB0_2 Depth=1
	str	w21, [x23, _readchar.state@PAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w0, [x24]
	mov	x1, x20
	bl	_serial_readchar
	mov	x19, x0
	tbnz	w0, #31, LBB0_5
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	and	w19, w19, #0x7f
	ldr	x8, [x25]
	ldr	x9, [x26]
	orr	x8, x8, x9
	cbz	x8, LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	strb	w19, [sp, #14]
	strb	wzr, [sp, #15]
	add	x1, sp, #14
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	mov	x2, x22
	bl	_puts_debug
LBB0_5:                                 ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x27]
	ldr	w8, [x8]
	ldr	w9, [x28]
	tst	w9, w8
	b.eq	LBB0_13
; %bb.6:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w8, [x23, _readchar.state@PAGEOFF]
	cmp	w19, #13
	ccmp	w8, #1, #0, eq
	b.eq	LBB0_1
; %bb.7:                                ;   in Loop: Header=BB0_2 Depth=1
	cmp	w19, #10
	ccmp	w8, #2, #0, eq
	b.eq	LBB0_1
; %bb.8:
	cmp	w19, #13
	b.ne	LBB0_10
; %bb.9:
	mov	w8, #2
	str	w8, [x23, _readchar.state@PAGEOFF]
	b	LBB0_17
LBB0_10:
	cmp	w19, #10
	b.ne	LBB0_12
; %bb.11:
	mov	w8, #1
	str	w8, [x23, _readchar.state@PAGEOFF]
	mov	w19, #13
	b	LBB0_17
LBB0_12:
	str	wzr, [x23, _readchar.state@PAGEOFF]
LBB0_13:
	tbz	w19, #31, LBB0_17
; %bb.14:
Lloh14:
	adrp	x8, _SERIAL_TIMEOUT@GOTPAGE
Lloh15:
	ldr	x8, [x8, _SERIAL_TIMEOUT@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
	cmp	w19, w8
	b.ne	LBB0_16
; %bb.15:
Lloh17:
	adrp	x0, l_.str.2@PAGE
Lloh18:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_error
LBB0_16:
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_perror_with_name
LBB0_17:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
.zerofill __DATA,__bss,_readchar.state,4,2 ; @readchar.state
	.comm	_monitor_desc,4,2               ; @monitor_desc
	.comm	_monitor_debug_p,8,3            ; @monitor_debug_p
	.comm	_remote_debug,8,3               ; @remote_debug
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"read -->"

l_.str.1:                               ; @.str.1
	.asciz	"<--"

	.comm	_current_monitor,8,3            ; @current_monitor
	.comm	_MO_HANDLE_NL,4,2               ; @MO_HANDLE_NL
	.comm	_SERIAL_TIMEOUT,4,2             ; @SERIAL_TIMEOUT
l_.str.2:                               ; @.str.2
	.asciz	"Timeout reading from remote system."

l_.str.3:                               ; @.str.3
	.asciz	"remote-monitor"

	.comm	_in_monitor_wait,8,3            ; @in_monitor_wait
	.no_dead_strip	_readchar
.subsections_via_symbols
