	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function srf08_read_ranging
_srf08_read_ranging:                    ## @srf08_read_ranging
	.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
	movq	%rdi, %r12
	movq	8(%rdi), %r14
	leaq	4(%rdi), %r15
	movq	%r15, %rdi
	callq	_mutex_lock
	movq	8(%r12), %rdi
	movq	_SRF08_WRITE_COMMAND@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_SRF08_CMD_RANGING_CM@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_i2c_smbus_write_byte_data
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	movslq	(%r12), %rax
	imulq	$799063683, %rax, %rax          ## imm = 0x2FA0BE83
	movq	%rax, %rcx
	sarq	$37, %rcx
	shrq	$63, %rax
	leal	(%rcx,%rax), %edi
	incl	%edi
	callq	_msleep
	movq	8(%r12), %rdi
	movq	_SRF08_READ_SW_REVISION@GOTPCREL(%rip), %r13
	movl	(%r13), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	decl	%eax
	cmpl	$254, %eax
	jb	LBB0_7
## %bb.3:
	movl	$5, %edi
	callq	_msleep
	movq	8(%r12), %rdi
	movl	(%r13), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	decl	%eax
	cmpl	$254, %eax
	jb	LBB0_7
## %bb.4:
	movl	$5, %edi
	callq	_msleep
	movq	8(%r12), %rdi
	movl	(%r13), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	decl	%eax
	cmpl	$254, %eax
	jb	LBB0_7
## %bb.5:
	movl	$5, %edi
	callq	_msleep
	movq	8(%r12), %rdi
	movl	(%r13), %esi
	callq	_i2c_smbus_read_byte_data
	movl	%eax, %ebx
	decl	%eax
	cmpl	$254, %eax
	jb	LBB0_7
## %bb.6:
	movl	$5, %edi
	callq	_msleep
LBB0_7:
	addl	$-255, %ebx
	cmpl	$-255, %ebx
	ja	LBB0_9
## %bb.8:
	leaq	L_.str.1(%rip), %rsi
	xorl	%ebx, %ebx
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	movq	%r15, %rdi
	callq	_mutex_unlock
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_13
LBB0_1:
	movl	%eax, %ebx
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_11
LBB0_9:
	movq	8(%r12), %rdi
	movq	_SRF08_READ_ECHO_1_HIGH@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_i2c_smbus_read_word_swapped
	movl	%eax, %ebx
	testl	%eax, %eax
	jns	LBB0_12
## %bb.10:
	leaq	L_.str.2(%rip), %rsi
LBB0_11:
	movq	%r14, %rdi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_12:
	movq	%r15, %rdi
	callq	_mutex_unlock
LBB0_13:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_SRF08_WRITE_COMMAND,4,2        ## @SRF08_WRITE_COMMAND
	.comm	_SRF08_CMD_RANGING_CM,4,2       ## @SRF08_CMD_RANGING_CM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"write command - err: %d\n"

	.comm	_SRF08_READ_SW_REVISION,4,2     ## @SRF08_READ_SW_REVISION
L_.str.1:                               ## @.str.1
	.asciz	"device not ready\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_SRF08_READ_ECHO_1_HIGH,4,2     ## @SRF08_READ_ECHO_1_HIGH
