	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function brcmstb_send_i2c_cmd
_brcmstb_send_i2c_cmd:                  ## @brcmstb_send_i2c_cmd
	.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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %rbx
	movq	16(%rdi), %r12
	callq	_brcmstb_i2c_wait_if_busy
	testl	%eax, %eax
	js	LBB0_1
## %bb.2:
	cmpq	$0, (%rbx)
	js	LBB0_4
## %bb.3:
	leaq	12(%rbx), %rdi
	callq	_reinit_completion
LBB0_4:
	movq	_INT_ENABLE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_brcmstb_i2c_enable_disable_irq
	movq	_BSC_IIC_EN_ENABLE_MASK@GOTPCREL(%rip), %rax
	movl	(%r12), %esi
	orl	(%rax), %esi
	movl	%esi, (%r12)
	movq	_iic_enable@GOTPCREL(%rip), %r12
	movl	(%r12), %edx
	movq	%rbx, %rdi
	callq	_bsc_writel
	movq	%rbx, %rdi
	callq	_brcmstb_i2c_wait_for_completion
	testl	%eax, %eax
	je	LBB0_6
## %bb.5:
	movl	%eax, %r15d
	leaq	L_.str(%rip), %rsi
LBB0_9:
	movl	8(%rbx), %edi
	movq	_cmd_string@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movl	%r14d, %ecx
	movl	(%rax,%rcx,4), %edx
	callq	_dev_dbg
LBB0_10:
	movq	_cnt_reg@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_bsc_writel
	movl	(%r12), %edx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_bsc_writel
	jmp	LBB0_11
LBB0_1:
	movl	%eax, %r15d
LBB0_11:
	movl	%r15d, %eax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_CMD_RD@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	_CMD_WR@GOTPCREL(%rip), %rcx
	xorl	%r15d, %r15d
	orq	(%rcx), %rax
	je	LBB0_10
## %bb.7:
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_bsc_readl
	movq	_BSC_IIC_EN_NOACK_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_10
## %bb.8:
	movq	_EREMOTEIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_9
	.cfi_endproc
                                        ## -- End function
	.comm	_INT_ENABLE,4,2                 ## @INT_ENABLE
	.comm	_BSC_IIC_EN_ENABLE_MASK,4,2     ## @BSC_IIC_EN_ENABLE_MASK
	.comm	_iic_enable,4,2                 ## @iic_enable
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"intr timeout for cmd %s\n"

	.comm	_cmd_string,8,3                 ## @cmd_string
	.comm	_CMD_RD,8,3                     ## @CMD_RD
	.comm	_CMD_WR,8,3                     ## @CMD_WR
	.comm	_BSC_IIC_EN_NOACK_MASK,4,2      ## @BSC_IIC_EN_NOACK_MASK
	.comm	_EREMOTEIO,4,2                  ## @EREMOTEIO
L_.str.1:                               ## @.str.1
	.asciz	"controller received NOACK intr for %s\n"

	.comm	_cnt_reg,4,2                    ## @cnt_reg
	.no_dead_strip	_brcmstb_send_i2c_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function brcmstb_send_i2c_cmd
