	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ngene_command_mutex
_ngene_command_mutex:                   ## @ngene_command_mutex
	.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
	movq	%rsi, %r14
	movq	%rdi, %r13
	movq	64(%rdi), %r15
	movl	$0, (%rdi)
	movl	16(%rsi), %eax
	movq	_CMD_FWLOAD_PREPARE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_2
## %bb.1:
	movl	$1, 4(%r13)
	movq	_NGENE_INT_COUNTS@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_ngreadl
	movl	%eax, 56(%r13)
	movq	_NGENE_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%r12d, %r12d
	xorl	%edi, %edi
	callq	_ngwritel
	movq	_NGENE_COMMAND_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	callq	_ngwritel
	movq	_NGENE_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	callq	_ngwritel
	movq	_NGENE_STATUS_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	callq	_ngwritel
	jmp	LBB0_4
LBB0_2:
	movq	_CMD_FWLOAD_FINISH@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_5
## %bb.3:
	movl	8(%r13), %r12d
	movq	_NGENE_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	callq	_ngwritel
	movq	_NGENE_COMMAND_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ngwritel
	leal	256(%r12), %edi
	movq	_NGENE_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ngwritel
	movq	_NGENE_STATUS_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_ngwritel
	addl	$512, %r12d                     ## imm = 0x200
LBB0_4:
	movq	_NGENE_EVENT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	callq	_ngwritel
	movq	_NGENE_EVENT_HI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%edi, %edi
	callq	_ngwritel
LBB0_5:
	movq	48(%r13), %rdi
	movq	8(%r14), %rsi
	movl	(%r14), %edx
	addl	$2, %edx
	callq	_memcpy
	cmpl	$0, 4(%r13)
	je	LBB0_7
## %bb.6:
	movq	_HOST_TO_NGENE@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	8(%r14), %rsi
	movl	(%r14), %edx
	addl	$2, %edx
	callq	_ngcpyto
LBB0_7:
	leaq	32(%r13), %rbx
	movq	%rbx, %rdi
	callq	_spin_lock_irq
	movq	16(%r13), %rax
	movslq	4(%r14), %rcx
	xorl	%edx, %edx
	testq	%rcx, %rcx
	sete	%dl
	leaq	(%rax,%rcx,8), %rcx
	leaq	(%rcx,%rdx,8), %rsi
	movq	$0, (%rcx,%rdx,8)
	xorps	%xmm0, %xmm0
	movups	%xmm0, (%rax)
	movq	%rsi, 40(%r13)
	movq	%rbx, %rdi
	callq	_spin_unlock_irq
	movq	_FORCE_INT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$1, %edi
	callq	_ngwritel
	movl	28(%r13), %edi
	xorl	%esi, %esi
	cmpl	$1, (%r13)
	sete	%sil
	movq	_HZ@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	addl	%edx, %edx
	callq	_wait_event_timeout
	movl	16(%r14), %edx
	testl	%eax, %eax
	je	LBB0_8
## %bb.9:
	movq	_CMD_FWLOAD_FINISH@GOTPCREL(%rip), %rax
	cmpl	(%rax), %edx
	jne	LBB0_11
## %bb.10:
	movl	$0, 4(%r13)
LBB0_11:
	movl	%edx, 24(%r13)
	movl	4(%r14), %edx
	xorl	%r15d, %r15d
	testl	%edx, %edx
	je	LBB0_13
## %bb.12:
	movq	8(%r14), %rdi
	movq	16(%r13), %rsi
	callq	_memcpy
	jmp	LBB0_13
LBB0_8:
	movl	24(%r13), %ecx
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_dev_err
	movq	%r13, %rdi
	callq	_dump_command_io
	movl	$-1, %r15d
