	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rfcomm_tty_open
_rfcomm_tty_open:                       ## @rfcomm_tty_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
	subq	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	_wait@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_current@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_DECLARE_WAITQUEUE
	movl	(%r12), %ebx
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_BT_DBG
	movl	%ebx, %edi
	callq	_rfcomm_dev_get
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r13
	leaq	28(%rax), %rdi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_batostr
	movl	%eax, %ebx
	movl	24(%r13), %r15d
	leaq	48(%r13), %r14
	movq	%r14, %rdi
	callq	_atomic_read
	leaq	L_.str.1(%rip), %rdi
	movq	%r13, %rsi
	movl	%ebx, %edx
	movl	%r15d, %ecx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_BT_DBG
	movq	%r14, %rdi
	xorl	%ebx, %ebx
	callq	_atomic_inc_return
	cmpl	$1, %eax
	jg	LBB0_15
## %bb.3:
	movq	8(%r13), %r15
	movq	%r15, %rdi
	callq	_rfcomm_dlc_lock
	movq	%r13, 8(%r12)
	movq	%r12, 40(%r13)
	movq	%r15, %rdi
	callq	_rfcomm_dlc_unlock
	movq	_RFCOMM_TTY_ATTACHED@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	36(%r13), %rsi
	callq	_set_bit
	leaq	32(%r13), %rsi
	movl	24(%r13), %ecx
	movq	%r15, %rdi
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	callq	_rfcomm_dlc_open
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_15
## %bb.4:
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	addq	$20, %rdi
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	callq	_add_wait_queue
	movq	_TASK_INTERRUPTIBLE@GOTPCREL(%rip), %r14
	movl	(%r14), %edi
	callq	_set_current_state
	movq	(%r15), %rax
	movq	_BT_CLOSED@GOTPCREL(%rip), %rbx
	cmpq	(%rbx), %rax
	je	LBB0_11
## %bb.5:
	movq	_BT_CONNECTED@GOTPCREL(%rip), %r12
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	(%r12), %rax
	je	LBB0_7
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_current@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_signal_pending
	testq	%rax, %rax
	jne	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_6 Depth=1
	xorl	%eax, %eax
	callq	_schedule
	movl	(%r14), %edi
	callq	_set_current_state
	movq	(%r15), %rax
	cmpq	(%rbx), %rax
	jne	LBB0_6
LBB0_11:
	xorl	%ebx, %ebx
	subl	(%r13), %ebx
	jmp	LBB0_12
LBB0_1:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_15
LBB0_7:
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	jmp	LBB0_12
LBB0_9:
	movq	_EINTR@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_12:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	movq	_TASK_RUNNING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_set_current_state
	movq	_wait@GOTPCREL(%rip), %rsi
	movq	%r14, %rdi
	callq	_remove_wait_queue
	testl	%ebx, %ebx
	jne	LBB0_14
## %bb.13:
	movl	16(%r13), %r14d
	movq	%r13, %rdi
	callq	_rfcomm_get_device
	movq	_DPM_ORDER_DEV_AFTER_PARENT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	%r14d, %edi
	movl	%eax, %esi
	callq	_device_move
LBB0_14:
	movq	%r13, %rdi
	callq	_rfcomm_tty_copy_pending
	movq	8(%r13), %rdi
	callq	_rfcomm_dlc_unthrottle
LBB0_15:
	movl	%ebx, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_wait,4,2                       ## @wait
	.comm	_current,4,2                    ## @current
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"tty %p id %d"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.1:                               ## @.str.1
	.asciz	"dev %p dst %s channel %d opened %d"

	.comm	_RFCOMM_TTY_ATTACHED,4,2        ## @RFCOMM_TTY_ATTACHED
	.comm	_TASK_INTERRUPTIBLE,4,2         ## @TASK_INTERRUPTIBLE
	.comm	_BT_CLOSED,8,3                  ## @BT_CLOSED
	.comm	_BT_CONNECTED,8,3               ## @BT_CONNECTED
	.comm	_EINTR,4,2                      ## @EINTR
	.comm	_TASK_RUNNING,4,2               ## @TASK_RUNNING
	.comm	_DPM_ORDER_DEV_AFTER_PARENT,4,2 ## @DPM_ORDER_DEV_AFTER_PARENT
	.no_dead_strip	_rfcomm_tty_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rfcomm_tty_open
_rfcomm_tty_open:                       ; @rfcomm_tty_open
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x20, x0
Lloh0:
	adrp	x8, _wait@GOTPAGE
Lloh1:
	ldr	x8, [x8, _wait@GOTPAGEOFF]
Lloh2:
	ldr	w0, [x8]
Lloh3:
	adrp	x24, _current@GOTPAGE
Lloh4:
	ldr	x24, [x24, _current@GOTPAGEOFF]
	ldr	w1, [x24]
	bl	_DECLARE_WAITQUEUE
	ldr	w19, [x20]
	stp	x20, x19, [sp]
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_BT_DBG
	mov	x0, x19
	bl	_rfcomm_dev_get
	cbz	x0, LBB0_3
