	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __rfcomm_dlc_open
___rfcomm_dlc_open:                     ## @__rfcomm_dlc_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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, %r14d
	movq	%rdx, %r12
	movq	%rdi, %r15
	movl	$0, -44(%rbp)
	movq	(%rdi), %rbx
	movq	%rsi, -64(%rbp)                 ## 8-byte Spill
	movq	%rsi, %rdi
	callq	_batostr
	movl	%eax, %r13d
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_batostr
	leaq	L_.str(%rip), %rdi
	movq	%r15, %rsi
	movq	%rbx, %rdx
	movl	%r13d, %ecx
	movl	%eax, %r8d
	movl	%r14d, %r9d
	callq	_BT_DBG
	leal	-31(%r14), %eax
	cmpl	$-31, %eax
	ja	LBB0_3
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_3:
	movq	%r14, %rdx
	movq	-64(%rbp), %r12                 ## 8-byte Reload
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	(%r15), %rax
	movq	_BT_OPEN@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_5
## %bb.4:
	xorl	%ebx, %ebx
	movq	_BT_CLOSED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_15
LBB0_5:
	movq	%rdx, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	movq	%r14, %rbx
	movq	%r14, %rsi
	callq	_rfcomm_session_get
	movq	%rax, %r13
	testq	%rax, %rax
	jne	LBB0_8
## %bb.6:
	leaq	-44(%rbp), %rdx
	movq	%r12, %rdi
	movq	%rbx, %rsi
	callq	_rfcomm_session_create
	movq	%rax, %r13
	testq	%rax, %rax
	je	LBB0_7
LBB0_8:
	xorl	%edi, %edi
	cmpl	$0, 20(%r13)
	sete	%dil
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
                                        ## kill: def $esi killed $esi killed $rsi
	callq	___dlci
	movl	%eax, %ebx
	movq	%r13, %rdi
	movl	%eax, %esi
	callq	_rfcomm_dlc_get
	testq	%rax, %rax
	je	LBB0_10
## %bb.9:
	movq	_EBUSY@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	movq	%r15, %rdi
	callq	_rfcomm_dlc_clear_state
	movl	%ebx, 8(%r15)
	movl	20(%r13), %edi
	movl	%ebx, %esi
	callq	___addr
	movl	%eax, 40(%r15)
	movl	$7, 12(%r15)
	movq	_BT_CONFIG@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, (%r15)
	movq	%r13, %rdi
	movq	%r15, %rsi
	callq	_rfcomm_dlc_link
	movl	$1, 16(%r15)
	movl	16(%r13), %eax
	movl	%eax, 36(%r15)
	movq	(%r13), %rax
	movq	_RFCOMM_CFC_UNKNOWN@GOTPCREL(%rip), %rcx
	xorl	%ebx, %ebx
	cmpq	(%rcx), %rax
	movl	$0, %ecx
	cmovneq	%rax, %rcx
	movq	%rcx, 24(%r15)
	movq	8(%r13), %rax
	movq	_BT_CONNECTED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_14
## %bb.11:
	movq	%r15, %rdi
	callq	_rfcomm_check_security
	testq	%rax, %rax
	je	LBB0_13
## %bb.12:
	movq	%r13, %rdi
	movl	$1, %esi
	movq	%r15, %rdx
	callq	_rfcomm_send_pn
	jmp	LBB0_14
LBB0_7:
	movl	-44(%rbp), %ebx
	jmp	LBB0_15
LBB0_13:
	movq	_RFCOMM_AUTH_PENDING@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	32(%r15), %rsi
	callq	_set_bit
