	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pmcmsptwi_xfer_cmd
_pmcmsptwi_xfer_cmd:                    ## @pmcmsptwi_xfer_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	%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, %r14
	movq	%rdi, %r12
	movq	%rsi, %rdi
	callq	_mutex_lock
	movl	(%r12), %edx
	movq	_pmcmsptwi_adapter@GOTPCREL(%rip), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_dbg
	movl	(%r12), %edi
	movq	_MSP_TWI_ADD_REG_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_pmcmsptwi_writel
	movq	8(%r12), %rax
	movq	_MSP_TWI_CMD_WRITE@GOTPCREL(%rip), %rcx
	movq	_MSP_TWI_CMD_WRITE_READ@GOTPCREL(%rip), %r13
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	cmpq	(%r13), %rax
	jne	LBB0_4
LBB0_2:
	movq	32(%r12), %rdi
	callq	_be64_to_cpup
	movl	%eax, %ebx
	movq	_MSP_MAX_BYTES_PER_RW@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	subl	16(%r12), %ecx
	shll	$3, %ecx
                                        ## kill: def $cl killed $cl killed $ecx
	sarl	%cl, %ebx
	movq	_pmcmsptwi_adapter@GOTPCREL(%rip), %rdi
	leaq	L_.str.1(%rip), %rsi
	movl	%ebx, %edx
	callq	_dev_dbg
	movq	_MSP_TWI_DAT_0_REG_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	movl	%ebx, %edi
	callq	_pmcmsptwi_writel
	cmpl	$5, 16(%r12)
	jl	LBB0_4
## %bb.3:
	movq	_MSP_TWI_DAT_1_REG_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%r14), %rsi
	callq	_pmcmsptwi_writel
LBB0_4:
	movq	%r12, %rdi
	callq	_pmcmsptwi_cmd_to_reg
	movl	%eax, %edi
	movq	%r14, %rsi
	callq	_pmcmsptwi_do_xfer
	movl	%eax, %r15d
	movq	_MSP_TWI_XFER_OK@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r15d
	jne	LBB0_12
## %bb.5:
	movq	8(%r12), %rax
	movq	_MSP_TWI_CMD_READ@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_7
## %bb.6:
	cmpq	(%r13), %rax
	jne	LBB0_12
LBB0_7:
	movb	20(%r12), %cl
	shlb	$3, %cl
	movq	$-1, %r13
	shlq	%cl, %r13
	notl	%r13d
	movq	_MSP_TWI_DAT_0_REG_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r14), %rdi
	callq	_pmcmsptwi_readl
	movq	%rax, %rbx
	cmpl	$5, 20(%r12)
	jl	LBB0_9
## %bb.8:
	movq	_MSP_TWI_DAT_1_REG_OFFSET@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%r14), %rdi
	callq	_pmcmsptwi_readl
LBB0_9:
	andl	%r13d, %ebx
	movq	_pmcmsptwi_adapter@GOTPCREL(%rip), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edx
	callq	_dev_dbg
	cmpl	$0, 20(%r12)
	jle	LBB0_12
## %bb.10:
	movq	24(%r12), %rax
	xorl	%ecx, %ecx
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movl	%ebx, %edx
	sarl	%cl, %edx
	movl	%edx, (%rax,%rcx,4)
	incq	%rcx
	movslq	20(%r12), %rdx
	cmpq	%rdx, %rcx
	jl	LBB0_11
LBB0_12:
	movq	%r14, %rdi
	callq	_mutex_unlock
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_pmcmsptwi_adapter,4,2          ## @pmcmsptwi_adapter
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Setting address to 0x%04x\n"

	.comm	_MSP_TWI_ADD_REG_OFFSET,8,3     ## @MSP_TWI_ADD_REG_OFFSET
	.comm	_MSP_TWI_CMD_WRITE,8,3          ## @MSP_TWI_CMD_WRITE
	.comm	_MSP_TWI_CMD_WRITE_READ,8,3     ## @MSP_TWI_CMD_WRITE_READ
	.comm	_MSP_MAX_BYTES_PER_RW,4,2       ## @MSP_MAX_BYTES_PER_RW
