	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hso_serial_open
_hso_serial_open:                       ## @hso_serial_open
	.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
	movq	%rdi, %r14
	movl	8(%rdi), %edi
	callq	_get_serial_by_index
	testq	%rax, %rax
	je	LBB0_2
## %bb.1:
	movq	%rax, %rbx
	movq	(%rax), %rax
	movq	_HSO_SERIAL_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_2
## %bb.3:
	movq	8(%rbx), %rdi
	callq	_mutex_lock
	movq	8(%rbx), %rax
	movl	4(%rax), %edi
	callq	_usb_autopm_get_interface
	movl	%eax, %r15d
	testl	%eax, %eax
	js	LBB0_12
## %bb.4:
	movl	28(%rbx), %edx
	leaq	L_.str.1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_hso_dbg
	movq	%rbx, (%r14)
	leaq	16(%rbx), %r12
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_tty_port_tty_set
	movl	16(%rbx), %eax
	leal	1(%rax), %ecx
	movl	%ecx, 16(%rbx)
	testl	%eax, %eax
	je	LBB0_5
## %bb.8:
	leaq	L_.str.2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_hso_dbg
	jmp	LBB0_9
LBB0_2:
	movl	$1, %edi
	callq	_WARN_ON
	movq	$0, (%r14)
	leaq	L_.str(%rip), %rsi
	xorl	%r15d, %r15d
	movl	$1, %edi
	xorl	%eax, %eax
	callq	_hso_dbg
	movq	_ENODEV@GOTPCREL(%rip), %rax
	subl	(%rax), %r15d
	jmp	LBB0_13
LBB0_5:
	movq	_RX_IDLE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, 24(%rbx)
	xorl	%r15d, %r15d
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	__hso_serial_set_termios
	movq	%rbx, %rdi
	addq	$20, %rdi
	movq	_hso_unthrottle_tasklet@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%rbx, %rdx
	callq	_tasklet_init
	movq	8(%rbx), %rdi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_hso_start_serial_device
	movq	8(%rbx), %rdi
	testl	%eax, %eax
	je	LBB0_7
## %bb.6:
	movl	%eax, %r13d
	callq	_hso_stop_serial_device
	decl	(%r12)
	movl	%r13d, %r15d
	jmp	LBB0_9
LBB0_7:
	addq	$8, %rdi
	callq	_kref_get
LBB0_9:
	movq	8(%rbx), %rax
	movl	4(%rax), %edi
	callq	_usb_autopm_put_interface
	testl	%r15d, %r15d
	je	LBB0_10
## %bb.11:
	movq	_TIOCM_RTS@GOTPCREL(%rip), %rax
	movq	_TIOCM_DTR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	orl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	callq	_hso_serial_tiocmset
	jmp	LBB0_12
LBB0_10:
	xorl	%r15d, %r15d
LBB0_12:
	movq	8(%rbx), %rdi
	callq	_mutex_unlock
LBB0_13:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_HSO_SERIAL_MAGIC,8,3           ## @HSO_SERIAL_MAGIC
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed to open port\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.1:                               ## @.str.1
	.asciz	"Opening %d\n"

	.comm	_RX_IDLE,4,2                    ## @RX_IDLE
	.comm	_hso_unthrottle_tasklet,8,3     ## @hso_unthrottle_tasklet
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
L_.str.2:                               ## @.str.2
	.asciz	"Port was already open\n"

	.comm	_TIOCM_RTS,4,2                  ## @TIOCM_RTS
	.comm	_TIOCM_DTR,4,2                  ## @TIOCM_DTR
	.no_dead_strip	_hso_serial_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hso_serial_open
