	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dce_mi_allocate_dmif
_dce_mi_allocate_dmif:                  ## @dce_mi_allocate_dmif
	.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	%r8d, -44(%rbp)                 ## 4-byte Spill
	movl	%ecx, %r12d
	movl	%edx, %r13d
	movl	%esi, %ebx
	callq	_TO_DCE_MEM_INPUT
	movq	%rax, %r15
	movl	%ebx, %edi
	movl	%r13d, %esi
	movl	%r12d, %edx
	callq	_get_dmif_switch_time_us
	movl	%eax, %ebx
	movq	_DMIF_BUFFER_CONTROL@GOTPCREL(%rip), %r13
	movl	(%r13), %edi
	movq	_DMIF_BUFFERS_ALLOCATED@GOTPCREL(%rip), %r14
	movl	(%r14), %esi
	leaq	-48(%rbp), %rdx
	callq	_REG_GET
	cmpl	$2, -48(%rbp)
	je	LBB0_8
## %bb.1:
	movslq	%ebx, %rcx
	imulq	$1717986919, %rcx, %rbx         ## imm = 0x66666667
	movq	%rbx, %rcx
	shrq	$63, %rcx
	sarq	$34, %rbx
	addl	%ecx, %ebx
	movl	(%r13), %edi
	movl	(%r14), %edx
	movl	%eax, %esi
	movl	$2, %ecx
	callq	_REG_SET
	movl	(%r13), %edi
	movq	_DMIF_BUFFERS_ALLOCATION_COMPLETED@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$1, %edx
	movl	$10, %ecx
	movl	%ebx, %r8d
	callq	_REG_WAIT
	testl	%r12d, %r12d
	je	LBB0_6
## %bb.2:
	movslq	%r12d, %rax
	cmpq	$1000000000, %rax               ## imm = 0x3B9ACA00
	ja	LBB0_3
## %bb.4:
	movl	$1000000000, %eax               ## imm = 0x3B9ACA00
	xorl	%edx, %edx
	divl	%r12d
	movl	%eax, %edx
	jmp	LBB0_5
LBB0_3:
	xorl	%edx, %edx
LBB0_5:
	movq	_DPG_PIPE_ARBITRATION_CONTROL1@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_PIXEL_DURATION@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_REG_UPDATE
LBB0_6:
	movl	(%r15), %edx
	testl	%edx, %edx
	je	LBB0_8
## %bb.7:
	xorl	%eax, %eax
	cmpl	$2, -44(%rbp)                   ## 4-byte Folded Reload
	cmovgel	%eax, %edx
	movq	_MC_HUB_RDREQ_DMIF_LIMIT@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movq	_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_REG_UPDATE
LBB0_8:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DMIF_BUFFER_CONTROL,4,2        ## @DMIF_BUFFER_CONTROL
	.comm	_DMIF_BUFFERS_ALLOCATED,4,2     ## @DMIF_BUFFERS_ALLOCATED
	.comm	_DMIF_BUFFERS_ALLOCATION_COMPLETED,4,2 ## @DMIF_BUFFERS_ALLOCATION_COMPLETED
	.comm	_DPG_PIPE_ARBITRATION_CONTROL1,4,2 ## @DPG_PIPE_ARBITRATION_CONTROL1
	.comm	_PIXEL_DURATION,4,2             ## @PIXEL_DURATION
	.comm	_MC_HUB_RDREQ_DMIF_LIMIT,4,2    ## @MC_HUB_RDREQ_DMIF_LIMIT
	.comm	_ENABLE,4,2                     ## @ENABLE
	.no_dead_strip	_dce_mi_allocate_dmif
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function dce_mi_allocate_dmif
_dce_mi_allocate_dmif:                  ; @dce_mi_allocate_dmif
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	mov	x19, x4
	mov	x21, x3
	mov	x22, x2
	mov	x23, x1
	bl	_TO_DCE_MEM_INPUT
	mov	x20, x0
	mov	x0, x23
	mov	x1, x22
	mov	x2, x21
	bl	_get_dmif_switch_time_us
	mov	x22, x0
