	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lp_acl_write                   ## -- Begin function lp_acl_write
	.p2align	4, 0x90
_lp_acl_write:                          ## @lp_acl_write
	.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
	movl	%ecx, %r15d
	movl	%edx, %r14d
	movq	%rsi, %r12
	callq	_hci_get_link
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r13
	movq	_hci_dev@GOTPCREL(%rip), %rax
	testq	%r12, %r12
	je	LBB0_7
## %bb.3:
	movq	(%rax), %rax
	cmpq	$0, (%rax)
	jne	LBB0_7
## %bb.4:
	cmpq	$0, 16(%r13)
	je	LBB0_6
## %bb.5:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_LOG
	jmp	LBB0_10
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_ERROR
	movq	_ERR_CONN@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_6:
	movq	%r12, %rdi
	callq	_btpbuf_take
	movq	%rax, %r12
	movq	%rax, 16(%r13)
	movl	%r14d, (%r13)
	movl	%r15d, 4(%r13)
	movq	%rax, %rdi
	callq	_btpbuf_ref
	leaq	L_.str.2(%rip), %rdi
	movq	%r12, %rsi
	xorl	%eax, %eax
	callq	_LOG
LBB0_7:
	movq	_PBUF_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_HCI_ACL_HDR_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	incq	%rsi
	movq	_PBUF_RAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_btpbuf_alloc
	testq	%rax, %rax
	je	LBB0_8
## %bb.9:
	movq	%rax, %rbx
	movq	%rax, %rdi
	movq	%r12, %rsi
	callq	_btpbuf_chain
	movq	_HCI_ACL_DATA_PACKET@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	8(%rbx), %r12
	movl	%eax, (%r12)
	shll	$12, %r15d
	orl	8(%r13), %r15d
	andl	$16383, %r15d                   ## imm = 0x3FFF
	movl	%r15d, %edi
	callq	_htole16
	movq	%rax, 12(%r12)
	movl	%r14d, %edi
	callq	_htole16
	movq	%rax, 4(%r12)
	addl	(%rbx), %r14d
	movq	%rbx, %rdi
	movl	%r14d, %esi
	callq	_physbusif_output
	movq	_hci_dev@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	decq	(%rax)
	movq	%rbx, %rdi
	callq	_btpbuf_dechain
	movq	%rbx, %rdi
	callq	_btpbuf_free
LBB0_10:
	movq	_ERR_OK@GOTPCREL(%rip), %rax
	jmp	LBB0_11
LBB0_8:
	leaq	L_.str.3(%rip), %rdi
	callq	_ERROR
	movq	_ERR_MEM@GOTPCREL(%rip), %rax
LBB0_11:
	movl	(%rax), %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"lp_acl_write: ACL connection does not exist\n"

	.comm	_ERR_CONN,4,2                   ## @ERR_CONN
	.comm	_hci_dev,8,3                    ## @hci_dev
L_.str.1:                               ## @.str.1
	.asciz	"lp_acl_write: Host buffer full. Dropped packet\n"

	.comm	_ERR_OK,4,2                     ## @ERR_OK
L_.str.2:                               ## @.str.2
	.asciz	"lp_acl_write: Host queued packet %p\n"

	.comm	_PBUF_RAW,4,2                   ## @PBUF_RAW
	.comm	_HCI_ACL_HDR_LEN,8,3            ## @HCI_ACL_HDR_LEN
	.comm	_PBUF_RAM,4,2                   ## @PBUF_RAM
L_.str.3:                               ## @.str.3
	.asciz	"lp_acl_write: Could not allocate memory for pbuf\n"

	.comm	_ERR_MEM,4,2                    ## @ERR_MEM
	.comm	_HCI_ACL_DATA_PACKET,4,2        ## @HCI_ACL_DATA_PACKET
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_lp_acl_write                   ; -- Begin function lp_acl_write
	.p2align	2
_lp_acl_write:                          ; @lp_acl_write
	.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	x20, x3
	mov	x19, x2
	mov	x22, x1
	bl	_hci_get_link
	cbz	x0, LBB0_5
; %bb.1:
	mov	x21, x0
Lloh0:
	adrp	x24, _hci_dev@GOTPAGE
Lloh1:
	ldr	x24, [x24, _hci_dev@GOTPAGEOFF]
	cbz	x22, LBB0_7
; %bb.2:
	ldr	x8, [x24]
	ldr	x8, [x8]
	cbnz	x8, LBB0_7
