	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kbd_led_level_get
_kbd_led_level_get:                     ## @kbd_led_level_get
	.cfi_startproc
## %bb.0:
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset %rbp, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register %rbp
	pushq	%rbx
	pushq	%rax
	.cfi_offset %rbx, -24
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_kbd_get_max_level
	testq	%rax, %rax
	je	LBB0_3
## %bb.1:
	leaq	-16(%rbp), %rdi
	callq	_kbd_get_state
	testl	%eax, %eax
	jne	LBB0_12
## %bb.2:
	leaq	-16(%rbp), %rdi
	callq	_kbd_get_level
	xorl	%ebx, %ebx
	testl	%eax, %eax
	cmovgl	%eax, %ebx
	jmp	LBB0_12
LBB0_3:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_kbd_get_valid_token_counts
	testq	%rax, %rax
	je	LBB0_11
## %bb.4:
	xorl	%eax, %eax
	callq	_kbd_get_first_active_token_bit
                                        ## kill: def $eax killed $eax def $rax
	testl	%eax, %eax
	js	LBB0_12
## %bb.5:
	movq	_kbd_token_bits@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, %ecx
	je	LBB0_9
## %bb.6:
	testl	%eax, %eax
	je	LBB0_9
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	%ecx, %edx
	leal	-1(%rdx), %ecx
	andl	%edx, %ecx
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	leal	-1(%rax), %edx
	cmpl	$1, %eax
	movl	%edx, %eax
	ja	LBB0_7
LBB0_9:
	testl	%ecx, %ecx
	je	LBB0_12
## %bb.10:
	bsfl	%ecx, %eax
	jmp	LBB0_13
LBB0_11:
	leaq	L_.str(%rip), %rdi
	callq	_pr_warn
LBB0_12:
	movl	%ebx, %eax
LBB0_13:
	addq	$8, %rsp
	popq	%rbx
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.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"

	.no_dead_strip	_kbd_led_level_get
.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_get
_kbd_led_level_get:                     ; @kbd_led_level_get
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #32
	.cfi_def_cfa_offset 32
	stp	x29, x30, [sp, #16]             ; 16-byte Folded Spill
	add	x29, sp, #16
	.cfi_def_cfa w29, 16
	.cfi_offset w30, -8
	.cfi_offset w29, -16
	bl	_kbd_get_max_level
	cbz	x0, LBB0_3
; %bb.1:
	add	x0, sp, #8
	bl	_kbd_get_state
	cbnz	w0, LBB0_9
; %bb.2:
	add	x0, sp, #8
	bl	_kbd_get_level
	cmp	w0, #0
	csel	w0, w0, wzr, gt
	b	LBB0_10
LBB0_3:
	bl	_kbd_get_valid_token_counts
	cbz	x0, LBB0_8
; %bb.4:
	bl	_kbd_get_first_active_token_bit
	tbnz	w0, #31, LBB0_9
; %bb.5:
Lloh0:
	adrp	x8, _kbd_token_bits@GOTPAGE
Lloh1:
	ldr	x8, [x8, _kbd_token_bits@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	cmp	w8, #0
	ccmp	w0, #0, #4, ne
	b.eq	LBB0_7
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	sub	w9, w8, #1
	and	w8, w9, w8
	cmp	w8, #0
	ccmp	w0, #1, #0, ne
	sub	w0, w0, #1
	b.hi	LBB0_6
LBB0_7:
	rbit	w9, w8
	clz	w9, w9
	cmp	w8, #0
	csel	w0, wzr, w9, eq
	b	LBB0_10
LBB0_8:
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_warn
LBB0_9:
	mov	w0, #0
LBB0_10:
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #32
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.cfi_endproc
                                        ; -- End function
	.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"

	.no_dead_strip	_kbd_led_level_get
.subsections_via_symbols