Lloh0:
	adrp	x23, _DMIF_BUFFER_CONTROL@GOTPAGE
Lloh1:
	ldr	x23, [x23, _DMIF_BUFFER_CONTROL@GOTPAGEOFF]
	ldr	w0, [x23]
Lloh2:
	adrp	x24, _DMIF_BUFFERS_ALLOCATED@GOTPAGE
Lloh3:
	ldr	x24, [x24, _DMIF_BUFFERS_ALLOCATED@GOTPAGEOFF]
	ldr	w1, [x24]
	add	x2, sp, #12
	bl	_REG_GET
	ldr	w8, [sp, #12]
	cmp	w8, #2
	b.eq	LBB0_5
; %bb.1:
	mov	x1, x0
	mov	w8, #26215
	movk	w8, #26214, lsl #16
	smull	x8, w22, w8
	lsr	x9, x8, #63
	asr	x8, x8, #34
	add	w22, w8, w9
	ldr	w0, [x23]
	ldr	w2, [x24]
	mov	w3, #2
	bl	_REG_SET
	ldr	w0, [x23]
Lloh4:
	adrp	x8, _DMIF_BUFFERS_ALLOCATION_COMPLETED@GOTPAGE
Lloh5:
	ldr	x8, [x8, _DMIF_BUFFERS_ALLOCATION_COMPLETED@GOTPAGEOFF]
Lloh6:
	ldr	w1, [x8]
	mov	w2, #1
	mov	w3, #10
	mov	x4, x22
	bl	_REG_WAIT
	cbz	w21, LBB0_3
; %bb.2:
	sxtw	x8, w21
Lloh7:
	adrp	x9, _DPG_PIPE_ARBITRATION_CONTROL1@GOTPAGE
Lloh8:
	ldr	x9, [x9, _DPG_PIPE_ARBITRATION_CONTROL1@GOTPAGEOFF]
	mov	w10, #51712
	movk	w10, #15258, lsl #16
Lloh9:
	ldr	w0, [x9]
Lloh10:
	adrp	x9, _PIXEL_DURATION@GOTPAGE
Lloh11:
	ldr	x9, [x9, _PIXEL_DURATION@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x9]
	udiv	x2, x10, x8
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_REG_UPDATE
LBB0_3:
	ldr	w8, [x20]
	cbz	w8, LBB0_5
; %bb.4:
	cmp	w19, #1
	csel	w2, wzr, w8, gt
Lloh13:
	adrp	x8, _MC_HUB_RDREQ_DMIF_LIMIT@GOTPAGE
Lloh14:
	ldr	x8, [x8, _MC_HUB_RDREQ_DMIF_LIMIT@GOTPAGEOFF]
Lloh15:
	ldr	w0, [x8]
Lloh16:
	adrp	x8, _ENABLE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _ENABLE@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	bl	_REG_UPDATE
LBB0_5:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.comm	_DMIF_BUFFER_CONTROL,4,2        ; @DMIF_BUFFER_CONTROL
	.comm	_DMIF_BUFFERS_ALLOCATED,4,2     ; @DMIF_BUFFERS_ALLOCATED
	.comm	_DMIF_BUFFERS_ALLOCATION_COMPLETED,4,2 ; @DMIF_BUFFERS_ALLOCATION_COMPLETED
	.comm	_DPG_PIPE_ARBITRATION_CONTROL1,4,2 ; @DPG_PIPE_ARBITRATION_CONTROL1
	.comm	_PIXEL_DURATION,4,2             ; @PIXEL_DURATION
	.comm	_MC_HUB_RDREQ_DMIF_LIMIT,4,2    ; @MC_HUB_RDREQ_DMIF_LIMIT
	.comm	_ENABLE,4,2                     ; @ENABLE
	.no_dead_strip	_dce_mi_allocate_dmif
.subsections_via_symbols
