	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function apds9300_calculate_lux
_apds9300_calculate_lux:                ## @apds9300_calculate_lux
	.cfi_startproc
## %bb.0:
	testl	%edi, %edi
	je	LBB0_1
## %bb.2:
	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
	movl	%esi, %r14d
	movl	%edi, %ebx
	imull	$100, %esi, %edi
	movl	%ebx, %esi
	callq	_DIV_ROUND_UP
	cmpq	$52, %rax
	ja	LBB0_4
## %bb.3:
	imull	$3150, %ebx, %ecx               ## imm = 0xC4E
	movslq	%ecx, %r14
	movq	_apds9300_lux_ratio@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	imull	(%rcx,%rax,4), %ebx
	imull	$5930, %ebx, %edi               ## imm = 0x172A
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_DIV_ROUND_UP_ULL
	subq	%rax, %r14
	jmp	LBB0_12
LBB0_1:
	xorl	%eax, %eax
	retq
LBB0_4:
	cmpq	$65, %rax
	ja	LBB0_6
## %bb.5:
	imull	$2290, %ebx, %eax               ## imm = 0x8F2
	imull	$-2910, %r14d, %ecx             ## imm = 0xF4A2
	jmp	LBB0_11
LBB0_6:
	cmpq	$80, %rax
	ja	LBB0_8
## %bb.7:
	imull	$1570, %ebx, %eax               ## imm = 0x622
	imull	$-1800, %r14d, %ecx             ## imm = 0xF8F8
	jmp	LBB0_11
LBB0_8:
	cmpq	$130, %rax
	ja	LBB0_9
## %bb.10:
	imull	$338, %ebx, %eax                ## imm = 0x152
	imull	$-260, %r14d, %ecx              ## imm = 0xFEFC
LBB0_11:
	addl	%eax, %ecx
	movslq	%ecx, %r14
LBB0_12:
	shrq	$5, %r14
	movabsq	$755578637259143235, %rcx       ## imm = 0xA7C5AC471B47843
	movq	%r14, %rax
	mulq	%rcx
	movq	%rdx, %rax
	shrq	$7, %rax
	popq	%rbx
	popq	%r14
	popq	%rbp
	retq
LBB0_9:
	xorl	%r14d, %r14d
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_apds9300_lux_ratio,8,3         ## @apds9300_lux_ratio
	.no_dead_strip	_apds9300_calculate_lux
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function apds9300_calculate_lux
_apds9300_calculate_lux:                ; @apds9300_calculate_lux
	.cfi_startproc
; %bb.0:
	cbz	w0, LBB0_3
; %bb.1:
	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
	.cfi_remember_state
	mov	x20, x1
	mov	x19, x0
	mov	w8, #100
	mul	w0, w1, w8
	mov	x1, x19
	bl	_DIV_ROUND_UP
	cmp	x0, #52
	b.hi	LBB0_4
; %bb.2:
	mov	w8, #3150
	mul	w8, w19, w8
	sxtw	x20, w8
Lloh0:
	adrp	x8, _apds9300_lux_ratio@GOTPAGE
Lloh1:
	ldr	x8, [x8, _apds9300_lux_ratio@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	ldr	w8, [x8, x0, lsl #2]
	mul	w8, w19, w8
	mov	w9, #5930
	mul	w0, w8, w9
	mov	w1, #1000
	bl	_DIV_ROUND_UP_ULL
	sub	x8, x20, x0
	b	LBB0_5
LBB0_3:
	.cfi_def_cfa wsp, 0
	.cfi_same_value w30
	.cfi_same_value w29
	.cfi_same_value w19
	.cfi_same_value w20
	mov	x0, #0
	ret
LBB0_4:
	.cfi_restore_state
	mov	w8, #338
	mul	w8, w19, w8
	mov	w9, #-260
	madd	w8, w20, w9, w8
	sxtw	x8, w8
	cmp	x0, #130
	csel	x8, xzr, x8, hi
	mov	w9, #1570
	mul	w9, w19, w9
	mov	w10, #-1800
	madd	w9, w20, w10, w9
	sxtw	x9, w9
	cmp	x0, #80
	csel	x8, x8, x9, hi
	mov	w9, #2290
	mul	w9, w19, w9
	mov	w10, #-2910
	madd	w9, w20, w10, w9
	sxtw	x9, w9
	cmp	x0, #65
	csel	x8, x8, x9, hi
LBB0_5:
	lsr	x8, x8, #5
	mov	x9, #30787
	movk	x9, #29108, lsl #16
	movk	x9, #23236, lsl #32
	movk	x9, #2684, lsl #48
	umulh	x8, x8, x9
	lsr	x0, x8, #7
	ldp	x29, x30, [sp, #16]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp], #32             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.cfi_endproc
                                        ; -- End function
	.comm	_apds9300_lux_ratio,8,3         ; @apds9300_lux_ratio
	.no_dead_strip	_apds9300_calculate_lux
.subsections_via_symbols
