	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_post_cqp_request           ## -- Begin function nes_post_cqp_request
	.p2align	4, 0x90
_nes_post_cqp_request:                  ## @nes_post_cqp_request
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r12
	movq	_NES_CQP_WQE_COMP_CTX_LOW_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	leaq	16(%rdi), %r13
	movq	%r13, %rdi
	callq	_spin_lock_irqsave
	movl	4(%r12), %eax
	leal	(%rax,%rax), %ecx
	addl	(%r12), %ecx
	subl	8(%r12), %ecx
	decl	%eax
	andl	%ecx, %eax
	cmpl	$1, %eax
	je	LBB0_5
## %bb.1:
	leaq	32(%r12), %rdi
	callq	_list_empty
	testq	%rax, %rax
	je	LBB0_5
## %bb.2:
	movl	%ebx, -48(%rbp)                 ## 4-byte Spill
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movslq	8(%r12), %rbx
	leal	1(%rbx), %eax
	movl	4(%r12), %ecx
	decl	%ecx
	andl	%eax, %ecx
	movl	%ecx, 8(%r12)
	movq	24(%r12), %r14
	leaq	(%r14,%rbx,8), %rdi
	leaq	8(%r15), %rsi
	movl	$8, %edx
	callq	_memcpy
	movq	(%r14,%rbx,8), %rax
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_le32_to_cpu
	movslq	%eax, %r13
	movq	_NES_CQP_OPCODE_MASK@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	andq	%r13, %rax
	movq	_NES_CQP_DOWNLOAD_SEGMENT@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_4
## %bb.3:
	movq	_NES_CQP_WQE_DL_COMP_CTX_LOW_IDX@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
LBB0_4:
	xorl	%eax, %eax
	callq	_barrier
	movq	(%r14,%rbx,8), %rdi
	movl	-48(%rbp), %esi                 ## 4-byte Reload
	movq	%r15, %rdx
	callq	_set_wqe_64bit_value
	movq	_NES_DBG_CQP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	_NES_CQP_OPCODE_MASK@GOTPCREL(%rip), %rax
	andq	(%rax), %r13
	movq	(%r14,%rbx,8), %rax
	movq	_NES_CQP_WQE_ID_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_le32_to_cpu
	movl	%eax, %ebx
	movl	8(%r12), %r14d
	movl	(%r12), %eax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	4(%r12), %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	20(%r15), %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	leaq	16(%r15), %rdi
	callq	_atomic_read
	movl	%eax, %r10d
	leaq	L_.str(%rip), %rsi
	movl	-52(%rbp), %edi                 ## 4-byte Reload
	movq	%r13, %rdx
	movl	%ebx, %ecx
	movq	%r15, %r8
	movl	%r14d, %r9d
	xorl	%eax, %eax
	pushq	%r10
	pushq	-64(%rbp)                       ## 8-byte Folded Reload
	pushq	-72(%rbp)                       ## 8-byte Folded Reload
	pushq	-48(%rbp)                       ## 8-byte Folded Reload
	callq	_nes_debug
	addq	$32, %rsp
	xorl	%eax, %eax
	callq	_barrier
	movq	_NES_WQE_ALLOC@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	40(%r12), %rdi
	movl	$25165824, %esi                 ## imm = 0x1800000
	orl	12(%r12), %esi
	callq	_nes_write32
	xorl	%eax, %eax
	callq	_barrier
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_6
LBB0_5:
	movq	_NES_DBG_CQP@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	8(%r15), %rax
	movq	_NES_CQP_WQE_OPCODE_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_le32_to_cpu
	movl	%eax, %ebx
	andl	$63, %ebx
	movq	8(%r15), %rax
	movq	_NES_CQP_WQE_ID_IDX@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_le32_to_cpu
	leaq	L_.str.1(%rip), %rsi
	movl	%r14d, %edi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_nes_debug
	addq	$32, %r12
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_list_add_tail
LBB0_6:
	movq	%r13, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_spin_unlock_irqrestore         ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NES_CQP_WQE_COMP_CTX_LOW_IDX,4,2 ## @NES_CQP_WQE_COMP_CTX_LOW_IDX
	.comm	_NES_CQP_WQE_OPCODE_IDX,8,3     ## @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_OPCODE_MASK,8,3        ## @NES_CQP_OPCODE_MASK
	.comm	_NES_CQP_DOWNLOAD_SEGMENT,8,3   ## @NES_CQP_DOWNLOAD_SEGMENT
	.comm	_NES_CQP_WQE_DL_COMP_CTX_LOW_IDX,4,2 ## @NES_CQP_WQE_DL_COMP_CTX_LOW_IDX
	.comm	_NES_DBG_CQP,4,2                ## @NES_DBG_CQP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"CQP request (opcode 0x%02X), line 1 = 0x%08X put on CQPs SQ, request = %p, cqp_head = %u, cqp_tail = %u, cqp_size = %u, waiting = %d, refcount = %d.\n"

	.comm	_NES_CQP_WQE_ID_IDX,8,3         ## @NES_CQP_WQE_ID_IDX
	.comm	_NES_WQE_ALLOC,8,3              ## @NES_WQE_ALLOC
