	.file	"extr_clock.c_tnetd7300_set_clock.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	tnetd7300_set_clock, @function
tnetd7300_set_clock:
.LFB0:
	.cfi_startproc
	endbr64
	push	rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	mov	rbp, rsi
	mov	esi, ecx
	mov	ecx, edi
	sub	rsp, 32
	.cfi_def_cfa_offset 48
	mov	r9d, DWORD PTR bus_clk[rip]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	mov	eax, DWORD PTR BOOT_PLL_SOURCE_MASK[rip]
	sal	eax, cl
	and	eax, DWORD PTR [rdx]
	sar	eax, cl
	cmp	eax, 129
	je	.L2
	cmp	eax, 130
	je	.L3
	cmp	eax, 128
	cmove	r9d, DWORD PTR AR7_XTAL_CLOCK[rip]
.L5:
	lea	rdx, 12[rsp]
	lea	r8, 20[rsp]
	mov	edi, r9d
	lea	rcx, 16[rsp]
	call	calculate@PLT
	mov	eax, DWORD PTR 12[rsp]
	mov	ecx, DWORD PTR PREDIV_SHIFT[rip]
	lea	rsi, 4[rbp]
	lea	edi, -1[rax]
	mov	eax, DWORD PTR 16[rsp]
	sal	edi, cl
	sub	eax, 1
	or	edi, eax
	call	writel@PLT
	mov	edi, 1
	call	mdelay@PLT
	mov	rsi, rbp
	mov	edi, 4
	call	writel@PLT
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rdi, rbp
	call	readl@PLT
	test	DWORD PTR PLL_STATUS[rip], eax
	jne	.L6
	mov	eax, DWORD PTR 20[rsp]
	mov	ecx, DWORD PTR MUL_SHIFT[rip]
	mov	rsi, rbp
	lea	edi, -1[rax]
	sal	edi, cl
	or	edi, 2046
	call	writel@PLT
	mov	edi, 75
	call	mdelay@PLT
	mov	rax, QWORD PTR 24[rsp]
	xor	rax, QWORD PTR fs:40
	jne	.L11
	add	rsp, 32
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	pop	rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	.cfi_restore_state
	mov	r9d, DWORD PTR AR7_REF_CLOCK[rip]
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L3:
	mov	r9d, DWORD PTR cpu_clk[rip]
	jmp	.L5
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	tnetd7300_set_clock, .-tnetd7300_set_clock
	.comm	cpu_clk,4,4
	.comm	bus_clk,4,4
	.comm	PREDIV_SHIFT,4,4
	.comm	PLL_STATUS,4,4
	.comm	MUL_SHIFT,4,4
	.comm	BOOT_PLL_SOURCE_MASK,4,4
	.comm	AR7_XTAL_CLOCK,4,4
	.comm	AR7_REF_CLOCK,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_clock.c_tnetd7300_set_clock.c"
	.text
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	tnetd7300_set_clock, %function
tnetd7300_set_clock:
	@ args = 0, pretend = 0, frame = 16
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, lr}
	ldr	lr, .L13
	ldr	ip, [r2]
	ldr	r2, [lr]
	mov	r4, r1
	and	r2, ip, r2, lsl r0
	asr	r2, r2, r0
	mov	r1, r3
	ldr	r0, .L13+4
	ldr	r3, .L13+8
	sub	sp, sp, #28
	cmp	r2, #129
	ldr	r3, [r3]
	str	r3, [sp, #20]
	mov	r3,#0
	ldr	r0, [r0]
	beq	.L2
	cmp	r2, #130
	beq	.L3
	cmp	r2, #128
	beq	.L11
.L5:
	add	r3, sp, #16
	str	r3, [sp]
	add	r2, sp, #8
	add	r3, sp, #12
	bl	calculate
	ldr	r1, .L13+12
	ldr	r2, [sp, #8]
	ldr	r3, [sp, #12]
	ldr	r0, [r1]
	sub	r2, r2, #1
	sub	r3, r3, #1
	orr	r0, r3, r2, lsl r0
	add	r1, r4, #4
	bl	writel
	mov	r0, #1
	bl	mdelay
	mov	r1, r4
	mov	r0, #4
	bl	writel
	ldr	r5, .L13+16
.L6:
	mov	r0, r4
	bl	readl
	ldr	r3, [r5]
	tst	r0, r3
	bne	.L6
	ldr	r2, .L13+20
	ldr	r3, [sp, #16]
	ldr	r0, [r2]
	ldr	r2, .L13+24
	sub	r3, r3, #1
	orr	r0, r2, r3, lsl r0
	mov	r1, r4
	bl	writel
	mov	r0, #75
	bl	mdelay
	ldr	r3, .L13+8
	ldr	r2, [r3]
	ldr	r3, [sp, #20]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L12
	add	sp, sp, #28
	@ sp needed
	pop	{r4, r5, pc}
.L2:
	ldr	r3, .L13+28
	ldr	r0, [r3]
	b	.L5
.L11:
	ldr	r3, .L13+32
	ldr	r0, [r3]
	b	.L5
.L3:
	ldr	r3, .L13+36
	ldr	r0, [r3]
	b	.L5
.L12:
	bl	__stack_chk_fail
.L14:
	.align	2
.L13:
	.word	BOOT_PLL_SOURCE_MASK
	.word	bus_clk
	.word	.LC0
	.word	PREDIV_SHIFT
	.word	PLL_STATUS
	.word	MUL_SHIFT
	.word	2046
	.word	AR7_REF_CLOCK
	.word	AR7_XTAL_CLOCK
	.word	cpu_clk
	.size	tnetd7300_set_clock, .-tnetd7300_set_clock
	.comm	cpu_clk,4,4
	.comm	bus_clk,4,4
	.comm	PREDIV_SHIFT,4,4
	.comm	PLL_STATUS,4,4
	.comm	MUL_SHIFT,4,4
	.comm	BOOT_PLL_SOURCE_MASK,4,4
	.comm	AR7_XTAL_CLOCK,4,4
	.comm	AR7_REF_CLOCK,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
