	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apds9960_set_als_gain
_apds9960_set_als_gain:                 ## @apds9960_set_als_gain
	.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
	movl	%esi, %r12d
	movq	%rdi, %r14
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	movq	_apds9960_als_gain_map@GOTPCREL(%rip), %r13
	movq	(%r13), %rdi
	callq	_ARRAY_SIZE
	testl	%eax, %eax
	jle	LBB0_7
## %bb.1:
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%r13), %rdi
	cmpl	%r12d, (%rdi,%rbx,4)
	je	LBB0_3
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	incq	%rbx
	callq	_ARRAY_SIZE
	cltq
	cmpq	%rax, %rbx
	jl	LBB0_2
	jmp	LBB0_7
LBB0_3:
	leaq	4(%r14), %r12
	movq	%r12, %rdi
	callq	_mutex_lock
	movl	8(%r14), %edi
	movq	_APDS9960_REG_CONTROL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_APDS9960_REG_CONTROL_AGAIN_MASK@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movl	%ebx, %ecx
	callq	_regmap_update_bits
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_5
## %bb.4:
	movl	%ebx, (%r14)
LBB0_5:
	movq	%r12, %rdi
	callq	_mutex_unlock
LBB0_7:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_apds9960_als_gain_map,8,3      ## @apds9960_als_gain_map
	.comm	_APDS9960_REG_CONTROL,4,2       ## @APDS9960_REG_CONTROL
	.comm	_APDS9960_REG_CONTROL_AGAIN_MASK,4,2 ## @APDS9960_REG_CONTROL_AGAIN_MASK
	.no_dead_strip	_apds9960_set_als_gain
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apds9960_set_als_gain
_apds9960_set_als_gain:                 ; @apds9960_set_als_gain
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w23, -56
	.cfi_offset w24, -64
	mov	x22, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _EINVAL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
	neg	w20, w8
Lloh3:
	adrp	x23, _apds9960_als_gain_map@GOTPAGE
Lloh4:
	ldr	x23, [x23, _apds9960_als_gain_map@GOTPAGEOFF]
	ldr	x0, [x23]
	bl	_ARRAY_SIZE
	cmp	w0, #1
	b.lt	LBB0_7
; %bb.1:
	mov	x21, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x0, [x23]
	ldr	w8, [x0, x21, lsl #2]
	cmp	w8, w22
	b.eq	LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x21, x21, #1
	bl	_ARRAY_SIZE
	cmp	x21, w0, sxtw
	b.lt	LBB0_2
	b	LBB0_7
LBB0_4:
	add	x22, x19, #4
	mov	x0, x22
	bl	_mutex_lock
	ldr	w0, [x19, #8]
Lloh5:
	adrp	x8, _APDS9960_REG_CONTROL@GOTPAGE
Lloh6:
	ldr	x8, [x8, _APDS9960_REG_CONTROL@GOTPAGEOFF]
Lloh7:
	ldr	w1, [x8]
Lloh8:
	adrp	x8, _APDS9960_REG_CONTROL_AGAIN_MASK@GOTPAGE
Lloh9:
	ldr	x8, [x8, _APDS9960_REG_CONTROL_AGAIN_MASK@GOTPAGEOFF]
Lloh10:
	ldr	w2, [x8]
	mov	x3, x21
	bl	_regmap_update_bits
	mov	x20, x0
	cbnz	w0, LBB0_6
; %bb.5:
	str	w21, [x19]
LBB0_6:
	mov	x0, x22
	bl	_mutex_unlock
LBB0_7:
	mov	x0, x20
	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
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_apds9960_als_gain_map,8,3      ; @apds9960_als_gain_map
	.comm	_APDS9960_REG_CONTROL,4,2       ; @APDS9960_REG_CONTROL
	.comm	_APDS9960_REG_CONTROL_AGAIN_MASK,4,2 ; @APDS9960_REG_CONTROL_AGAIN_MASK
	.no_dead_strip	_apds9960_set_als_gain
.subsections_via_symbols
