	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehea_create_cq                 ## -- Begin function ehea_create_cq
	.p2align	4, 0x90
_ehea_create_cq:                        ## @ehea_create_cq
	.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	%ecx, %r12d
	movl	%edx, %r15d
	movl	%esi, %r13d
	movq	%rdi, %r14
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$40, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_4
## %bb.1:
	movq	%rax, %rbx
	leaq	8(%rax), %rsi
	movl	%r13d, 8(%rax)
	movl	%r12d, 12(%rax)
	movl	%r15d, 20(%rax)
	movq	%r14, 32(%rax)
	movl	(%r14), %edi
	leaq	24(%rax), %rcx
	movq	%rax, %rdx
	callq	_ehea_h_alloc_resource_cq
	movq	_H_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_2
## %bb.5:
	movq	%rbx, %r15
	addq	$4, %r15
	movl	16(%rbx), %esi
	movq	_EHEA_PAGESIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movl	$4, %ecx
	callq	_hw_queue_ctor
	testl	%eax, %eax
	jne	LBB0_13
## %bb.6:
	cmpl	$0, 16(%rbx)
	jle	LBB0_19
## %bb.7:
	xorl	%r12d, %r12d
	jmp	LBB0_8
LBB0_2:
	leaq	L_.str(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_23:                                ##   in Loop: Header=BB0_8 Depth=1
	movq	_H_PAGE_REGISTERED@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jne	LBB0_24
LBB0_18:                                ##   in Loop: Header=BB0_8 Depth=1
	incl	%r12d
	cmpl	%r8d, %r12d
	jge	LBB0_19
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	callq	_hw_qpageit_get_inc
	testq	%rax, %rax
	je	LBB0_9
## %bb.10:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%rax, %rdi
	callq	___pa
	movl	(%r14), %edi
	movq	_EHEA_CQ_REGISTER_ORIG@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	(%rbx), %ecx
	xorl	%esi, %esi
	movl	%eax, %r8d
	movl	$1, %r9d
	callq	_ehea_h_register_rpage
	movl	%eax, %r13d
	movl	16(%rbx), %r8d
	movq	_H_SUCCESS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r13d
	jl	LBB0_11
## %bb.14:                              ##   in Loop: Header=BB0_8 Depth=1
	leal	-1(%r8), %eax
	cmpl	%eax, %r12d
	jne	LBB0_23
## %bb.15:                              ##   in Loop: Header=BB0_8 Depth=1
	movq	%r15, %rdi
	callq	_hw_qpageit_get_inc
	movq	_H_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %r13d
	jne	LBB0_21
## %bb.16:                              ##   in Loop: Header=BB0_8 Depth=1
	testq	%rax, %rax
	jne	LBB0_21
## %bb.17:                              ##   in Loop: Header=BB0_8 Depth=1
	movl	16(%rbx), %r8d
	jmp	LBB0_18
LBB0_19:
	movq	%r15, %rdi
	callq	_hw_qeit_reset
	movq	%rbx, %rdi
	callq	_ehea_reset_cq_ep
	movq	%rbx, %rdi
	callq	_ehea_reset_cq_n1
	jmp	LBB0_20
LBB0_9:
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_12
LBB0_11:
	leaq	L_.str.2(%rip), %rdi
	movq	%rbx, %rsi
	movl	%r13d, %edx
	movl	%r12d, %ecx
                                        ## kill: def $r8d killed $r8d killed $r8
	xorl	%eax, %eax
	callq	_pr_err
	jmp	LBB0_12
LBB0_24:
	leaq	L_.str.4(%rip), %rdi
	jmp	LBB0_22
LBB0_21:
	leaq	L_.str.3(%rip), %rdi
LBB0_22:
	movl	%r13d, %esi
	xorl	%eax, %eax
	callq	_pr_err
LBB0_12:
	movq	%r15, %rdi
	callq	_hw_queue_dtor
LBB0_13:
	movl	(%r14), %edi
	movl	(%rbx), %esi
	movq	_FORCE_FREE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_ehea_h_free_resource
LBB0_3:
	movq	%rbx, %rdi
	callq	_kfree
LBB0_4:
	xorl	%ebx, %ebx
LBB0_20:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_H_SUCCESS,4,2                  ## @H_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"alloc_resource_cq failed\n"

	.comm	_EHEA_PAGESIZE,4,2              ## @EHEA_PAGESIZE
L_.str.1:                               ## @.str.1
	.asciz	"hw_qpageit_get_inc failed\n"

	.comm	_EHEA_CQ_REGISTER_ORIG,4,2      ## @EHEA_CQ_REGISTER_ORIG
L_.str.2:                               ## @.str.2
	.asciz	"register_rpage_cq failed ehea_cq=%p hret=%llx counter=%i act_pages=%i\n"

L_.str.3:                               ## @.str.3
	.asciz	"registration of pages not complete hret=%llx\n"

	.comm	_H_PAGE_REGISTERED,4,2          ## @H_PAGE_REGISTERED
L_.str.4:                               ## @.str.4
	.asciz	"CQ: registration of page failed hret=%llx\n"

	.comm	_FORCE_FREE,4,2                 ## @FORCE_FREE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_ehea_create_cq                 ; -- Begin function ehea_create_cq
	.p2align	2
_ehea_create_cq:                        ; @ehea_create_cq
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x22, x3
	mov	x21, x2
	mov	x23, x1
	mov	x20, x0
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #40
	bl	_kzalloc
	mov	x19, x0
	cbz	x0, LBB0_21
; %bb.1:
	mov	x1, x19
	str	w23, [x1, #8]!
	str	w22, [x19, #12]
	str	w21, [x19, #20]
	str	x20, [x19, #32]
	add	x3, x19, #24
	ldr	w0, [x20]
	mov	x2, x19
	bl	_ehea_h_alloc_resource_cq
Lloh3:
	adrp	x23, _H_SUCCESS@GOTPAGE
Lloh4:
	ldr	x23, [x23, _H_SUCCESS@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w0, w8
	b.ne	LBB0_5
; %bb.2:
	add	x21, x19, #4
	ldr	w1, [x19, #16]
Lloh5:
	adrp	x8, _EHEA_PAGESIZE@GOTPAGE
Lloh6:
	ldr	x8, [x8, _EHEA_PAGESIZE@GOTPAGEOFF]
Lloh7:
	ldr	w2, [x8]
	mov	x0, x21
	mov	w3, #4
	bl	_hw_queue_ctor
	cbnz	w0, LBB0_19
; %bb.3:
	ldr	w8, [x19, #16]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.4:
	mov	w24, #0
Lloh8:
	adrp	x25, _EHEA_CQ_REGISTER_ORIG@GOTPAGE
Lloh9:
	ldr	x25, [x25, _EHEA_CQ_REGISTER_ORIG@GOTPAGEOFF]
Lloh10:
	adrp	x26, _H_PAGE_REGISTERED@GOTPAGE
Lloh11:
	ldr	x26, [x26, _H_PAGE_REGISTERED@GOTPAGEOFF]
	b	LBB0_8
LBB0_5:
Lloh12:
	adrp	x0, l_.str@PAGE
Lloh13:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_err
	b	LBB0_20
LBB0_6:                                 ;   in Loop: Header=BB0_8 Depth=1
	ldr	w9, [x26]
	cmp	w22, w9
	b.ne	LBB0_16
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=1
	add	w24, w24, #1
	cmp	w24, w8
	b.ge	LBB0_13
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x21
	bl	_hw_qpageit_get_inc
	cbz	x0, LBB0_14
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=1
	bl	___pa
	mov	x4, x0
	ldr	w0, [x20]
	ldr	w2, [x25]
	ldr	w3, [x19]
	mov	w1, #0
	mov	w5, #1
	bl	_ehea_h_register_rpage
	mov	x22, x0
	ldr	w9, [x23]
	ldr	w8, [x19, #16]
	cmp	w0, w9
	b.lt	LBB0_15
; %bb.10:                               ;   in Loop: Header=BB0_8 Depth=1
	sub	w9, w8, #1
	cmp	w24, w9
	b.ne	LBB0_6
; %bb.11:                               ;   in Loop: Header=BB0_8 Depth=1
	mov	x0, x21
	bl	_hw_qpageit_get_inc
	ldr	w8, [x23]
	cmp	w22, w8
	ccmp	x0, #0, #0, eq
	b.ne	LBB0_17
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=1
	ldr	w8, [x19, #16]
	b	LBB0_7
LBB0_13:
	mov	x0, x21
	bl	_hw_qeit_reset
	mov	x0, x19
	bl	_ehea_reset_cq_ep
	mov	x0, x19
	bl	_ehea_reset_cq_n1
	b	LBB0_21
LBB0_14:
Lloh14:
	adrp	x0, l_.str.1@PAGE
Lloh15:
	add	x0, x0, l_.str.1@PAGEOFF
	b	LBB0_18
LBB0_15:
	stp	x24, x8, [sp, #16]
	stp	x19, x22, [sp]
Lloh16:
	adrp	x0, l_.str.2@PAGE
Lloh17:
	add	x0, x0, l_.str.2@PAGEOFF
	b	LBB0_18
LBB0_16:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	str	x22, [sp]
Lloh18:
	adrp	x0, l_.str.4@PAGE
Lloh19:
	add	x0, x0, l_.str.4@PAGEOFF
	b	LBB0_18
LBB0_17:
                                        ; kill: def $w22 killed $w22 killed $x22 def $x22
	str	x22, [sp]
Lloh20:
	adrp	x0, l_.str.3@PAGE
Lloh21:
	add	x0, x0, l_.str.3@PAGEOFF
LBB0_18:
	bl	_pr_err
	mov	x0, x21
	bl	_hw_queue_dtor
LBB0_19:
	ldr	w0, [x20]
	ldr	w1, [x19]
Lloh22:
	adrp	x8, _FORCE_FREE@GOTPAGE
Lloh23:
	ldr	x8, [x8, _FORCE_FREE@GOTPAGEOFF]
Lloh24:
	ldr	w2, [x8]
	bl	_ehea_h_free_resource
LBB0_20:
	mov	x0, x19
	bl	_kfree
	mov	x19, #0
LBB0_21:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.cfi_endproc
                                        ; -- End function
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_H_SUCCESS,4,2                  ; @H_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"alloc_resource_cq failed\n"

	.comm	_EHEA_PAGESIZE,4,2              ; @EHEA_PAGESIZE
l_.str.1:                               ; @.str.1
	.asciz	"hw_qpageit_get_inc failed\n"

	.comm	_EHEA_CQ_REGISTER_ORIG,4,2      ; @EHEA_CQ_REGISTER_ORIG
l_.str.2:                               ; @.str.2
	.asciz	"register_rpage_cq failed ehea_cq=%p hret=%llx counter=%i act_pages=%i\n"

l_.str.3:                               ; @.str.3
	.asciz	"registration of pages not complete hret=%llx\n"

	.comm	_H_PAGE_REGISTERED,4,2          ; @H_PAGE_REGISTERED
l_.str.4:                               ; @.str.4
	.asciz	"CQ: registration of page failed hret=%llx\n"

	.comm	_FORCE_FREE,4,2                 ; @FORCE_FREE
.subsections_via_symbols
