	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function kvaser_pciefd_spi_cmd
_kvaser_pciefd_spi_cmd:                 ## @kvaser_pciefd_spi_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
	movl	%r8d, %r14d
	movq	%rcx, %r15
	movl	%edx, %r12d
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movq	%rdi, %rbx
	xorl	%edi, %edi
	callq	_BIT
	movq	_KVASER_PCIEFD_SPI_SSEL_REG@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	8(%rbx), %rsi
	movl	%eax, %edi
	callq	_iowrite32
	movl	$10, %edi
	callq	_BIT
	movq	_KVASER_PCIEFD_SPI_CTRL_REG@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	8(%rbx), %rsi
	movl	%eax, %edi
	callq	_iowrite32
	movq	_KVASER_PCIEFD_SPI_RX_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%rbx), %rdi
	callq	_ioread32
	testl	%r12d, %r12d
	je	LBB0_5
## %bb.1:
	movl	%r12d, %r13d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	_KVASER_PCIEFD_SPI_TRDY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_kvaser_pciefd_spi_wait_loop
	testq	%rax, %rax
	jne	LBB0_14
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax,%r12,4), %edi
	movq	_KVASER_PCIEFD_SPI_TX_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	callq	_iowrite32
	movq	_KVASER_PCIEFD_SPI_RRDY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_kvaser_pciefd_spi_wait_loop
	testq	%rax, %rax
	jne	LBB0_14
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_KVASER_PCIEFD_SPI_RX_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%rbx), %rdi
	callq	_ioread32
	incq	%r12
	cmpl	%r12d, %r13d
	jne	LBB0_2
LBB0_5:
	testl	%r14d, %r14d
	jle	LBB0_11
## %bb.6:
	incl	%r14d
	movq	_KVASER_PCIEFD_SPI_TRDY@GOTPCREL(%rip), %r12
	movq	_KVASER_PCIEFD_SPI_RRDY@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	movl	(%r12), %esi
	movq	%rbx, %rdi
	callq	_kvaser_pciefd_spi_wait_loop
	testq	%rax, %rax
	jne	LBB0_14
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_KVASER_PCIEFD_SPI_TX_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	xorl	%edi, %edi
	callq	_iowrite32
	movl	(%r13), %esi
	movq	%rbx, %rdi
	callq	_kvaser_pciefd_spi_wait_loop
	testq	%rax, %rax
	jne	LBB0_14
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=1
	movq	_KVASER_PCIEFD_SPI_RX_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	8(%rbx), %rdi
	callq	_ioread32
	movl	%eax, (%r15)
	addq	$4, %r15
	decl	%r14d
	cmpl	$1, %r14d
	ja	LBB0_7
## %bb.10:
	xorl	%r14d, %r14d
LBB0_11:
	movq	_KVASER_PCIEFD_SPI_TMT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%rbx, %rdi
	callq	_kvaser_pciefd_spi_wait_loop
	testq	%rax, %rax
	jne	LBB0_14
## %bb.12:
	movq	_KVASER_PCIEFD_SPI_CTRL_REG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	8(%rbx), %rsi
	xorl	%r15d, %r15d
	xorl	%edi, %edi
	callq	_iowrite32
	testl	%r14d, %r14d
	je	LBB0_15
## %bb.13:
	movq	(%rbx), %rdi
	leaq	L_.str(%rip), %rsi
	callq	_dev_err
