	.file	"extr_smsc47m1.c_fan_div_store.c"
	.intel_syntax noprefix
	.text
	.p2align 4
	.type	fan_div_store, @function
fan_div_store:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	mov	r15, rdx
	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
	mov	rdi, rsi
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 40
	.cfi_def_cfa_offset 96
	mov	QWORD PTR 8[rsp], rcx
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 24[rsp], rax
	xor	eax, eax
	call	to_sensor_dev_attr@PLT
	mov	rdi, rbp
	mov	rbx, rax
	call	dev_get_drvdata@PLT
	movsx	rbx, DWORD PTR [rbx]
	mov	r12, rax
	mov	rax, QWORD PTR [rax]
	mov	edi, DWORD PTR [rax+rbx*4]
	call	DIV_FROM_REG@PLT
	lea	rdx, 16[rsp]
	mov	esi, 10
	mov	rdi, r15
	mov	rbp, rax
	call	kstrtol@PLT
	test	eax, eax
	jne	.L1
	cmp	QWORD PTR 16[rsp], rbp
	je	.L18
	lea	r15, 16[r12]
	mov	r13, rbx
	lea	r14, 0[0+rbx*4]
	mov	rdi, r15
	call	mutex_lock@PLT
	mov	rax, QWORD PTR 16[rsp]
	cmp	rax, 4
	je	.L4
	jg	.L5
	cmp	rax, 1
	je	.L6
	cmp	rax, 2
	jne	.L8
	mov	rax, QWORD PTR [r12]
	mov	DWORD PTR [rax+rbx*4], 1
.L10:
	cmp	r13d, 1
	jle	.L20
	cmp	r13d, 2
	jne	.L13
	mov	esi, DWORD PTR SMSC47M2_REG_FANDIV3[rip]
	mov	rdi, r12
	call	smsc47m1_read_value@PLT
	mov	rdx, QWORD PTR [r12]
	mov	esi, DWORD PTR SMSC47M2_REG_FANDIV3[rip]
	mov	rdi, r12
	and	eax, 207
	mov	edx, DWORD PTR 8[rdx]
	sal	edx, 4
	or	edx, eax
	movsx	rdx, edx
	call	smsc47m1_write_value@PLT
.L15:
	add	r14, QWORD PTR 8[r12]
	mov	rcx, QWORD PTR 16[rsp]
	mov	eax, 192
	xor	esi, esi
	sub	eax, DWORD PTR [r14]
	mov	edi, 192
	cdqe
	imul	rbp, rax
	mov	rax, rcx
	shr	rax, 63
	add	rax, rcx
	sar	rax
	add	rax, rbp
	cqo
	idiv	rcx
	mov	edx, 191
	sub	rdi, rax
	call	clamp_val@PLT
	mov	rdi, r12
	mov	DWORD PTR [r14], eax
	mov	rax, QWORD PTR 8[r12]
	movsx	rdx, DWORD PTR [rax+rbx*4]
	mov	rax, QWORD PTR SMSC47M1_REG_FAN_PRELOAD[rip]
	mov	esi, DWORD PTR [rax+rbx*4]
	call	smsc47m1_write_value@PLT
	mov	rdi, r15
	call	mutex_unlock@PLT
.L18:
	mov	eax, DWORD PTR 8[rsp]
.L1:
	mov	rcx, QWORD PTR 24[rsp]
	xor	rcx, QWORD PTR fs:40
	jne	.L21
	add	rsp, 40
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	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
.L20:
	.cfi_restore_state
	test	r13d, r13d
	jns	.L22
.L13:
	xor	eax, eax
	call	BUG@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L5:
	cmp	rax, 8
	jne	.L8
	mov	rax, QWORD PTR [r12]
	mov	DWORD PTR [rax+rbx*4], 3
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L22:
	mov	esi, DWORD PTR SMSC47M1_REG_FANDIV[rip]
	mov	rdi, r12
	call	smsc47m1_read_value@PLT
	mov	rdx, QWORD PTR [r12]
	lea	ecx, 4[r13+r13]
	mov	rdi, r12
	mov	esi, 3
	mov	edx, DWORD PTR [rdx+rbx*4]
	sal	esi, cl
	not	esi
	and	esi, eax
	sal	edx, cl
	or	edx, esi
	mov	esi, DWORD PTR SMSC47M1_REG_FANDIV[rip]
	movsx	rdx, edx
	call	smsc47m1_write_value@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L8:
	mov	rdi, r15
	call	mutex_unlock@PLT
	mov	eax, DWORD PTR EINVAL[rip]
	neg	eax
	jmp	.L1
	.p2align 4,,10
	.p2align 3
.L6:
	mov	rax, QWORD PTR [r12]
	mov	DWORD PTR [rax+rbx*4], 0
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L4:
	mov	rax, QWORD PTR [r12]
	mov	DWORD PTR [rax+rbx*4], 2
	jmp	.L10
