	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function octeon_i2c_hlc_comp_write
_octeon_i2c_hlc_comp_write:             ## @octeon_i2c_hlc_comp_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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %r12
	movq	%rdi, %r14
	callq	_octeon_i2c_hlc_enable
	movq	_SW_TWSI_V@GOTPCREL(%rip), %rdx
	movq	_SW_TWSI_SOVR@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	movl	24(%r12), %eax
	leal	-1(%rax), %ebx
	movq	_SW_TWSI_SIZE_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	%ebx, %esi
	shll	%cl, %esi
	orl	(%rdx), %edi
	orl	%edi, %esi
	movl	(%r12), %edx
	movl	4(%r12), %edi
	andl	$127, %edi
	movq	_SW_TWSI_ADDR_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %edi
	orl	%esi, %edi
	movq	_I2C_M_TEN@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	testl	%ecx, 8(%r12)
	jne	LBB0_1
## %bb.2:
	movq	_SW_TWSI_OP_7_IA@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_1:
	movq	_SW_TWSI_OP_10_IA@GOTPCREL(%rip), %rcx
LBB0_3:
	orl	(%rcx), %edi
	cmpl	$2, %edx
	jne	LBB0_5
## %bb.4:
	movq	_SW_TWSI_EIA@GOTPCREL(%rip), %rcx
	orl	(%rcx), %edi
	movq	16(%r12), %rsi
	movq	_SW_TWSI_IA_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	movl	(%rsi), %r15d
	movl	8(%rsi), %r13d
	shll	%cl, %r15d
	shll	%cl, %r13d
	orl	%edi, %r13d
	testl	%eax, %eax
	jg	LBB0_7
	jmp	LBB0_19
LBB0_5:
	movq	16(%r12), %rcx
	movl	(%rcx), %r13d
	movq	_SW_TWSI_IA_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	shll	%cl, %r13d
	orl	%edi, %r13d
	xorl	%r15d, %r15d
	testl	%eax, %eax
	jle	LBB0_19
LBB0_7:
	cmpl	$3, %ebx
	movl	$3, %edi
	cmovbl	%ebx, %edi
	movq	40(%r12), %rcx
	orl	-8(%rcx,%rax,8), %r13d
	testl	%edi, %edi
	je	LBB0_8
## %bb.9:
	movl	-16(%rcx,%rax,8), %esi
	shll	$8, %esi
	orl	%esi, %r13d
	cmpl	$1, %edi
	jne	LBB0_11
## %bb.10:
	leaq	-3(%rax), %rcx
	cmpl	$5, %eax
	jl	LBB0_19
	jmp	LBB0_15
LBB0_8:
	leaq	-2(%rax), %rcx
	cmpl	$5, %eax
	jl	LBB0_19
	jmp	LBB0_15
LBB0_11:
	movl	-24(%rcx,%rax,8), %esi
	shll	$16, %esi
	orl	%esi, %r13d
	cmpl	$2, %edi
	jne	LBB0_13
## %bb.12:
	leaq	-4(%rax), %rcx
	cmpl	$5, %eax
	jge	LBB0_15
LBB0_19:
	cmpl	$2, %edx
	je	LBB0_20
	jmp	LBB0_21
LBB0_13:
	movl	-32(%rcx,%rax,8), %ecx
	shll	$24, %ecx
	orl	%ecx, %r13d
	leaq	-5(%rax), %rcx
	cmpl	$5, %eax
	jl	LBB0_19
LBB0_15:
	movq	40(%r12), %rdx
	addl	$-5, %eax
	cmpl	$3, %eax
	movl	$3, %esi
	cmovbl	%eax, %esi
	movslq	%ecx, %rax
	orl	(%rdx,%rax,8), %r15d
	testl	%esi, %esi
	je	LBB0_20
## %bb.16:
	movl	-8(%rdx,%rax,8), %ecx
	shll	$8, %ecx
	orl	%ecx, %r15d
	cmpl	$1, %esi
	je	LBB0_20
## %bb.17:
	movl	-16(%rdx,%rax,8), %ecx
	shll	$16, %ecx
	orl	%ecx, %r15d
	cmpl	$2, %esi
	je	LBB0_20
## %bb.18:
	movl	-24(%rdx,%rax,8), %eax
	shll	$24, %eax
	orl	%eax, %r15d
LBB0_20:
	movq	(%r14), %rbx
	movq	%r14, %rdi
	callq	_SW_TWSI_EXT
	addq	%rax, %rbx
	movl	%r15d, %edi
	movq	%rbx, %rsi
	callq	_octeon_i2c_writeq_flush
LBB0_21:
	movq	%r14, %rdi
	callq	_octeon_i2c_hlc_int_clear
	movq	(%r14), %rbx
	movq	%r14, %rdi
	callq	_SW_TWSI
	addq	%rax, %rbx
	movl	%r13d, %edi
	movq	%rbx, %rsi
	callq	_octeon_i2c_writeq_flush
	movq	%r14, %rdi
	callq	_octeon_i2c_hlc_wait
	testl	%eax, %eax
	jne	LBB0_23