L_.str.2:                               ## @.str.2
	.asciz	"cannot read distance: ret=%d\n"

	.no_dead_strip	_srf08_read_ranging
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function srf08_read_ranging
_srf08_read_ranging:                    ; @srf08_read_ranging
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.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
	mov	x21, x0
	ldr	x20, [x0, #8]
	add	x19, x0, #4
	mov	x0, x19
	bl	_mutex_lock
	ldr	x0, [x21, #8]
Lloh0:
	adrp	x8, _SRF08_WRITE_COMMAND@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SRF08_WRITE_COMMAND@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x8, _SRF08_CMD_RANGING_CM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _SRF08_CMD_RANGING_CM@GOTPAGEOFF]
Lloh5:
	ldr	w2, [x8]
	bl	_i2c_smbus_write_byte_data
	tbnz	w0, #31, LBB0_8
; %bb.1:
	ldrsw	x8, [x21]
	mov	w9, #48771
	movk	w9, #12192, lsl #16
	mul	x8, x8, x9
	lsr	x9, x8, #63
	asr	x8, x8, #37
	add	w8, w8, w9
	add	w0, w8, #1
	bl	_msleep
	ldr	x0, [x21, #8]
Lloh6:
	adrp	x23, _SRF08_READ_SW_REVISION@GOTPAGE
Lloh7:
	ldr	x23, [x23, _SRF08_READ_SW_REVISION@GOTPAGEOFF]
	ldr	w1, [x23]
	bl	_i2c_smbus_read_byte_data
	mov	x22, x0
	sub	w8, w0, #1
	cmp	w8, #254
	b.lo	LBB0_6
; %bb.2:
	mov	w0, #5
	bl	_msleep
	ldr	x0, [x21, #8]
	ldr	w1, [x23]
	bl	_i2c_smbus_read_byte_data
	mov	x22, x0
	sub	w8, w0, #1
	cmp	w8, #254
	b.lo	LBB0_6
; %bb.3:
	mov	w0, #5
	bl	_msleep
	ldr	x0, [x21, #8]
	ldr	w1, [x23]
	bl	_i2c_smbus_read_byte_data
	mov	x22, x0
	sub	w8, w0, #1
	cmp	w8, #254
	b.lo	LBB0_6
; %bb.4:
	mov	w0, #5
	bl	_msleep
	ldr	x0, [x21, #8]
	ldr	w1, [x23]
	bl	_i2c_smbus_read_byte_data
	mov	x22, x0
	sub	w8, w0, #1
	cmp	w8, #254
	b.lo	LBB0_6
; %bb.5:
	mov	w0, #5
	bl	_msleep
LBB0_6:
	sub	w8, w22, #255
	cmn	w8, #255
	b.hi	LBB0_9
; %bb.7:
Lloh8:
	adrp	x1, l_.str.1@PAGE
Lloh9:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_dev_err
	mov	x0, x19
	bl	_mutex_unlock
Lloh10:
	adrp	x8, _EIO@GOTPAGE
Lloh11:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh12:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_13
LBB0_8:
	mov	x22, x0
	str	x22, [sp]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_11
LBB0_9:
	ldr	x0, [x21, #8]
Lloh15:
	adrp	x8, _SRF08_READ_ECHO_1_HIGH@GOTPAGE
Lloh16:
	ldr	x8, [x8, _SRF08_READ_ECHO_1_HIGH@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	bl	_i2c_smbus_read_word_swapped
	mov	x22, x0
	tbz	w0, #31, LBB0_12
; %bb.10:
	mov	x8, x22
	str	x8, [sp]
Lloh18:
	adrp	x1, l_.str.2@PAGE
Lloh19:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_11:
	mov	x0, x20
	bl	_dev_err
LBB0_12:
	mov	x0, x19
	bl	_mutex_unlock
LBB0_13:
	mov	x0, x22
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_SRF08_WRITE_COMMAND,4,2        ; @SRF08_WRITE_COMMAND
	.comm	_SRF08_CMD_RANGING_CM,4,2       ; @SRF08_CMD_RANGING_CM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"write command - err: %d\n"

	.comm	_SRF08_READ_SW_REVISION,4,2     ; @SRF08_READ_SW_REVISION
l_.str.1:                               ; @.str.1
	.asciz	"device not ready\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_SRF08_READ_ECHO_1_HIGH,4,2     ; @SRF08_READ_ECHO_1_HIGH
l_.str.2:                               ; @.str.2
	.asciz	"cannot read distance: ret=%d\n"

	.no_dead_strip	_srf08_read_ranging
.subsections_via_symbols
