	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function _dpu_rm_reserve_ctls
__dpu_rm_reserve_ctls:                  ## @_dpu_rm_reserve_ctls
	.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	%rdx, %r12
	movl	%esi, %r15d
	movq	%rdi, %rbx
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	_MAX_BLOCKS@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movq	%r14, %rax
	shlq	$3, %rax
	callq	____chkstk_darwin
	addq	$15, %rax
	andq	$-16, %rax
	subq	%rax, %rsp
	movq	%rsp, %rdi
	leal	(,%r14,8), %edx
	xorl	%r14d, %r14d
	movq	%rdi, -72(%rbp)                 ## 8-byte Spill
	xorl	%esi, %esi
	callq	_memset
	movl	(%r12), %r13d
	movq	%r12, %rdi
	callq	__dpu_rm_needs_split_display
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movq	_DPU_HW_BLK_CTL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	leaq	-56(%rbp), %r12
	movq	%r12, %rdi
	xorl	%esi, %esi
	callq	_dpu_rm_init_hw_iter
	movq	%rbx, %rdi
	movq	%r12, %rsi
	callq	__dpu_rm_get_hw_locked
	testq	%rax, %rax
	je	LBB0_7
## %bb.1:
	xorl	%r14d, %r14d
	movl	%r15d, -60(%rbp)                ## 4-byte Spill
	jmp	LBB0_2
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %r13
	movq	%r15, %rbx
	movl	-60(%rbp), %r15d                ## 4-byte Reload
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %rdi
	leaq	-56(%rbp), %rsi
	callq	__dpu_rm_get_hw_locked
	testq	%rax, %rax
	je	LBB0_7
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rax
	movl	8(%rax), %edi
	callq	_to_dpu_hw_ctl
	movq	(%rax), %rax
	movq	(%rax), %r12
	movq	-56(%rbp), %rdi
	movl	%r15d, %esi
	callq	_RESERVED_BY_OTHER
	testq	%rax, %rax
	jne	LBB0_6
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	%rbx, %r15
	movq	%r13, %rbx
	movq	_DPU_CTL_SPLIT_DISPLAY@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	callq	_BIT
	movq	%rax, %r13
	andl	%r12d, %r13d
	movq	-56(%rbp), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdi
	movq	%r12, %rdx
	xorl	%eax, %eax
	callq	_DPU_DEBUG
	cmpl	%r13d, -64(%rbp)                ## 4-byte Folded Reload
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-56(%rbp), %rax
	movslq	%r14d, %r14
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx,%r14,8)
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdi
	xorl	%eax, %eax
	callq	_DPU_DEBUG
	incl	%r14d
	movq	%rbx, %r13
	cmpl	%r13d, %r14d
	movq	%r15, %rbx
	movl	-60(%rbp), %r15d                ## 4-byte Reload
	jne	LBB0_6
LBB0_7:
	cmpl	%r13d, %r14d
	jne	LBB0_15
## %bb.8:
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jle	LBB0_13
## %bb.9:
	testl	%r13d, %r13d
	jle	LBB0_13
## %bb.10:
	movl	$1, %ebx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movq	-8(%r12,%rbx,8), %rax
	movl	%r15d, 4(%rax)
	movl	(%rax), %edi
	movl	%r15d, %esi
	callq	_trace_dpu_rm_reserve_ctls
	movq	%r12, %rdi
	callq	_ARRAY_SIZE
	cltq
	cmpq	%rax, %rbx
	jge	LBB0_13
## %bb.12:                              ##   in Loop: Header=BB0_11 Depth=1
	leaq	1(%rbx), %rax
	cmpq	%r13, %rbx
	movq	%rax, %rbx
	jb	LBB0_11
	jmp	LBB0_13
LBB0_15:
	movq	_ENAVAIL@GOTPCREL(%rip), %rax
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_13:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_16
## %bb.14:
	movl	%r14d, %eax
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_BLOCKS,4,2                 ## @MAX_BLOCKS
	.comm	_DPU_HW_BLK_CTL,4,2             ## @DPU_HW_BLK_CTL
	.comm	_DPU_CTL_SPLIT_DISPLAY,4,2      ## @DPU_CTL_SPLIT_DISPLAY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ctl %d caps 0x%lX\n"

L_.str.1:                               ## @.str.1
	.asciz	"ctl %d match\n"

	.comm	_ENAVAIL,4,2                    ## @ENAVAIL
	.no_dead_strip	__dpu_rm_reserve_ctls
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function _dpu_rm_reserve_ctls
__dpu_rm_reserve_ctls:                  ; @_dpu_rm_reserve_ctls
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	sub	sp, sp, #16
	mov	x22, x2
	mov	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-88]
