	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function sun4i_rgb_mode_valid
_sun4i_rgb_mode_valid:                  ## @sun4i_rgb_mode_valid
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	callq	_drm_encoder_to_sun4i_rgb
	movq	%rax, %r14
	movq	16(%rax), %rax
	movq	%rax, -56(%rbp)                 ## 8-byte Spill
	movl	(%rbx), %r12d
	movl	8(%rbx), %r13d
	subl	12(%rbx), %r13d
	movslq	16(%rbx), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movl	4(%rbx), %r15d
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	subl	%r15d, %r12d
	jle	LBB0_1
## %bb.2:
	cmpl	$1023, %r12d                    ## imm = 0x3FF
	jbe	LBB0_4
## %bb.3:
	movq	_MODE_HSYNC_WIDE@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_1:
	movq	_MODE_HSYNC_NARROW@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_4:
	movl	20(%rbx), %ecx
	movq	_MODE_H_ILLEGAL@GOTPCREL(%rip), %rax
	testl	%ecx, %ecx
	jle	LBB0_24
## %bb.5:
	movl	24(%rbx), %edx
	testl	%edx, %edx
	jle	LBB0_24
## %bb.6:
	movq	_MODE_BAD_HVALUE@GOTPCREL(%rip), %rax
	cmpl	$2047, %ecx                     ## imm = 0x7FF
	ja	LBB0_24
## %bb.7:
	cmpl	$4095, %edx                     ## imm = 0xFFF
	ja	LBB0_24
