	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nes_setup_mmap_qp
_nes_setup_mmap_qp:                     ## @nes_setup_mmap_qp
	.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	%rdi, %r15
	movq	(%rsi), %r14
	movslq	%edx, %r12
	shlq	$2, %r12
	movslq	%ecx, %r13
	shlq	$2, %r13
	leal	(%r12,%r13), %ebx
	movl	$4, %edi
	movl	$256, %esi                      ## imm = 0x100
	callq	_max
                                        ## kill: def $eax killed $eax def $rax
	leal	(%rbx,%rax), %ecx
	addl	%ebx, %eax
	addl	$256, %eax                      ## imm = 0x100
	movl	%eax, (%r15)
	movq	_PAGE_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	addl	%edx, %ecx
	addl	$255, %ecx
	movl	%ecx, (%r15)
	xorl	%esi, %esi
	subl	(%rax), %esi
	andl	%ecx, %esi
	movl	%esi, (%r15)
	movl	(%r14), %edi
	leaq	40(%r15), %rdx
	callq	_pci_alloc_consistent
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %rbx
	movq	_NES_DBG_QP@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	40(%r15), %rcx
	movl	(%r15), %r8d
	leaq	L_.str(%rip), %rsi
	movq	%rbx, %rdx
	callq	_nes_debug
	movl	(%r15), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	%rbx, 56(%r15)
	addq	%r12, %rbx
	movq	%rbx, 48(%r15)
	addq	40(%r15), %r12
	movq	%r12, 32(%r15)
	leaq	(%rbx,%r13), %rdi
	movq	%rdi, 16(%r15)
	addq	%r13, %r12
	movq	%r12, 24(%r15)
	addq	%r13, %rbx
	addq	$256, %rbx                      ## imm = 0x100
	xorl	%esi, %esi
	movl	$256, %edx                      ## imm = 0x100
	callq	_memset
	movq	%rbx, 8(%r15)
	movl	$256, %eax                      ## imm = 0x100
	addq	24(%r15), %rax
	movq	%rax, 64(%r15)
	movq	%rbx, %rdi
	xorl	%esi, %esi
	movl	$1, %edx
	callq	_memset
	xorl	%eax, %eax
	jmp	LBB0_3
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_3:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PAGE_SIZE,4,2                  ## @PAGE_SIZE
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_NES_DBG_QP,4,2                 ## @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"PCI consistent memory for host descriptor rings located @ %p (pa = 0x%08lX.) size = %u.\n"

	.no_dead_strip	_nes_setup_mmap_qp
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nes_setup_mmap_qp
_nes_setup_mmap_qp:                     ; @nes_setup_mmap_qp
	.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
                                        ; kill: def $w3 killed $w3 def $x3
                                        ; kill: def $w2 killed $w2 def $x2
	mov	x19, x0
	ldr	x20, [x1]
	sbfiz	x21, x2, #2, #32
	sbfiz	x22, x3, #2, #32
	add	w23, w22, w21
	mov	w0, #4
	mov	w1, #256
	bl	_max
	add	w8, w23, w0
	add	w8, w8, #256
Lloh0:
	adrp	x9, _PAGE_SIZE@GOTPAGE
Lloh1:
	ldr	x9, [x9, _PAGE_SIZE@GOTPAGEOFF]
	str	w8, [x19]
	ldr	w10, [x9]
	add	w8, w8, w10
	sub	w8, w8, #1
	str	w8, [x19]
	ldr	w9, [x9]
	neg	w9, w9
	and	w1, w8, w9
	mov	x2, x19
	str	w1, [x2], #40
	ldr	w0, [x20]
	bl	_pci_alloc_consistent
	cbz	x0, LBB0_2
; %bb.1:
	mov	x20, x0
Lloh2:
	adrp	x8, _NES_DBG_QP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _NES_DBG_QP@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	ldr	x3, [x19, #40]
	ldr	w4, [x19]
Lloh5:
	adrp	x1, l_.str@PAGE
Lloh6:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_nes_debug
	ldr	w2, [x19]
	mov	x0, x20
	mov	w1, #0
	bl	_memset
	add	x8, x20, x21
	add	x0, x8, x22
	stp	x8, x20, [x19, #48]
	ldr	x8, [x19, #40]
	add	x8, x8, x21
	add	x9, x8, x22
	stp	x9, x8, [x19, #24]
	str	x0, [x19, #16]
	add	x20, x0, #256
	mov	w1, #0
	mov	w2, #256
	bl	_memset
	str	x20, [x19, #8]
	ldr	x8, [x19, #24]
	add	x8, x8, #256
	str	x8, [x19, #64]
	mov	x0, x20
	mov	w1, #0
	mov	w2, #1
	bl	_memset
	mov	w0, #0
	b	LBB0_3
LBB0_2:
Lloh7:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_3:
	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	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.cfi_endproc
                                        ; -- End function
	.comm	_PAGE_SIZE,4,2                  ; @PAGE_SIZE
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_NES_DBG_QP,4,2                 ; @NES_DBG_QP
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"PCI consistent memory for host descriptor rings located @ %p (pa = 0x%08lX.) size = %u.\n"

	.no_dead_strip	_nes_setup_mmap_qp
.subsections_via_symbols
