	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_read
_i2c_read:                              ## @i2c_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
	movq	%rsi, %r12
	leaq	16(%rbp), %rbx
	movb	$0, -41(%rbp)
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	movl	%eax, %r15d
	cmpl	$-1, %eax
	jne	LBB0_2
## %bb.1:
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_2:
	leaq	-72(%rbp), %rdi
	movl	$24, %esi
	callq	_bzero
	movl	(%rbx), %r14d
	movl	4(%rbx), %r13d
	testl	%r14d, %r14d
	je	LBB0_3
## %bb.8:
	movl	%r13d, -72(%rbp)
	movq	$1, -68(%rbp)
	leaq	-41(%rbp), %rax
	movq	%rax, -56(%rbp)
	movq	_I2CSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdx
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_9
## %bb.12:
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rax
	leal	7(%r14), %ebx
	testl	%r14d, %r14d
	cmovnsl	%r14d, %ebx
	sarl	$3, %ebx
	movl	20(%rax), %esi
	movl	%ebx, %edi
	callq	_prepare_buf
	testq	%rax, %rax
	je	LBB0_13
## %bb.14:
	movq	%rax, %r12
	movl	%ebx, -68(%rbp)
	movq	%rax, -56(%rbp)
	movl	$0, -64(%rbp)
	movq	_I2CWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdx
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	movl	%eax, %ebx
	movq	%r12, %rdi
	callq	_free
	cmpl	$-1, %ebx
	je	LBB0_15
## %bb.16:
	leaq	16(%rbp), %rax
	movq	8(%rax), %rbx
	movq	_I2C_MODE_STOP_START@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_17
## %bb.18:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	jne	LBB0_4
## %bb.19:
	leaq	L_.str.4(%rip), %rbx
	jmp	LBB0_27
LBB0_3:
	movq	8(%rbx), %rbx
LBB0_4:
	orl	$1, %r13d
	movl	%r13d, -72(%rbp)
	movq	$1, -68(%rbp)
	leaq	-41(%rbp), %rax
	movq	%rax, -56(%rbp)
	movq	_I2C_MODE_STOP_START@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	je	LBB0_6
## %bb.5:
	testl	%r14d, %r14d
	je	LBB0_6
## %bb.20:
	movq	_I2C_MODE_REPEATED_START@GOTPCREL(%rip), %rax
	cmpq	(%rax), %rbx
	jne	LBB0_23
## %bb.21:
	movq	_I2CRPTSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdx
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	jne	LBB0_23
## %bb.22:
	leaq	L_.str.5(%rip), %rbx
	jmp	LBB0_10
LBB0_6:
	movq	_I2CSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-72(%rbp), %rdx
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_7
LBB0_23:
	leaq	16(%rbp), %rax
	movl	16(%rax), %eax
	movl	%eax, -68(%rbp)
	movq	%r12, -56(%rbp)
	movl	$1, -64(%rbp)
	movq	_I2CREAD@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	leaq	-72(%rbp), %rdx
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_24
## %bb.25:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	jne	LBB0_28
## %bb.26:
	leaq	L_.str.7(%rip), %rbx
	jmp	LBB0_27
LBB0_9:
	leaq	L_.str.1(%rip), %rbx
	jmp	LBB0_10
LBB0_13:
	leaq	L_.str.2(%rip), %rbx
	jmp	LBB0_10
LBB0_24:
	leaq	L_.str.6(%rip), %rbx
	jmp	LBB0_10
LBB0_7:
	leaq	L_.str.1(%rip), %rbx
	jmp	LBB0_27
LBB0_15:
	leaq	L_.str.3(%rip), %rbx
LBB0_10:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r15d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	jne	LBB0_27
## %bb.11:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.8(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
LBB0_27:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.9(%rip), %rsi
	movq	%rbx, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movl	$1, %ebx
LBB0_28:
	movl	%r15d, %edi
	callq	_close
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movq	-80(%rbp), %r12                 ## 8-byte Reload
	jmp	LBB0_4
	.cfi_endproc
                                        ## -- End function
	.comm	_O_RDWR,4,2                     ## @O_RDWR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"open failed"

	.comm	_I2CSTART,4,2                   ## @I2CSTART
L_.str.1:                               ## @.str.1
	.asciz	"ioctl: error sending start condition"

L_.str.2:                               ## @.str.2
	.asciz	"error: offset malloc"

	.comm	_I2CWRITE,4,2                   ## @I2CWRITE
L_.str.3:                               ## @.str.3
	.asciz	"ioctl: error writing offset"

	.comm	_I2C_MODE_STOP_START,8,3        ## @I2C_MODE_STOP_START
	.comm	_I2CSTOP,4,2                    ## @I2CSTOP
