	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function __set_pwm
___set_pwm:                             ## @__set_pwm
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r15
	movq	%rdi, %r13
	movq	$0, -48(%rbp)
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	xorl	%ebx, %ebx
	cmpq	%r15, (%r13)
	je	LBB0_3
## %bb.1:
	movq	16(%r13), %rdi
	leaq	-48(%rbp), %r12
	movq	%r12, %rsi
	callq	_pwm_init_state
	movq	16(%r13), %rax
	movq	(%rax), %rdi
	decq	%rdi
	imulq	%r15, %rdi
	movq	_MAX_PWM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_DIV_ROUND_UP
	movl	%eax, -44(%rbp)
	xorl	%eax, %eax
	testq	%r15, %r15
	setne	%al
	movl	%eax, -48(%rbp)
	movq	16(%r13), %rdi
	movq	%r12, %rsi
	callq	_pwm_apply_state
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_3
## %bb.2:
	movq	%r15, (%r13)
	xorl	%ebx, %ebx
LBB0_3:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_PWM,4,2                    ## @MAX_PWM
	.no_dead_strip	___set_pwm
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function __set_pwm
___set_pwm:                             ; @__set_pwm
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x20, x1
	mov	x21, x0
	str	xzr, [sp, #8]
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
	ldr	x8, [x21]
	cmp	x8, x20
	b.ne	LBB0_2
; %bb.1:
	mov	w22, #0
	b	LBB0_4
LBB0_2:
	ldr	x0, [x21, #16]
	add	x1, sp, #8
	bl	_pwm_init_state
	ldr	x8, [x21, #16]
	ldr	x8, [x8]
	sub	x8, x8, #1
	mul	x0, x8, x20
Lloh0:
	adrp	x8, _MAX_PWM@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MAX_PWM@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_DIV_ROUND_UP
	cmp	x20, #0
	cset	w8, ne
	stp	w8, w0, [sp, #8]
	ldr	x0, [x21, #16]
	add	x1, sp, #8
	bl	_pwm_apply_state
	mov	x22, x0
	cbnz	w0, LBB0_4
; %bb.3:
	str	x20, [x21]
LBB0_4:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x22
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #64
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_PWM,4,2                    ; @MAX_PWM
	.no_dead_strip	___set_pwm
.subsections_via_symbols
