	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vc4_dsi_encoder_mode_fixup
_vc4_dsi_encoder_mode_fixup:            ## @vc4_dsi_encoder_mode_fixup
	.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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r14
	movq	%rsi, %r15
	callq	_to_vc4_dsi_encoder
	movq	(%rax), %rbx
	movl	8(%rbx), %edi
	callq	_clk_get_parent
	movq	%rax, %rdi
	callq	_clk_get_rate
	movq	%rax, %rcx
	movslq	(%r15), %rax
	movq	(%rbx), %rsi
	imulq	%rsi, %rax
	imulq	$1000, %rax, %rdi               ## imm = 0x3E8
	cmpq	%rdi, %rcx
	jae	LBB0_2
## %bb.1:
	xorl	%ebx, %ebx
	jmp	LBB0_8
LBB0_2:
	movq	%rcx, %rax
	shrq	%rax
	movl	$1, %ebx
	cmpq	%rdi, %rax
	jb	LBB0_8
## %bb.3:
	movabsq	$-6148914691236517205, %r8      ## imm = 0xAAAAAAAAAAAAAAAB
	movq	%rcx, %rax
	mulq	%r8
	shrq	%rdx
	movl	$2, %ebx
	cmpq	%rdi, %rdx
	jb	LBB0_8
## %bb.4:
	movq	%rcx, %rax
	shrq	$2, %rax
	movl	$3, %ebx
	cmpq	%rdi, %rax
	jb	LBB0_8
## %bb.5:
	movabsq	$-3689348814741910323, %rdx     ## imm = 0xCCCCCCCCCCCCCCCD
	movq	%rcx, %rax
	mulq	%rdx
	shrq	$2, %rdx
	movl	$4, %ebx
	cmpq	%rdi, %rdx
	jb	LBB0_8
## %bb.6:
	movq	%rcx, %rax
	mulq	%r8
	shrq	$2, %rdx
	movl	$5, %ebx
	cmpq	%rdi, %rdx
	jb	LBB0_8
## %bb.7:
	movabsq	$2635249153387078803, %rdx      ## imm = 0x2492492492492493
	movq	%rcx, %rax
	mulq	%rdx
	movq	%rcx, %rax
	subq	%rdx, %rax
	shrq	%rax
	addq	%rdx, %rax
	shrq	$2, %rax
	xorl	%edx, %edx
	cmpq	%rdi, %rax
	setae	%dl
	leaq	(%rdx,%rdx), %rbx
	addq	$6, %rbx
LBB0_8:
	movq	%rcx, %rax
	shrq	$32, %rax
	je	LBB0_9
## %bb.10:
	movq	%rcx, %rax
	xorl	%edx, %edx
	divq	%rbx
	jmp	LBB0_11
LBB0_9:
	movl	%ecx, %eax
	xorl	%edx, %edx
	divl	%ebx
                                        ## kill: def $eax killed $eax def $rax
LBB0_11:
	movq	%rax, %rcx
	orq	%rsi, %rcx
	shrq	$32, %rcx
	je	LBB0_12
## %bb.13:
	xorl	%edx, %edx
	divq	%rsi
	jmp	LBB0_14
LBB0_12:
                                        ## kill: def $eax killed $eax killed $rax
	xorl	%edx, %edx
	divl	%esi
                                        ## kill: def $eax killed $eax def $rax
LBB0_14:
	shrq	$3, %rax
	movabsq	$2361183241434822607, %rcx      ## imm = 0x20C49BA5E353F7CF
	mulq	%rcx
	movq	%rdx, %rax
	shrq	$4, %rax
	movl	%eax, (%r14)
	imull	4(%r15), %eax
                                        ## kill: def $eax killed $eax killed $rax
	cltd
	idivl	(%r15)
	movl	%eax, 4(%r14)
	subl	4(%r15), %eax
	addl	%eax, 12(%r14)
	addl	%eax, 8(%r14)
	movl	$1, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_vc4_dsi_encoder_mode_fixup
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vc4_dsi_encoder_mode_fixup
_vc4_dsi_encoder_mode_fixup:            ; @vc4_dsi_encoder_mode_fixup
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x2
	mov	x20, x1
	bl	_to_vc4_dsi_encoder
	ldr	x21, [x0]
	ldr	w0, [x21, #8]
	bl	_clk_get_parent
	bl	_clk_get_rate
	ldrsw	x9, [x20]
	ldr	x8, [x21]
	mul	x9, x9, x8
	mov	w10, #1000
	mul	x9, x9, x10
	cmp	x0, x9
	b.hs	LBB0_2
; %bb.1:
	mov	x9, #0
	b	LBB0_13
LBB0_2:
	cmp	x9, x0, lsr #1
	b.ls	LBB0_4
; %bb.3:
	mov	w9, #1
	b	LBB0_13
LBB0_4:
	mov	x10, #-6148914691236517206
	movk	x10, #43691
	umulh	x10, x0, x10
	cmp	x9, x10, lsr #1
	b.ls	LBB0_6
; %bb.5:
	mov	w9, #2
	b	LBB0_13
LBB0_6:
	cmp	x9, x0, lsr #2
	b.ls	LBB0_8
; %bb.7:
	mov	w9, #3
	b	LBB0_13
LBB0_8:
	mov	x10, #-3689348814741910324
	movk	x10, #52429
	umulh	x10, x0, x10
	cmp	x9, x10, lsr #2
	b.ls	LBB0_10
; %bb.9:
	mov	w9, #4
	b	LBB0_13
LBB0_10:
	mov	x10, #-6148914691236517206
	movk	x10, #43691
	umulh	x10, x0, x10
	cmp	x9, x10, lsr #2
	b.ls	LBB0_12
; %bb.11:
	mov	w9, #5
	b	LBB0_13
LBB0_12:
	mov	x10, #9363
	movk	x10, #37449, lsl #16
	movk	x10, #18724, lsl #32
	movk	x10, #9362, lsl #48
	umulh	x10, x0, x10
	sub	x11, x0, x10
	add	x10, x10, x11, lsr #1
	cmp	x9, x10, lsr #2
	mov	w9, #8
	mov	w10, #6
	csel	x9, x10, x9, hi
LBB0_13:
	udiv	x9, x0, x9
	udiv	x8, x9, x8
	lsr	x8, x8, #3
	mov	x9, #63439
	movk	x9, #58195, lsl #16
	movk	x9, #39845, lsl #32
	movk	x9, #8388, lsl #48
	umulh	x8, x8, x9
	lsr	x8, x8, #4
	str	w8, [x19]
	ldp	w10, w9, [x20]
	mul	w8, w9, w8
	sdiv	w8, w8, w10
	str	w8, [x19, #4]
	ldr	w9, [x20, #4]
	sub	w8, w8, w9
	ldr	d0, [x19, #8]
	dup.2s	v1, w8
	add.2s	v0, v0, v1
	str	d0, [x19, #8]
	mov	w0, #1
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_vc4_dsi_encoder_mode_fixup
.subsections_via_symbols
