	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function rockchip_set_mux
_rockchip_set_mux:                      ## @rockchip_set_mux
	.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
	movl	%esi, %r12d
	movq	%rdi, %rbx
	movq	24(%rdi), %r14
	movl	%edx, -56(%rbp)                 ## 4-byte Spill
	callq	_rockchip_verify_mux
	testl	%eax, %eax
	js	LBB0_22
## %bb.1:
	movq	%r14, -64(%rbp)                 ## 8-byte Spill
	leal	7(%r12), %r14d
	testl	%r12d, %r12d
	movl	%r12d, %r13d
	cmovsl	%r14d, %r13d
	movl	%r13d, %eax
	sarl	$3, %eax
	movq	8(%rbx), %rcx
	movslq	%eax, %r15
	movq	_IOMUX_GPIO_ONLY@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%eax, %eax
	testl	%edx, (%rcx,%r15,8)
	jne	LBB0_22
## %bb.2:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	16(%rax), %edi
	movl	16(%rbx), %edx
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %ecx
	movl	-56(%rbp), %r8d                 ## 4-byte Reload
	callq	_dev_dbg
	movq	%rbx, %rdi
	movq	8(%rbx), %rax
	movl	(%rax,%r15,8), %edx
	movl	4(%rax,%r15,8), %eax
	movq	_IOMUX_SOURCE_PMU@GOTPCREL(%rip), %rcx
	xorl	%esi, %esi
	movl	(%rcx), %ecx
	andl	%edx, %ecx
	setne	%sil
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx,%rsi,8), %r15
	movl	%eax, -52(%rbp)
	movq	_IOMUX_WIDTH_4BIT@GOTPCREL(%rip), %rcx
	testl	%edx, (%rcx)
	je	LBB0_6
## %bb.3:
	testl	%r12d, %r12d
	cmovnsl	%r12d, %r14d
	andl	$-8, %r14d
	movl	%r12d, %ecx
	subl	%r14d, %ecx
	cmpl	$4, %ecx
	jl	LBB0_5
## %bb.4:
	addl	$4, %eax
	movl	%eax, -52(%rbp)
LBB0_5:
	leal	3(%r12), %eax
	testl	%r12d, %r12d
	cmovnsl	%r12d, %eax
	andl	$1073741820, %eax               ## imm = 0x3FFFFFFC
	movl	%r12d, %ecx
	subl	%eax, %ecx
	shll	$2, %ecx
	movl	%ecx, -44(%rbp)
	movl	$15, -48(%rbp)
	jmp	LBB0_11
LBB0_6:
	andl	$-8, %r13d
	movl	%r12d, %ecx
	subl	%r13d, %ecx
	movq	_IOMUX_WIDTH_3BIT@GOTPCREL(%rip), %rsi
	testl	%edx, (%rsi)
	je	LBB0_10
## %bb.7:
	cmpl	$5, %ecx
	jl	LBB0_9
## %bb.8:
	addl	$4, %eax
	movl	%eax, -52(%rbp)
LBB0_9:
	movsbl	%cl, %eax
	imull	$103, %eax, %eax
	movzwl	%ax, %eax
	movswl	%ax, %edx
	shrl	$15, %eax
	shrl	$9, %edx
	addb	%al, %dl
	movzbl	%dl, %eax
	leal	(%rax,%rax,4), %eax
	subb	%al, %cl
	movzbl	%cl, %eax
	leal	(%rax,%rax,2), %eax
	movsbl	%al, %eax
	movl	%eax, -44(%rbp)
	movl	$7, -48(%rbp)
	jmp	LBB0_11
LBB0_10:
	addl	%ecx, %ecx
	movl	%ecx, -44(%rbp)
	movl	$3, -48(%rbp)
LBB0_11:
	movq	%rdi, %rbx
	movl	(%rdi), %r14d
	movl	%r12d, %edi
	callq	_BIT
	testl	%r14d, %eax
	je	LBB0_13
## %bb.12:
	leaq	-52(%rbp), %rdx
	leaq	-44(%rbp), %rcx
	leaq	-48(%rbp), %r8
	movq	%rbx, %rdi
	movl	%r12d, %esi
	callq	_rockchip_get_recalced_mux
