	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function cs_hsi_write_on_control
_cs_hsi_write_on_control:               ## @cs_hsi_write_on_control
	.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	%esi, %r15d
	movq	%rdi, %r12
	leaq	16(%rdi), %r13
	movq	%r13, %rdi
	callq	_spin_lock
	movl	(%r12), %eax
	movq	_SSI_CHANNEL_STATE_ERROR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_2
## %bb.1:
	movq	%r13, %rdi
	callq	_spin_unlock
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_2:
	movq	_SSI_CHANNEL_STATE_WRITING@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%eax, %ecx
	je	LBB0_4
## %bb.3:
	movq	8(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r13, %rdi
	callq	_spin_unlock
	movq	_EBUSY@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_4:
	orl	%eax, %ecx
	movl	%ecx, (%r12)
	movq	%r12, %rdi
	callq	_cs_claim_cmd
	movq	%rax, %r14
	movq	%r13, %rdi
	callq	_spin_unlock
	movq	%r14, %rdi
	movl	%r15d, %esi
	callq	_cs_set_cmd
	movl	$1, 4(%r14)
	movq	_cs_hsi_write_on_control_complete@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	movq	8(%r12), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	callq	_dev_dbg
	movq	8(%r12), %rdi
	movq	%r14, %rsi
	callq	_hsi_async_write
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movq	8(%r12), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_cs_hsi_control_write_error
LBB0_6:
	movq	_SSI_CHANNEL_STATE_READING@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%ebx, %ebx
	testl	%eax, (%r12)
	jne	LBB0_8
## %bb.7:
	movq	8(%r12), %rdi
	leaq	L_.str.3(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r12, %rdi
	callq	_cs_hsi_read_on_control
LBB0_8:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SSI_CHANNEL_STATE_ERROR,4,2    ## @SSI_CHANNEL_STATE_ERROR
	.comm	_EIO,4,2                        ## @EIO
	.comm	_SSI_CHANNEL_STATE_WRITING,4,2  ## @SSI_CHANNEL_STATE_WRITING
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Write still pending on control channel.\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_cs_hsi_write_on_control_complete,4,2 ## @cs_hsi_write_on_control_complete
L_.str.1:                               ## @.str.1
	.asciz	"Sending control message %08X\n"

L_.str.2:                               ## @.str.2
	.asciz	"async_write failed with %d\n"

	.comm	_SSI_CHANNEL_STATE_READING,4,2  ## @SSI_CHANNEL_STATE_READING
L_.str.3:                               ## @.str.3
	.asciz	"Restarting control reads\n"

	.no_dead_strip	_cs_hsi_write_on_control
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function cs_hsi_write_on_control
_cs_hsi_write_on_control:               ; @cs_hsi_write_on_control
	.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, x1
	mov	x19, x0
	add	x22, x0, #16
	mov	x0, x22
	bl	_spin_lock
	ldr	w8, [x19]
Lloh0:
	adrp	x9, _SSI_CHANNEL_STATE_ERROR@GOTPAGE
Lloh1:
	ldr	x9, [x9, _SSI_CHANNEL_STATE_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_2
; %bb.1:
	mov	x0, x22
	bl	_spin_unlock
Lloh3:
	adrp	x8, _EIO@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:
Lloh5:
	adrp	x9, _SSI_CHANNEL_STATE_WRITING@GOTPAGE
Lloh6:
	ldr	x9, [x9, _SSI_CHANNEL_STATE_WRITING@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.3:
	ldr	x0, [x19, #8]
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	mov	x0, x22
	bl	_spin_unlock
Lloh10:
	adrp	x8, _EBUSY@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
LBB0_4:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_5:
	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
LBB0_6:
	orr	w8, w9, w8
	str	w8, [x19]
	mov	x0, x19
	bl	_cs_claim_cmd
	mov	x21, x0
	mov	x0, x22
	bl	_spin_unlock
	mov	x0, x21
	mov	x1, x20
	bl	_cs_set_cmd
	mov	w8, #1
Lloh12:
	adrp	x9, _cs_hsi_write_on_control_complete@GOTPAGE
Lloh13:
	ldr	x9, [x9, _cs_hsi_write_on_control_complete@GOTPAGEOFF]
Lloh14:
	ldr	w9, [x9]
	stp	w9, w8, [x21]
	ldr	x0, [x19, #8]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_dev_dbg
	ldr	x0, [x19, #8]
	mov	x1, x21
	bl	_hsi_async_write
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_8
; %bb.7:
	ldr	x8, [x19, #8]
	str	x0, [sp]
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x8
	bl	_dev_err
	mov	x0, x19
	mov	x1, x21
	bl	_cs_hsi_control_write_error
LBB0_8:
	ldr	w8, [x19]
Lloh19:
	adrp	x9, _SSI_CHANNEL_STATE_READING@GOTPAGE
Lloh20:
	ldr	x9, [x9, _SSI_CHANNEL_STATE_READING@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	tst	w9, w8
	b.ne	LBB0_10
; %bb.9:
	ldr	x0, [x19, #8]
Lloh22:
	adrp	x1, l_.str.3@PAGE
Lloh23:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	bl	_cs_hsi_read_on_control
LBB0_10:
	mov	w0, #0
	b	LBB0_5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_SSI_CHANNEL_STATE_ERROR,4,2    ; @SSI_CHANNEL_STATE_ERROR
	.comm	_EIO,4,2                        ; @EIO
	.comm	_SSI_CHANNEL_STATE_WRITING,4,2  ; @SSI_CHANNEL_STATE_WRITING
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Write still pending on control channel.\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_cs_hsi_write_on_control_complete,4,2 ; @cs_hsi_write_on_control_complete
l_.str.1:                               ; @.str.1
	.asciz	"Sending control message %08X\n"

l_.str.2:                               ; @.str.2
	.asciz	"async_write failed with %d\n"

	.comm	_SSI_CHANNEL_STATE_READING,4,2  ; @SSI_CHANNEL_STATE_READING
l_.str.3:                               ; @.str.3
	.asciz	"Restarting control reads\n"

	.no_dead_strip	_cs_hsi_write_on_control
.subsections_via_symbols
