	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bte_sendmessage                ## -- Begin function bte_sendmessage
	.p2align	4, 0x90
_bte_sendmessage:                       ## @bte_sendmessage
	.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
	testq	%rdi, %rdi
	je	LBB0_10
## %bb.1:
	movq	%rsi, %r12
	testq	%rsi, %rsi
	je	LBB0_10
## %bb.2:
	movl	%edx, %r15d
	testl	%edx, %edx
	je	LBB0_10
## %bb.3:
	movq	%rdi, %rbx
	movq	(%rdi), %rax
	movq	_STATE_DISCONNECTING@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.4:
	movq	_STATE_DISCONNECTED@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_11
## %bb.5:
	movq	_bte_ctrl_reqs@GOTPCREL(%rip), %rdi
	callq	_btmemb_alloc
	testq	%rax, %rax
	je	LBB0_12
## %bb.6:
	movq	%rax, %r14
	movq	_PBUF_RAW@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leal	1(%r15), %esi
	movq	_PBUF_RAM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_btpbuf_alloc
	testq	%rax, %rax
	je	LBB0_13
## %bb.7:
	movq	%rax, %r13
	movq	_HIDP_TRANS_SETREPORT@GOTPCREL(%rip), %rax
	movq	_HIDP_DATA_RTYPE_OUPUT@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	movq	(%r13), %rdi
	movl	%ecx, (%rdi)
	incq	%rdi
	movq	%r12, %rsi
	movl	%r15d, %edx
	callq	_memcpy
	movq	%r13, 16(%r14)
	movq	%rbx, 8(%r14)
	movq	$0, (%r14)
	movq	%r14, %rdi
	callq	___bte_send_request
	movq	%rax, %rbx
	movq	_ERR_OK@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_9
## %bb.8:
	movq	%r14, %rdi
	callq	___bte_waitrequest
	movq	%rax, %rbx
LBB0_9:
	movq	_bte_ctrl_reqs@GOTPCREL(%rip), %rdi
	movq	%r14, %rsi
	callq	_btmemb_free
	jmp	LBB0_16
LBB0_10:
	movq	_ERR_VAL@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_11:
	movq	_ERR_CLSD@GOTPCREL(%rip), %rax
	jmp	LBB0_15
LBB0_12:
	leaq	L_.str(%rip), %rdi
	callq	_ERROR
	jmp	LBB0_14
LBB0_13:
	leaq	L_.str.1(%rip), %rdi
	callq	_ERROR
	movq	_bte_ctrl_reqs@GOTPCREL(%rip), %rdi
	movq	%r14, %rsi
	callq	_btmemb_free
LBB0_14:
	movq	_ERR_MEM@GOTPCREL(%rip), %rax
LBB0_15:
	movq	(%rax), %rbx
LBB0_16:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ERR_VAL,8,3                    ## @ERR_VAL
	.comm	_STATE_DISCONNECTING,8,3        ## @STATE_DISCONNECTING
	.comm	_STATE_DISCONNECTED,8,3         ## @STATE_DISCONNECTED
	.comm	_ERR_CLSD,8,3                   ## @ERR_CLSD
	.comm	_bte_ctrl_reqs,4,2              ## @bte_ctrl_reqs
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bte_sendmessage: Could not allocate memory for request\n"

	.comm	_ERR_MEM,8,3                    ## @ERR_MEM
	.comm	_PBUF_RAW,4,2                   ## @PBUF_RAW
	.comm	_PBUF_RAM,4,2                   ## @PBUF_RAM
L_.str.1:                               ## @.str.1
	.asciz	"bte_sendmessage: Could not allocate memory for pbuf\n"

	.comm	_HIDP_TRANS_SETREPORT,4,2       ## @HIDP_TRANS_SETREPORT
	.comm	_HIDP_DATA_RTYPE_OUPUT,4,2      ## @HIDP_DATA_RTYPE_OUPUT
	.comm	_ERR_OK,8,3                     ## @ERR_OK
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_bte_sendmessage                ; -- Begin function bte_sendmessage
	.p2align	2
_bte_sendmessage:                       ; @bte_sendmessage
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	cbz	x0, LBB0_5
; %bb.1:
	mov	x22, x1
	cbz	x1, LBB0_5
; %bb.2:
	mov	x21, x2
	cbz	w2, LBB0_5
; %bb.3:
	mov	x20, x0
	ldr	x8, [x0]
Lloh0:
	adrp	x9, _STATE_DISCONNECTING@GOTPAGE
