	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function zopt2201_read
_zopt2201_read:                         ## @zopt2201_read
	.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
	subq	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r15d
	movq	%rdi, %r13
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	movq	16(%rdi), %r12
	leaq	8(%rdi), %r14
	movq	%r14, %rdi
	callq	_mutex_lock
	movq	_ZOPT2201_UVB_DATA@GOTPCREL(%rip), %rax
	xorl	%esi, %esi
	cmpl	%r15d, (%rax)
	sete	%sil
	movq	%r13, %rdi
	callq	_zopt2201_enable_mode
	testl	%eax, %eax
	js	LBB0_13
## %bb.1:
	movl	%r15d, -76(%rbp)                ## 4-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movl	$11, %r15d
	movl	$2, %r14d
	jmp	LBB0_4
	.p2align	4, 0x90
LBB0_2:                                 ##   in Loop: Header=BB0_4 Depth=1
	shrq	$3, %rax
	movabsq	$2361183241434822607, %rcx      ## imm = 0x20C49BA5E353F7CF
	mulq	%rcx
	movq	%rdx, %rdi
	shrq	$4, %rdi
	callq	_msleep
LBB0_3:                                 ##   in Loop: Header=BB0_4 Depth=1
	movq	_ZOPT2201_MAIN_STATUS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	xorl	%eax, %eax
	movq	_ZOPT2201_MAIN_STATUS_DRDY@GOTPCREL(%rip), %rcx
	testl	%ebx, (%rcx)
	setne	%al
	shll	$2, %eax
	testl	%ebx, %ebx
	cmovsl	%r14d, %eax
	decl	%r15d
	testl	%eax, %eax
	jne	LBB0_7
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$1, %r15d
	je	LBB0_14
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	_zopt2201_resolution@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%r13), %rcx
	movq	(%rax,%rcx,8), %rax
	cmpq	$20000, %rax                    ## imm = 0x4E20
	ja	LBB0_2
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	leaq	1000(%rax), %rsi
	movq	%rax, %rdi
	callq	_usleep_range
	jmp	LBB0_3
LBB0_7:
	cmpl	$2, %eax
	je	LBB0_15
## %bb.8:
	cmpl	$4, %eax
	jne	LBB0_19
## %bb.9:
	testl	%r15d, %r15d
	jle	LBB0_14
## %bb.10:
	leaq	-60(%rbp), %rcx
	movq	%r12, %rdi
	movl	-76(%rbp), %esi                 ## 4-byte Reload
	movl	$12, %edx
	callq	_i2c_smbus_read_i2c_block_data
	testl	%eax, %eax
	js	LBB0_20
## %bb.11:
	movq	_ZOPT2201_MAIN_CTRL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	xorl	%edx, %edx
	callq	_i2c_smbus_write_byte_data
	testl	%eax, %eax
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	js	LBB0_13
## %bb.12:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	-56(%rbp), %ebx
	movl	-52(%rbp), %eax
	shll	$16, %eax
	shll	$8, %ebx
	orl	%eax, %ebx
	orl	-60(%rbp), %ebx
	jmp	LBB0_17
LBB0_13:
	movl	%eax, %ebx
	jmp	LBB0_16
LBB0_14:
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movq	-72(%rbp), %r14                 ## 8-byte Reload
LBB0_16:
	movq	%r14, %rdi
	callq	_mutex_unlock
LBB0_17:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_22
## %bb.18:
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_19:
                                        ## implicit-def: $ebx
	jmp	LBB0_17
LBB0_20:
	movl	%eax, %ebx
	jmp	LBB0_15
LBB0_22:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.comm	_ZOPT2201_UVB_DATA,4,2          ## @ZOPT2201_UVB_DATA
	.comm	_zopt2201_resolution,8,3        ## @zopt2201_resolution
	.comm	_ZOPT2201_MAIN_STATUS,4,2       ## @ZOPT2201_MAIN_STATUS
	.comm	_ZOPT2201_MAIN_STATUS_DRDY,4,2  ## @ZOPT2201_MAIN_STATUS_DRDY
	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.comm	_ZOPT2201_MAIN_CTRL,4,2         ## @ZOPT2201_MAIN_CTRL
	.no_dead_strip	_zopt2201_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function zopt2201_read