## %bb.22:
	movq	(%r14), %rbx
	movq	%r14, %rdi
	callq	_SW_TWSI
	addq	%rax, %rbx
	movq	%rbx, %rdi
	callq	___raw_readq
	movl	%eax, %ecx
	movq	_SW_TWSI_R@GOTPCREL(%rip), %rdx
	xorl	%eax, %eax
	testl	%ecx, (%rdx)
	je	LBB0_24
LBB0_23:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_24:
	movq	%r14, %rdi
	xorl	%esi, %esi
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_octeon_i2c_check_status        ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_SW_TWSI_V,4,2                  ## @SW_TWSI_V
	.comm	_SW_TWSI_SOVR,4,2               ## @SW_TWSI_SOVR
	.comm	_SW_TWSI_SIZE_SHIFT,4,2         ## @SW_TWSI_SIZE_SHIFT
	.comm	_SW_TWSI_ADDR_SHIFT,4,2         ## @SW_TWSI_ADDR_SHIFT
	.comm	_I2C_M_TEN,4,2                  ## @I2C_M_TEN
	.comm	_SW_TWSI_OP_10_IA,4,2           ## @SW_TWSI_OP_10_IA
	.comm	_SW_TWSI_OP_7_IA,4,2            ## @SW_TWSI_OP_7_IA
	.comm	_SW_TWSI_EIA,4,2                ## @SW_TWSI_EIA
	.comm	_SW_TWSI_IA_SHIFT,4,2           ## @SW_TWSI_IA_SHIFT
	.comm	_SW_TWSI_R,4,2                  ## @SW_TWSI_R
	.no_dead_strip	_octeon_i2c_hlc_comp_write
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function octeon_i2c_hlc_comp_write
_octeon_i2c_hlc_comp_write:             ; @octeon_i2c_hlc_comp_write
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x22, x1
	mov	x19, x0
	bl	_octeon_i2c_hlc_enable