Lloh1:
	ldr	x9, [x9, _STATE_DISCONNECTING@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _STATE_DISCONNECTED@GOTPAGE
Lloh4:
	ldr	x10, [x10, _STATE_DISCONNECTED@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_6
; %bb.4:
Lloh6:
	adrp	x8, _ERR_CLSD@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ERR_CLSD@GOTPAGEOFF]
	b	LBB0_14
LBB0_5:
Lloh8:
	adrp	x8, _ERR_VAL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _ERR_VAL@GOTPAGEOFF]
	b	LBB0_14
LBB0_6:
Lloh10:
	adrp	x0, _bte_ctrl_reqs@GOTPAGE
Lloh11:
	ldr	x0, [x0, _bte_ctrl_reqs@GOTPAGEOFF]
	bl	_btmemb_alloc
	cbz	x0, LBB0_11
; %bb.7:
	mov	x19, x0
Lloh12:
	adrp	x8, _PBUF_RAW@GOTPAGE
Lloh13:
	ldr	x8, [x8, _PBUF_RAW@GOTPAGEOFF]
Lloh14:
	ldr	w0, [x8]
	add	w1, w21, #1
Lloh15:
	adrp	x8, _PBUF_RAM@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PBUF_RAM@GOTPAGEOFF]
Lloh17:
	ldr	w2, [x8]
	bl	_btpbuf_alloc
	cbz	x0, LBB0_12
; %bb.8:
	mov	x23, x0
Lloh18:
	adrp	x8, _HIDP_TRANS_SETREPORT@GOTPAGE
Lloh19:
	ldr	x8, [x8, _HIDP_TRANS_SETREPORT@GOTPAGEOFF]
Lloh20:
	adrp	x9, _HIDP_DATA_RTYPE_OUPUT@GOTPAGE
Lloh21:
	ldr	x9, [x9, _HIDP_DATA_RTYPE_OUPUT@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
Lloh23:
	ldr	w9, [x9]
	orr	w8, w9, w8
	ldr	x0, [x0]
	str	w8, [x0], #1
	mov	x1, x22
	mov	x2, x21
	bl	_memcpy
	stp	x20, x23, [x19, #8]
	str	xzr, [x19]
	mov	x0, x19
	bl	___bte_send_request
	mov	x20, x0
Lloh24:
	adrp	x8, _ERR_OK@GOTPAGE
Lloh25:
	ldr	x8, [x8, _ERR_OK@GOTPAGEOFF]
Lloh26:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_10
; %bb.9:
	mov	x0, x19
	bl	___bte_waitrequest
	mov	x20, x0
LBB0_10:
Lloh27:
	adrp	x0, _bte_ctrl_reqs@GOTPAGE
Lloh28:
	ldr	x0, [x0, _bte_ctrl_reqs@GOTPAGEOFF]
	mov	x1, x19
	bl	_btmemb_free
	b	LBB0_15
LBB0_11:
Lloh29:
	adrp	x0, l_.str@PAGE
Lloh30:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERROR
	b	LBB0_13
LBB0_12:
Lloh31:
	adrp	x0, l_.str.1@PAGE
Lloh32:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERROR
Lloh33:
	adrp	x0, _bte_ctrl_reqs@GOTPAGE
Lloh34:
	ldr	x0, [x0, _bte_ctrl_reqs@GOTPAGEOFF]
	mov	x1, x19
	bl	_btmemb_free
LBB0_13:
Lloh35:
	adrp	x8, _ERR_MEM@GOTPAGE
Lloh36:
	ldr	x8, [x8, _ERR_MEM@GOTPAGEOFF]
LBB0_14:
	ldr	x20, [x8]
LBB0_15:
	mov	x0, x20
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh22
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpAdd	Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_ERR_VAL,8,3                    ; @ERR_VAL
	.comm	_STATE_DISCONNECTING,8,3        ; @STATE_DISCONNECTING
	.comm	_STATE_DISCONNECTED,8,3         ; @STATE_DISCONNECTED
	.comm	_ERR_CLSD,8,3                   ; @ERR_CLSD
	.comm	_bte_ctrl_reqs,4,2              ; @bte_ctrl_reqs
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bte_sendmessage: Could not allocate memory for request\n"

	.comm	_ERR_MEM,8,3                    ; @ERR_MEM
	.comm	_PBUF_RAW,4,2                   ; @PBUF_RAW
	.comm	_PBUF_RAM,4,2                   ; @PBUF_RAM
l_.str.1:                               ; @.str.1
	.asciz	"bte_sendmessage: Could not allocate memory for pbuf\n"

	.comm	_HIDP_TRANS_SETREPORT,4,2       ; @HIDP_TRANS_SETREPORT
	.comm	_HIDP_DATA_RTYPE_OUPUT,4,2      ; @HIDP_DATA_RTYPE_OUPUT
	.comm	_ERR_OK,8,3                     ; @ERR_OK
.subsections_via_symbols
