	.file	"extr_rk_clk_composite.c_rk_clk_composite_set_freq.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.8,"aMS",@progbits,1
	.align 8
.LC0:
	.string	"Finding best parent/div for target freq of %ju\n"
	.align 8
.LC1:
	.string	"Testing with parent %s (%d) at freq %ju\n"
	.align 8
.LC2:
	.string	"Best parent so far %s (%d) with best freq at %ju\n"
	.align 8
.LC3:
	.string	"Switching parent index from %d to %d\n"
	.align 8
.LC4:
	.string	"Setting divider to %d (reg: %d)\n"
	.align 8
.LC5:
	.string	" div_mask: 0x%X, div_shift: %d\n"
	.align 8
.LC6:
	.string	"Write: muxdiv_offset=%x, val=%x\n"
	.text
	.p2align 4
	.type	rk_clk_composite_set_freq, @function
rk_clk_composite_set_freq:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	mov	rbp, rdi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	mov	rbx, rdx
	sub	rsp, 88
	.cfi_def_cfa_offset 144
	mov	QWORD PTR 8[rsp], rdx
	lea	r15, 56[rsp]
	mov	DWORD PTR 44[rsp], ecx
	mov	QWORD PTR 48[rsp], r8
	mov	QWORD PTR 56[rsp], rsi
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	call	clknode_get_softc@PLT
	mov	rsi, QWORD PTR [rbx]
	lea	rdi, .LC0[rip]
	xor	ebx, ebx
	mov	r13, rax
	xor	eax, eax
	call	dprintf@PLT
	mov	rdi, rbp
	call	clknode_get_parent_names@PLT
	mov	QWORD PTR [rsp], 0
	mov	QWORD PTR 24[rsp], 0
	mov	r14, rax
	mov	QWORD PTR 16[rsp], r15
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L3:
	add	rbx, 1
.L2:
	mov	rdi, rbp
	call	clknode_get_parents_num@PLT
	cmp	eax, ebx
	je	.L21
	mov	rdi, QWORD PTR [r14+rbx*8]
	call	clknode_find_by_name@PLT
	mov	rsi, QWORD PTR 16[rsp]
	mov	r15, rax
	mov	rdi, rax
	call	clknode_get_freq@PLT
	mov	r12, QWORD PTR 56[rsp]
	mov	rdi, r15
	call	clknode_get_name@PLT
	mov	edx, ebx
	lea	rdi, .LC1[rip]
	movsx	rsi, eax
	mov	rcx, r12
	xor	eax, eax
	call	dprintf@PLT
	mov	rax, QWORD PTR 8[rsp]
	mov	rsi, QWORD PTR 56[rsp]
	mov	rdi, r13
	lea	rcx, 64[rsp]
	mov	rdx, QWORD PTR [rax]
	call	rk_clk_composite_find_best@PLT
	mov	r8, rax
	mov	rax, QWORD PTR 56[rsp]
	cqo
	idiv	r8
	mov	r12, rax
	cmp	QWORD PTR [rsp], rax
	jge	.L3
	mov	rax, QWORD PTR 64[rsp]
	mov	rdi, r15
	mov	QWORD PTR [rsp], r8
	mov	QWORD PTR 32[rsp], rax
	call	clknode_get_name@PLT
	mov	rcx, r12
	mov	edx, ebx
	lea	rdi, .LC2[rip]
	movsx	rsi, eax
	xor	eax, eax
	call	dprintf@PLT
	mov	r8, QWORD PTR [rsp]
	mov	DWORD PTR 40[rsp], ebx
	mov	QWORD PTR [rsp], r12
	mov	QWORD PTR 24[rsp], r8
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L21:
	mov	rax, QWORD PTR 48[rsp]
	cmp	QWORD PTR 24[rsp], 0
	mov	DWORD PTR [rax], 1
	je	.L8
	mov	rax, QWORD PTR 8[rsp]
	mov	rdx, QWORD PTR [rsp]
	cmp	QWORD PTR [rax], rdx
	jle	.L7
	mov	eax, DWORD PTR 44[rsp]
	test	DWORD PTR CLK_SET_ROUND_DOWN[rip], eax
	je	.L8
.L9:
	mov	r14d, DWORD PTR 44[rsp]
	and	r14d, DWORD PTR CLK_SET_DRYRUN[rip]
	je	.L10
	mov	rax, QWORD PTR 8[rsp]
	mov	rdx, QWORD PTR [rsp]
	xor	r14d, r14d
	mov	QWORD PTR [rax], rdx
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L7:
	jge	.L9
	mov	eax, DWORD PTR 44[rsp]
	test	DWORD PTR CLK_SET_ROUND_UP[rip], eax
	jne	.L9
	.p2align 4,,10
	.p2align 3
