	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pmcmsptwi_master_xfer
_pmcmsptwi_master_xfer:                 ## @pmcmsptwi_master_xfer
	.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	$88, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%edx, %ebx
	movq	%rsi, %r15
	movq	%rdi, -120(%rbp)                ## 8-byte Spill
	callq	_i2c_get_adapdata
	movq	%rax, %r12
	movl	%ebx, -60(%rbp)                 ## 4-byte Spill
	cmpl	$2, %ebx
	jne	LBB0_2
## %bb.1:
	movq	_MSP_TWI_CMD_WRITE_READ@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -72(%rbp)
	movq	8(%r15), %rax
	movq	%rax, -96(%rbp)
	movq	24(%r15), %rax
	movq	%rax, -104(%rbp)
	movq	40(%r15), %rax
	movq	%rax, -80(%rbp)
	movq	56(%r15), %rax
	movq	%rax, -88(%rbp)
	movl	(%r15), %eax
	jmp	LBB0_5
LBB0_2:
	movl	(%r15), %eax
	movq	_I2C_M_RD@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_4
## %bb.3:
	movq	_MSP_TWI_CMD_READ@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -72(%rbp)
	movq	8(%r15), %rcx
	movq	%rcx, -80(%rbp)
	movq	24(%r15), %rcx
	movq	%rcx, -88(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -104(%rbp)
	jmp	LBB0_5
LBB0_4:
	movq	_MSP_TWI_CMD_WRITE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movl	%ecx, -72(%rbp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, -88(%rbp)
	movq	8(%r15), %rcx
	movq	%rcx, -96(%rbp)
	movq	24(%r15), %rcx
	movq	%rcx, -104(%rbp)
LBB0_5:
	movl	16(%r15), %ecx
	movl	%ecx, -112(%rbp)
	movq	_I2C_M_TEN@GOTPCREL(%rip), %r14
	testl	%eax, (%r14)
	je	LBB0_7
## %bb.6:
	leaq	-48(%rbp), %r13
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_pmcmsptwi_get_twi_config
	leaq	-56(%rbp), %rdi
	movq	%r13, %rsi
	movl	$4, %edx
	callq	_memcpy
	movl	$1, -48(%rbp)
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_pmcmsptwi_set_twi_config
LBB0_7:
	leaq	-112(%rbp), %rdi
	movq	%r12, %rsi
	callq	_pmcmsptwi_xfer_cmd
	movl	%eax, %r13d
	movl	(%r15), %eax
	testl	%eax, (%r14)
	je	LBB0_9
## %bb.8:
	leaq	-56(%rbp), %rdi
	movq	%r12, %rsi
	callq	_pmcmsptwi_set_twi_config
	movl	(%r15), %eax
LBB0_9:
	movq	_I2C_M_RD@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	leaq	L_.str.2(%rip), %rax
	leaq	L_.str.1(%rip), %rdx
	cmoveq	%rax, %rdx
	movq	8(%r15), %rcx
	movq	_MSP_TWI_XFER_OK@GOTPCREL(%rip), %rbx
	cmpl	(%rbx), %r13d
	leaq	L_.str.3(%rip), %rax
	leaq	L_.str.4(%rip), %r8
	cmoveq	%rax, %r8
	leaq	L_.str(%rip), %rsi
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	callq	_dev_dbg
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
	cmpl	(%rbx), %r13d
	cmovel	-60(%rbp), %eax                 ## 4-byte Folded Reload
	addq	$88, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_MSP_TWI_CMD_WRITE_READ,4,2     ## @MSP_TWI_CMD_WRITE_READ
	.comm	_I2C_M_RD,4,2                   ## @I2C_M_RD
	.comm	_MSP_TWI_CMD_READ,4,2           ## @MSP_TWI_CMD_READ
	.comm	_MSP_TWI_CMD_WRITE,4,2          ## @MSP_TWI_CMD_WRITE
	.comm	_I2C_M_TEN,4,2                  ## @I2C_M_TEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"I2C %s of %d bytes %s\n"

L_.str.1:                               ## @.str.1
	.asciz	"read"

L_.str.2:                               ## @.str.2
	.asciz	"write"

	.comm	_MSP_TWI_XFER_OK,4,2            ## @MSP_TWI_XFER_OK
L_.str.3:                               ## @.str.3
	.asciz	"succeeded"

L_.str.4:                               ## @.str.4
	.asciz	"failed"

	.comm	_EIO,4,2                        ## @EIO
	.no_dead_strip	_pmcmsptwi_master_xfer
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pmcmsptwi_master_xfer
_pmcmsptwi_master_xfer:                 ; @pmcmsptwi_master_xfer
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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	x19, x2
	mov	x21, x1
	mov	x20, x0
	bl	_i2c_get_adapdata
	mov	x22, x0
Lloh0:
	adrp	x24, _I2C_M_RD@GOTPAGE
Lloh1:
	ldr	x24, [x24, _I2C_M_RD@GOTPAGEOFF]
	cmp	w19, #2
	b.ne	LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _MSP_TWI_CMD_WRITE_READ@GOTPAGE
Lloh3:
	ldr	x8, [x8, _MSP_TWI_CMD_WRITE_READ@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	str	w8, [sp, #56]
	ldr	x8, [x21, #8]
	ldr	x9, [x21, #24]
	stp	x9, x8, [sp, #24]
	ldr	x8, [x21, #40]
	ldr	x9, [x21, #56]
	stp	x9, x8, [sp, #40]
	ldr	w8, [x21]
	b	LBB0_5
LBB0_2:
	ldr	w8, [x21]
	ldr	w9, [x24]
	tst	w9, w8
	b.eq	LBB0_4
; %bb.3:
Lloh5:
	adrp	x9, _MSP_TWI_CMD_READ@GOTPAGE
Lloh6:
	ldr	x9, [x9, _MSP_TWI_CMD_READ@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	str	w9, [sp, #56]
	ldr	x9, [x21, #8]
	ldr	x10, [x21, #24]
	stp	x10, x9, [sp, #40]
	stp	xzr, xzr, [sp, #24]
	b	LBB0_5
LBB0_4:
Lloh8:
	adrp	x9, _MSP_TWI_CMD_WRITE@GOTPAGE
Lloh9:
	ldr	x9, [x9, _MSP_TWI_CMD_WRITE@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	str	w9, [sp, #56]
	stp	xzr, xzr, [sp, #40]
	ldr	x9, [x21, #8]
	ldr	x10, [x21, #24]
	stp	x10, x9, [sp, #24]
LBB0_5:
	ldr	w9, [x21, #16]
	str	w9, [sp, #16]
Lloh11:
	adrp	x25, _I2C_M_TEN@GOTPAGE
Lloh12:
	ldr	x25, [x25, _I2C_M_TEN@GOTPAGEOFF]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_7
; %bb.6:
	mov	x0, sp
	mov	x1, x22
	bl	_pmcmsptwi_get_twi_config
	add	x0, sp, #8
	mov	x1, sp
	mov	w2, #4
	bl	_memcpy
	mov	w8, #1
	str	w8, [sp]
	mov	x0, sp
	mov	x1, x22
	bl	_pmcmsptwi_set_twi_config
LBB0_7:
	add	x0, sp, #16
	mov	x1, x22
	bl	_pmcmsptwi_xfer_cmd
	mov	x23, x0
	ldr	w8, [x21]
	ldr	w9, [x25]
	tst	w9, w8
	b.eq	LBB0_9
; %bb.8:
	add	x0, sp, #8
	mov	x1, x22
	bl	_pmcmsptwi_set_twi_config
	ldr	w8, [x21]
LBB0_9:
	ldr	w9, [x24]
Lloh13:
	adrp	x10, l_.str.1@PAGE
Lloh14:
	add	x10, x10, l_.str.1@PAGEOFF
Lloh15:
	adrp	x11, l_.str.2@PAGE
Lloh16:
	add	x11, x11, l_.str.2@PAGEOFF
	tst	w9, w8
	csel	x2, x11, x10, eq
	ldr	x3, [x21, #8]
Lloh17:
	adrp	x21, _MSP_TWI_XFER_OK@GOTPAGE
Lloh18:
	ldr	x21, [x21, _MSP_TWI_XFER_OK@GOTPAGEOFF]
	ldr	w8, [x21]
Lloh19:
	adrp	x9, l_.str.4@PAGE
Lloh20:
	add	x9, x9, l_.str.4@PAGEOFF
Lloh21:
	adrp	x10, l_.str.3@PAGE
Lloh22:
	add	x10, x10, l_.str.3@PAGEOFF
	cmp	w23, w8
	csel	x4, x10, x9, eq
Lloh23:
	adrp	x1, l_.str@PAGE
Lloh24:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	bl	_dev_dbg
	ldr	w8, [x21]
Lloh25:
	adrp	x9, _EIO@GOTPAGE
Lloh26:
	ldr	x9, [x9, _EIO@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	cmp	w23, w8
	csneg	w0, w19, w9, eq
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_MSP_TWI_CMD_WRITE_READ,4,2     ; @MSP_TWI_CMD_WRITE_READ
	.comm	_I2C_M_RD,4,2                   ; @I2C_M_RD
	.comm	_MSP_TWI_CMD_READ,4,2           ; @MSP_TWI_CMD_READ
	.comm	_MSP_TWI_CMD_WRITE,4,2          ; @MSP_TWI_CMD_WRITE
	.comm	_I2C_M_TEN,4,2                  ; @I2C_M_TEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"I2C %s of %d bytes %s\n"

l_.str.1:                               ; @.str.1
	.asciz	"read"

l_.str.2:                               ; @.str.2
	.asciz	"write"

	.comm	_MSP_TWI_XFER_OK,4,2            ; @MSP_TWI_XFER_OK
l_.str.3:                               ; @.str.3
	.asciz	"succeeded"

l_.str.4:                               ; @.str.4
	.asciz	"failed"

	.comm	_EIO,4,2                        ; @EIO
	.no_dead_strip	_pmcmsptwi_master_xfer
.subsections_via_symbols