; %bb.3:
	ldr	x8, [x21, #16]
	cbz	x8, LBB0_6
; %bb.4:
Lloh2:
	adrp	x0, l_.str.1@PAGE
Lloh3:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_LOG
	b	LBB0_9
LBB0_5:
Lloh4:
	adrp	x0, l_.str@PAGE
Lloh5:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERROR
Lloh6:
	adrp	x8, _ERR_CONN@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ERR_CONN@GOTPAGEOFF]
	b	LBB0_11
LBB0_6:
	mov	x0, x22
	bl	_btpbuf_take
	mov	x22, x0
	str	x0, [x21, #16]
	stp	w19, w20, [x21]
	bl	_btpbuf_ref
	str	x22, [sp]
Lloh8:
	adrp	x0, l_.str.2@PAGE
Lloh9:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_LOG
LBB0_7:
Lloh10:
	adrp	x8, _PBUF_RAW@GOTPAGE
Lloh11:
	ldr	x8, [x8, _PBUF_RAW@GOTPAGEOFF]
Lloh12:
	adrp	x9, _HCI_ACL_HDR_LEN@GOTPAGE
Lloh13:
	ldr	x9, [x9, _HCI_ACL_HDR_LEN@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
Lloh15:
	ldr	x8, [x9]
	add	x1, x8, #1
Lloh16:
	adrp	x8, _PBUF_RAM@GOTPAGE
Lloh17:
	ldr	x8, [x8, _PBUF_RAM@GOTPAGEOFF]
Lloh18:
	ldr	w2, [x8]
	bl	_btpbuf_alloc
	cbz	x0, LBB0_10
; %bb.8:
	mov	x23, x0
	mov	x1, x22
	bl	_btpbuf_chain
Lloh19:
	adrp	x8, _HCI_ACL_DATA_PACKET@GOTPAGE
Lloh20:
	ldr	x8, [x8, _HCI_ACL_DATA_PACKET@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	ldr	x22, [x23, #8]
	str	w8, [x22]
	ldr	w8, [x21, #8]
	orr	w8, w8, w20, lsl #12
	and	w0, w8, #0x3fff
	bl	_htole16
	stur	x0, [x22, #12]
	mov	x0, x19
	bl	_htole16
	stur	x0, [x22, #4]
	ldr	w8, [x23]
	add	w1, w8, w19
	mov	x0, x23
	bl	_physbusif_output
	ldr	x8, [x24]
	ldr	x9, [x8]
	sub	x9, x9, #1
	str	x9, [x8]
	mov	x0, x23
	bl	_btpbuf_dechain
	mov	x0, x23
	bl	_btpbuf_free
LBB0_9:
Lloh22:
	adrp	x8, _ERR_OK@GOTPAGE
Lloh23:
	ldr	x8, [x8, _ERR_OK@GOTPAGEOFF]
	b	LBB0_11
LBB0_10:
Lloh24:
	adrp	x0, l_.str.3@PAGE
Lloh25:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_ERROR
Lloh26:
	adrp	x8, _ERR_MEM@GOTPAGE
Lloh27:
	ldr	x8, [x8, _ERR_MEM@GOTPAGEOFF]
LBB0_11:
	ldr	w0, [x8]
	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 AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpAdd	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"lp_acl_write: ACL connection does not exist\n"

	.comm	_ERR_CONN,4,2                   ; @ERR_CONN
	.comm	_hci_dev,8,3                    ; @hci_dev
l_.str.1:                               ; @.str.1
	.asciz	"lp_acl_write: Host buffer full. Dropped packet\n"

	.comm	_ERR_OK,4,2                     ; @ERR_OK
l_.str.2:                               ; @.str.2
	.asciz	"lp_acl_write: Host queued packet %p\n"

	.comm	_PBUF_RAW,4,2                   ; @PBUF_RAW
	.comm	_HCI_ACL_HDR_LEN,8,3            ; @HCI_ACL_HDR_LEN
	.comm	_PBUF_RAM,4,2                   ; @PBUF_RAM
l_.str.3:                               ; @.str.3
	.asciz	"lp_acl_write: Could not allocate memory for pbuf\n"

	.comm	_ERR_MEM,4,2                    ; @ERR_MEM
	.comm	_HCI_ACL_DATA_PACKET,4,2        ; @HCI_ACL_DATA_PACKET
.subsections_via_symbols
