	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dos_close
_dos_close:                             ## @dos_close
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testq	%rdi, %rdi
	je	LBB0_4
## %bb.1:
	movq	_ports@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	movq	(%rdi), %rax
	leaq	(%rax,%rax,4), %rbx
	movl	32(%r12,%rbx,8), %eax
	leal	-1(%rax), %ecx
	movl	%ecx, 32(%r12,%rbx,8)
	cmpl	$1, %eax
	jg	LBB0_4
## %bb.2:
	movq	24(%r12,%rbx,8), %r15
	testq	%r15, %r15
	je	LBB0_4
## %bb.3:
	leaq	(%r12,%rbx,8), %r14
	xorl	%eax, %eax
	callq	_disable
	movq	$0, 24(%r14)
	movl	$0, (%r15)
	movq	_com_fifo@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_outb
	movq	_com_ier@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_outb
	xorl	%eax, %eax
	callq	_enable
	movq	%r15, %rdi
	callq	_dos_unhookirq
	movq	_com_mcr@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_outb
	cmpq	$0, 16(%r12,%rbx,8)
	je	LBB0_4
## %bb.5:
	movq	_gdb_stderr@GOTPCREL(%rip), %r15
	movl	(%r15), %edi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf_unfiltered
	cmpq	$0, 8(%r12,%rbx,8)
	leaq	L_.str.3(%rip), %rax
	leaq	L_.str.2(%rip), %rdx
	cmoveq	%rax, %rdx
	movl	(%r15), %edi
	movl	(%r14), %ecx
	leaq	L_.str.1(%rip), %rsi
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_fprintf_unfiltered             ## TAILCALL
LBB0_4:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ports,8,3                      ## @ports
	.comm	_com_fifo,4,2                   ## @com_fifo
	.comm	_com_ier,4,2                    ## @com_ier
	.comm	_com_mcr,4,2                    ## @com_mcr
	.comm	_gdb_stderr,4,2                 ## @gdb_stderr
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Serial input overruns occurred.\n"

L_.str.1:                               ## @.str.1
	.asciz	"This system %s handle %d baud.\n"

L_.str.2:                               ## @.str.2
	.asciz	"cannot"

L_.str.3:                               ## @.str.3
	.asciz	"needs a 16550 to"

	.no_dead_strip	_dos_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dos_close
_dos_close:                             ; @dos_close
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	cbz	x0, LBB0_5
; %bb.1:
Lloh0:
	adrp	x8, _ports@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ports@GOTPAGEOFF]
Lloh2:
	ldr	x21, [x8]
	ldr	x22, [x0]
	mov	w8, #40
	madd	x19, x22, x8, x21
	ldr	w8, [x19, #32]
	subs	w8, w8, #1
	str	w8, [x19, #32]
	b.gt	LBB0_5
; %bb.2:
	mov	w8, #40
	madd	x23, x22, x8, x21
	ldr	x20, [x23, #24]!
	cbz	x20, LBB0_5
; %bb.3:
	bl	_disable
	str	xzr, [x23]
	str	wzr, [x20]
Lloh3:
	adrp	x8, _com_fifo@GOTPAGE
Lloh4:
	ldr	x8, [x8, _com_fifo@GOTPAGEOFF]
Lloh5:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_outb
Lloh6:
	adrp	x8, _com_ier@GOTPAGE
Lloh7:
	ldr	x8, [x8, _com_ier@GOTPAGEOFF]
Lloh8:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_outb
	bl	_enable
	mov	x0, x20
	bl	_dos_unhookirq
Lloh9:
	adrp	x8, _com_mcr@GOTPAGE
Lloh10:
	ldr	x8, [x8, _com_mcr@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #0
	bl	_outb
	mov	w8, #40
	madd	x8, x22, x8, x21
	ldr	x8, [x8, #16]
	cbz	x8, LBB0_5
; %bb.4:
Lloh12:
	adrp	x20, _gdb_stderr@GOTPAGE
Lloh13:
	ldr	x20, [x20, _gdb_stderr@GOTPAGEOFF]
	ldr	w0, [x20]
Lloh14:
	adrp	x1, l_.str@PAGE
Lloh15:
	add	x1, x1, l_.str@PAGEOFF
	bl	_fprintf_unfiltered
	ldr	w0, [x20]
	mov	w8, #40
	madd	x8, x22, x8, x21
Lloh16:
	adrp	x9, l_.str.2@PAGE
Lloh17:
	add	x9, x9, l_.str.2@PAGEOFF
	ldr	x8, [x8, #8]
Lloh18:
	adrp	x10, l_.str.3@PAGE
Lloh19:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	x8, #0
	csel	x8, x10, x9, eq
	ldr	w9, [x19]
	stp	x8, x9, [sp]
Lloh20:
	adrp	x1, l_.str.1@PAGE
Lloh21:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_fprintf_unfiltered
LBB0_5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_ports,8,3                      ; @ports
	.comm	_com_fifo,4,2                   ; @com_fifo
	.comm	_com_ier,4,2                    ; @com_ier
	.comm	_com_mcr,4,2                    ; @com_mcr
	.comm	_gdb_stderr,4,2                 ; @gdb_stderr
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Serial input overruns occurred.\n"

l_.str.1:                               ; @.str.1
	.asciz	"This system %s handle %d baud.\n"

l_.str.2:                               ; @.str.2
	.asciz	"cannot"

l_.str.3:                               ; @.str.3
	.asciz	"needs a 16550 to"

	.no_dead_strip	_dos_close
.subsections_via_symbols
