	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function build_memreg
_build_memreg:                          ## @build_memreg
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r13
	movq	%rcx, %rbx
	movq	%rdx, %r15
	movq	%rsi, %r14
	movq	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	8(%rsi), %rdi
	callq	_to_iwch_mr
	movq	%rax, %r12
	movl	(%rax), %eax
	movq	_T3_MAX_FASTREG_DEPTH@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_2
## %bb.1:
	movq	_EINVAL@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	jmp	LBB0_9
LBB0_2:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movl	$1, (%rbx)
	movl	(%r14), %edi
	callq	_cpu_to_be32
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	%rax, 40(%r15)
	movl	16(%r12), %edi
	callq	_cpu_to_be32
	movq	%rax, 32(%r15)
	callq	_cpu_to_be32
	movq	%rax, 24(%r15)
	movl	20(%r12), %edi
	callq	_cpu_to_be32
	movq	%rax, 16(%r15)
	movl	(%r12), %edi
	callq	_V_FR_PAGE_COUNT
	movl	%eax, %r13d
	movq	8(%r14), %rax
	movl	(%rax), %edi
	callq	_ilog2
	leaq	-12(%rax), %rdi
	callq	_V_FR_PAGE_SIZE
	movl	%eax, %ebx
	movq	_TPT_VATO@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_V_FR_TYPE
	orl	%eax, %r13d
	orl	%ebx, %r13d
	movl	4(%r14), %edi
	callq	_iwch_ib_to_tpt_access
	movl	%eax, %edi
	callq	_V_FR_PERMS
	orl	%eax, %r13d
	movl	%r13d, %edi
	callq	_cpu_to_be32
	movq	%rax, 8(%r15)
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	movl	(%r12), %eax
	testl	%eax, %eax
	jle	LBB0_8
## %bb.3:
	movq	%r12, %r14
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rbx
	xorl	%r12d, %r12d
	movq	_T3_MAX_FASTREG_FRAG@GOTPCREL(%rip), %r15
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	8(%r14), %rax
	movl	(%rax,%r12,8), %edi
	callq	_cpu_to_be64
	movl	%eax, (%rbx)
	incq	%r12
	addq	$4, %rbx
	movslq	(%r14), %rax
	cmpq	%rax, %r12
	jge	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r15), %eax
	cmpq	%rax, %r12
	jne	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	$2, (%rax)
	movq	%r14, %r15
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	16(%r14), %rbx
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	8(%r14), %rdi
	incq	%rdi
	movl	(%r14), %esi
	callq	_Q_PTR2IDX
	movq	%rax, %r13
	addq	%rax, %rbx
	movq	_T3_WR_FASTREG@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	8(%r14), %rdi
	incq	%rdi
	movl	(%r14), %esi
	movq	%r15, %r14
	movq	_T3_MAX_FASTREG_FRAG@GOTPCREL(%rip), %r15
	callq	_Q_GENBIT
	movl	(%r14), %r9d
	subl	(%r15), %r9d
	incl	%r9d
	movq	_T3_EOP@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, (%rsp)
	movq	%rbx, %rdi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	xorl	%edx, %edx
	movl	%eax, %ecx
	xorl	%r8d, %r8d
	callq	_build_fw_riwrh
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%r13,%rax), %rbx
	jmp	LBB0_6
LBB0_7:
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
LBB0_8:
	leal	5(%rax), %ecx
	cmpl	$11, %eax
	movl	$15, %eax
	cmovll	%ecx, %eax
	movl	%eax, (%rdx)
	xorl	%eax, %eax