L_.str.1:                               ## @.str.1
	.asciz	"Writing 0x%016llx\n"

	.comm	_MSP_TWI_DAT_0_REG_OFFSET,8,3   ## @MSP_TWI_DAT_0_REG_OFFSET
	.comm	_MSP_TWI_DAT_1_REG_OFFSET,8,3   ## @MSP_TWI_DAT_1_REG_OFFSET
	.comm	_MSP_TWI_XFER_OK,4,2            ## @MSP_TWI_XFER_OK
	.comm	_MSP_TWI_CMD_READ,8,3           ## @MSP_TWI_CMD_READ
L_.str.2:                               ## @.str.2
	.asciz	"Read 0x%016llx\n"

	.no_dead_strip	_pmcmsptwi_xfer_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pmcmsptwi_xfer_cmd
_pmcmsptwi_xfer_cmd:                    ; @pmcmsptwi_xfer_cmd
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x1
	mov	x20, x0
	mov	x0, x1
	bl	_mutex_lock
	ldr	w2, [x20]
Lloh0:
	adrp	x0, _pmcmsptwi_adapter@GOTPAGE
Lloh1:
	ldr	x0, [x0, _pmcmsptwi_adapter@GOTPAGEOFF]
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_dbg
	ldr	w0, [x20]
	ldr	x8, [x19, #8]
Lloh4:
	adrp	x9, _MSP_TWI_ADD_REG_OFFSET@GOTPAGE
Lloh5:
	ldr	x9, [x9, _MSP_TWI_ADD_REG_OFFSET@GOTPAGEOFF]
Lloh6:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_pmcmsptwi_writel
	ldr	x8, [x20, #8]
Lloh7:
	adrp	x9, _MSP_TWI_CMD_WRITE@GOTPAGE
Lloh8:
	ldr	x9, [x9, _MSP_TWI_CMD_WRITE@GOTPAGEOFF]
Lloh9:
	ldr	x9, [x9]
Lloh10:
	adrp	x22, _MSP_TWI_CMD_WRITE_READ@GOTPAGE
Lloh11:
	ldr	x22, [x22, _MSP_TWI_CMD_WRITE_READ@GOTPAGEOFF]
	ldr	x10, [x22]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_3
; %bb.1:
	ldr	x0, [x20, #32]
	bl	_be64_to_cpup
Lloh12:
	adrp	x8, _MSP_MAX_BYTES_PER_RW@GOTPAGE
Lloh13:
	ldr	x8, [x8, _MSP_MAX_BYTES_PER_RW@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x20, #16]
	sub	w8, w8, w9
	lsl	w8, w8, #3
	asr	w21, w0, w8
Lloh15:
	adrp	x0, _pmcmsptwi_adapter@GOTPAGE
Lloh16:
	ldr	x0, [x0, _pmcmsptwi_adapter@GOTPAGEOFF]
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x2, x21
	bl	_dev_dbg
	ldr	x8, [x19, #8]
Lloh19:
	adrp	x9, _MSP_TWI_DAT_0_REG_OFFSET@GOTPAGE
Lloh20:
	ldr	x9, [x9, _MSP_TWI_DAT_0_REG_OFFSET@GOTPAGEOFF]
Lloh21:
	ldr	x9, [x9]
	add	x1, x9, x8
	mov	x0, x21
	bl	_pmcmsptwi_writel
	ldr	w8, [x20, #16]
	cmp	w8, #5
	b.lt	LBB0_3
; %bb.2:
	ldr	x8, [x19, #8]
Lloh22:
	adrp	x9, _MSP_TWI_DAT_1_REG_OFFSET@GOTPAGE
Lloh23:
	ldr	x9, [x9, _MSP_TWI_DAT_1_REG_OFFSET@GOTPAGEOFF]
Lloh24:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_pmcmsptwi_writel
LBB0_3:
	mov	x0, x20
	bl	_pmcmsptwi_cmd_to_reg
	mov	x1, x19
	bl	_pmcmsptwi_do_xfer
	mov	x21, x0
Lloh25:
	adrp	x8, _MSP_TWI_XFER_OK@GOTPAGE
Lloh26:
	ldr	x8, [x8, _MSP_TWI_XFER_OK@GOTPAGEOFF]
Lloh27:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_10
; %bb.4:
	ldr	x8, [x20, #8]
Lloh28:
	adrp	x9, _MSP_TWI_CMD_READ@GOTPAGE
Lloh29:
	ldr	x9, [x9, _MSP_TWI_CMD_READ@GOTPAGEOFF]
Lloh30:
	ldr	x9, [x9]
	ldr	x10, [x22]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_10
; %bb.5:
	ldr	w8, [x20, #20]
	lsl	w8, w8, #3
	mov	x9, #-1
	lsl	x8, x9, x8
	mvn	w23, w8
	ldr	x8, [x19, #8]
Lloh31:
	adrp	x9, _MSP_TWI_DAT_0_REG_OFFSET@GOTPAGE
Lloh32:
	ldr	x9, [x9, _MSP_TWI_DAT_0_REG_OFFSET@GOTPAGEOFF]
Lloh33:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_pmcmsptwi_readl
	mov	x22, x0
	ldr	w8, [x20, #20]
	cmp	w8, #5
	b.lt	LBB0_7
; %bb.6:
	ldr	x8, [x19, #8]
Lloh34:
	adrp	x9, _MSP_TWI_DAT_1_REG_OFFSET@GOTPAGE
Lloh35:
	ldr	x9, [x9, _MSP_TWI_DAT_1_REG_OFFSET@GOTPAGEOFF]
Lloh36:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_pmcmsptwi_readl
LBB0_7:
	and	w22, w22, w23
Lloh37:
	adrp	x0, _pmcmsptwi_adapter@GOTPAGE
Lloh38:
	ldr	x0, [x0, _pmcmsptwi_adapter@GOTPAGEOFF]
Lloh39:
	adrp	x1, l_.str.2@PAGE
Lloh40:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x2, x22
	bl	_dev_dbg
	ldr	w8, [x20, #20]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.8:
	mov	x8, #0
	ldr	x9, [x20, #24]
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	asr	w10, w22, w8
	str	w10, [x9, x8, lsl #2]
	add	x8, x8, #1
	ldrsw	x10, [x20, #20]
	cmp	x8, x10
	b.lt	LBB0_9
LBB0_10:
	mov	x0, x19
	bl	_mutex_unlock
	mov	x0, x21
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.loh AdrpLdrGotLdr	Lloh31, Lloh32, Lloh33
	.loh AdrpLdrGotLdr	Lloh34, Lloh35, Lloh36
	.loh AdrpAdd	Lloh39, Lloh40
	.loh AdrpLdrGot	Lloh37, Lloh38
	.cfi_endproc
                                        ; -- End function
	.comm	_pmcmsptwi_adapter,4,2          ; @pmcmsptwi_adapter
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Setting address to 0x%04x\n"

	.comm	_MSP_TWI_ADD_REG_OFFSET,8,3     ; @MSP_TWI_ADD_REG_OFFSET
	.comm	_MSP_TWI_CMD_WRITE,8,3          ; @MSP_TWI_CMD_WRITE
	.comm	_MSP_TWI_CMD_WRITE_READ,8,3     ; @MSP_TWI_CMD_WRITE_READ
	.comm	_MSP_MAX_BYTES_PER_RW,4,2       ; @MSP_MAX_BYTES_PER_RW
l_.str.1:                               ; @.str.1
	.asciz	"Writing 0x%016llx\n"

	.comm	_MSP_TWI_DAT_0_REG_OFFSET,8,3   ; @MSP_TWI_DAT_0_REG_OFFSET
	.comm	_MSP_TWI_DAT_1_REG_OFFSET,8,3   ; @MSP_TWI_DAT_1_REG_OFFSET
	.comm	_MSP_TWI_XFER_OK,4,2            ; @MSP_TWI_XFER_OK
	.comm	_MSP_TWI_CMD_READ,8,3           ; @MSP_TWI_CMD_READ
l_.str.2:                               ; @.str.2
	.asciz	"Read 0x%016llx\n"

	.no_dead_strip	_pmcmsptwi_xfer_cmd
.subsections_via_symbols
