	.file	"extr_w83795.c_pwm_freq_to_reg.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	pwm_freq_to_reg, @function
pwm_freq_to_reg:
.LFB0:
	.cfi_startproc
	endbr64
	push	r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	push	r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	push	r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	push	rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	mov	ebp, esi
	push	rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	mov	rbx, rdi
	mov	rdi, QWORD PTR pwm_freq_cksel0[rip]
	call	ARRAY_SIZE@PLT
	mov	rsi, QWORD PTR pwm_freq_cksel0[rip]
	mov	rdi, rbx
	mov	edx, eax
	call	find_closest_descending@PLT
	mov	r14, rax
	cmp	rbx, 374
	jbe	.L1
	mov	rax, QWORD PTR pwm_freq_cksel0[rip]
	mov	edx, 256
	mov	ecx, 384
	mov	rsi, rbx
	mov	r13, QWORD PTR [rax+r14*8]
	imul	eax, ebp, 1000
	cmp	ebp, 48000
	cmovne	ecx, edx
	cdq
	idiv	ecx
	movsx	r12, eax
	mov	rdi, r12
	call	DIV_ROUND_CLOSEST@PLT
	mov	esi, 1
	mov	edx, 128
	mov	edi, eax
	call	clamp_val@PLT
	xor	edx, edx
	mov	rdi, rbx
	mov	rbp, rax
	mov	rax, r12
	sub	rdi, r13
	div	rbp
	sub	rbp, 1
	or	bpl, -128
	mov	r12, rax
	call	abs@PLT
	sub	rbx, r12
	mov	rdi, rbx
	mov	r13, rax
	call	abs@PLT
	cmp	r13, rax
	cmovg	r14, rbp
.L1:
	pop	rbx
	.cfi_def_cfa_offset 40
	mov	rax, r14
	pop	rbp
	.cfi_def_cfa_offset 32
	pop	r12
	.cfi_def_cfa_offset 24
	pop	r13
	.cfi_def_cfa_offset 16
	pop	r14
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	pwm_freq_to_reg, .-pwm_freq_to_reg
	.comm	pwm_freq_cksel0,8,8
	.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_w83795.c_pwm_freq_to_reg.c"
	.text
	.global	__aeabi_idiv
	.global	__aeabi_uidiv
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	pwm_freq_to_reg, %function
pwm_freq_to_reg:
	@ args = 0, pretend = 0, frame = 0
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, lr}
	ldr	r7, .L7
	mov	r4, r0
	ldr	r6, [r7]
	mov	r5, r1
	mov	r0, r6
	bl	ARRAY_SIZE
	mov	r1, r6
	mov	r2, r0
	mov	r0, r4
	bl	find_closest_descending
	ldr	r3, .L7+4
	mov	r6, r0
	cmp	r4, r3
	bls	.L1
	ldr	r1, .L7+8
	rsb	r0, r5, r5, lsl #5
	cmp	r5, r1
	ldr	r3, [r7]
	add	r0, r5, r0, lsl #2
	moveq	r1, #384
	movne	r1, #256
	lsl	r0, r0, #3
	ldr	r5, [r3, r6, lsl #2]
	bl	__aeabi_idiv
	mov	r1, r4
	mov	r8, r0
	bl	DIV_ROUND_CLOSEST
	mov	r2, #128
	mov	r1, #1
	bl	clamp_val
	mov	r7, r0
	sub	r5, r4, r5
	cmp	r5, #0
	mov	r0, r8
	mov	r1, r7
	rsblt	r5, r5, #0
	bl	__aeabi_uidiv
	sub	r4, r4, r0
	cmp	r4, #0
	rsblt	r4, r4, #0
	cmp	r5, r4
	subgt	r6, r7, #1
	orrgt	r6, r6, #128
.L1:
	mov	r0, r6
	pop	{r4, r5, r6, r7, r8, pc}
.L8:
	.align	2
.L7:
	.word	pwm_freq_cksel0
	.word	374
	.word	48000
	.size	pwm_freq_to_reg, .-pwm_freq_to_reg
	.comm	pwm_freq_cksel0,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