Lloh0:
	adrp	x8, _SW_TWSI_V@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SW_TWSI_V@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x9, _SW_TWSI_SOVR@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SW_TWSI_SOVR@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	orr	w9, w9, w8
	ldr	w8, [x22, #24]
	sub	w10, w8, #1
Lloh6:
	adrp	x11, _SW_TWSI_SIZE_SHIFT@GOTPAGE
Lloh7:
	ldr	x11, [x11, _SW_TWSI_SIZE_SHIFT@GOTPAGEOFF]
Lloh8:
	ldr	w11, [x11]
	lsl	w11, w10, w11
	orr	w11, w9, w11
	ldp	w9, w12, [x22]
	and	w12, w12, #0x7f
Lloh9:
	adrp	x13, _SW_TWSI_ADDR_SHIFT@GOTPAGE
Lloh10:
	ldr	x13, [x13, _SW_TWSI_ADDR_SHIFT@GOTPAGEOFF]
Lloh11:
	ldr	w13, [x13]
	lsl	w12, w12, w13
	orr	w11, w11, w12
	ldr	w12, [x22, #8]
Lloh12:
	adrp	x13, _I2C_M_TEN@GOTPAGE
Lloh13:
	ldr	x13, [x13, _I2C_M_TEN@GOTPAGEOFF]
Lloh14:
	ldr	w13, [x13]
Lloh15:
	adrp	x14, _SW_TWSI_OP_7_IA@GOTPAGE
Lloh16:
	ldr	x14, [x14, _SW_TWSI_OP_7_IA@GOTPAGEOFF]
	tst	w13, w12
Lloh17:
	adrp	x12, _SW_TWSI_OP_10_IA@GOTPAGE
Lloh18:
	ldr	x12, [x12, _SW_TWSI_OP_10_IA@GOTPAGEOFF]
	csel	x12, x14, x12, eq
	ldr	w12, [x12]
	orr	w11, w11, w12
	cmp	w9, #2
	b.ne	LBB0_2
; %bb.1:
Lloh19:
	adrp	x12, _SW_TWSI_EIA@GOTPAGE
Lloh20:
	ldr	x12, [x12, _SW_TWSI_EIA@GOTPAGEOFF]
Lloh21:
	ldr	w12, [x12]
	orr	w11, w12, w11
	ldr	x12, [x22, #16]
Lloh22:
	adrp	x13, _SW_TWSI_IA_SHIFT@GOTPAGE
Lloh23:
	ldr	x13, [x13, _SW_TWSI_IA_SHIFT@GOTPAGEOFF]
	ldr	w14, [x12]
Lloh24:
	ldr	w13, [x13]
	lsl	w21, w14, w13
	ldr	w12, [x12, #8]
	lsl	w12, w12, w13
	orr	w20, w11, w12
	cmp	w8, #1
	b.ge	LBB0_3
	b	LBB0_12
LBB0_2:
	mov	w21, #0
	ldr	x12, [x22, #16]
	ldr	w12, [x12]
Lloh25:
	adrp	x13, _SW_TWSI_IA_SHIFT@GOTPAGE
Lloh26:
	ldr	x13, [x13, _SW_TWSI_IA_SHIFT@GOTPAGEOFF]
Lloh27:
	ldr	w13, [x13]
	lsl	w12, w12, w13
	orr	w20, w12, w11
	cmp	w8, #1
	b.lt	LBB0_12
LBB0_3:
	ldr	x11, [x22, #40]
	mov	w12, #3
	cmp	w10, #3
	csel	w12, w10, w12, lo
	add	x10, x11, x8, lsl #3
	ldur	w10, [x10, #-8]
	orr	w20, w20, w10
	sub	x10, x8, #2
	cbz	w12, LBB0_7
; %bb.4:
	ldr	x10, [x11, x10, lsl #3]
	orr	w20, w20, w10, lsl #8
	sub	x10, x8, #3
	cmp	w12, #1
	b.eq	LBB0_7
; %bb.5:
	ldr	x10, [x11, x10, lsl #3]
	orr	w20, w20, w10, lsl #16
	sub	x10, x8, #4
	cmp	w12, #2
	b.eq	LBB0_7
; %bb.6:
	ldr	x10, [x11, x10, lsl #3]
	orr	w20, w20, w10, lsl #24
	sub	x10, x8, #5
LBB0_7:
	cmp	w8, #5
	b.lt	LBB0_12
; %bb.8:
	ldr	x9, [x22, #40]
	sub	w8, w8, #5
	mov	w11, #3
	cmp	w8, #3
	csel	w8, w8, w11, lo
	sbfiz	x11, x10, #3, #32
	ldr	w11, [x9, x11]
	orr	w21, w21, w11
	cbz	w8, LBB0_13
; %bb.9:
	sxtw	x10, w10
	add	x11, x9, x10, lsl #3
	ldur	w12, [x11, #-8]
	orr	w21, w21, w12, lsl #8
	cmp	w8, #1
	b.eq	LBB0_13
; %bb.10:
	ldur	w11, [x11, #-16]
	orr	w21, w21, w11, lsl #16
	cmp	w8, #2
	b.eq	LBB0_13
; %bb.11:
	add	x8, x9, x10, lsl #3
	ldur	w8, [x8, #-24]
	orr	w21, w21, w8, lsl #24
	b	LBB0_13
LBB0_12:
	cmp	w9, #2
	b.ne	LBB0_14
LBB0_13:
	ldr	x22, [x19]
	mov	x0, x19
	bl	_SW_TWSI_EXT
	add	x1, x0, x22
	mov	x0, x21
	bl	_octeon_i2c_writeq_flush
LBB0_14:
	mov	x0, x19
	bl	_octeon_i2c_hlc_int_clear
	ldr	x21, [x19]
	mov	x0, x19
	bl	_SW_TWSI
	add	x1, x0, x21
	mov	x0, x20
	bl	_octeon_i2c_writeq_flush
	mov	x0, x19
	bl	_octeon_i2c_hlc_wait
	cbnz	w0, LBB0_17
; %bb.15:
	ldr	x20, [x19]
	mov	x0, x19
	bl	_SW_TWSI
	add	x0, x0, x20
	bl	___raw_readq
Lloh28:
	adrp	x8, _SW_TWSI_R@GOTPAGE
Lloh29:
	ldr	x8, [x8, _SW_TWSI_R@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_18
; %bb.16:
	mov	w0, #0
LBB0_17:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_18:
	mov	x0, x19
	mov	w1, #0
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	b	_octeon_i2c_check_status
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_SW_TWSI_V,4,2                  ; @SW_TWSI_V
	.comm	_SW_TWSI_SOVR,4,2               ; @SW_TWSI_SOVR
	.comm	_SW_TWSI_SIZE_SHIFT,4,2         ; @SW_TWSI_SIZE_SHIFT
	.comm	_SW_TWSI_ADDR_SHIFT,4,2         ; @SW_TWSI_ADDR_SHIFT
	.comm	_I2C_M_TEN,4,2                  ; @I2C_M_TEN
	.comm	_SW_TWSI_OP_10_IA,4,2           ; @SW_TWSI_OP_10_IA
	.comm	_SW_TWSI_OP_7_IA,4,2            ; @SW_TWSI_OP_7_IA
	.comm	_SW_TWSI_EIA,4,2                ; @SW_TWSI_EIA
	.comm	_SW_TWSI_IA_SHIFT,4,2           ; @SW_TWSI_IA_SHIFT
	.comm	_SW_TWSI_R,4,2                  ; @SW_TWSI_R
	.no_dead_strip	_octeon_i2c_hlc_comp_write
.subsections_via_symbols
