	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apds990x_calc_again
_apds990x_calc_again:                   ## @apds990x_calc_again
	.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
	.cfi_offset %rbx, -32
	.cfi_offset %r14, -24
	movq	%rdi, %rbx
	movl	(%rdi), %ecx
	movl	4(%rdi), %edx
	movl	8(%rdi), %esi
	cmpl	%esi, %edx
	jne	LBB0_1
## %bb.12:
	leal	-2(%rcx), %edx
	movq	_APDS990X_MAX_AGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	cmovll	%edx, %eax
	xorl	%r14d, %r14d
	cmpl	$2, %ecx
	cmovll	%r14d, %eax
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	jmp	LBB0_7
LBB0_1:
	movl	%esi, %eax
	shrl	$31, %eax
	addl	%esi, %eax
	sarl	%eax
	movq	_APDS_LUX_GAIN_LO_LIMIT_STRICT@GOTPCREL(%rip), %rsi
	movl	(%rsi), %esi
	movl	$-1, %edi
	cmpl	%eax, %edx
	jg	LBB0_4
## %bb.2:
	movl	$2, %edi
	cmpl	%esi, %edx
	jl	LBB0_4
## %bb.3:
	movq	_APDS_LUX_GAIN_LO_LIMIT@GOTPCREL(%rip), %rax
	xorl	%edi, %edi
	cmpl	(%rax), %edx
	setl	%dil
LBB0_4:
	addl	%ecx, %edi
	movq	_APDS990X_MAX_AGAIN@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edi
	cmovll	%edi, %eax
	xorl	%r14d, %r14d
	testl	%edi, %edi
	cmovsl	%r14d, %eax
	cmpl	%ecx, %eax
	je	LBB0_8
## %bb.5:
	cmpl	%esi, %edx
	jge	LBB0_8
## %bb.6:
	movq	_ERANGE@GOTPCREL(%rip), %rcx
	xorl	%r14d, %r14d
LBB0_7:
	subl	(%rcx), %r14d
LBB0_8:
	movl	%eax, 12(%rbx)
	movq	_APDS990X_CONTROL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %esi
	movl	16(%rbx), %ecx
	movl	20(%rbx), %edx
	shll	$6, %ecx
	shll	$4, %edx
	movl	24(%rbx), %edi
	shll	$2, %edi
	orl	%ecx, %edi
	orl	%eax, %edx
	orl	%edi, %edx
	movq	%rbx, %rdi
	callq	_apds990x_write_byte
	movq	%rbx, %rdi
	testl	%r14d, %r14d
	js	LBB0_9
## %bb.10:
	callq	_apds990x_refresh_athres
	jmp	LBB0_11
LBB0_9:
	callq	_apds990x_force_a_refresh
LBB0_11:
	movl	%r14d, %eax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_APDS_LUX_GAIN_LO_LIMIT_STRICT,4,2 ## @APDS_LUX_GAIN_LO_LIMIT_STRICT
	.comm	_APDS_LUX_GAIN_LO_LIMIT,4,2     ## @APDS_LUX_GAIN_LO_LIMIT
	.comm	_APDS990X_MAX_AGAIN,4,2         ## @APDS990X_MAX_AGAIN
	.comm	_ERANGE,4,2                     ## @ERANGE
	.comm	_APDS990X_CONTROL,4,2           ## @APDS990X_CONTROL
	.no_dead_strip	_apds990x_calc_again
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apds990x_calc_again
_apds990x_calc_again:                   ; @apds990x_calc_again
	.cfi_startproc
; %bb.0:
	stp	x20, x19, [sp, #-32]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w19, -24
	.cfi_offset w20, -32
	mov	x19, x0
	ldp	w8, w9, [x0]
	ldr	w10, [x0, #8]
	cmp	w9, w10
	b.ne	LBB0_2
; %bb.1:
	subs	w9, w8, #2
Lloh0:
	adrp	x10, _APDS990X_MAX_AGAIN@GOTPAGE
Lloh1:
	ldr	x10, [x10, _APDS990X_MAX_AGAIN@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	cmp	w9, w10
	csel	w9, w9, w10, lt
	cmp	w8, #2
	csel	w11, wzr, w9, lt
	b	LBB0_9
LBB0_2:
	cmp	w10, #0
	cinc	w11, w10, lt
Lloh3:
	adrp	x10, _APDS_LUX_GAIN_LO_LIMIT_STRICT@GOTPAGE
Lloh4:
	ldr	x10, [x10, _APDS_LUX_GAIN_LO_LIMIT_STRICT@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	cmp	w9, w11, asr #1
	b.le	LBB0_4
; %bb.3:
	mov	w11, #-1
	b	LBB0_7
LBB0_4:
	cmp	w9, w10
	b.ge	LBB0_6
; %bb.5:
	mov	w11, #2
	b	LBB0_7
LBB0_6:
Lloh6:
	adrp	x11, _APDS_LUX_GAIN_LO_LIMIT@GOTPAGE
Lloh7:
	ldr	x11, [x11, _APDS_LUX_GAIN_LO_LIMIT@GOTPAGEOFF]
Lloh8:
	ldr	w11, [x11]
	cmp	w9, w11
	cset	w11, lt
LBB0_7:
Lloh9:
	adrp	x12, _APDS990X_MAX_AGAIN@GOTPAGE
Lloh10:
	ldr	x12, [x12, _APDS990X_MAX_AGAIN@GOTPAGEOFF]
Lloh11:
	ldr	w12, [x12]
	add	w11, w11, w8
	cmp	w11, w12
	csel	w12, w11, w12, lt
	cmp	w11, #0
	csel	w11, wzr, w12, lt
	cmp	w11, w8
	ccmp	w9, w10, #0, ne
	b.lt	LBB0_9
; %bb.8:
	mov	w20, #0
	b	LBB0_10
LBB0_9:
Lloh12:
	adrp	x8, _ERANGE@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ERANGE@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_10:
	str	w11, [x19, #12]
Lloh15:
	adrp	x8, _APDS990X_CONTROL@GOTPAGE
Lloh16:
	ldr	x8, [x8, _APDS990X_CONTROL@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	ldp	w8, w9, [x19, #16]
	ldr	w10, [x19, #24]
	orr	w8, w11, w8, lsl #6
	orr	w8, w8, w9, lsl #4
	orr	w2, w8, w10, lsl #2
	mov	x0, x19
	bl	_apds990x_write_byte
	mov	x0, x19
	tbnz	w20, #31, LBB0_12
; %bb.11:
	bl	_apds990x_refresh_athres
	b	LBB0_13
LBB0_12:
	bl	_apds990x_force_a_refresh
LBB0_13:
	mov	x0, x20
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.cfi_endproc
                                        ; -- End function
	.comm	_APDS_LUX_GAIN_LO_LIMIT_STRICT,4,2 ; @APDS_LUX_GAIN_LO_LIMIT_STRICT
	.comm	_APDS_LUX_GAIN_LO_LIMIT,4,2     ; @APDS_LUX_GAIN_LO_LIMIT
	.comm	_APDS990X_MAX_AGAIN,4,2         ; @APDS990X_MAX_AGAIN
	.comm	_ERANGE,4,2                     ; @ERANGE
	.comm	_APDS990X_CONTROL,4,2           ; @APDS990X_CONTROL
	.no_dead_strip	_apds990x_calc_again
.subsections_via_symbols