L_.str.1:                               ## @.str.1
	.asciz	"CQP request %p (opcode 0x%02X), line 1 = 0x%08X put on the pending queue.\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nes_post_cqp_request           ; -- Begin function nes_post_cqp_request
	.p2align	2
_nes_post_cqp_request:                  ; @nes_post_cqp_request
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _NES_CQP_WQE_COMP_CTX_LOW_IDX@GOTPAGE
Lloh1:
	ldr	x8, [x8, _NES_CQP_WQE_COMP_CTX_LOW_IDX@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
	add	x19, x0, #16
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldp	w8, w9, [x20]
	add	w8, w8, w9, lsl #1
	ldr	w10, [x20, #8]
	sub	w9, w9, #1
	sub	w8, w8, w10
	and	w8, w8, w9
	cmp	w8, #1
	b.eq	LBB0_3
; %bb.1:
	add	x0, x20, #32
	bl	_list_empty
	cbz	x0, LBB0_3
; %bb.2:
	ldp	w9, w8, [x20, #4]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	w10, w8, #1
	sub	w9, w9, #1
	and	w9, w9, w10
	str	w9, [x20, #8]
	ldr	x9, [x20, #24]
	add	x22, x9, x8, lsl #3
	add	x1, x21, #8
	mov	x0, x22
	mov	w2, #8
	bl	_memcpy
	ldr	x8, [x22]
Lloh3:
	adrp	x9, _NES_CQP_WQE_OPCODE_IDX@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NES_CQP_WQE_OPCODE_IDX@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le32_to_cpu
                                        ; kill: def $w0 killed $w0 def $x0
	sxtw	x24, w0
Lloh6:
	adrp	x25, _NES_CQP_OPCODE_MASK@GOTPAGE
Lloh7:
	ldr	x25, [x25, _NES_CQP_OPCODE_MASK@GOTPAGEOFF]
	ldr	x8, [x25]
	and	x8, x8, x24
Lloh8:
	adrp	x9, _NES_CQP_DOWNLOAD_SEGMENT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _NES_CQP_DOWNLOAD_SEGMENT@GOTPAGEOFF]
Lloh10:
	ldr	x9, [x9]
Lloh11:
	adrp	x10, _NES_CQP_WQE_DL_COMP_CTX_LOW_IDX@GOTPAGE
Lloh12:
	ldr	x10, [x10, _NES_CQP_WQE_DL_COMP_CTX_LOW_IDX@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	cmp	x8, x9
	csel	w23, w10, w23, eq
	bl	_barrier
	ldr	x0, [x22]
	mov	x1, x23
	mov	x2, x21
	bl	_set_wqe_64bit_value
Lloh14:
	adrp	x8, _NES_DBG_CQP@GOTPAGE
Lloh15:
	ldr	x8, [x8, _NES_DBG_CQP@GOTPAGEOFF]
Lloh16:
	ldr	w23, [x8]
	ldr	x8, [x25]
	and	x24, x8, x24
	ldr	x8, [x22]
Lloh17:
	adrp	x9, _NES_CQP_WQE_ID_IDX@GOTPAGE
Lloh18:
	ldr	x9, [x9, _NES_CQP_WQE_ID_IDX@GOTPAGEOFF]
Lloh19:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le32_to_cpu
	mov	x22, x0
	add	x0, x21, #16
	ldp	w27, w25, [x20, #4]
	ldr	w26, [x20]
	ldr	w28, [x21, #20]
	bl	_atomic_read
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x28, x0, [sp, #48]
	stp	x26, x27, [sp, #32]
	stp	x21, x25, [sp, #16]
Lloh20:
	adrp	x1, l_.str@PAGE
Lloh21:
	add	x1, x1, l_.str@PAGEOFF
	stp	x24, x22, [sp]
	mov	x0, x23
	bl	_nes_debug
	bl	_barrier
	ldr	x8, [x20, #40]
Lloh22:
	adrp	x9, _NES_WQE_ALLOC@GOTPAGE
Lloh23:
	ldr	x9, [x9, _NES_WQE_ALLOC@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	add	x0, x9, x8
	ldr	w8, [x20, #12]
	orr	w1, w8, #0x1800000
	bl	_nes_write32
	bl	_barrier
	b	LBB0_4
LBB0_3:
Lloh25:
	adrp	x8, _NES_DBG_CQP@GOTPAGE
Lloh26:
	ldr	x8, [x8, _NES_DBG_CQP@GOTPAGEOFF]
Lloh27:
	ldr	w22, [x8]
	ldr	x8, [x21, #8]
Lloh28:
	adrp	x9, _NES_CQP_WQE_OPCODE_IDX@GOTPAGE
Lloh29:
	ldr	x9, [x9, _NES_CQP_WQE_OPCODE_IDX@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le32_to_cpu
	and	w23, w0, #0x3f
	ldr	x8, [x21, #8]
Lloh31:
	adrp	x9, _NES_CQP_WQE_ID_IDX@GOTPAGE
Lloh32:
	ldr	x9, [x9, _NES_CQP_WQE_ID_IDX@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le32_to_cpu
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x23, x0, [sp, #8]
	str	x21, [sp]
Lloh34:
	adrp	x1, l_.str.1@PAGE
Lloh35:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x22
	bl	_nes_debug
	add	x1, x20, #32
	mov	x0, x21
	bl	_list_add_tail
LBB0_4:
	mov	x0, x19
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	b	_spin_unlock_irqrestore
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_NES_CQP_WQE_COMP_CTX_LOW_IDX,4,2 ; @NES_CQP_WQE_COMP_CTX_LOW_IDX
	.comm	_NES_CQP_WQE_OPCODE_IDX,8,3     ; @NES_CQP_WQE_OPCODE_IDX
	.comm	_NES_CQP_OPCODE_MASK,8,3        ; @NES_CQP_OPCODE_MASK
	.comm	_NES_CQP_DOWNLOAD_SEGMENT,8,3   ; @NES_CQP_DOWNLOAD_SEGMENT
	.comm	_NES_CQP_WQE_DL_COMP_CTX_LOW_IDX,4,2 ; @NES_CQP_WQE_DL_COMP_CTX_LOW_IDX
	.comm	_NES_DBG_CQP,4,2                ; @NES_DBG_CQP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"CQP request (opcode 0x%02X), line 1 = 0x%08X put on CQPs SQ, request = %p, cqp_head = %u, cqp_tail = %u, cqp_size = %u, waiting = %d, refcount = %d.\n"

	.comm	_NES_CQP_WQE_ID_IDX,8,3         ; @NES_CQP_WQE_ID_IDX
	.comm	_NES_WQE_ALLOC,8,3              ; @NES_WQE_ALLOC
l_.str.1:                               ; @.str.1
	.asciz	"CQP request %p (opcode 0x%02X), line 1 = 0x%08X put on the pending queue.\n"

.subsections_via_symbols