; %bb.1:
	mov	x19, x0
	add	x22, x0, #28
	mov	x0, x22
	bl	_batostr
	mov	x21, x0
	add	x23, x19, #48
	ldr	w25, [x19, #24]
	mov	x0, x23
	bl	_atomic_read
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x25, x0, [sp, #16]
	stp	x19, x21, [sp]
Lloh7:
	adrp	x0, l_.str.1@PAGE
Lloh8:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_BT_DBG
	mov	x0, x23
	bl	_atomic_inc_return
	cmp	w0, #1
	b.le	LBB0_4
; %bb.2:
	mov	w20, #0
	b	LBB0_16
LBB0_3:
Lloh9:
	adrp	x8, _ENODEV@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w20, w8
	b	LBB0_16
LBB0_4:
	ldr	x21, [x19, #8]
	mov	x0, x21
	bl	_rfcomm_dlc_lock
	str	x19, [x20, #8]
	str	x20, [x19, #40]
	mov	x0, x21
	bl	_rfcomm_dlc_unlock
Lloh12:
	adrp	x8, _RFCOMM_TTY_ATTACHED@GOTPAGE
Lloh13:
	ldr	x8, [x8, _RFCOMM_TTY_ATTACHED@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	add	x1, x19, #36
	bl	_set_bit
	add	x1, x19, #32
	ldr	w3, [x19, #24]
	mov	x0, x21
	mov	x2, x22
	bl	_rfcomm_dlc_open
	mov	x20, x0
	tbnz	w0, #31, LBB0_16
; %bb.5:
	add	x22, x19, #20
Lloh15:
	adrp	x1, _wait@GOTPAGE
Lloh16:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x22
	bl	_add_wait_queue
Lloh17:
	adrp	x23, _TASK_INTERRUPTIBLE@GOTPAGE
Lloh18:
	ldr	x23, [x23, _TASK_INTERRUPTIBLE@GOTPAGEOFF]
	ldr	w0, [x23]
	bl	_set_current_state
	ldr	x8, [x21]
Lloh19:
	adrp	x25, _BT_CLOSED@GOTPAGE
Lloh20:
	ldr	x25, [x25, _BT_CLOSED@GOTPAGEOFF]
	ldr	x9, [x25]
	cmp	x8, x9
	b.eq	LBB0_10
; %bb.6:
Lloh21:
	adrp	x26, _BT_CONNECTED@GOTPAGE
Lloh22:
	ldr	x26, [x26, _BT_CONNECTED@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x26]
	cmp	x8, x9
	b.eq	LBB0_13
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w0, [x24]
	bl	_signal_pending
	cbnz	x0, LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	bl	_schedule
	ldr	w0, [x23]
	bl	_set_current_state
	ldr	x8, [x21]
	ldr	x9, [x25]
	cmp	x8, x9
	b.ne	LBB0_7
LBB0_10:
	ldr	w8, [x19]
	b	LBB0_12
LBB0_11:
Lloh23:
	adrp	x8, _EINTR@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EINTR@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
LBB0_12:
	neg	w20, w8
LBB0_13:
Lloh26:
	adrp	x8, _TASK_RUNNING@GOTPAGE
Lloh27:
	ldr	x8, [x8, _TASK_RUNNING@GOTPAGEOFF]
Lloh28:
	ldr	w0, [x8]
	bl	_set_current_state
Lloh29:
	adrp	x1, _wait@GOTPAGE
Lloh30:
	ldr	x1, [x1, _wait@GOTPAGEOFF]
	mov	x0, x22
	bl	_remove_wait_queue
	cbnz	w20, LBB0_15
; %bb.14:
	ldr	w21, [x19, #16]
	mov	x0, x19
	bl	_rfcomm_get_device
	mov	x1, x0
Lloh31:
	adrp	x8, _DPM_ORDER_DEV_AFTER_PARENT@GOTPAGE
Lloh32:
	ldr	x8, [x8, _DPM_ORDER_DEV_AFTER_PARENT@GOTPAGEOFF]
Lloh33:
	ldr	w2, [x8]
	mov	x0, x21
	bl	_device_move
LBB0_15:
	mov	x0, x19
	bl	_rfcomm_tty_copy_pending
	ldr	x0, [x19, #8]
	bl	_rfcomm_dlc_unthrottle
LBB0_16:
	mov	x0, x20
	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
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGot	Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.cfi_endproc
                                        ; -- End function
	.comm	_wait,4,2                       ; @wait
	.comm	_current,4,2                    ; @current
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"tty %p id %d"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.1:                               ; @.str.1
	.asciz	"dev %p dst %s channel %d opened %d"

	.comm	_RFCOMM_TTY_ATTACHED,4,2        ; @RFCOMM_TTY_ATTACHED
	.comm	_TASK_INTERRUPTIBLE,4,2         ; @TASK_INTERRUPTIBLE
	.comm	_BT_CLOSED,8,3                  ; @BT_CLOSED
	.comm	_BT_CONNECTED,8,3               ; @BT_CONNECTED
	.comm	_EINTR,4,2                      ; @EINTR
	.comm	_TASK_RUNNING,4,2               ; @TASK_RUNNING
	.comm	_DPM_ORDER_DEV_AFTER_PARENT,4,2 ; @DPM_ORDER_DEV_AFTER_PARENT
	.no_dead_strip	_rfcomm_tty_open
.subsections_via_symbols