LBB0_9:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_T3_MAX_FASTREG_DEPTH,4,2       ## @T3_MAX_FASTREG_DEPTH
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TPT_VATO,4,2                   ## @TPT_VATO
	.comm	_T3_MAX_FASTREG_FRAG,4,2        ## @T3_MAX_FASTREG_FRAG
	.comm	_T3_WR_FASTREG,4,2              ## @T3_WR_FASTREG
	.comm	_T3_EOP,4,2                     ## @T3_EOP
	.no_dead_strip	_build_memreg
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function build_memreg
_build_memreg:                          ; @build_memreg
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x4
	mov	x21, x3
	mov	x26, x2
	mov	x24, x1
	mov	x23, x0
	ldr	x0, [x1, #8]
	bl	_to_iwch_mr
	ldr	w8, [x0]
Lloh0:
	adrp	x9, _T3_MAX_FASTREG_DEPTH@GOTPAGE
Lloh1:
	ldr	x9, [x9, _T3_MAX_FASTREG_DEPTH@GOTPAGEOFF]
Lloh2:
	ldr	w9, [x9]
	cmp	w8, w9
	b.le	LBB0_2
; %bb.1:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w0, w8
	b	LBB0_9
LBB0_2:
	mov	x22, x0
	mov	w8, #1
	str	w8, [x21]
	ldr	w0, [x24]
	bl	_cpu_to_be32
	str	x0, [x23, #40]
	ldr	w0, [x22, #16]
	bl	_cpu_to_be32
	str	x0, [x23, #32]
	bl	_cpu_to_be32
	str	x0, [x23, #24]
	ldr	w0, [x22, #20]
	bl	_cpu_to_be32
	str	x0, [x23, #16]
	ldr	w0, [x22]
	bl	_V_FR_PAGE_COUNT
	mov	x25, x0
	ldr	x8, [x24, #8]
	ldr	w0, [x8]
	bl	_ilog2
	sub	x0, x0, #12
	bl	_V_FR_PAGE_SIZE
	orr	w19, w0, w25
Lloh6:
	adrp	x8, _TPT_VATO@GOTPAGE
Lloh7:
	ldr	x8, [x8, _TPT_VATO@GOTPAGEOFF]
Lloh8:
	ldr	w0, [x8]
	bl	_V_FR_TYPE
	orr	w19, w19, w0
	ldr	w0, [x24, #4]
	bl	_iwch_ib_to_tpt_access
	bl	_V_FR_PERMS
	orr	w0, w19, w0
	bl	_cpu_to_be32
	str	x0, [x23, #8]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_8
; %bb.3:
	str	x26, [sp, #8]                   ; 8-byte Folded Spill
	mov	x25, #0
Lloh9:
	adrp	x26, _T3_MAX_FASTREG_FRAG@GOTPAGE
Lloh10:
	ldr	x26, [x26, _T3_MAX_FASTREG_FRAG@GOTPAGEOFF]
	ldr	x23, [x23]
	mov	w27, #2
Lloh11:
	adrp	x28, _T3_WR_FASTREG@GOTPAGE
Lloh12:
	ldr	x28, [x28, _T3_WR_FASTREG@GOTPAGEOFF]
Lloh13:
	adrp	x19, _T3_EOP@GOTPAGE
Lloh14:
	ldr	x19, [x19, _T3_EOP@GOTPAGEOFF]
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	ldr	x8, [x22, #8]
	ldr	x0, [x8, x25, lsl #3]
                                        ; kill: def $w0 killed $w0 killed $x0
	bl	_cpu_to_be64
	str	w0, [x23], #4
	add	x25, x25, #1
	ldrsw	x8, [x22]
	cmp	x25, x8
	b.ge	LBB0_7
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x26]
	cmp	x25, x8
	b.ne	LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	str	w27, [x21]
	ldp	x8, x23, [x20, #8]
	add	x0, x8, #1
	ldr	w1, [x20]
	bl	_Q_PTR2IDX
	add	x23, x0, x23
	ldr	w24, [x28]
	ldr	x8, [x20, #8]
	add	x0, x8, #1
	ldr	w1, [x20]
	bl	_Q_GENBIT
	mov	x3, x0
	ldr	w8, [x22]
	ldr	w9, [x26]
	sub	w8, w8, w9
	add	w5, w8, #1
	ldr	w6, [x19]
	mov	x0, x23
	mov	x1, x24
	mov	w2, #0
	mov	w4, #0
	bl	_build_fw_riwrh
	ldr	x23, [x23]
	b	LBB0_4
LBB0_7:
	ldr	x26, [sp, #8]                   ; 8-byte Folded Reload
LBB0_8:
	mov	w0, #0
	add	w9, w8, #5
	mov	w10, #15
	cmp	w8, #10
	csel	w8, w10, w9, gt
	str	w8, [x26]
LBB0_9:
	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
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_T3_MAX_FASTREG_DEPTH,4,2       ; @T3_MAX_FASTREG_DEPTH
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TPT_VATO,4,2                   ; @TPT_VATO
	.comm	_T3_MAX_FASTREG_FRAG,4,2        ; @T3_MAX_FASTREG_FRAG
	.comm	_T3_WR_FASTREG,4,2              ; @T3_WR_FASTREG
	.comm	_T3_EOP,4,2                     ; @T3_EOP
	.no_dead_strip	_build_memreg
.subsections_via_symbols