.L21:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	fan_div_store, .-fan_div_store
	.comm	SMSC47M2_REG_FANDIV3,4,4
	.comm	SMSC47M1_REG_FAN_PRELOAD,8,8
	.comm	SMSC47M1_REG_FANDIV,4,4
	.comm	EINVAL,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_smsc47m1.c_fan_div_store.c"
	.text
	.global	__aeabi_idiv
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC0:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	fan_div_store, %function
fan_div_store:
	@ args = 0, pretend = 0, frame = 8
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, lr}
	mov	r7, r3
	ldr	r3, .L22
	sub	sp, sp, #12
	mov	r4, r0
	mov	r0, r1
	mov	r8, r2
	ldr	r3, [r3]
	str	r3, [sp, #4]
	mov	r3,#0
	bl	to_sensor_dev_attr
	mov	r5, r0
	mov	r0, r4
	bl	dev_get_drvdata
	ldr	r5, [r5]
	ldr	r3, [r0]
	mov	r4, r0
	ldr	r0, [r3, r5, lsl #2]
	bl	DIV_FROM_REG
	mov	r2, sp
	mov	r6, r0
	mov	r1, #10
	mov	r0, r8
	bl	kstrtol
	cmp	r0, #0
	bne	.L1
	ldr	r3, [sp]
	cmp	r3, r6
	beq	.L18
	add	r8, r4, #8
	mov	r0, r8
	bl	mutex_lock
	ldr	r3, [sp]
	sub	r3, r3, #1
	cmp	r3, #7
	ldrls	pc, [pc, r3, asl #2]
	b	.L4
.L6:
	.word	.L9
	.word	.L8
	.word	.L4
	.word	.L7
	.word	.L4
	.word	.L4
	.word	.L4
	.word	.L5
.L5:
	mov	r2, #3
	ldr	r3, [r4]
	str	r2, [r3, r5, lsl #2]
.L10:
	cmp	r5, #1
	bgt	.L11
	cmp	r5, #0
	bge	.L20
.L13:
	bl	BUG
.L15:
	ldr	r9, [r4, #4]
	ldr	r1, [sp]
	ldr	r0, [r9, r5, lsl #2]
	add	r3, r1, r1, lsr #31
	asr	r3, r3, #1
	rsb	r0, r0, #192
	mla	r0, r6, r0, r3
	bl	__aeabi_idiv
	mov	r2, #191
	mov	r1, #0
	rsb	r0, r0, #192
	bl	clamp_val
	ldr	r3, .L22+4
	ldr	r2, [r4, #4]
	ldr	r3, [r3]
	str	r0, [r9, r5, lsl #2]
	ldr	r2, [r2, r5, lsl #2]
	mov	r0, r4
	ldr	r1, [r3, r5, lsl #2]
	bl	smsc47m1_write_value
	mov	r0, r8
	bl	mutex_unlock
.L18:
	mov	r0, r7
.L1:
	ldr	r3, .L22
	ldr	r2, [r3]
	ldr	r3, [sp, #4]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L21
	add	sp, sp, #12
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, pc}
.L4:
	mov	r0, r8
	bl	mutex_unlock
	ldr	r3, .L22+8
	ldr	r0, [r3]
	rsb	r0, r0, #0
	b	.L1
.L7:
	mov	r2, #2
	ldr	r3, [r4]
	str	r2, [r3, r5, lsl #2]
	b	.L10
.L8:
	mov	r2, #1
	ldr	r3, [r4]
	str	r2, [r3, r5, lsl #2]
	b	.L10
.L9:
	mov	r2, #0
	ldr	r3, [r4]
	str	r2, [r3, r5, lsl #2]
	b	.L10
.L11:
	cmp	r5, #2
	bne	.L13
	ldr	r9, .L22+12
	mov	r0, r4
	ldr	r1, [r9]
	bl	smsc47m1_read_value
	ldr	r3, [r4]
	and	r0, r0, #207
	ldr	r2, [r3, #8]
	ldr	r1, [r9]
	orr	r2, r0, r2, lsl #4
	mov	r0, r4
	bl	smsc47m1_write_value
	b	.L15
.L20:
	ldr	r9, .L22+16
	mov	r0, r4
	ldr	r1, [r9]
	bl	smsc47m1_read_value
	mov	r1, #3
	ldr	r2, [r4]
	add	r3, r5, #2
	lsl	r3, r3, #1
	ldr	r2, [r2, r5, lsl #2]
	bic	r0, r0, r1, lsl r3
	orr	r2, r0, r2, lsl r3
	ldr	r1, [r9]
	mov	r0, r4
	bl	smsc47m1_write_value
	b	.L15
.L21:
	bl	__stack_chk_fail
.L23:
	.align	2
.L22:
	.word	.LC0
	.word	SMSC47M1_REG_FAN_PRELOAD
	.word	EINVAL
	.word	SMSC47M2_REG_FANDIV3
	.word	SMSC47M1_REG_FANDIV
	.size	fan_div_store, .-fan_div_store
	.comm	SMSC47M2_REG_FANDIV3,4,4
	.comm	SMSC47M1_REG_FAN_PRELOAD,4,4
	.comm	SMSC47M1_REG_FANDIV,4,4
	.comm	EINVAL,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
