	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function reg_write
_reg_write:                             ## @reg_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	(%rdi), %rax
	movl	4(%rax), %ecx
	movl	%ecx, -48(%rbp)
	movq	$0, -56(%rbp)
	movl	$2, -72(%rbp)
	testl	%edx, %edx
	jle	LBB0_6
## %bb.1:
	movl	%edx, %r15d
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	%rsi, -64(%rbp)
	movl	(%rax), %edi
	leaq	-72(%rbp), %rsi
	movl	$1, %edx
	callq	_i2c_transfer
	movl	%eax, %ecx
	movq	_EIO@GOTPCREL(%rip), %r12
	xorl	%eax, %eax
	subl	(%r12), %eax
	testl	%ecx, %ecx
	cmovnel	%ecx, %eax
	testl	%eax, %eax
	js	LBB0_7
## %bb.2:
	movl	%r15d, %ebx
	addq	$4, %r13
	leaq	-72(%rbp), %r15
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	decq	%rbx
	je	LBB0_6
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	movq	(%r14), %rax
	movq	%r13, -64(%rbp)
	addq	$4, %r13
	movl	(%rax), %edi
	movq	%r15, %rsi
	movl	$1, %edx
	callq	_i2c_transfer
	movl	%eax, %ecx
	xorl	%eax, %eax
	subl	(%r12), %eax
	testl	%ecx, %ecx
	cmovnel	%ecx, %eax
	testl	%eax, %eax
	jns	LBB0_3
	jmp	LBB0_7
LBB0_6:
	xorl	%eax, %eax
LBB0_7:
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_reg_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function reg_write
_reg_write:                             ; @reg_write
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	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
	ldr	x8, [x0]
	ldr	w9, [x8, #4]
	str	w9, [sp, #24]
	str	xzr, [sp, #16]
	mov	w9, #2
	str	w9, [sp]
	cmp	w2, #1
	b.lt	LBB0_5
; %bb.1:
	mov	x21, x2
	mov	x20, x1
	mov	x19, x0
	str	x1, [sp, #8]
	ldr	w0, [x8]
	mov	x1, sp
	mov	w2, #1
	bl	_i2c_transfer
Lloh0:
	adrp	x22, _EIO@GOTPAGE
Lloh1:
	ldr	x22, [x22, _EIO@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w0, #0
	csneg	w0, w0, w8, ne
	tbnz	w0, #31, LBB0_6
; %bb.2:
	mov	w21, w21
	add	x8, x20, #4
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	subs	x21, x21, #1
	b.eq	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x20, x8, #4
	ldr	x9, [x19]
	str	x8, [sp, #8]
	ldr	w0, [x9]
	mov	x1, sp
	mov	w2, #1
	bl	_i2c_transfer
	ldr	w8, [x22]
	cmp	w0, #0
	csneg	w0, w0, w8, ne
	mov	x8, x20
	tbz	w0, #31, LBB0_3
	b	LBB0_6
LBB0_5:
	mov	w0, #0
LBB0_6:
	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
	add	sp, sp, #80
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_reg_write
.subsections_via_symbols
