	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function lm8323_pwm_work
_lm8323_pwm_work:                       ## @lm8323_pwm_work
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_work_to_pwm
	movq	%rax, %r15
	leaq	20(%rax), %r13
	movq	%r13, %rdi
	callq	_mutex_lock
	cmpq	$0, 24(%r15)
	jne	LBB0_8
## %bb.1:
	movq	(%r15), %rdi
	movq	8(%r15), %rax
	cmpq	%rax, %rdi
	je	LBB0_8
## %bb.2:
	xorl	%ecx, %ecx
	testq	%rdi, %rdi
	sete	%cl
	movl	%ecx, -68(%rbp)                 ## 4-byte Spill
	movl	$0, -64(%rbp)                   ## 4-byte Folded Spill
	subq	%rax, %rdi
	setg	%r14b
	callq	_abs
	movl	%eax, %ebx
	movq	%r15, -88(%rbp)                 ## 8-byte Spill
	movl	16(%r15), %ecx
	movl	%ecx, %eax
	cltd
	idivl	%ebx
	xorl	%r15d, %r15d
	cmpl	$65, %eax
	setge	%sil
	movl	$64, %edx
	movl	$2048, %eax                     ## imm = 0x800
	cmovgel	%edx, %eax
	imull	%ecx, %eax
	imull	$1000, %ebx, %ecx               ## imm = 0x3E8
	cltd
	idivl	%ecx
	cmpl	$63, %eax
	movl	$63, %ecx
	cmovll	%eax, %ecx
	testl	%eax, %eax
	movl	$1, %r12d
	cmovnel	%ecx, %r12d
	testl	%ebx, %ebx
	je	LBB0_3
## %bb.4:
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	movl	-64(%rbp), %eax                 ## 4-byte Reload
	movb	%r14b, %al
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movb	%sil, %r15b
	xorl	%r14d, %r14d
	.p2align	4, 0x90
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movl	$126, %edi
	movl	%ebx, %esi
	callq	_min
	movl	%eax, %r13d
	movl	%r15d, %edi
	movl	%r12d, %esi
	movl	%eax, %edx
	movl	-64(%rbp), %ecx                 ## 4-byte Reload
	callq	_PWM_RAMP
	movl	%eax, -60(%rbp,%r14,4)
	incq	%r14
	subl	%r13d, %ebx
	jne	LBB0_5
## %bb.6:
	movq	-80(%rbp), %r13                 ## 8-byte Reload
	jmp	LBB0_7
LBB0_3:
	xorl	%r14d, %r14d
LBB0_7:
	leaq	-60(%rbp), %rcx
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	-68(%rbp), %esi                 ## 4-byte Reload
	movl	%r14d, %edx
	callq	_lm8323_write_pwm
	movq	(%rbx), %rax
	movq	%rax, 8(%rbx)
LBB0_8:
	movq	%r13, %rdi
	callq	_mutex_unlock
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_10
## %bb.9:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_10:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_lm8323_pwm_work
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function lm8323_pwm_work
_lm8323_pwm_work:                       ; @lm8323_pwm_work
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	.cfi_offset w27, -88
	.cfi_offset w28, -96
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #24]
	bl	_work_to_pwm
	mov	x20, x0
	add	x19, x0, #20
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x20, #24]
	cbnz	x8, LBB0_7
; %bb.1:
	ldp	x8, x9, [x20]
	cmp	x8, x9
	b.eq	LBB0_7
; %bb.2:
	cmp	x8, #0
	cset	w21, eq
	subs	x0, x8, x9
	cset	w22, gt
	bl	_abs
	ldr	w8, [x20, #16]
	sdiv	w9, w8, w0
	mov	w10, #2048
	mov	w11, #64
	cmp	w9, #64
	csel	w9, w11, w10, gt
	cset	w24, gt
	mul	w8, w9, w8
	mov	w9, #1000
	mul	w9, w0, w9
	sdiv	w8, w8, w9
	mov	w9, #63
	cmp	w8, #63
	csel	w9, w8, w9, lt
	cmp	w8, #0
	csinc	w25, w9, wzr, ne
	cbz	w0, LBB0_5
; %bb.3:
	mov	x23, x0
	mov	x2, #0
	add	x27, sp, #12
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x28, x2
	mov	w0, #126
	mov	x1, x23
	bl	_min
	mov	x26, x0
	mov	x0, x24
	mov	x1, x25
	mov	x2, x26
	mov	x3, x22
	bl	_PWM_RAMP
	add	x2, x28, #1
	str	w0, [x27, x28, lsl #2]
	subs	w23, w23, w26
	b.ne	LBB0_4
	b	LBB0_6
LBB0_5:
	mov	w2, #0
LBB0_6:
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x21
                                        ; kill: def $w2 killed $w2 killed $x2
	bl	_lm8323_write_pwm
	ldr	x8, [x20]
	str	x8, [x20, #8]
LBB0_7:
	mov	x0, x19
	bl	_mutex_unlock
	ldr	x8, [sp, #24]
Lloh3:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh4:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_9
; %bb.8:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_9:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_lm8323_pwm_work
.subsections_via_symbols