LBB0_14:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_15:
	movl	%r15d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_KVASER_PCIEFD_SPI_SSEL_REG,8,3 ## @KVASER_PCIEFD_SPI_SSEL_REG
	.comm	_KVASER_PCIEFD_SPI_CTRL_REG,8,3 ## @KVASER_PCIEFD_SPI_CTRL_REG
	.comm	_KVASER_PCIEFD_SPI_RX_REG,8,3   ## @KVASER_PCIEFD_SPI_RX_REG
	.comm	_KVASER_PCIEFD_SPI_TRDY,4,2     ## @KVASER_PCIEFD_SPI_TRDY
	.comm	_EIO,4,2                        ## @EIO
	.comm	_KVASER_PCIEFD_SPI_TX_REG,8,3   ## @KVASER_PCIEFD_SPI_TX_REG
	.comm	_KVASER_PCIEFD_SPI_RRDY,4,2     ## @KVASER_PCIEFD_SPI_RRDY
	.comm	_KVASER_PCIEFD_SPI_TMT,4,2      ## @KVASER_PCIEFD_SPI_TMT
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Flash SPI transfer failed\n"

	.no_dead_strip	_kvaser_pciefd_spi_cmd
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function kvaser_pciefd_spi_cmd
_kvaser_pciefd_spi_cmd:                 ; @kvaser_pciefd_spi_cmd
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x21, x4
	mov	x20, x3
	mov	x22, x2
	mov	x23, x1
	mov	x19, x0
	mov	w0, #0
	bl	_BIT
	ldr	x8, [x19, #8]
Lloh0:
	adrp	x9, _KVASER_PCIEFD_SPI_SSEL_REG@GOTPAGE
Lloh1:
	ldr	x9, [x9, _KVASER_PCIEFD_SPI_SSEL_REG@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	mov	w0, #10
	bl	_BIT
	ldr	x8, [x19, #8]
Lloh3:
	adrp	x24, _KVASER_PCIEFD_SPI_CTRL_REG@GOTPAGE
Lloh4:
	ldr	x24, [x24, _KVASER_PCIEFD_SPI_CTRL_REG@GOTPAGEOFF]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x19, #8]
Lloh5:
	adrp	x25, _KVASER_PCIEFD_SPI_RX_REG@GOTPAGE
Lloh6:
	ldr	x25, [x25, _KVASER_PCIEFD_SPI_RX_REG@GOTPAGEOFF]
	ldr	x9, [x25]
	add	x0, x9, x8
	bl	_ioread32
	cbz	w22, LBB0_5
; %bb.1:
Lloh7:
	adrp	x26, _KVASER_PCIEFD_SPI_TRDY@GOTPAGE
Lloh8:
	ldr	x26, [x26, _KVASER_PCIEFD_SPI_TRDY@GOTPAGEOFF]
Lloh9:
	adrp	x27, _KVASER_PCIEFD_SPI_TX_REG@GOTPAGE
Lloh10:
	ldr	x27, [x27, _KVASER_PCIEFD_SPI_TX_REG@GOTPAGEOFF]
Lloh11:
	adrp	x28, _KVASER_PCIEFD_SPI_RRDY@GOTPAGE
Lloh12:
	ldr	x28, [x28, _KVASER_PCIEFD_SPI_RRDY@GOTPAGEOFF]
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	mov	x0, x19
	bl	_kvaser_pciefd_spi_wait_loop
	cbnz	x0, LBB0_14
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x23]
	ldr	x8, [x19, #8]
	ldr	x9, [x27]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	w1, [x28]
	mov	x0, x19
	bl	_kvaser_pciefd_spi_wait_loop
	cbnz	x0, LBB0_14
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	sub	w22, w22, #1
	add	x23, x23, #4
	ldr	x8, [x19, #8]
	ldr	x9, [x25]
	add	x0, x9, x8
	bl	_ioread32
	cbnz	w22, LBB0_2
LBB0_5:
	cmp	w21, #1
	b.lt	LBB0_11
; %bb.6:
	add	w21, w21, #1
Lloh13:
	adrp	x22, _KVASER_PCIEFD_SPI_TRDY@GOTPAGE
Lloh14:
	ldr	x22, [x22, _KVASER_PCIEFD_SPI_TRDY@GOTPAGEOFF]
Lloh15:
	adrp	x23, _KVASER_PCIEFD_SPI_TX_REG@GOTPAGE
Lloh16:
	ldr	x23, [x23, _KVASER_PCIEFD_SPI_TX_REG@GOTPAGEOFF]
Lloh17:
	adrp	x26, _KVASER_PCIEFD_SPI_RRDY@GOTPAGE
Lloh18:
	ldr	x26, [x26, _KVASER_PCIEFD_SPI_RRDY@GOTPAGEOFF]
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x22]
	mov	x0, x19
	bl	_kvaser_pciefd_spi_wait_loop
	cbnz	x0, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19, #8]
	ldr	x9, [x23]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	w1, [x26]
	mov	x0, x19
	bl	_kvaser_pciefd_spi_wait_loop
	cbnz	x0, LBB0_14
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x19, #8]
	ldr	x9, [x25]
	add	x0, x9, x8
	bl	_ioread32
	str	w0, [x20], #4
	sub	w21, w21, #1
	cmp	w21, #1
	b.hi	LBB0_7
; %bb.10:
	mov	w21, #0
LBB0_11:
Lloh19:
	adrp	x8, _KVASER_PCIEFD_SPI_TMT@GOTPAGE
Lloh20:
	ldr	x8, [x8, _KVASER_PCIEFD_SPI_TMT@GOTPAGEOFF]
Lloh21:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_kvaser_pciefd_spi_wait_loop
	cbnz	x0, LBB0_14
; %bb.12:
	ldr	x8, [x19, #8]
	ldr	x9, [x24]
	add	x1, x9, x8
	bl	_iowrite32
	cbz	w21, LBB0_16
; %bb.13:
	ldr	x0, [x19]
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
LBB0_14:
Lloh24:
	adrp	x8, _EIO@GOTPAGE
Lloh25:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh26:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_16:
	mov	w0, #0
	b	LBB0_15
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.cfi_endproc
                                        ; -- End function
	.comm	_KVASER_PCIEFD_SPI_SSEL_REG,8,3 ; @KVASER_PCIEFD_SPI_SSEL_REG
	.comm	_KVASER_PCIEFD_SPI_CTRL_REG,8,3 ; @KVASER_PCIEFD_SPI_CTRL_REG
	.comm	_KVASER_PCIEFD_SPI_RX_REG,8,3   ; @KVASER_PCIEFD_SPI_RX_REG
	.comm	_KVASER_PCIEFD_SPI_TRDY,4,2     ; @KVASER_PCIEFD_SPI_TRDY
	.comm	_EIO,4,2                        ; @EIO
	.comm	_KVASER_PCIEFD_SPI_TX_REG,8,3   ; @KVASER_PCIEFD_SPI_TX_REG
	.comm	_KVASER_PCIEFD_SPI_RRDY,4,2     ; @KVASER_PCIEFD_SPI_RRDY
	.comm	_KVASER_PCIEFD_SPI_TMT,4,2      ; @KVASER_PCIEFD_SPI_TMT
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Flash SPI transfer failed\n"

	.no_dead_strip	_kvaser_pciefd_spi_cmd
.subsections_via_symbols