LBB0_13:
	movl	4(%rbx), %r14d
	movl	%r12d, %edi
	callq	_BIT
	testl	%r14d, %eax
	je	LBB0_21
## %bb.14:
	leaq	-76(%rbp), %rcx
	leaq	-72(%rbp), %r8
	leaq	-68(%rbp), %r9
	movq	%rbx, %rdi
	movl	%r12d, %esi
	movl	-56(%rbp), %edx                 ## 4-byte Reload
	callq	_rockchip_get_mux_route
	testq	%rax, %rax
	je	LBB0_21
## %bb.15:
	movl	-76(%rbp), %eax
	cmpl	$128, %eax
	je	LBB0_16
## %bb.17:
	movq	%r15, %rdi
	cmpl	$129, %eax
	jne	LBB0_20
## %bb.18:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	jmp	LBB0_19
LBB0_16:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	$8, %rax
LBB0_19:
	movq	(%rax), %rdi
LBB0_20:
	movl	-72(%rbp), %esi
	movl	-68(%rbp), %edx
	callq	_regmap_write
	testl	%eax, %eax
	jne	LBB0_22
LBB0_21:
	movl	-48(%rbp), %edx
	movb	-44(%rbp), %al
	leal	16(%rax), %ecx
	movl	%edx, %esi
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %esi
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	andl	%edx, %ebx
	movl	%esi, %edx
	movl	%eax, %ecx
	shll	%cl, %ebx
	sarl	$16, %edx
	orl	%esi, %edx
	orl	%esi, %ebx
	movl	-52(%rbp), %esi
	movq	%r15, %rdi
	movl	%ebx, %ecx
	callq	_regmap_update_bits