.L8:
	mov	r14d, DWORD PTR ERANGE[rip]
.L1:
	mov	rax, QWORD PTR 72[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L22
	add	rsp, 88
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	mov	eax, r14d
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	mov	rdi, rbp
	call	clknode_get_parent_idx@PLT
	mov	ebx, DWORD PTR 40[rsp]
	mov	edx, ebx
	cmp	ebx, eax
	jne	.L23
.L11:
	mov	rbx, QWORD PTR 32[rsp]
	mov	rsi, QWORD PTR 24[rsp]
	lea	rdi, .LC4[rip]
	xor	eax, eax
	mov	rdx, rbx
	call	dprintf@PLT
	mov	rdx, QWORD PTR 8[r13]
	mov	rsi, QWORD PTR 0[r13]
	xor	eax, eax
	lea	rdi, .LC5[rip]
	call	dprintf@PLT
	mov	rdi, rbp
	call	DEVICE_LOCK@PLT
	mov	rcx, QWORD PTR 8[r13]
	mov	rdx, rbx
	mov	r15, QWORD PTR 0[r13]
	mov	rsi, QWORD PTR 16[r13]
	lea	rdi, .LC6[rip]
	xor	eax, eax
	sal	rdx, cl
	mov	rcx, QWORD PTR RK_CLK_COMPOSITE_MASK_SHIFT[rip]
	sal	r15, cl
	or	r15, rdx
	mov	rdx, r15
	call	dprintf@PLT
	mov	rsi, QWORD PTR 16[r13]
	mov	rdx, r15
	mov	rdi, rbp
	call	WRITE4@PLT
	mov	rdi, rbp
	call	DEVICE_UNLOCK@PLT
	mov	rax, QWORD PTR 8[rsp]
	mov	rdx, QWORD PTR [rsp]
	mov	QWORD PTR [rax], rdx
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L23:
	movsx	rsi, eax
	lea	rdi, .LC3[rip]
	xor	eax, eax
	call	dprintf@PLT
	mov	esi, ebx
	mov	rdi, rbp
	call	clknode_set_parent_by_idx@PLT
	jmp	.L11
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	rk_clk_composite_set_freq, .-rk_clk_composite_set_freq
	.comm	RK_CLK_COMPOSITE_MASK_SHIFT,8,8
	.comm	ERANGE,4,4
	.comm	CLK_SET_ROUND_UP,4,4
	.comm	CLK_SET_ROUND_DOWN,4,4
	.comm	CLK_SET_DRYRUN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_rk_clk_composite.c_rk_clk_composite_set_freq.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Finding best parent/div for target freq of %ju\012\000"
	.align	2
.LC1:
	.ascii	"Testing with parent %s (%d) at freq %ju\012\000"
	.global	__aeabi_idiv
	.align	2
.LC2:
	.ascii	"Best parent so far %s (%d) with best freq at %ju\012"
	.ascii	"\000"
	.align	2
.LC3:
	.ascii	"Switching parent index from %d to %d\012\000"
	.align	2
.LC4:
	.ascii	"Setting divider to %d (reg: %d)\012\000"
	.align	2
.LC5:
	.ascii	" div_mask: 0x%X, div_shift: %d\012\000"
	.align	2
.LC6:
	.ascii	"Write: muxdiv_offset=%x, val=%x\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC7:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	rk_clk_composite_set_freq, %function
rk_clk_composite_set_freq:
	@ args = 4, pretend = 0, frame = 40
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	sub	sp, sp, #44
	str	r3, [sp, #20]
	ldr	r3, .L24
	str	r2, [sp, #4]
	str	r1, [sp, #28]
	ldr	r3, [r3]
	str	r3, [sp, #36]
	mov	r3,#0
	ldr	r3, [sp, #80]
	mov	r4, r2
	str	r3, [sp, #24]
	mov	r8, r0
	bl	clknode_get_softc
	ldr	r1, [r4]
	mov	r10, r0
	ldr	r0, .L24+4
	bl	dprintf
	mov	r0, r8
	bl	clknode_get_parent_names
	mov	r4, #0
	ldr	fp, .L24+8
	mov	r9, r4
	sub	r7, r0, #4
	str	r4, [sp, #8]
	b	.L2
.L3:
	add	r4, r4, #1
.L2:
	mov	r0, r8
	bl	clknode_get_parents_num
	cmp	r0, r4
	beq	.L21
	ldr	r0, [r7, #4]!
	bl	clknode_find_by_name
	mov	r6, r0
	add	r1, sp, #28
	bl	clknode_get_freq
	mov	r0, r6
	bl	clknode_get_name
	mov	r2, r4
	mov	r1, r0
	ldr	r3, [sp, #28]
	mov	r0, fp
	bl	dprintf
	ldr	r2, [sp, #4]
	ldr	r1, [sp, #28]
	ldr	r2, [r2]
	add	r3, sp, #32
	mov	r0, r10
	bl	rk_clk_composite_find_best
	mov	r5, r0
	ldr	r0, [sp, #28]
	mov	r1, r5
	bl	__aeabi_idiv
	cmp	r9, r0
	bge	.L3
	ldr	r3, [sp, #32]
	str	r0, [sp, #8]
	mov	r0, r6
	str	r3, [sp, #12]
	bl	clknode_get_name
	ldr	r3, [sp, #8]
	mov	r1, r0
	mov	r2, r4
	ldr	r0, .L24+12
	mov	r9, r3
	str	r5, [sp, #8]
	bl	dprintf
	str	r4, [sp, #16]
	b	.L3
.L21:
	mov	r3, #1
	ldr	r2, [sp, #8]
	cmp	r2, #0
	ldr	r2, [sp, #24]
	str	r3, [r2]
	beq	.L8
	ldr	r3, [sp, #4]
	ldr	r3, [r3]
	cmp	r3, r9
	ble	.L7
	ldr	r3, .L24+16
	ldr	r2, [sp, #20]
	ldr	r3, [r3]
	tst	r2, r3
	beq	.L8
.L9:
	ldr	r3, .L24+20
	ldr	r4, [r3]
	ldr	r3, [sp, #20]
	ands	r4, r3, r4
	beq	.L10
	ldr	r3, [sp, #4]
	mov	r4, #0
	str	r9, [r3]
	b	.L1
.L7:
	bge	.L9
	ldr	r3, .L24+24
	ldr	r2, [sp, #20]
	ldr	r3, [r3]
	tst	r2, r3
	bne	.L9
.L8:
	ldr	r3, .L24+28
	ldr	r4, [r3]
.L1:
	ldr	r3, .L24
	ldr	r2, [r3]
	ldr	r3, [sp, #36]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L22
	mov	r0, r4
	add	sp, sp, #44
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L10:
	mov	r0, r8
	bl	clknode_get_parent_idx
	ldr	r5, [sp, #16]
	cmp	r5, r0
	bne	.L23
.L11:
	ldr	r6, [sp, #12]
	ldr	r1, [sp, #8]
	mov	r2, r6
	ldr	r0, .L24+32
	bl	dprintf
	ldm	r10, {r1, r2}
	ldr	r0, .L24+36
	bl	dprintf
	mov	r0, r8
	bl	DEVICE_LOCK
	ldr	r3, .L24+40
	ldr	r5, [r10]
	ldr	r3, [r3]
	ldr	r2, [r10, #4]
	lsl	r5, r5, r3
	orr	r5, r5, r6, lsl r2
	mov	r2, r5
	ldr	r1, [r10, #8]
	ldr	r0, .L24+44
	bl	dprintf
	mov	r2, r5
	ldr	r1, [r10, #8]
	mov	r0, r8
	bl	WRITE4
	mov	r0, r8
	bl	DEVICE_UNLOCK
	ldr	r3, [sp, #4]
	str	r9, [r3]
	b	.L1
.L23:
	mov	r1, r0
	mov	r2, r5
	ldr	r0, .L24+48
	bl	dprintf
	mov	r1, r5
	mov	r0, r8
	bl	clknode_set_parent_by_idx
	b	.L11
.L22:
	bl	__stack_chk_fail
.L25:
	.align	2
.L24:
	.word	.LC7
	.word	.LC0
	.word	.LC1
	.word	.LC2
	.word	CLK_SET_ROUND_DOWN
	.word	CLK_SET_DRYRUN
	.word	CLK_SET_ROUND_UP
	.word	ERANGE
	.word	.LC4
	.word	.LC5
	.word	RK_CLK_COMPOSITE_MASK_SHIFT
	.word	.LC6
	.word	.LC3
	.size	rk_clk_composite_set_freq, .-rk_clk_composite_set_freq
	.comm	RK_CLK_COMPOSITE_MASK_SHIFT,4,4
	.comm	ERANGE,4,4
	.comm	CLK_SET_ROUND_UP,4,4
	.comm	CLK_SET_ROUND_DOWN,4,4
	.comm	CLK_SET_DRYRUN,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