LBB0_14:
	movq	_RFCOMM_CONN_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r15, %rdi
	callq	_rfcomm_dlc_set_timer
	jmp	LBB0_15
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"dlc %p state %ld %s %s channel %d"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_BT_OPEN,8,3                    ## @BT_OPEN
	.comm	_BT_CLOSED,8,3                  ## @BT_CLOSED
	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_BT_CONFIG,8,3                  ## @BT_CONFIG
	.comm	_RFCOMM_CFC_UNKNOWN,8,3         ## @RFCOMM_CFC_UNKNOWN
	.comm	_BT_CONNECTED,8,3               ## @BT_CONNECTED
	.comm	_RFCOMM_AUTH_PENDING,4,2        ## @RFCOMM_AUTH_PENDING
	.comm	_RFCOMM_CONN_TIMEOUT,4,2        ## @RFCOMM_CONN_TIMEOUT
	.no_dead_strip	___rfcomm_dlc_open
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __rfcomm_dlc_open
___rfcomm_dlc_open:                     ; @__rfcomm_dlc_open
	.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
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	str	wzr, [sp, #12]
	ldr	x20, [x0]
	mov	x0, x1
	bl	_batostr
	mov	x24, x0
	mov	x0, x22
	bl	_batostr
	mov	x4, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	mov	x1, x19
	mov	x2, x20
	mov	x3, x24
	mov	x5, x21
	bl	_BT_DBG
	sub	w8, w21, #31
	cmn	w8, #31
	b.hi	LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_7
LBB0_2:
	ldr	x8, [x19]
Lloh4:
	adrp	x9, _BT_OPEN@GOTPAGE
Lloh5:
	ldr	x9, [x9, _BT_OPEN@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
Lloh7:
	adrp	x10, _BT_CLOSED@GOTPAGE
Lloh8:
	ldr	x10, [x10, _BT_CLOSED@GOTPAGEOFF]
Lloh9:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_14
; %bb.3:
	mov	x0, x23
	mov	x1, x22
	bl	_rfcomm_session_get
	mov	x20, x0
	cbnz	x0, LBB0_5
; %bb.4:
	add	x2, sp, #12
	mov	x0, x23
	mov	x1, x22
	bl	_rfcomm_session_create
	mov	x20, x0
	cbz	x0, LBB0_11
LBB0_5:
	ldr	w8, [x20, #20]
	cmp	w8, #0
	cset	w0, eq
	mov	x1, x21
	bl	___dlci
	mov	x21, x0
	mov	x0, x20
	mov	x1, x21
	bl	_rfcomm_dlc_get
	cbz	x0, LBB0_8
; %bb.6:
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_15
LBB0_8:
	mov	x0, x19
	bl	_rfcomm_dlc_clear_state
	str	w21, [x19, #8]
	ldr	w0, [x20, #20]
	mov	x1, x21
	bl	___addr
	str	w0, [x19, #40]
	mov	w8, #7
	str	w8, [x19, #12]
Lloh12:
	adrp	x8, _BT_CONFIG@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BT_CONFIG@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	str	x8, [x19]
	mov	x0, x20
	mov	x1, x19
	bl	_rfcomm_dlc_link
	mov	w8, #1
	str	w8, [x19, #16]
	ldr	w8, [x20, #16]
	str	w8, [x19, #36]
Lloh15:
	adrp	x8, _RFCOMM_CFC_UNKNOWN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _RFCOMM_CFC_UNKNOWN@GOTPAGEOFF]
Lloh17:
	ldr	x8, [x8]
	ldp	x9, x10, [x20]
	cmp	x9, x8
	csel	x8, xzr, x9, eq
	str	x8, [x19, #24]
Lloh18:
	adrp	x8, _BT_CONNECTED@GOTPAGE
Lloh19:
	ldr	x8, [x8, _BT_CONNECTED@GOTPAGEOFF]
Lloh20:
	ldr	x8, [x8]
	cmp	x10, x8
	b.ne	LBB0_13
; %bb.9:
	mov	x0, x19
	bl	_rfcomm_check_security
	cbz	x0, LBB0_12
; %bb.10:
	mov	x0, x20
	mov	w1, #1
	mov	x2, x19
	bl	_rfcomm_send_pn
	b	LBB0_13
LBB0_11:
	ldr	w0, [sp, #12]
	b	LBB0_15
LBB0_12:
Lloh21:
	adrp	x8, _RFCOMM_AUTH_PENDING@GOTPAGE
Lloh22:
	ldr	x8, [x8, _RFCOMM_AUTH_PENDING@GOTPAGEOFF]
Lloh23:
	ldr	w0, [x8]
	add	x1, x19, #32
	bl	_set_bit
LBB0_13:
Lloh24:
	adrp	x8, _RFCOMM_CONN_TIMEOUT@GOTPAGE
Lloh25:
	ldr	x8, [x8, _RFCOMM_CONN_TIMEOUT@GOTPAGEOFF]
Lloh26:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_rfcomm_dlc_set_timer
LBB0_14:
	mov	w0, #0
LBB0_15:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"dlc %p state %ld %s %s channel %d"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_BT_OPEN,8,3                    ; @BT_OPEN
	.comm	_BT_CLOSED,8,3                  ; @BT_CLOSED
	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_BT_CONFIG,8,3                  ; @BT_CONFIG
	.comm	_RFCOMM_CFC_UNKNOWN,8,3         ; @RFCOMM_CFC_UNKNOWN
	.comm	_BT_CONNECTED,8,3               ; @BT_CONNECTED
	.comm	_RFCOMM_AUTH_PENDING,4,2        ; @RFCOMM_AUTH_PENDING
	.comm	_RFCOMM_CONN_TIMEOUT,4,2        ; @RFCOMM_CONN_TIMEOUT
	.no_dead_strip	___rfcomm_dlc_open
.subsections_via_symbols