_hso_serial_open:                       ; @hso_serial_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x0
	ldr	w0, [x0, #8]
	bl	_get_serial_by_index
	cbz	x0, LBB0_5
; %bb.1:
	mov	x19, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _HSO_SERIAL_MAGIC@GOTPAGE
Lloh1:
	ldr	x9, [x9, _HSO_SERIAL_MAGIC@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_5
; %bb.2:
	ldr	x0, [x19, #8]
	bl	_mutex_lock
	ldr	x8, [x19, #8]
	ldr	w0, [x8, #4]
	bl	_usb_autopm_get_interface
	mov	x21, x0
	tbnz	w0, #31, LBB0_11
; %bb.3:
	ldr	w8, [x19, #28]
	str	x8, [sp]
Lloh3:
	adrp	x1, l_.str.1@PAGE
Lloh4:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	w0, #1
	bl	_hso_dbg
	str	x19, [x20]
	add	x22, x19, #16
	mov	x0, x22
	mov	x1, x20
	bl	_tty_port_tty_set
	ldr	w8, [x19, #16]
	add	w9, w8, #1
	str	w9, [x19, #16]
	cbz	w8, LBB0_6
; %bb.4:
Lloh5:
	adrp	x1, l_.str.2@PAGE
Lloh6:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	w0, #1
	bl	_hso_dbg
	b	LBB0_9
LBB0_5:
	mov	w0, #1
	bl	_WARN_ON
	str	xzr, [x20]
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_hso_dbg
Lloh9:
	adrp	x8, _ENODEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_12
LBB0_6:
Lloh12:
	adrp	x8, _RX_IDLE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RX_IDLE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	str	w8, [x19, #24]
	mov	x0, x20
	mov	x1, #0
	bl	__hso_serial_set_termios
	add	x0, x19, #20
Lloh15:
	adrp	x8, _hso_unthrottle_tasklet@GOTPAGE
Lloh16:
	ldr	x8, [x8, _hso_unthrottle_tasklet@GOTPAGEOFF]
Lloh17:
	ldr	x1, [x8]
	mov	x2, x19
	bl	_tasklet_init
	ldr	x0, [x19, #8]
Lloh18:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh19:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	bl	_hso_start_serial_device
	mov	x21, x0
	ldr	x0, [x19, #8]
	cbz	w21, LBB0_8
; %bb.7:
	bl	_hso_stop_serial_device
	ldr	w8, [x22]
	sub	w8, w8, #1
	str	w8, [x22]
	b	LBB0_9
LBB0_8:
	add	x0, x0, #8
	bl	_kref_get
LBB0_9:
	ldr	x8, [x19, #8]
	ldr	w0, [x8, #4]
	bl	_usb_autopm_put_interface
	cbz	w21, LBB0_11
; %bb.10:
Lloh21:
	adrp	x8, _TIOCM_RTS@GOTPAGE
Lloh22:
	ldr	x8, [x8, _TIOCM_RTS@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
Lloh24:
	adrp	x9, _TIOCM_DTR@GOTPAGE
Lloh25:
	ldr	x9, [x9, _TIOCM_DTR@GOTPAGEOFF]
Lloh26:
	ldr	w9, [x9]
	orr	w1, w9, w8
	mov	x0, x20
	mov	w2, #0
	bl	_hso_serial_tiocmset
LBB0_11:
	ldr	x0, [x19, #8]
	bl	_mutex_unlock
LBB0_12:
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_HSO_SERIAL_MAGIC,8,3           ; @HSO_SERIAL_MAGIC
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed to open port\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.1:                               ; @.str.1
	.asciz	"Opening %d\n"

	.comm	_RX_IDLE,4,2                    ; @RX_IDLE
	.comm	_hso_unthrottle_tasklet,8,3     ; @hso_unthrottle_tasklet
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
l_.str.2:                               ; @.str.2
	.asciz	"Port was already open\n"

	.comm	_TIOCM_RTS,4,2                  ; @TIOCM_RTS
	.comm	_TIOCM_DTR,4,2                  ; @TIOCM_DTR
	.no_dead_strip	_hso_serial_open
.subsections_via_symbols