LBB0_13:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_CMD_FWLOAD_PREPARE,4,2         ## @CMD_FWLOAD_PREPARE
	.comm	_NGENE_INT_COUNTS,4,2           ## @NGENE_INT_COUNTS
	.comm	_NGENE_COMMAND,4,2              ## @NGENE_COMMAND
	.comm	_NGENE_COMMAND_HI,4,2           ## @NGENE_COMMAND_HI
	.comm	_NGENE_STATUS,4,2               ## @NGENE_STATUS
	.comm	_NGENE_STATUS_HI,4,2            ## @NGENE_STATUS_HI
	.comm	_NGENE_EVENT,4,2                ## @NGENE_EVENT
	.comm	_NGENE_EVENT_HI,4,2             ## @NGENE_EVENT_HI
	.comm	_CMD_FWLOAD_FINISH,4,2          ## @CMD_FWLOAD_FINISH
	.comm	_HOST_TO_NGENE,4,2              ## @HOST_TO_NGENE
	.comm	_FORCE_INT,4,2                  ## @FORCE_INT
	.comm	_HZ,4,2                         ## @HZ
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Command timeout cmd=%02x prev=%02x\n"

	.no_dead_strip	_ngene_command_mutex
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ngene_command_mutex
_ngene_command_mutex:                   ; @ngene_command_mutex
	.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
	mov	x20, x1
	mov	x19, x0
	ldr	x21, [x0, #64]
	str	wzr, [x0]
	ldr	w8, [x1, #16]
Lloh0:
	adrp	x9, _CMD_FWLOAD_PREPARE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _CMD_FWLOAD_PREPARE@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
Lloh3:
	adrp	x23, _CMD_FWLOAD_FINISH@GOTPAGE
Lloh4:
	ldr	x23, [x23, _CMD_FWLOAD_FINISH@GOTPAGEOFF]
	cmp	w8, w9
	b.ne	LBB0_2
; %bb.1:
	mov	w8, #1
	str	w8, [x19, #4]
Lloh5:
	adrp	x8, _NGENE_INT_COUNTS@GOTPAGE
Lloh6:
	ldr	x8, [x8, _NGENE_INT_COUNTS@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	bl	_ngreadl
	str	w0, [x19, #56]
Lloh8:
	adrp	x8, _NGENE_COMMAND@GOTPAGE
Lloh9:
	ldr	x8, [x8, _NGENE_COMMAND@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_ngwritel
Lloh11:
	adrp	x8, _NGENE_COMMAND_HI@GOTPAGE
Lloh12:
	ldr	x8, [x8, _NGENE_COMMAND_HI@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_ngwritel
Lloh14:
	adrp	x8, _NGENE_STATUS@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NGENE_STATUS@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_ngwritel
Lloh17:
	adrp	x8, _NGENE_STATUS_HI@GOTPAGE
Lloh18:
	ldr	x8, [x8, _NGENE_STATUS_HI@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_ngwritel
	mov	w0, #0
	b	LBB0_4
LBB0_2:
	ldr	w9, [x23]
	cmp	w8, w9
	b.ne	LBB0_5
; %bb.3:
	ldr	w22, [x19, #8]
Lloh20:
	adrp	x8, _NGENE_COMMAND@GOTPAGE
Lloh21:
	ldr	x8, [x8, _NGENE_COMMAND@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_ngwritel
Lloh23:
	adrp	x8, _NGENE_COMMAND_HI@GOTPAGE
Lloh24:
	ldr	x8, [x8, _NGENE_COMMAND_HI@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	bl	_ngwritel
	add	w0, w22, #256
Lloh26:
	adrp	x8, _NGENE_STATUS@GOTPAGE
Lloh27:
	ldr	x8, [x8, _NGENE_STATUS@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	bl	_ngwritel
Lloh29:
	adrp	x8, _NGENE_STATUS_HI@GOTPAGE
Lloh30:
	ldr	x8, [x8, _NGENE_STATUS_HI@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	bl	_ngwritel
	add	w0, w22, #512
LBB0_4:
Lloh32:
	adrp	x8, _NGENE_EVENT@GOTPAGE
Lloh33:
	ldr	x8, [x8, _NGENE_EVENT@GOTPAGEOFF]
Lloh34:
	ldr	w1, [x8]
	bl	_ngwritel
Lloh35:
	adrp	x8, _NGENE_EVENT_HI@GOTPAGE
Lloh36:
	ldr	x8, [x8, _NGENE_EVENT_HI@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	mov	w0, #0
	bl	_ngwritel
LBB0_5:
	ldr	x0, [x19, #48]
	ldr	x1, [x20, #8]
	ldr	w8, [x20]
	add	w2, w8, #2
	bl	_memcpy
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_7
; %bb.6:
Lloh38:
	adrp	x8, _HOST_TO_NGENE@GOTPAGE
Lloh39:
	ldr	x8, [x8, _HOST_TO_NGENE@GOTPAGEOFF]
Lloh40:
	ldr	w0, [x8]
	ldr	x1, [x20, #8]
	ldr	w8, [x20]
	add	w2, w8, #2
	bl	_ngcpyto
LBB0_7:
	add	x22, x19, #32
	mov	x0, x22
	bl	_spin_lock_irq
	ldr	x8, [x19, #16]
	ldrsw	x9, [x20, #4]
	cmp	x9, #0
	cset	w10, eq
	add	x9, x8, x9, lsl #3
	add	x9, x9, w10, uxtw #3
	str	xzr, [x9]
	stp	xzr, xzr, [x8]
	str	x9, [x19, #40]
	mov	x0, x22
	bl	_spin_unlock_irq
Lloh41:
	adrp	x8, _FORCE_INT@GOTPAGE
Lloh42:
	ldr	x8, [x8, _FORCE_INT@GOTPAGEOFF]
Lloh43:
	ldr	w1, [x8]
	mov	w0, #1
	bl	_ngwritel
	ldr	w0, [x19, #28]
	ldr	w8, [x19]
	cmp	w8, #1
	cset	w1, eq
Lloh44:
	adrp	x8, _HZ@GOTPAGE
Lloh45:
	ldr	x8, [x8, _HZ@GOTPAGEOFF]
Lloh46:
	ldr	w8, [x8]
	lsl	w2, w8, #1
	bl	_wait_event_timeout
	ldr	w2, [x20, #16]
	cbz	w0, LBB0_13
; %bb.8:
	ldr	w8, [x23]
	cmp	w2, w8
	b.ne	LBB0_10
; %bb.9:
	str	wzr, [x19, #4]
LBB0_10:
	str	w2, [x19, #24]
	ldr	w2, [x20, #4]
	cbz	w2, LBB0_12
; %bb.11:
	ldr	x0, [x20, #8]
	ldr	x1, [x19, #16]
	bl	_memcpy
LBB0_12:
	mov	w0, #0
	b	LBB0_14
LBB0_13:
	ldr	w3, [x19, #24]
Lloh47:
	adrp	x1, l_.str@PAGE
Lloh48:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	bl	_dev_err
	mov	x0, x19
	bl	_dump_command_io
	mov	w0, #-1
LBB0_14:
	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 AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh38, Lloh39, Lloh40
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpLdrGotLdr	Lloh41, Lloh42, Lloh43
	.loh AdrpAdd	Lloh47, Lloh48
	.cfi_endproc
                                        ; -- End function
	.comm	_CMD_FWLOAD_PREPARE,4,2         ; @CMD_FWLOAD_PREPARE
	.comm	_NGENE_INT_COUNTS,4,2           ; @NGENE_INT_COUNTS
	.comm	_NGENE_COMMAND,4,2              ; @NGENE_COMMAND
	.comm	_NGENE_COMMAND_HI,4,2           ; @NGENE_COMMAND_HI
	.comm	_NGENE_STATUS,4,2               ; @NGENE_STATUS
	.comm	_NGENE_STATUS_HI,4,2            ; @NGENE_STATUS_HI
	.comm	_NGENE_EVENT,4,2                ; @NGENE_EVENT
	.comm	_NGENE_EVENT_HI,4,2             ; @NGENE_EVENT_HI
	.comm	_CMD_FWLOAD_FINISH,4,2          ; @CMD_FWLOAD_FINISH
	.comm	_HOST_TO_NGENE,4,2              ; @HOST_TO_NGENE
	.comm	_FORCE_INT,4,2                  ; @FORCE_INT
	.comm	_HZ,4,2                         ; @HZ
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Command timeout cmd=%02x prev=%02x\n"

	.no_dead_strip	_ngene_command_mutex
.subsections_via_symbols
