	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vl6180_measure
_vl6180_measure:                        ## @vl6180_measure
	.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, %ebx
	movq	%rdi, %r14
	movq	8(%rdi), %r15
	callq	_mutex_lock
	movq	_vl6180_chan_regs_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movslq	%ebx, %rcx
	leaq	(%rcx,%rcx,2), %r12
	movl	16(%rax,%r12,8), %esi
	movq	_VL6180_STARTSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	callq	_vl6180_write_byte
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	$20, %r14d
	movq	_VL6180_INTR_STATUS@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r13), %esi
	movq	%r15, %rdi
	callq	_vl6180_read_byte
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	_vl6180_chan_regs_table@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	testl	%ebx, (%rax,%r12,8)
	jne	LBB0_7
## %bb.6:                               ##   in Loop: Header=BB0_3 Depth=1
	movl	$20, %edi
	callq	_msleep
	decl	%r14d
	jne	LBB0_3
	jmp	LBB0_8
LBB0_1:
	movl	%eax, %ebx
	jmp	LBB0_14
LBB0_4:
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_7:
	testl	%r14d, %r14d
	jle	LBB0_8
## %bb.9:
	cmpq	$0, 8(%rax,%r12,8)
	movl	4(%rax,%r12,8), %esi
	movq	%r15, %rdi
	je	LBB0_11
## %bb.10:
	callq	_vl6180_read_word
	jmp	LBB0_12
LBB0_8:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	jmp	LBB0_14
LBB0_11:
	callq	_vl6180_read_byte
LBB0_12:
	movl	%eax, %ebx
	movq	-48(%rbp), %r14                 ## 8-byte Reload
	testl	%eax, %eax
	js	LBB0_14
## %bb.13:
	movq	_VL6180_INTR_CLEAR@GOTPCREL(%rip), %rax
	movq	_VL6180_CLEAR_ERROR@GOTPCREL(%rip), %rcx
	movq	_VL6180_CLEAR_ALS@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	movl	(%rax), %esi
	movq	_VL6180_CLEAR_RANGE@GOTPCREL(%rip), %rax
	orl	(%rax), %edx
	movq	%r15, %rdi
	callq	_vl6180_write_byte
	testl	%eax, %eax
	cmovsl	%eax, %ebx
LBB0_14:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_vl6180_chan_regs_table,8,3     ## @vl6180_chan_regs_table
	.comm	_VL6180_STARTSTOP,4,2           ## @VL6180_STARTSTOP
	.comm	_VL6180_INTR_STATUS,4,2         ## @VL6180_INTR_STATUS
	.comm	_EIO,4,2                        ## @EIO
	.comm	_VL6180_INTR_CLEAR,4,2          ## @VL6180_INTR_CLEAR
	.comm	_VL6180_CLEAR_ERROR,4,2         ## @VL6180_CLEAR_ERROR
	.comm	_VL6180_CLEAR_ALS,4,2           ## @VL6180_CLEAR_ALS
	.comm	_VL6180_CLEAR_RANGE,4,2         ## @VL6180_CLEAR_RANGE
	.no_dead_strip	_vl6180_measure
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vl6180_measure
_vl6180_measure:                        ; @vl6180_measure
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x22, x1
	mov	x19, x0
	ldr	x20, [x0, #8]
	bl	_mutex_lock
Lloh0:
	adrp	x23, _vl6180_chan_regs_table@GOTPAGE
Lloh1:
	ldr	x23, [x23, _vl6180_chan_regs_table@GOTPAGEOFF]
	ldr	x8, [x23]
	mov	w9, #24
	smaddl	x8, w22, w9, x8
	ldr	w1, [x8, #16]
Lloh2:
	adrp	x8, _VL6180_STARTSTOP@GOTPAGE
Lloh3:
	ldr	x8, [x8, _VL6180_STARTSTOP@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	mov	x0, x20
	bl	_vl6180_write_byte
	tbnz	w0, #31, LBB0_5
; %bb.1:
	sxtw	x22, w22
	mov	w24, #20
Lloh5:
	adrp	x25, _VL6180_INTR_STATUS@GOTPAGE
Lloh6:
	ldr	x25, [x25, _VL6180_INTR_STATUS@GOTPAGEOFF]
	mov	w8, #24
	mul	x26, x22, x8
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x25]
	mov	x0, x20
	bl	_vl6180_read_byte
	mov	x21, x0
	tbnz	w0, #31, LBB0_12
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x8, [x23]
	ldr	w9, [x8, x26]
	tst	w9, w21
	b.ne	LBB0_6
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	w0, #20
	bl	_msleep
	subs	w24, w24, #1
	b.ne	LBB0_2
	b	LBB0_9
LBB0_5:
	mov	x21, x0
	b	LBB0_12
LBB0_6:
	cmp	w24, #0
	b.le	LBB0_9
; %bb.7:
	mov	w9, #24
	madd	x8, x22, x9, x8
	ldr	x9, [x8, #8]
	ldr	w1, [x8, #4]
	mov	x0, x20
	cbz	x9, LBB0_10
; %bb.8:
	bl	_vl6180_read_word
	mov	x21, x0
	tbz	w0, #31, LBB0_11
	b	LBB0_12
LBB0_9:
Lloh7:
	adrp	x8, _EIO@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh9:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_12
LBB0_10:
	bl	_vl6180_read_byte
	mov	x21, x0
	tbnz	w0, #31, LBB0_12
LBB0_11:
Lloh10:
	adrp	x8, _VL6180_INTR_CLEAR@GOTPAGE
Lloh11:
	ldr	x8, [x8, _VL6180_INTR_CLEAR@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
Lloh13:
	adrp	x8, _VL6180_CLEAR_ERROR@GOTPAGE
Lloh14:
	ldr	x8, [x8, _VL6180_CLEAR_ERROR@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
Lloh16:
	adrp	x9, _VL6180_CLEAR_ALS@GOTPAGE
Lloh17:
	ldr	x9, [x9, _VL6180_CLEAR_ALS@GOTPAGEOFF]
Lloh18:
	ldr	w9, [x9]
	orr	w8, w9, w8
Lloh19:
	adrp	x9, _VL6180_CLEAR_RANGE@GOTPAGE
Lloh20:
	ldr	x9, [x9, _VL6180_CLEAR_RANGE@GOTPAGEOFF]
Lloh21:
	ldr	w9, [x9]
	orr	w2, w8, w9
	mov	x0, x20
	bl	_vl6180_write_byte
	cmp	w0, #0
	csel	w21, w0, w21, lt
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_vl6180_chan_regs_table,8,3     ; @vl6180_chan_regs_table
	.comm	_VL6180_STARTSTOP,4,2           ; @VL6180_STARTSTOP
	.comm	_VL6180_INTR_STATUS,4,2         ; @VL6180_INTR_STATUS
	.comm	_EIO,4,2                        ; @EIO
	.comm	_VL6180_INTR_CLEAR,4,2          ; @VL6180_INTR_CLEAR
	.comm	_VL6180_CLEAR_ERROR,4,2         ; @VL6180_CLEAR_ERROR
	.comm	_VL6180_CLEAR_ALS,4,2           ; @VL6180_CLEAR_ALS
	.comm	_VL6180_CLEAR_RANGE,4,2         ; @VL6180_CLEAR_RANGE
	.no_dead_strip	_vl6180_measure
.subsections_via_symbols