LBB0_22:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_IOMUX_GPIO_ONLY,4,2            ## @IOMUX_GPIO_ONLY
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"setting mux of GPIO%d-%d to %d\n"

	.comm	_IOMUX_SOURCE_PMU,4,2           ## @IOMUX_SOURCE_PMU
	.comm	_IOMUX_WIDTH_4BIT,4,2           ## @IOMUX_WIDTH_4BIT
	.comm	_IOMUX_WIDTH_3BIT,4,2           ## @IOMUX_WIDTH_3BIT
	.no_dead_strip	_rockchip_set_mux
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function rockchip_set_mux
_rockchip_set_mux:                      ; @rockchip_set_mux
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x2
	mov	x21, x1
	mov	x22, x0
	ldr	x23, [x0, #24]
	bl	_rockchip_verify_mux
	tbnz	w0, #31, LBB0_22
; %bb.1:
	add	w8, w21, #7
	cmp	w21, #0
	csel	w8, w8, w21, lt
	asr	w9, w8, #3
	ldr	x10, [x22, #8]
	sbfiz	x9, x9, #3, #32
	ldr	w9, [x10, x9]
Lloh0:
	adrp	x10, _IOMUX_GPIO_ONLY@GOTPAGE
Lloh1:
	ldr	x10, [x10, _IOMUX_GPIO_ONLY@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	tst	w10, w9
	b.eq	LBB0_3
; %bb.2:
	mov	w0, #0
	b	LBB0_22
LBB0_3:
	sbfx	x24, x8, #3, #29
	ldr	w0, [x23, #16]
	ldr	w2, [x22, #16]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x3, x21
	mov	x4, x19
	bl	_dev_dbg
	ldr	x8, [x22, #8]
	add	x8, x8, x24, lsl #3
Lloh5:
	adrp	x9, _IOMUX_SOURCE_PMU@GOTPAGE
Lloh6:
	ldr	x9, [x9, _IOMUX_SOURCE_PMU@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	ldp	w10, w8, [x8]
	tst	w9, w10
	cset	w9, ne
	ldr	x20, [x23, w9, uxtw #3]
	str	w8, [sp, #28]
Lloh8:
	adrp	x9, _IOMUX_WIDTH_4BIT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _IOMUX_WIDTH_4BIT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	tst	w9, w10
	b.eq	LBB0_7
; %bb.4:
	negs	w9, w21
	and	w9, w9, #0x7
	and	w10, w21, #0x7
	csneg	w9, w10, w9, mi
	cmp	w9, #4
	b.lt	LBB0_6
; %bb.5:
	add	w8, w8, #4
	str	w8, [sp, #28]
LBB0_6:
	negs	w8, w21
	and	w8, w8, #0x3
	and	w9, w21, #0x3
	csneg	w8, w9, w8, mi
	lsl	w8, w8, #2
	str	w8, [sp, #20]
	mov	w8, #15
	b	LBB0_12
LBB0_7:
Lloh11:
	adrp	x9, _IOMUX_WIDTH_3BIT@GOTPAGE
Lloh12:
	ldr	x9, [x9, _IOMUX_WIDTH_3BIT@GOTPAGEOFF]
Lloh13:
	ldr	w11, [x9]
	sub	w9, w21, w24, lsl #3
	and	w10, w11, w10
	cbz	w10, LBB0_11
; %bb.8:
	cmp	w9, #5
	b.lt	LBB0_10
; %bb.9:
	add	w8, w8, #4
	str	w8, [sp, #28]
LBB0_10:
	sxtb	w8, w9
	mov	w10, #103
	mul	w8, w8, w10
	asr	w10, w8, #8
	ubfx	w8, w8, #15, #1
	add	w8, w8, w10, lsr #1
	add	w8, w8, w8, lsl #2
	sub	w8, w9, w8
	add	w8, w8, w8, lsl #1
	sxtb	w8, w8
	str	w8, [sp, #20]
	mov	w8, #7
	b	LBB0_12
LBB0_11:
	lsl	w8, w9, #1
	str	w8, [sp, #20]
	mov	w8, #3
LBB0_12:
	str	w8, [sp, #24]
	ldr	w24, [x22]
	mov	x0, x21
	bl	_BIT
	tst	w0, w24
	b.eq	LBB0_14
; %bb.13:
	add	x2, sp, #28
	add	x3, sp, #20
	add	x4, sp, #24
	mov	x0, x22
	mov	x1, x21
	bl	_rockchip_get_recalced_mux
LBB0_14:
	ldr	w24, [x22, #4]
	mov	x0, x21
	bl	_BIT
	tst	w0, w24
	b.eq	LBB0_21
; %bb.15:
	add	x3, sp, #16
	add	x4, sp, #12
	add	x5, sp, #8
	mov	x0, x22
	mov	x1, x21
	mov	x2, x19
	bl	_rockchip_get_mux_route
	cbz	x0, LBB0_21
; %bb.16:
	ldr	w8, [sp, #16]
	cmp	w8, #128
	b.eq	LBB0_18
; %bb.17:
	mov	x0, x20
	cmp	w8, #129
	b.eq	LBB0_19
	b	LBB0_20
LBB0_18:
	add	x23, x23, #8
LBB0_19:
	ldr	x0, [x23]
LBB0_20:
	ldp	w2, w1, [sp, #8]
	bl	_regmap_write
	cbnz	w0, LBB0_22
LBB0_21:
	ldp	w9, w8, [sp, #20]
	add	w10, w9, #16
	lsl	w10, w8, w10
	orr	w2, w10, w10, asr #16
	and	w8, w8, w19
	lsl	w8, w8, w9
	orr	w3, w10, w8
	ldr	w1, [sp, #28]
	mov	x0, x20
	bl	_regmap_update_bits
LBB0_22:
	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
	add	sp, sp, #96
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_IOMUX_GPIO_ONLY,4,2            ; @IOMUX_GPIO_ONLY
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"setting mux of GPIO%d-%d to %d\n"

	.comm	_IOMUX_SOURCE_PMU,4,2           ; @IOMUX_SOURCE_PMU
	.comm	_IOMUX_WIDTH_4BIT,4,2           ; @IOMUX_WIDTH_4BIT
	.comm	_IOMUX_WIDTH_3BIT,4,2           ; @IOMUX_WIDTH_3BIT
	.no_dead_strip	_rockchip_set_mux
.subsections_via_symbols
