	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hso_serial_close
_hso_serial_close:                      ## @hso_serial_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	%r14
	pushq	%rbx
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	(%rdi), %rbx
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_hso_dbg
	testq	%rbx, %rbx
	je	LBB0_10
## %bb.1:
	movq	(%rbx), %rdi
	callq	_mutex_lock
	movq	(%rbx), %rax
	movl	8(%rax), %r14d
	testl	%r14d, %r14d
	jne	LBB0_3
## %bb.2:
	movl	4(%rax), %edi
	callq	_usb_autopm_get_interface
LBB0_3:
	movq	16(%rbx), %rax
	leaq	-1(%rax), %rcx
	movq	%rcx, 16(%rbx)
	cmpq	$1, %rax
	jg	LBB0_7
## %bb.4:
	leaq	16(%rbx), %rdi
	movq	$0, (%rdi)
	xorl	%esi, %esi
	callq	_tty_port_tty_set
	testl	%r14d, %r14d
	jne	LBB0_6
## %bb.5:
	movq	(%rbx), %rdi
	callq	_hso_stop_serial_device
LBB0_6:
	leaq	8(%rbx), %rdi
	callq	_tasklet_kill
LBB0_7:
	testl	%r14d, %r14d
	jne	LBB0_9
## %bb.8:
	movq	(%rbx), %rax
	movl	4(%rax), %edi
	callq	_usb_autopm_put_interface
LBB0_9:
	movq	(%rbx), %rdi
	popq	%rbx
	popq	%r14
	popq	%rbp
	jmp	_mutex_unlock                   ## TAILCALL
LBB0_10:
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Closing serial port\n"

	.no_dead_strip	_hso_serial_close
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hso_serial_close
_hso_serial_close:                      ; @hso_serial_close
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	ldr	x19, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_hso_dbg
	cbz	x19, LBB0_10
; %bb.1:
	ldr	x0, [x19]
	bl	_mutex_lock
	ldr	x8, [x19]
	ldr	w20, [x8, #8]
	cbnz	w20, LBB0_3
; %bb.2:
	ldr	w0, [x8, #4]
	bl	_usb_autopm_get_interface
LBB0_3:
	mov	x0, x19
	ldr	x8, [x0, #16]!
	subs	x8, x8, #1
	str	x8, [x0]
	b.gt	LBB0_7
; %bb.4:
	str	xzr, [x0]
	mov	x1, #0
	bl	_tty_port_tty_set
	cbnz	w20, LBB0_6
; %bb.5:
	ldr	x0, [x19]
	bl	_hso_stop_serial_device
LBB0_6:
	add	x0, x19, #8
	bl	_tasklet_kill
LBB0_7:
	cbnz	w20, LBB0_9
; %bb.8:
	ldr	x8, [x19]
	ldr	w0, [x8, #4]
	bl	_usb_autopm_put_interface
LBB0_9:
	ldr	x0, [x19]
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	b	_mutex_unlock
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Closing serial port\n"

	.no_dead_strip	_hso_serial_close
.subsections_via_symbols
