	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rk3066_hdmi_set_power_mode
_rk3066_hdmi_set_power_mode:            ## @rk3066_hdmi_set_power_mode
	.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
	movl	%esi, %ebx
	movq	%rdi, %r14
	callq	_rk3066_hdmi_get_power_mode
	movl	%eax, %r15d
	movl	4(%r14), %edi
	leaq	L_.str(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_DRM_DEV_DEBUG
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	4(%r14), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%r15d, %edx
	xorl	%eax, %eax
	callq	_DRM_DEV_DEBUG
	cmpl	%ebx, %r15d
	je	LBB0_12
## %bb.1:
	movq	_HDMI_SYS_CTRL@GOTPCREL(%rip), %r14
	xorl	%r13d, %r13d
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	%ebx, %r15d
	jle	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	%r15d, %eax
	shrl	$31, %eax
	addl	%r15d, %eax
	sarl	%eax
	movl	%eax, %r15d
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_HDMI_SYS_POWER_MODE_A@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r15d
	leal	(%r15,%r15), %ecx
	cmovll	%eax, %ecx
	movl	%ecx, %r15d
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movl	4(%rbx), %edi
	leaq	L_.str.2(%rip), %rsi
	movl	%r13d, %edx
	movl	%r15d, %ecx
	xorl	%eax, %eax
	callq	_DRM_DEV_DEBUG
	movl	(%r14), %esi
	movq	_HDMI_SYS_POWER_MODE_D@GOTPCREL(%rip), %r12
	cmpl	(%r12), %r15d
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_HDMI_SYS_PLL_RESET_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	%r15d, %edx
	movq	%rbx, %rdi
	callq	_hdmi_writeb
	movl	$90, %edi
	movl	$100, %esi
	callq	_usleep_range
	movl	(%r14), %esi
	movq	_HDMI_SYS_PLLB_RESET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_hdmi_writeb
	movl	$90, %edi
	movl	$100, %esi
	callq	_usleep_range
	movl	(%r14), %esi
	movl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_hdmi_writeb
	jmp	LBB0_8
	.p2align	4, 0x90
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	movq	_HDMI_SYS_POWER_MODE_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movl	%r15d, %ecx
	callq	_hdmi_modb
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	cmpl	%ebx, %r15d
	movq	_HDMI_SYS_POWER_MODE_D@GOTPCREL(%rip), %rcx
	movq	_HDMI_SYS_CTRL@GOTPCREL(%rip), %r14
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	leal	1(%r13), %eax
	cmpl	$4, %r13d
	movl	%eax, %r13d
	jb	LBB0_2
LBB0_10:
	cmpl	%ebx, (%rcx)
	jle	LBB0_12
## %bb.11:
	movq	_DEFAULT_PLLA_RATE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
LBB0_12:
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"mode         :%d\n"

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

	.comm	_HDMI_SYS_POWER_MODE_A,4,2      ## @HDMI_SYS_POWER_MODE_A
L_.str.2:                               ## @.str.2
	.asciz	"%d: next_mode :%d\n"

	.comm	_HDMI_SYS_POWER_MODE_D,4,2      ## @HDMI_SYS_POWER_MODE_D
	.comm	_HDMI_SYS_CTRL,4,2              ## @HDMI_SYS_CTRL
	.comm	_HDMI_SYS_POWER_MODE_MASK,4,2   ## @HDMI_SYS_POWER_MODE_MASK
	.comm	_HDMI_SYS_PLL_RESET_MASK,4,2    ## @HDMI_SYS_PLL_RESET_MASK
	.comm	_HDMI_SYS_PLLB_RESET,4,2        ## @HDMI_SYS_PLLB_RESET
	.comm	_DEFAULT_PLLA_RATE,4,2          ## @DEFAULT_PLLA_RATE
	.no_dead_strip	_rk3066_hdmi_set_power_mode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rk3066_hdmi_set_power_mode
_rk3066_hdmi_set_power_mode:            ; @rk3066_hdmi_set_power_mode
	.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, x1
	mov	x19, x0
	bl	_rk3066_hdmi_get_power_mode
	mov	x21, x0
	ldr	w0, [x19, #4]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x20
	bl	_DRM_DEV_DEBUG
	ldr	w0, [x19, #4]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	bl	_DRM_DEV_DEBUG
	cmp	w21, w20
	b.eq	LBB0_11
; %bb.1:
	mov	w22, #0
Lloh4:
	adrp	x24, _HDMI_SYS_POWER_MODE_D@GOTPAGE
Lloh5:
	ldr	x24, [x24, _HDMI_SYS_POWER_MODE_D@GOTPAGEOFF]
Lloh6:
	adrp	x25, _HDMI_SYS_CTRL@GOTPAGE
Lloh7:
	ldr	x25, [x25, _HDMI_SYS_CTRL@GOTPAGEOFF]
Lloh8:
	adrp	x23, l_.str.2@PAGE
Lloh9:
	add	x23, x23, l_.str.2@PAGEOFF
Lloh10:
	adrp	x27, _HDMI_SYS_PLLB_RESET@GOTPAGE
Lloh11:
	ldr	x27, [x27, _HDMI_SYS_PLLB_RESET@GOTPAGEOFF]
Lloh12:
	adrp	x28, _HDMI_SYS_POWER_MODE_MASK@GOTPAGE
Lloh13:
	ldr	x28, [x28, _HDMI_SYS_POWER_MODE_MASK@GOTPAGEOFF]
Lloh14:
	adrp	x26, _HDMI_SYS_POWER_MODE_A@GOTPAGE
Lloh15:
	ldr	x26, [x26, _HDMI_SYS_POWER_MODE_A@GOTPAGEOFF]
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
Lloh16:
	adrp	x8, _HDMI_SYS_PLL_RESET_MASK@GOTPAGE
Lloh17:
	ldr	x8, [x8, _HDMI_SYS_PLL_RESET_MASK@GOTPAGEOFF]
Lloh18:
	ldr	w8, [x8]
	orr	w2, w8, w21
	mov	x0, x19
	bl	_hdmi_writeb
	mov	w0, #90
	mov	w1, #100
	bl	_usleep_range
	ldr	w1, [x25]
	ldr	w8, [x24]
	ldr	w9, [x27]
	orr	w2, w9, w8
	mov	x0, x19
	bl	_hdmi_writeb
	mov	w0, #90
	mov	w1, #100
	bl	_usleep_range
	ldr	w1, [x25]
	ldr	w2, [x24]
	mov	x0, x19
	bl	_hdmi_writeb
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	cmp	w21, w20
	ccmp	w22, #4, #2, ne
	add	w22, w22, #1
	b.hs	LBB0_9
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	cmp	w21, w20
	b.le	LBB0_6
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	cmp	w21, #0
	cinc	w8, w21, lt
	asr	w21, w8, #1
	b	LBB0_7
LBB0_6:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w8, [x26]
	lsl	w9, w21, #1
	cmp	w21, w8
	csel	w21, w8, w9, lt
LBB0_7:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w0, [x19, #4]
	str	x21, [sp]
	mov	x1, x23
	mov	x2, x22
	bl	_DRM_DEV_DEBUG
	ldr	w8, [x24]
	ldr	w1, [x25]
	cmp	w21, w8
	b.eq	LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	w2, [x28]
	mov	x0, x19
	mov	x3, x21
	bl	_hdmi_modb
	b	LBB0_3
LBB0_9:
	ldr	w8, [x24]
	cmp	w8, w20
	b.le	LBB0_11
; %bb.10:
Lloh19:
	adrp	x8, _DEFAULT_PLLA_RATE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _DEFAULT_PLLA_RATE@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	str	w8, [x19]
LBB0_11:
	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 AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"mode         :%d\n"

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

	.comm	_HDMI_SYS_POWER_MODE_A,4,2      ; @HDMI_SYS_POWER_MODE_A
l_.str.2:                               ; @.str.2
	.asciz	"%d: next_mode :%d\n"

	.comm	_HDMI_SYS_POWER_MODE_D,4,2      ; @HDMI_SYS_POWER_MODE_D
	.comm	_HDMI_SYS_CTRL,4,2              ; @HDMI_SYS_CTRL
	.comm	_HDMI_SYS_POWER_MODE_MASK,4,2   ; @HDMI_SYS_POWER_MODE_MASK
	.comm	_HDMI_SYS_PLL_RESET_MASK,4,2    ; @HDMI_SYS_PLL_RESET_MASK
	.comm	_HDMI_SYS_PLLB_RESET,4,2        ; @HDMI_SYS_PLLB_RESET
	.comm	_DEFAULT_PLLA_RATE,4,2          ; @DEFAULT_PLLA_RATE
	.no_dead_strip	_rk3066_hdmi_set_power_mode
.subsections_via_symbols