_zopt2201_read:                         ; @zopt2201_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	str	x8, [sp, #40]
	ldr	x20, [x0, #16]
	add	x19, x0, #8
	mov	x0, x19
	bl	_mutex_lock
Lloh3:
	adrp	x8, _ZOPT2201_UVB_DATA@GOTPAGE
Lloh4:
	ldr	x8, [x8, _ZOPT2201_UVB_DATA@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w21
	cset	w1, eq
	mov	x0, x22
	bl	_zopt2201_enable_mode
	tbnz	w0, #31, LBB0_13
; %bb.1:
	str	w21, [sp, #12]                  ; 4-byte Folded Spill
	str	x19, [sp, #16]                  ; 8-byte Folded Spill
	mov	w24, #11
Lloh6:
	adrp	x25, _zopt2201_resolution@GOTPAGE
Lloh7:
	ldr	x25, [x25, _zopt2201_resolution@GOTPAGEOFF]
	mov	w26, #20000
Lloh8:
	adrp	x27, _ZOPT2201_MAIN_STATUS@GOTPAGE
Lloh9:
	ldr	x27, [x27, _ZOPT2201_MAIN_STATUS@GOTPAGEOFF]
Lloh10:
	adrp	x28, _ZOPT2201_MAIN_STATUS_DRDY@GOTPAGE
Lloh11:
	ldr	x28, [x28, _ZOPT2201_MAIN_STATUS_DRDY@GOTPAGEOFF]
	mov	w21, #2
	mov	x19, #63439
	movk	x19, #58195, lsl #16
	movk	x19, #39845, lsl #32
	movk	x19, #8388, lsl #48
	b	LBB0_4
LBB0_2:                                 ;   in Loop: Header=BB0_4 Depth=1
	lsr	x8, x0, #3
	umulh	x8, x8, x19
	lsr	x0, x8, #4
	bl	_msleep
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	w1, [x27]
	mov	x0, x20
	bl	_i2c_smbus_read_byte_data
	ldr	w8, [x28]
	tst	w8, w0
	cset	w8, ne
	lsl	w8, w8, #2
	cmp	w0, #0
	csel	w8, w21, w8, lt
	cbnz	w8, LBB0_7
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	subs	w24, w24, #1
	b.eq	LBB0_14
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldr	x8, [x25]
	ldr	x9, [x22]
	ldr	x0, [x8, x9, lsl #3]
	cmp	x0, x26
	b.hi	LBB0_2
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	add	x1, x0, #1000
	bl	_usleep_range
	b	LBB0_3
LBB0_7:
	cmp	w8, #2
	b.eq	LBB0_15
; %bb.8:
	cmp	w8, #4
	b.ne	LBB0_20
; %bb.9:
	cmp	w24, #0
	b.le	LBB0_14
; %bb.10:
	add	x3, sp, #28
	mov	x0, x20
	ldr	w1, [sp, #12]                   ; 4-byte Folded Reload
	mov	w2, #12
	bl	_i2c_smbus_read_i2c_block_data
	tbnz	w0, #31, LBB0_15
; %bb.11:
Lloh12:
	adrp	x8, _ZOPT2201_MAIN_CTRL@GOTPAGE
Lloh13:
	ldr	x8, [x8, _ZOPT2201_MAIN_CTRL@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_i2c_smbus_write_byte_data
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
	tbnz	w0, #31, LBB0_13
; %bb.12:
	mov	x0, x19
	bl	_mutex_unlock
	ldp	w9, w8, [sp, #32]
	ldr	w10, [sp, #28]
	lsl	w9, w9, #8
	orr	w8, w9, w8, lsl #16
	orr	w23, w8, w10
	b	LBB0_18
LBB0_13:
	mov	x23, x0
	b	LBB0_17
LBB0_14:
Lloh15:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh16:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
Lloh17:
	ldr	w8, [x8]
	neg	w23, w8
	b	LBB0_16
LBB0_15:
	mov	x23, x0
LBB0_16:
	ldr	x19, [sp, #16]                  ; 8-byte Folded Reload
LBB0_17:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_18:
	ldr	x8, [sp, #40]
Lloh18:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh19:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh20:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_21
; %bb.19:
	mov	x0, x23
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
LBB0_20:
                                        ; implicit-def: $w23
	b	LBB0_18
LBB0_21:
	bl	___stack_chk_fail
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_ZOPT2201_UVB_DATA,4,2          ; @ZOPT2201_UVB_DATA
	.comm	_zopt2201_resolution,8,3        ; @zopt2201_resolution
	.comm	_ZOPT2201_MAIN_STATUS,4,2       ; @ZOPT2201_MAIN_STATUS
	.comm	_ZOPT2201_MAIN_STATUS_DRDY,4,2  ; @ZOPT2201_MAIN_STATUS_DRDY
	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.comm	_ZOPT2201_MAIN_CTRL,4,2         ; @ZOPT2201_MAIN_CTRL
	.no_dead_strip	_zopt2201_read
.subsections_via_symbols