Lloh3:
	adrp	x8, _MAX_BLOCKS@GOTPAGE
Lloh4:
	ldr	x8, [x8, _MAX_BLOCKS@GOTPAGEOFF]
Lloh5:
	ldr	w12, [x8]
	lsl	x8, x12, #3
	mov	x9, x8
Lloh6:
	adrp	x16, ___chkstk_darwin@GOTPAGE
Lloh7:
	ldr	x16, [x16, ___chkstk_darwin@GOTPAGEOFF]
	blr	x16
	mov	x9, sp
	add	x8, x8, #15
	and	x8, x8, #0xffffffff0
	sub	x20, x9, x8
	mov	sp, x20
	lsl	w2, w12, #3
	mov	x0, x20
	mov	w1, #0
	bl	_memset
	ldr	w25, [x22]
	mov	x0, x22
	bl	__dpu_rm_needs_split_display
	mov	x22, x0
Lloh8:
	adrp	x8, _DPU_HW_BLK_CTL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _DPU_HW_BLK_CTL@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	sub	x0, x29, #96
	mov	w1, #0
	bl	_dpu_rm_init_hw_iter
	sub	x1, x29, #96
	mov	x0, x21
	bl	__dpu_rm_get_hw_locked
	mov	w26, #0
	cbz	x0, LBB0_6
; %bb.1:
Lloh11:
	adrp	x27, _DPU_CTL_SPLIT_DISPLAY@GOTPAGE
Lloh12:
	ldr	x27, [x27, _DPU_CTL_SPLIT_DISPLAY@GOTPAGEOFF]
Lloh13:
	adrp	x23, l_.str@PAGE
Lloh14:
	add	x23, x23, l_.str@PAGEOFF
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	sub	x1, x29, #96
	mov	x0, x21
	bl	__dpu_rm_get_hw_locked
	cbz	x0, LBB0_6
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldur	x8, [x29, #-96]
	ldr	w0, [x8, #8]
	bl	_to_dpu_hw_ctl
	ldr	x8, [x0]
	ldr	x28, [x8]
	ldur	x0, [x29, #-96]
	mov	x1, x19
	bl	_RESERVED_BY_OTHER
	cbnz	x0, LBB0_2
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	w0, [x27]
	bl	_BIT
	and	w24, w0, w28
	ldur	x8, [x29, #-96]
	ldr	w1, [x8]
	str	x28, [sp, #-16]!
	mov	x0, x23
	bl	_DPU_DEBUG
	add	sp, sp, #16
	cmp	w22, w24
	b.ne	LBB0_2
; %bb.5:                                ;   in Loop: Header=BB0_3 Depth=1
	ldur	x8, [x29, #-96]
	str	x8, [x20, w26, sxtw #3]
	ldr	w1, [x8]
Lloh15:
	adrp	x0, l_.str.1@PAGE
Lloh16:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DPU_DEBUG
	add	w26, w26, #1
	cmp	w26, w25
	b.ne	LBB0_2
LBB0_6:
	cmp	w26, w25
	b.ne	LBB0_9
; %bb.7:
	mov	x0, x20
	bl	_ARRAY_SIZE
	cmp	w0, #1
	ccmp	w25, #1, #8, ge
	b.ge	LBB0_12
; %bb.8:
	mov	w0, #0
	b	LBB0_10
LBB0_9:
Lloh17:
	adrp	x8, _ENAVAIL@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENAVAIL@GOTPAGEOFF]
Lloh19:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_10:
	ldur	x8, [x29, #-88]
Lloh20:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh21:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh22:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_15
; %bb.11:
	sub	sp, x29, #80
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_12:
	mov	x21, #0
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, x21, lsl #3]
	str	w19, [x8, #4]
	ldr	w0, [x8]
	mov	x1, x19
	bl	_trace_dpu_rm_reserve_ctls
	add	x21, x21, #1
	mov	x0, x20
	bl	_ARRAY_SIZE
	mov	x8, x0
	mov	w0, #0
	cmp	x21, w8, sxtw
	b.ge	LBB0_10
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	cmp	x21, x25
	b.lo	LBB0_13
	b	LBB0_10
LBB0_15:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_BLOCKS,4,2                 ; @MAX_BLOCKS
	.comm	_DPU_HW_BLK_CTL,4,2             ; @DPU_HW_BLK_CTL
	.comm	_DPU_CTL_SPLIT_DISPLAY,4,2      ; @DPU_CTL_SPLIT_DISPLAY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ctl %d caps 0x%lX\n"

l_.str.1:                               ; @.str.1
	.asciz	"ctl %d match\n"

	.comm	_ENAVAIL,4,2                    ; @ENAVAIL
	.no_dead_strip	__dpu_rm_reserve_ctls
.subsections_via_symbols
