	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vl6180_set_it
_vl6180_set_it:                         ## @vl6180_set_it
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	testl	%esi, %esi
	jne	LBB0_2
## %bb.1:
	movl	%edx, %r12d
	leal	-512500(%r12), %eax
	cmpl	$-512001, %eax                  ## imm = 0xFFF82FFF
	jbe	LBB0_2
## %bb.3:
	movq	%rdi, %r15
	leaq	4(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	%r15, %rdi
	movl	$1, %esi
	callq	_vl6180_hold
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:
	addl	$500, %r12d                     ## imm = 0x1F4
	movslq	%r12d, %rax
	imulq	$274877907, %rax, %r12          ## imm = 0x10624DD3
	movq	%r12, %rax
	shrq	$63, %rax
	sarq	$38, %r12
	addl	%eax, %r12d
	movl	8(%r15), %edi
	movq	_VL6180_ALS_IT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leal	-1(%r12), %edx
	callq	_vl6180_write_word
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_7
## %bb.6:
	movl	%r12d, (%r15)
	jmp	LBB0_7
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_4:
	movl	%eax, %ebx
LBB0_7:
	movq	%r15, %rdi
	xorl	%esi, %esi
	callq	_vl6180_hold
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_8:
	movl	%ebx, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_VL6180_ALS_IT,4,2              ## @VL6180_ALS_IT
	.no_dead_strip	_vl6180_set_it
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vl6180_set_it
_vl6180_set_it:                         ; @vl6180_set_it
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w21, -40
	.cfi_offset w22, -48
	cbnz	w1, LBB0_5
; %bb.1:
	mov	x22, x2
	mov	w8, #11788
	movk	w8, #65528, lsl #16
	add	w9, w8, #500
	add	w8, w2, w8
	cmp	w8, w9
	b.lo	LBB0_5
; %bb.2:
	mov	x19, x0
	add	x20, x0, #4
	mov	x0, x20
	bl	_mutex_lock
	mov	x0, x19
	mov	w1, #1
	bl	_vl6180_hold
	tbnz	w0, #31, LBB0_6
; %bb.3:
	add	w8, w22, #500
	mov	w9, #19923
	movk	w9, #4194, lsl #16
	smull	x8, w8, w9
	lsr	x9, x8, #63
	asr	x8, x8, #38
	add	w22, w8, w9
	ldr	w0, [x19, #8]
Lloh0:
	adrp	x8, _VL6180_ALS_IT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _VL6180_ALS_IT@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	sub	w2, w22, #1
	bl	_vl6180_write_word
	mov	x21, x0
	tbnz	w0, #31, LBB0_7
; %bb.4:
	str	w22, [x19]
	b	LBB0_7
LBB0_5:
Lloh3:
	adrp	x8, _EINVAL@GOTPAGE
Lloh4:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_8
LBB0_6:
	mov	x21, x0
LBB0_7:
	mov	x0, x19
	mov	w1, #0
	bl	_vl6180_hold
	mov	x0, x20
	bl	_mutex_unlock
LBB0_8:
	mov	x0, x21
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_VL6180_ALS_IT,4,2              ; @VL6180_ALS_IT
	.no_dead_strip	_vl6180_set_it
.subsections_via_symbols
