	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kbd_led_level_set
_kbd_led_level_set:                     ## @kbd_led_level_set
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%r14
	pushq	%rbx
	subq	$16, %rsp
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movl	%esi, %r14d
	movq	_kbd_led_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	xorl	%eax, %eax
	callq	_kbd_get_max_level
	testq	%rax, %rax
	je	LBB0_5
## %bb.1:
	leaq	-32(%rbp), %rdi
	callq	_kbd_get_state
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.2:
	movl	-32(%rbp), %eax
	movl	%eax, -24(%rbp)
	leaq	-24(%rbp), %rdi
	movl	%r14d, %esi
	callq	_kbd_set_level
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.3:
	leaq	-24(%rbp), %rdi
	leaq	-32(%rbp), %rsi
	callq	_kbd_set_state_safe
	jmp	LBB0_4
LBB0_5:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_kbd_get_valid_token_counts
	testq	%rax, %rax
	je	LBB0_13
## %bb.6:
	movq	_kbd_token_bits@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	testl	%edi, %edi
	je	LBB0_11
## %bb.7:
	testl	%r14d, %r14d
	je	LBB0_11
## %bb.8:
	leal	-1(%r14), %eax
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	movl	%edi, %edx
	leal	-1(%rdx), %edi
	addl	$-1, %eax
	setb	%cl
	andl	%edx, %edi
	je	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=1
	testb	%cl, %cl
	jne	LBB0_9
LBB0_11:
	testl	%edi, %edi
	je	LBB0_14
## %bb.12:
	callq	_ffs
	leaq	-1(%rax), %rdi
	callq	_kbd_set_token_bit
LBB0_4:
	movl	%eax, %ebx
	testl	%ebx, %ebx
	jne	LBB0_15
LBB0_14:
	movq	_kbd_led_level@GOTPCREL(%rip), %rax
	movl	%r14d, (%rax)
	xorl	%ebx, %ebx
LBB0_15:
	movq	_kbd_led_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$16, %rsp
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_13:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
	movq	_ENXIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	testl	%ebx, %ebx
	jne	LBB0_15
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_kbd_led_mutex,4,2              ## @kbd_led_mutex
	.comm	_kbd_token_bits,4,2             ## @kbd_token_bits
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Keyboard brightness level control not supported\n"

	.comm	_ENXIO,4,2                      ## @ENXIO
	.comm	_kbd_led_level,4,2              ## @kbd_led_level
	.no_dead_strip	_kbd_led_level_set
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kbd_led_level_set
_kbd_led_level_set:                     ; @kbd_led_level_set
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #48
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x1
Lloh0:
	adrp	x0, _kbd_led_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _kbd_led_mutex@GOTPAGEOFF]
	bl	_mutex_lock
	bl	_kbd_get_max_level
	cbz	x0, LBB0_4
; %bb.1:
	add	x0, sp, #8
	bl	_kbd_get_state
	mov	x20, x0
	cbnz	w0, LBB0_13
; %bb.2:
	ldr	w8, [sp, #8]
	str	w8, [sp]
	mov	x0, sp
	mov	x1, x19
	bl	_kbd_set_level
	mov	x20, x0
	cbnz	w0, LBB0_13
; %bb.3:
	mov	x0, sp
	add	x1, sp, #8
	bl	_kbd_set_state_safe
	mov	x20, x0
	cbnz	w20, LBB0_13
	b	LBB0_12
LBB0_4:
	bl	_kbd_get_valid_token_counts
	cbz	x0, LBB0_11
; %bb.5:
Lloh2:
	adrp	x8, _kbd_token_bits@GOTPAGE
Lloh3:
	ldr	x8, [x8, _kbd_token_bits@GOTPAGEOFF]
Lloh4:
	ldr	w0, [x8]
	cmp	w0, #0
	ccmp	w19, #0, #4, ne
	b.eq	LBB0_9
; %bb.6:
	sub	w8, w19, #1
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	sub	w10, w0, #1
	subs	w8, w8, #1
	cset	w9, hs
	and	w0, w10, w0
	cbz	w0, LBB0_9
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	tbnz	w9, #0, LBB0_7
LBB0_9:
	cbz	w0, LBB0_12
; %bb.10:
	bl	_ffs
	sub	x0, x0, #1
	bl	_kbd_set_token_bit
	mov	x20, x0
	cbnz	w20, LBB0_13
	b	LBB0_12
LBB0_11:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
Lloh7:
	adrp	x8, _ENXIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w20, w8
	cbnz	w20, LBB0_13
LBB0_12:
	mov	w20, #0
Lloh10:
	adrp	x8, _kbd_led_level@GOTPAGE
Lloh11:
	ldr	x8, [x8, _kbd_led_level@GOTPAGEOFF]
Lloh12:
	str	w19, [x8]
LBB0_13:
Lloh13:
	adrp	x0, _kbd_led_mutex@GOTPAGE
Lloh14:
	ldr	x0, [x0, _kbd_led_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
	mov	x0, x20
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #48
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGotStr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_kbd_led_mutex,4,2              ; @kbd_led_mutex
	.comm	_kbd_token_bits,4,2             ; @kbd_token_bits
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Keyboard brightness level control not supported\n"

	.comm	_ENXIO,4,2                      ; @ENXIO
	.comm	_kbd_led_level,4,2              ; @kbd_led_level
	.no_dead_strip	_kbd_led_level_set
.subsections_via_symbols