L_.str.4:                               ## @.str.4
	.asciz	"error sending stop condition"

	.comm	_I2C_MODE_REPEATED_START,8,3    ## @I2C_MODE_REPEATED_START
	.comm	_I2CRPTSTART,4,2                ## @I2CRPTSTART
L_.str.5:                               ## @.str.5
	.asciz	"ioctl: error sending repeated start condition"

	.comm	_I2CREAD,4,2                    ## @I2CREAD
L_.str.6:                               ## @.str.6
	.asciz	"ioctl: error while reading"

L_.str.7:                               ## @.str.7
	.asciz	"error sending stop condtion\n"

	.comm	_stderr,4,2                     ## @stderr
L_.str.8:                               ## @.str.8
	.asciz	"error sending stop condition\n"

L_.str.9:                               ## @.str.9
	.asciz	"%s\n"

	.no_dead_strip	_i2c_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.section	__TEXT,__literal8,8byte_literals
	.p2align	3                               ; -- Begin function i2c_read
lCPI0_0:
	.long	1                               ; 0x1
	.long	0                               ; 0x0
	.section	__TEXT,__text,regular,pure_instructions
	.p2align	2
_i2c_read:                              ; @i2c_read
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x20, x2
	mov	x21, x1
	strb	wzr, [sp, #23]
Lloh0:
	adrp	x8, _O_RDWR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _O_RDWR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_open
	mov	x19, x0
	cmn	w0, #1
	b.ne	LBB0_2
; %bb.1:
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_2:
	add	x22, sp, #24
	add	x0, sp, #24
	mov	w1, #24
	bl	_bzero
	ldr	w8, [x21]
Lloh5:
	adrp	x24, _stderr@GOTPAGE
Lloh6:
	ldr	x24, [x24, _stderr@GOTPAGEOFF]
	adrp	x25, lCPI0_0@PAGE
	cbz	w8, LBB0_8
; %bb.3:
	ldr	w8, [x21, #4]
	str	w8, [sp, #24]
	ldr	d0, [x25, lCPI0_0@PAGEOFF]
	stur	d0, [sp, #28]
	add	x8, sp, #23
	str	x8, [sp, #40]
Lloh7:
	adrp	x8, _I2CSTART@GOTPAGE
Lloh8:
	ldr	x8, [x8, _I2CSTART@GOTPAGEOFF]
Lloh9:
	ldr	w1, [x8]
	str	x22, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_17
; %bb.4:
	ldr	w8, [x21]
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w23, w8, #3
	ldr	w1, [x21, #20]
	mov	x0, x23
	bl	_prepare_buf
	cbz	x0, LBB0_18
; %bb.5:
	mov	x22, x0
	str	x0, [sp, #40]
	stp	w23, wzr, [sp, #28]
Lloh10:
	adrp	x8, _I2CWRITE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _I2CWRITE@GOTPAGEOFF]
Lloh12:
	ldr	w1, [x8]
	add	x8, sp, #24
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	mov	x23, x0
	mov	x0, x22
	bl	_free
	cmn	w23, #1
	b.eq	LBB0_21
; %bb.6:
	ldr	x8, [x21, #8]
Lloh13:
	adrp	x9, _I2C_MODE_STOP_START@GOTPAGE
Lloh14:
	ldr	x9, [x9, _I2C_MODE_STOP_START@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_8
; %bb.7:
Lloh16:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh17:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh18:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_25
LBB0_8:
	ldr	w8, [x21, #4]
	orr	w8, w8, #0x1
	str	w8, [sp, #24]
	ldr	d0, [x25, lCPI0_0@PAGEOFF]
	stur	d0, [sp, #28]
	add	x8, sp, #23
	str	x8, [sp, #40]
	ldr	x8, [x21, #8]
Lloh19:
	adrp	x9, _I2C_MODE_STOP_START@GOTPAGE
Lloh20:
	ldr	x9, [x9, _I2C_MODE_STOP_START@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_13
; %bb.9:
	ldr	w9, [x21]
	cbz	w9, LBB0_13
; %bb.10:
Lloh22:
	adrp	x9, _I2C_MODE_REPEATED_START@GOTPAGE
Lloh23:
	ldr	x9, [x9, _I2C_MODE_REPEATED_START@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_14
; %bb.11:
Lloh25:
	adrp	x8, _I2CRPTSTART@GOTPAGE
Lloh26:
	ldr	x8, [x8, _I2CRPTSTART@GOTPAGEOFF]
Lloh27:
	ldr	w1, [x8]
	add	x8, sp, #24
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.ne	LBB0_14
; %bb.12:
Lloh28:
	adrp	x20, l_.str.5@PAGE
Lloh29:
	add	x20, x20, l_.str.5@PAGEOFF
	b	LBB0_22
LBB0_13:
Lloh30:
	adrp	x8, _I2CSTART@GOTPAGE
Lloh31:
	ldr	x8, [x8, _I2CSTART@GOTPAGEOFF]
Lloh32:
	ldr	w1, [x8]
	add	x8, sp, #24
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_19
LBB0_14:
	ldr	w8, [x21, #16]
	str	x20, [sp, #40]
	mov	w9, #1
	stp	w8, w9, [sp, #28]
Lloh33:
	adrp	x8, _I2CREAD@GOTPAGE
Lloh34:
	ldr	x8, [x8, _I2CREAD@GOTPAGEOFF]
Lloh35:
	ldr	w1, [x8]
	add	x8, sp, #24
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_20
; %bb.15:
Lloh36:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh37:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh38:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_24
; %bb.16:
	mov	w20, #0
	b	LBB0_27
LBB0_17:
Lloh39:
	adrp	x20, l_.str.1@PAGE
Lloh40:
	add	x20, x20, l_.str.1@PAGEOFF
	b	LBB0_22
LBB0_18:
Lloh41:
	adrp	x20, l_.str.2@PAGE
Lloh42:
	add	x20, x20, l_.str.2@PAGEOFF
	b	LBB0_22
LBB0_19:
Lloh43:
	adrp	x20, l_.str.1@PAGE
Lloh44:
	add	x20, x20, l_.str.1@PAGEOFF
	b	LBB0_26
LBB0_20:
Lloh45:
	adrp	x20, l_.str.6@PAGE
Lloh46:
	add	x20, x20, l_.str.6@PAGEOFF
	b	LBB0_22
LBB0_21:
Lloh47:
	adrp	x20, l_.str.3@PAGE
Lloh48:
	add	x20, x20, l_.str.3@PAGEOFF
LBB0_22:
Lloh49:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh50:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh51:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.ne	LBB0_26
; %bb.23:
	ldr	w0, [x24]
Lloh52:
	adrp	x1, l_.str.8@PAGE
Lloh53:
	add	x1, x1, l_.str.8@PAGEOFF
	bl	_fprintf
	b	LBB0_26
LBB0_24:
Lloh54:
	adrp	x20, l_.str.7@PAGE
Lloh55:
	add	x20, x20, l_.str.7@PAGEOFF
	b	LBB0_26
LBB0_25:
Lloh56:
	adrp	x20, l_.str.4@PAGE
Lloh57:
	add	x20, x20, l_.str.4@PAGEOFF
LBB0_26:
	ldr	w0, [x24]
	str	x20, [sp]
Lloh58:
	adrp	x1, l_.str.9@PAGE
Lloh59:
	add	x1, x1, l_.str.9@PAGEOFF
	bl	_fprintf
	mov	w20, #1
LBB0_27:
	mov	x0, x19
	bl	_close
	mov	x0, x20
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpAdd	Lloh41, Lloh42
	.loh AdrpAdd	Lloh43, Lloh44
	.loh AdrpAdd	Lloh45, Lloh46
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpLdrGotLdr	Lloh49, Lloh50, Lloh51
	.loh AdrpAdd	Lloh52, Lloh53
	.loh AdrpAdd	Lloh54, Lloh55
	.loh AdrpAdd	Lloh56, Lloh57
	.loh AdrpAdd	Lloh58, Lloh59
	.cfi_endproc
                                        ; -- End function
	.comm	_O_RDWR,4,2                     ; @O_RDWR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"open failed"

	.comm	_I2CSTART,4,2                   ; @I2CSTART
l_.str.1:                               ; @.str.1
	.asciz	"ioctl: error sending start condition"

l_.str.2:                               ; @.str.2
	.asciz	"error: offset malloc"

	.comm	_I2CWRITE,4,2                   ; @I2CWRITE
l_.str.3:                               ; @.str.3
	.asciz	"ioctl: error writing offset"

	.comm	_I2C_MODE_STOP_START,8,3        ; @I2C_MODE_STOP_START
	.comm	_I2CSTOP,4,2                    ; @I2CSTOP
l_.str.4:                               ; @.str.4
	.asciz	"error sending stop condition"

	.comm	_I2C_MODE_REPEATED_START,8,3    ; @I2C_MODE_REPEATED_START
	.comm	_I2CRPTSTART,4,2                ; @I2CRPTSTART
l_.str.5:                               ; @.str.5
	.asciz	"ioctl: error sending repeated start condition"

	.comm	_I2CREAD,4,2                    ; @I2CREAD
l_.str.6:                               ; @.str.6
	.asciz	"ioctl: error while reading"

l_.str.7:                               ; @.str.7
	.asciz	"error sending stop condtion\n"

	.comm	_stderr,4,2                     ; @stderr
l_.str.8:                               ; @.str.8
	.asciz	"error sending stop condition\n"

l_.str.9:                               ; @.str.9
	.asciz	"%s\n"

	.no_dead_strip	_i2c_read
.subsections_via_symbols
