	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function stu300_start_and_await_event
_stu300_start_and_await_event:          ## @stu300_start_and_await_event
	.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	%edx, %r14d
	movl	%esi, %ebx
	movq	%rdi, %r12
	leaq	32(%rdi), %r15
	movq	%r15, %rdi
	callq	_spin_lock_irq
	leaq	16(%r12), %r13
	movq	%r13, %rdi
	callq	_init_completion
	movq	_STU300_ERROR_NONE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r12)
	movl	%r14d, 4(%r12)
	movq	%r15, %rdi
	callq	_spin_unlock_irq
	movq	_I2C_CR_INTERRUPT_ENABLE@GOTPCREL(%rip), %rax
	orl	(%rax), %ebx
	movq	_I2C_CR@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	24(%r12), %rsi
	movl	%ebx, %edi
	callq	_stu300_wr8
	movq	_STU300_TIMEOUT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_wait_for_completion_interruptible_timeout
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	je	LBB0_3
## %bb.4:
	movl	(%r12), %edx
	xorl	%r15d, %r15d
	movq	_STU300_ERROR_NONE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	je	LBB0_7
## %bb.5:
	movq	8(%r12), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r12, %rdi
	callq	_stu300_init_hw
	movq	_EIO@GOTPCREL(%rip), %rax
	jmp	LBB0_6
LBB0_1:
	movl	%eax, %r15d
	movq	8(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	movl	%eax, %edx
	movl	%r14d, %ecx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_7
LBB0_3:
	movq	8(%r12), %rdi
	leaq	L_.str.1(%rip), %rsi
	xorl	%r15d, %r15d
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r12, %rdi
	callq	_stu300_init_hw
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
LBB0_6:
	subl	(%rax), %r15d
LBB0_7:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_STU300_ERROR_NONE,4,2          ## @STU300_ERROR_NONE
	.comm	_I2C_CR_INTERRUPT_ENABLE,4,2    ## @I2C_CR_INTERRUPT_ENABLE
	.comm	_I2C_CR,8,3                     ## @I2C_CR
	.comm	_STU300_TIMEOUT,4,2             ## @STU300_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"wait_for_completion_interruptible_timeout() returned %d waiting for event %04x\n"

L_.str.1:                               ## @.str.1
	.asciz	"controller timed out waiting for event %d, reinit hardware\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.2:                               ## @.str.2
	.asciz	"controller (start) error %d waiting for event %d, reinit hardware\n"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_stu300_start_and_await_event
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function stu300_start_and_await_event
_stu300_start_and_await_event:          ; @stu300_start_and_await_event
	.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, x2
	mov	x21, x1
	mov	x19, x0
	add	x22, x0, #32
	mov	x0, x22
	bl	_spin_lock_irq
	add	x23, x19, #16
	mov	x0, x23
	bl	_init_completion
Lloh0:
	adrp	x24, _STU300_ERROR_NONE@GOTPAGE
Lloh1:
	ldr	x24, [x24, _STU300_ERROR_NONE@GOTPAGEOFF]
	ldr	w8, [x24]
	stp	w8, w20, [x19]
	mov	x0, x22
	bl	_spin_unlock_irq
Lloh2:
	adrp	x8, _I2C_CR_INTERRUPT_ENABLE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _I2C_CR_INTERRUPT_ENABLE@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	orr	w0, w8, w21
	ldr	x8, [x19, #24]
Lloh5:
	adrp	x9, _I2C_CR@GOTPAGE
Lloh6:
	ldr	x9, [x9, _I2C_CR@GOTPAGEOFF]
Lloh7:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_stu300_wr8
Lloh8:
	adrp	x8, _STU300_TIMEOUT@GOTPAGE
Lloh9:
	ldr	x8, [x8, _STU300_TIMEOUT@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	x0, x23
	bl	_wait_for_completion_interruptible_timeout
	mov	x21, x0
	tbnz	w0, #31, LBB0_4
; %bb.1:
	cbz	w21, LBB0_5
; %bb.2:
	ldr	w2, [x19]
	ldr	w8, [x24]
	cmp	w2, w8
	b.ne	LBB0_6
; %bb.3:
	mov	w21, #0
	b	LBB0_8
LBB0_4:
	ldr	x0, [x19, #8]
	str	x20, [sp]
Lloh11:
	adrp	x1, l_.str@PAGE
Lloh12:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x21
	bl	_dev_err
	b	LBB0_8
LBB0_5:
	ldr	x0, [x19, #8]
Lloh13:
	adrp	x1, l_.str.1@PAGE
Lloh14:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x20
	bl	_dev_err
	mov	x0, x19
	bl	_stu300_init_hw
Lloh15:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
	ldr	x0, [x19, #8]
                                        ; kill: def $w20 killed $w20 killed $x20 def $x20
	str	x20, [sp]
Lloh17:
	adrp	x1, l_.str.2@PAGE
Lloh18:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
	mov	x0, x19
	bl	_stu300_init_hw
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_8:
	mov	x0, x21
	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 AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_STU300_ERROR_NONE,4,2          ; @STU300_ERROR_NONE
	.comm	_I2C_CR_INTERRUPT_ENABLE,4,2    ; @I2C_CR_INTERRUPT_ENABLE
	.comm	_I2C_CR,8,3                     ; @I2C_CR
	.comm	_STU300_TIMEOUT,4,2             ; @STU300_TIMEOUT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"wait_for_completion_interruptible_timeout() returned %d waiting for event %04x\n"

l_.str.1:                               ; @.str.1
	.asciz	"controller timed out waiting for event %d, reinit hardware\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.2:                               ; @.str.2
	.asciz	"controller (start) error %d waiting for event %d, reinit hardware\n"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_stu300_start_and_await_event
.subsections_via_symbols
