	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i2c_write
_i2c_write:                             ## @i2c_write
	.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, %r13
	leaq	16(%rbp), %r15
	movq	_O_RDWR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_open
	movl	%eax, %r12d
	cmpl	$-1, %eax
	jne	LBB0_2
## %bb.1:
	movq	%r13, %rdi
	callq	_free
	leaq	L_.str(%rip), %rsi
	movl	$1, %edi
	callq	_err
LBB0_2:
	movl	12(%r15), %eax
	movl	%eax, -72(%rbp)                 ## 4-byte Spill
	movl	%eax, -44(%rbp)
	movq	_I2CSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	leaq	L_.str.1(%rip), %r14
	cmpl	$-1, %eax
	je	LBB0_26
## %bb.3:
	movl	%r12d, %r14d
	movq	%r15, %r12
	movl	(%r15), %r15d
	testl	%r15d, %r15d
	movq	%r13, -80(%rbp)                 ## 8-byte Spill
	je	LBB0_6
## %bb.4:
	leal	7(%r15), %ebx
	testl	%r15d, %r15d
	cmovnsl	%r15d, %ebx
	sarl	$3, %ebx
	movl	16(%r12), %esi
	movl	%ebx, %edi
	callq	_prepare_buf
	movq	%rax, %r13
	testq	%rax, %rax
	jne	LBB0_7
## %bb.5:
	leaq	L_.str.2(%rip), %rax
	movl	%r14d, %r12d
	movq	%rax, %r14
	jmp	LBB0_26
LBB0_6:
	xorl	%r13d, %r13d
LBB0_7:
	movl	4(%r12), %eax
	cmpl	$129, %eax
	je	LBB0_15
## %bb.8:
	cmpl	$128, %eax
	movl	%r14d, %r12d
	jne	LBB0_19
## %bb.9:
	testl	%r15d, %r15d
	je	LBB0_11
## %bb.10:
	movl	%ebx, -64(%rbp)
	movq	%r13, -56(%rbp)
	movq	_I2CWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_free
	cmpl	$-1, %ebx
	je	LBB0_25