_brcmstb_send_i2c_cmd:                  ; @brcmstb_send_i2c_cmd
	.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	x20, x1
	mov	x19, x0
	ldr	x22, [x0, #16]
	bl	_brcmstb_i2c_wait_if_busy
	tbnz	w0, #31, LBB0_6
; %bb.1:
	ldr	x8, [x19]
	tbnz	x8, #63, LBB0_3
; %bb.2:
	add	x0, x19, #12
	bl	_reinit_completion
LBB0_3:
Lloh0:
	adrp	x8, _INT_ENABLE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _INT_ENABLE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_brcmstb_i2c_enable_disable_irq
Lloh3:
	adrp	x8, _BSC_IIC_EN_ENABLE_MASK@GOTPAGE
Lloh4:
	ldr	x8, [x8, _BSC_IIC_EN_ENABLE_MASK@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	ldr	w9, [x22]
	orr	w1, w9, w8
	str	w1, [x22]
Lloh6:
	adrp	x22, _iic_enable@GOTPAGE
Lloh7:
	ldr	x22, [x22, _iic_enable@GOTPAGEOFF]
	ldr	w2, [x22]
	mov	x0, x19
	bl	_bsc_writel
	mov	x0, x19
	bl	_brcmstb_i2c_wait_for_completion
	cbz	w0, LBB0_7
; %bb.4:
	mov	x21, x0
Lloh8:
	adrp	x1, l_.str@PAGE
Lloh9:
	add	x1, x1, l_.str@PAGEOFF
LBB0_5:
	ldr	w0, [x19, #8]
Lloh10:
	adrp	x8, _cmd_string@GOTPAGE
Lloh11:
	ldr	x8, [x8, _cmd_string@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	ldr	w2, [x8, w20, uxtw #2]
	bl	_dev_dbg
	b	LBB0_11
LBB0_6:
	mov	x21, x0
	b	LBB0_12
LBB0_7:
Lloh13:
	adrp	x8, _CMD_RD@GOTPAGE
Lloh14:
	ldr	x8, [x8, _CMD_RD@GOTPAGEOFF]
Lloh15:
	ldr	x8, [x8]
Lloh16:
	adrp	x9, _CMD_WR@GOTPAGE
Lloh17:
	ldr	x9, [x9, _CMD_WR@GOTPAGEOFF]
Lloh18:
	ldr	x9, [x9]
	orr	x8, x8, x9
	cbz	x8, LBB0_10
; %bb.8:
	ldr	w1, [x22]
	mov	x0, x19
	bl	_bsc_readl
Lloh19:
	adrp	x8, _BSC_IIC_EN_NOACK_MASK@GOTPAGE
Lloh20:
	ldr	x8, [x8, _BSC_IIC_EN_NOACK_MASK@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	tst	w8, w0
	b.eq	LBB0_10
; %bb.9:
Lloh22:
	adrp	x8, _EREMOTEIO@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EREMOTEIO@GOTPAGEOFF]
Lloh24:
	ldr	w8, [x8]
	neg	w21, w8
Lloh25:
	adrp	x1, l_.str.1@PAGE
Lloh26:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_5
LBB0_10:
	mov	w21, #0
LBB0_11:
Lloh27:
	adrp	x8, _cnt_reg@GOTPAGE
Lloh28:
	ldr	x8, [x8, _cnt_reg@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	mov	x0, x19
	mov	w1, #0
	bl	_bsc_writel
	ldr	w2, [x22]
	mov	x0, x19
	mov	w1, #0
	bl	_bsc_writel
LBB0_12:
	mov	x0, x21
	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
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh16, Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.cfi_endproc
                                        ; -- End function
	.comm	_INT_ENABLE,4,2                 ; @INT_ENABLE
	.comm	_BSC_IIC_EN_ENABLE_MASK,4,2     ; @BSC_IIC_EN_ENABLE_MASK
	.comm	_iic_enable,4,2                 ; @iic_enable
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"intr timeout for cmd %s\n"

	.comm	_cmd_string,8,3                 ; @cmd_string
	.comm	_CMD_RD,8,3                     ; @CMD_RD
	.comm	_CMD_WR,8,3                     ; @CMD_WR
	.comm	_BSC_IIC_EN_NOACK_MASK,4,2      ; @BSC_IIC_EN_NOACK_MASK
	.comm	_EREMOTEIO,4,2                  ; @EREMOTEIO
l_.str.1:                               ; @.str.1
	.asciz	"controller received NOACK intr for %s\n"

	.comm	_cnt_reg,4,2                    ; @cnt_reg
	.no_dead_strip	_brcmstb_send_i2c_cmd
.subsections_via_symbols