## %bb.8:
	leaq	L_.str.1(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	testl	%r13d, %r13d
	jle	LBB0_9
## %bb.10:
	cmpl	$1023, %r13d                    ## imm = 0x3FF
	jbe	LBB0_12
## %bb.11:
	movq	_MODE_VSYNC_WIDE@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_9:
	movq	_MODE_VSYNC_NARROW@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_12:
	movl	28(%rbx), %ecx
	movq	_MODE_V_ILLEGAL@GOTPCREL(%rip), %rax
	testl	%ecx, %ecx
	jle	LBB0_24
## %bb.13:
	movl	32(%rbx), %edx
	testl	%edx, %edx
	jle	LBB0_24
## %bb.14:
	movq	_MODE_BAD_VVALUE@GOTPCREL(%rip), %rax
	cmpl	$2047, %ecx                     ## imm = 0x7FF
	ja	LBB0_24
## %bb.15:
	cmpl	$4095, %edx                     ## imm = 0xFFF
	ja	LBB0_24
## %bb.16:
	leaq	L_.str.2(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	cmpq	$0, 8(%r14)
	je	LBB0_19
## %bb.17:
	leaq	L_.str.3(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
LBB0_18:
	leaq	L_.str.4(%rip), %rdi
	callq	_DRM_DEBUG_DRIVER
	movq	_MODE_OK@GOTPCREL(%rip), %rax
LBB0_24:
	movl	(%rax), %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
	cmpl	$0, (%r14)
	je	LBB0_18
## %bb.20:
	imulq	$1000, -48(%rbp), %r15          ## 8-byte Folded Reload
                                        ## imm = 0x3E8
	movabsq	$545460846598, %rax             ## imm = 0x7F00000006
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	movl	8(%rcx), %edi
	movq	%r15, %rsi
	callq	_clk_round_rate
	movq	%rax, %r14
	movq	_SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE@GOTPCREL(%rip), %r12
	movslq	(%r12), %rax
	movl	$1000, %ebx                     ## imm = 0x3E8
	subq	%rax, %rbx
	imulq	%r15, %rbx
	movq	%rbx, %rdi
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_do_div
	cmpq	%rbx, %r14
	jae	LBB0_22
## %bb.21:
	movq	_MODE_CLOCK_LOW@GOTPCREL(%rip), %rax
	jmp	LBB0_24
LBB0_22:
	movslq	(%r12), %rbx
	addq	$1000, %rbx                     ## imm = 0x3E8
	imulq	%r15, %rbx
	movq	%rbx, %rdi
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_do_div
	cmpq	%rbx, %r14
	jbe	LBB0_18
## %bb.23:
	movq	_MODE_CLOCK_HIGH@GOTPCREL(%rip), %rax
	jmp	LBB0_24
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Validating modes...\n"

	.comm	_MODE_HSYNC_NARROW,4,2          ## @MODE_HSYNC_NARROW
	.comm	_MODE_HSYNC_WIDE,4,2            ## @MODE_HSYNC_WIDE
	.comm	_MODE_H_ILLEGAL,4,2             ## @MODE_H_ILLEGAL
	.comm	_MODE_BAD_HVALUE,4,2            ## @MODE_BAD_HVALUE
L_.str.1:                               ## @.str.1
	.asciz	"Horizontal parameters OK\n"

	.comm	_MODE_VSYNC_NARROW,4,2          ## @MODE_VSYNC_NARROW
	.comm	_MODE_VSYNC_WIDE,4,2            ## @MODE_VSYNC_WIDE
	.comm	_MODE_V_ILLEGAL,4,2             ## @MODE_V_ILLEGAL
	.comm	_MODE_BAD_VVALUE,4,2            ## @MODE_BAD_VVALUE
L_.str.2:                               ## @.str.2
	.asciz	"Vertical parameters OK\n"

L_.str.3:                               ## @.str.3
	.asciz	"RGB panel used, skipping clock rate checks"

	.comm	_SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE,4,2 ## @SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE
	.comm	_MODE_CLOCK_LOW,4,2             ## @MODE_CLOCK_LOW
	.comm	_MODE_CLOCK_HIGH,4,2            ## @MODE_CLOCK_HIGH
L_.str.4:                               ## @.str.4
	.asciz	"Clock rate OK\n"

	.comm	_MODE_OK,4,2                    ## @MODE_OK
	.no_dead_strip	_sun4i_rgb_mode_valid
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function sun4i_rgb_mode_valid
lCPI0_0:
	.long	6                               ; 0x6
	.long	127                             ; 0x7f
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_sun4i_rgb_mode_valid:                  ; @sun4i_rgb_mode_valid
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x20, x1
	bl	_drm_encoder_to_sun4i_rgb
	mov	x19, x0
	ldr	x21, [x0, #16]
	ldp	w8, w9, [x20]
	sub	w25, w8, w9
	ldp	w23, w24, [x20, #8]
	ldrsw	x22, [x20, #16]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
	cmp	w25, #1
	b.lt	LBB0_3
; %bb.1:
	cmp	w25, #1023
	b.ls	LBB0_4
; %bb.2:
Lloh2:
	adrp	x8, _MODE_HSYNC_WIDE@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MODE_HSYNC_WIDE@GOTPAGEOFF]
	b	LBB0_12
LBB0_3:
Lloh4:
	adrp	x8, _MODE_HSYNC_NARROW@GOTPAGE
Lloh5:
	ldr	x8, [x8, _MODE_HSYNC_NARROW@GOTPAGEOFF]
	b	LBB0_12
LBB0_4:
	ldr	w9, [x20, #20]
	cmp	w9, #1
	b.lt	LBB0_11
; %bb.5:
	ldr	w10, [x20, #24]
	cmp	w10, #1
	b.lt	LBB0_11
; %bb.6:
Lloh6:
	adrp	x8, _MODE_BAD_HVALUE@GOTPAGE
Lloh7:
	ldr	x8, [x8, _MODE_BAD_HVALUE@GOTPAGEOFF]
	cmp	w9, #2047
	b.hi	LBB0_12
; %bb.7:
	cmp	w10, #4095
	b.hi	LBB0_12
; %bb.8:
	sub	w23, w23, w24
Lloh8:
	adrp	x0, l_.str.1@PAGE
Lloh9:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
	cmp	w23, #1
	b.lt	LBB0_13
; %bb.9:
	cmp	w23, #1023
	b.ls	LBB0_14
; %bb.10:
Lloh10:
	adrp	x8, _MODE_VSYNC_WIDE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _MODE_VSYNC_WIDE@GOTPAGEOFF]
	b	LBB0_12
LBB0_11:
Lloh12:
	adrp	x8, _MODE_H_ILLEGAL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MODE_H_ILLEGAL@GOTPAGEOFF]
LBB0_12:
	ldr	w0, [x8]
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_13:
Lloh14:
	adrp	x8, _MODE_VSYNC_NARROW@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MODE_VSYNC_NARROW@GOTPAGEOFF]
	b	LBB0_12
LBB0_14:
	ldr	w9, [x20, #28]
	cmp	w9, #1
	b.lt	LBB0_21
; %bb.15:
	ldr	w10, [x20, #32]
	cmp	w10, #1
	b.lt	LBB0_21
; %bb.16:
Lloh16:
	adrp	x8, _MODE_BAD_VVALUE@GOTPAGE
Lloh17:
	ldr	x8, [x8, _MODE_BAD_VVALUE@GOTPAGEOFF]
	cmp	w9, #2047
	b.hi	LBB0_12
; %bb.17:
	cmp	w10, #4095
	b.hi	LBB0_12
; %bb.18:
Lloh18:
	adrp	x0, l_.str.2@PAGE
Lloh19:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
	ldr	x8, [x19, #8]
	cbz	x8, LBB0_22
; %bb.19:
Lloh20:
	adrp	x0, l_.str.3@PAGE
Lloh21:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
LBB0_20:
Lloh22:
	adrp	x0, l_.str.4@PAGE
Lloh23:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
Lloh24:
	adrp	x8, _MODE_OK@GOTPAGE
Lloh25:
	ldr	x8, [x8, _MODE_OK@GOTPAGEOFF]
	b	LBB0_12
LBB0_21:
Lloh26:
	adrp	x8, _MODE_V_ILLEGAL@GOTPAGE
Lloh27:
	ldr	x8, [x8, _MODE_V_ILLEGAL@GOTPAGEOFF]
	b	LBB0_12
LBB0_22:
	ldr	w8, [x19]
	cbz	w8, LBB0_20
; %bb.23:
	mov	w8, #1000
	mul	x19, x22, x8
Lloh28:
	adrp	x8, lCPI0_0@PAGE
Lloh29:
	ldr	d0, [x8, lCPI0_0@PAGEOFF]
	str	d0, [x21]
	ldr	w0, [x21, #8]
	mov	x1, x19
	bl	_clk_round_rate
	mov	x20, x0
Lloh30:
	adrp	x22, _SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE@GOTPAGE
Lloh31:
	ldr	x22, [x22, _SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE@GOTPAGEOFF]
	ldrsw	x8, [x22]
	mov	w9, #1000
	sub	x8, x9, x8
	mul	x21, x8, x19
	mov	x0, x21
	mov	w1, #1000
	bl	_do_div
	cmp	x20, x21
	b.hs	LBB0_25
; %bb.24:
Lloh32:
	adrp	x8, _MODE_CLOCK_LOW@GOTPAGE
Lloh33:
	ldr	x8, [x8, _MODE_CLOCK_LOW@GOTPAGEOFF]
	b	LBB0_12
LBB0_25:
	ldrsw	x8, [x22]
	add	x8, x8, #1000
	mul	x19, x8, x19
	mov	x0, x19
	mov	w1, #1000
	bl	_do_div
	cmp	x20, x19
	b.ls	LBB0_20
; %bb.26:
Lloh34:
	adrp	x8, _MODE_CLOCK_HIGH@GOTPAGE
Lloh35:
	ldr	x8, [x8, _MODE_CLOCK_HIGH@GOTPAGEOFF]
	b	LBB0_12
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh24, Lloh25
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh30, Lloh31
	.loh AdrpLdr	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh32, Lloh33
	.loh AdrpLdrGot	Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Validating modes...\n"

	.comm	_MODE_HSYNC_NARROW,4,2          ; @MODE_HSYNC_NARROW
	.comm	_MODE_HSYNC_WIDE,4,2            ; @MODE_HSYNC_WIDE
	.comm	_MODE_H_ILLEGAL,4,2             ; @MODE_H_ILLEGAL
	.comm	_MODE_BAD_HVALUE,4,2            ; @MODE_BAD_HVALUE
l_.str.1:                               ; @.str.1
	.asciz	"Horizontal parameters OK\n"

	.comm	_MODE_VSYNC_NARROW,4,2          ; @MODE_VSYNC_NARROW
	.comm	_MODE_VSYNC_WIDE,4,2            ; @MODE_VSYNC_WIDE
	.comm	_MODE_V_ILLEGAL,4,2             ; @MODE_V_ILLEGAL
	.comm	_MODE_BAD_VVALUE,4,2            ; @MODE_BAD_VVALUE
l_.str.2:                               ; @.str.2
	.asciz	"Vertical parameters OK\n"

l_.str.3:                               ; @.str.3
	.asciz	"RGB panel used, skipping clock rate checks"

	.comm	_SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE,4,2 ; @SUN4I_RGB_DOTCLOCK_TOLERANCE_PER_MILLE
	.comm	_MODE_CLOCK_LOW,4,2             ; @MODE_CLOCK_LOW
	.comm	_MODE_CLOCK_HIGH,4,2            ; @MODE_CLOCK_HIGH
l_.str.4:                               ; @.str.4
	.asciz	"Clock rate OK\n"

	.comm	_MODE_OK,4,2                    ; @MODE_OK
	.no_dead_strip	_sun4i_rgb_mode_valid
.subsections_via_symbols