LBB0_11:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_22
## %bb.12:
	movl	-72(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -44(%rbp)
	movq	_I2CSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	leaq	L_.str.1(%rip), %r14
	jne	LBB0_13
	jmp	LBB0_26
LBB0_15:
	testl	%r15d, %r15d
	movl	%r14d, %r12d
	je	LBB0_17
## %bb.16:
	movl	%ebx, -64(%rbp)
	movq	%r13, -56(%rbp)
	movq	_I2CWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	movl	%eax, %ebx
	movq	%r13, %rdi
	callq	_free
	cmpl	$-1, %ebx
	je	LBB0_25
LBB0_17:
	movl	-72(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, -44(%rbp)
	movq	_I2CRPTSTART@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_24
LBB0_13:
	leaq	16(%rbp), %rax
	movl	8(%rax), %eax
	movl	%eax, -64(%rbp)
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	%rax, -56(%rbp)
	movl	$0, -48(%rbp)
	movq	_I2CWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	je	LBB0_14
LBB0_21:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	jne	LBB0_29
LBB0_22:
	leaq	L_.str.4(%rip), %r14
	jmp	LBB0_28
LBB0_19:
	leaq	16(%rbp), %rax
	movl	8(%rax), %eax
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	leal	(%rax,%rbx), %r14d
	movq	%r13, %rdi
	movl	%r14d, %esi
	callq	_realloc
	testq	%rax, %rax
	je	LBB0_23
## %bb.20:
	movq	%rax, %r15
	movslq	%ebx, %rdi
	addq	%rax, %rdi
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
	callq	_memcpy
	movl	%r14d, -64(%rbp)
	movq	%r15, -56(%rbp)
	movl	$0, -48(%rbp)
	movq	_I2CWRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	-64(%rbp), %rdx
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	movl	%eax, %ebx
	movq	%r15, %rdi
	callq	_free
	cmpl	$-1, %ebx
	jne	LBB0_21
LBB0_14:
	leaq	L_.str.5(%rip), %r14
	jmp	LBB0_26
LBB0_25:
	leaq	L_.str.3(%rip), %r14
	jmp	LBB0_26
LBB0_23:
	leaq	L_.str.7(%rip), %r14
	jmp	LBB0_26
LBB0_24:
	leaq	L_.str.6(%rip), %r14
LBB0_26:
	movq	_I2CSTOP@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r12d, %edi
	xorl	%eax, %eax
	callq	_ioctl
	cmpl	$-1, %eax
	jne	LBB0_28
## %bb.27:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.8(%rip), %rsi
	xorl	%eax, %eax
	callq	_fprintf
LBB0_28:
	movq	_stderr@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leaq	L_.str.9(%rip), %rsi
	movq	%r14, %rdx
	xorl	%eax, %eax
	callq	_fprintf
	movl	$1, %ebx
LBB0_29:
	movl	%r12d, %edi
	callq	_close
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.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	_I2CSTOP,4,2                    ## @I2CSTOP
L_.str.4:                               ## @.str.4
	.asciz	"ioctl: error sending stop condition"

L_.str.5:                               ## @.str.5
	.asciz	"ioctl: error writing"

	.comm	_I2CRPTSTART,4,2                ## @I2CRPTSTART
L_.str.6:                               ## @.str.6
	.asciz	"ioctl: error sending repeated start condition"

L_.str.7:                               ## @.str.7
	.asciz	"error: data malloc"

	.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_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i2c_write
_i2c_write:                             ; @i2c_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
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:
	mov	x0, x20
	bl	_free
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	w0, #1
	bl	_err
LBB0_2:
	ldr	w8, [x21, #12]
	str	w8, [sp, #28]
Lloh5:
	adrp	x25, _I2CSTART@GOTPAGE
Lloh6:
	ldr	x25, [x25, _I2CSTART@GOTPAGEOFF]
	ldr	w1, [x25]
	add	x8, sp, #8
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
Lloh7:
	adrp	x24, _stderr@GOTPAGE
Lloh8:
	ldr	x24, [x24, _stderr@GOTPAGEOFF]
	cmn	w0, #1
	b.eq	LBB0_13
; %bb.3:
	ldr	w8, [x21]
	cbz	w8, LBB0_6
; %bb.4:
	add	w9, w8, #7
	cmp	w8, #0
	csel	w8, w9, w8, lt
	asr	w23, w8, #3
	ldr	w1, [x21, #16]
	mov	x0, x23
	bl	_prepare_buf
	cbz	x0, LBB0_23
; %bb.5:
	mov	x22, x0
	b	LBB0_7
LBB0_6:
	mov	w23, #0
	mov	x22, #0
LBB0_7:
	ldr	w8, [x21, #4]
	cmp	w8, #129
	b.eq	LBB0_14
; %bb.8:
	cmp	w8, #128
	b.ne	LBB0_20
; %bb.9:
	ldr	w8, [x21]
	cbz	w8, LBB0_11
; %bb.10:
	str	w23, [sp, #8]
	str	x22, [sp, #16]
Lloh9:
	adrp	x8, _I2CWRITE@GOTPAGE
Lloh10:
	ldr	x8, [x8, _I2CWRITE@GOTPAGEOFF]
Lloh11:
	ldr	w1, [x8]
	add	x8, sp, #8
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	mov	x23, x0
	mov	x0, x22
	bl	_free
	cmn	w23, #1
	b.eq	LBB0_25
LBB0_11:
Lloh12:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh13:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_24
; %bb.12:
	ldr	w8, [x21, #12]
	str	w8, [sp, #28]
	ldr	w1, [x25]
	add	x22, sp, #8
	str	x22, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.ne	LBB0_17
LBB0_13:
Lloh15:
	adrp	x20, l_.str.1@PAGE
Lloh16:
	add	x20, x20, l_.str.1@PAGEOFF
	b	LBB0_28
LBB0_14:
	ldr	w8, [x21]
	cbz	w8, LBB0_16
; %bb.15:
	str	w23, [sp, #8]
	str	x22, [sp, #16]
Lloh17:
	adrp	x8, _I2CWRITE@GOTPAGE
Lloh18:
	ldr	x8, [x8, _I2CWRITE@GOTPAGEOFF]
Lloh19:
	ldr	w1, [x8]
	add	x8, sp, #8
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	mov	x23, x0
	mov	x0, x22
	bl	_free
	cmn	w23, #1
	b.eq	LBB0_25
LBB0_16:
	ldr	w8, [x21, #12]
	str	w8, [sp, #28]
Lloh20:
	adrp	x8, _I2CRPTSTART@GOTPAGE
Lloh21:
	ldr	x8, [x8, _I2CRPTSTART@GOTPAGEOFF]
Lloh22:
	ldr	w1, [x8]
	add	x22, sp, #8
	str	x22, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_27
LBB0_17:
	ldr	w8, [x21, #8]
	str	w8, [sp, #8]
	str	x20, [sp, #16]
	str	wzr, [sp, #24]
Lloh23:
	adrp	x8, _I2CWRITE@GOTPAGE
Lloh24:
	ldr	x8, [x8, _I2CWRITE@GOTPAGEOFF]
Lloh25:
	ldr	w1, [x8]
	str	x22, [sp]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_22
LBB0_18:
Lloh26:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh27:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh28:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.eq	LBB0_24
; %bb.19:
	mov	w20, #0
	b	LBB0_31
LBB0_20:
	ldr	w8, [x21, #8]
	add	w1, w8, w23
	mov	x0, x22
	bl	_realloc
	cbz	x0, LBB0_26
; %bb.21:
	mov	x22, x0
	add	x0, x0, w23, sxtw
	ldr	w2, [x21, #8]
	mov	x1, x20
	bl	_memcpy
	ldr	w8, [x21, #8]
	add	w8, w8, w23
	str	w8, [sp, #8]
	str	x22, [sp, #16]
	str	wzr, [sp, #24]
Lloh29:
	adrp	x8, _I2CWRITE@GOTPAGE
Lloh30:
	ldr	x8, [x8, _I2CWRITE@GOTPAGEOFF]
Lloh31:
	ldr	w1, [x8]
	add	x8, sp, #8
	str	x8, [sp]
	mov	x0, x19
	bl	_ioctl
	mov	x20, x0
	mov	x0, x22
	bl	_free
	cmn	w20, #1
	b.ne	LBB0_18
LBB0_22:
Lloh32:
	adrp	x20, l_.str.5@PAGE
Lloh33:
	add	x20, x20, l_.str.5@PAGEOFF
	b	LBB0_28
LBB0_23:
Lloh34:
	adrp	x20, l_.str.2@PAGE
Lloh35:
	add	x20, x20, l_.str.2@PAGEOFF
	b	LBB0_28
LBB0_24:
Lloh36:
	adrp	x20, l_.str.4@PAGE
Lloh37:
	add	x20, x20, l_.str.4@PAGEOFF
	b	LBB0_30
LBB0_25:
Lloh38:
	adrp	x20, l_.str.3@PAGE
Lloh39:
	add	x20, x20, l_.str.3@PAGEOFF
	b	LBB0_28
LBB0_26:
Lloh40:
	adrp	x20, l_.str.7@PAGE
Lloh41:
	add	x20, x20, l_.str.7@PAGEOFF
	b	LBB0_28
LBB0_27:
Lloh42:
	adrp	x20, l_.str.6@PAGE
Lloh43:
	add	x20, x20, l_.str.6@PAGEOFF
LBB0_28:
Lloh44:
	adrp	x8, _I2CSTOP@GOTPAGE
Lloh45:
	ldr	x8, [x8, _I2CSTOP@GOTPAGEOFF]
Lloh46:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_ioctl
	cmn	w0, #1
	b.ne	LBB0_30
; %bb.29:
	ldr	w0, [x24]
Lloh47:
	adrp	x1, l_.str.8@PAGE
Lloh48:
	add	x1, x1, l_.str.8@PAGEOFF
	bl	_fprintf
LBB0_30:
	ldr	w0, [x24]
	str	x20, [sp]
Lloh49:
	adrp	x1, l_.str.9@PAGE
Lloh50:
	add	x1, x1, l_.str.9@PAGEOFF
	bl	_fprintf
	mov	w20, #1
LBB0_31:
	mov	x0, x19
	bl	_close
	mov	x0, x20
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh26, Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpAdd	Lloh32, Lloh33
	.loh AdrpAdd	Lloh34, Lloh35
	.loh AdrpAdd	Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpAdd	Lloh42, Lloh43
	.loh AdrpLdrGotLdr	Lloh44, Lloh45, Lloh46
	.loh AdrpAdd	Lloh47, Lloh48
	.loh AdrpAdd	Lloh49, Lloh50
	.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	_I2CSTOP,4,2                    ; @I2CSTOP
l_.str.4:                               ; @.str.4
	.asciz	"ioctl: error sending stop condition"

l_.str.5:                               ; @.str.5
	.asciz	"ioctl: error writing"

	.comm	_I2CRPTSTART,4,2                ; @I2CRPTSTART
l_.str.6:                               ; @.str.6
	.asciz	"ioctl: error sending repeated start condition"

l_.str.7:                               ; @.str.7
	.asciz	"error: data malloc"

	.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_write
.subsections_via_symbols
