	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function pcan_write_eeprom
_pcan_write_eeprom:                     ## @pcan_write_eeprom
	.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	%edx, %r15d
	movl	%esi, %r14d
	movq	%rdi, %r12
	movq	_PCC_SPI_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_PCC_EEP_WREN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	callq	_pcan_write_reg
	movq	%r12, %rdi
	callq	_pcan_wait_spi_busy
	movl	%eax, %ebx
	testl	%eax, %eax
	je	LBB0_1
LBB0_6:
	movq	(%r12), %rdi
	leaq	L_.str.2(%rip), %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_24:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, %eax
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	jle	LBB0_2
## %bb.3:
	xorl	%r14d, %r14d
	movq	_PCC_EEP_RDSR@GOTPCREL(%rip), %r15
	movq	_PCC_EEP_SR_WEN@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_4:                                 ## =>This Inner Loop Header: Depth=1
	movq	_PCC_SPI_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r15), %edx
	movq	%r12, %rdi
	callq	_pcan_write_reg
	movq	%r12, %rdi
	callq	_pcan_wait_spi_busy
	testl	%eax, %eax
	jne	LBB0_5
## %bb.7:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	_PCC_SPI_DIR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pcan_read_reg
	testl	%eax, (%r13)
	jne	LBB0_8
## %bb.9:                               ##   in Loop: Header=BB0_4 Depth=1
	incl	%r14d
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r14d
	jl	LBB0_4
	jmp	LBB0_10
LBB0_2:
	xorl	%r14d, %r14d
LBB0_10:
	cmpl	%eax, %r14d
	jge	LBB0_11
LBB0_13:
	movq	_PCC_SPI_ADR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movzbl	%bl, %edx
	movq	%r12, %rdi
	callq	_pcan_write_reg
	movq	_PCC_SPI_DOR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movl	-44(%rbp), %edx                 ## 4-byte Reload
	callq	_pcan_write_reg
	movq	_PCC_SPI_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %r14d
	movl	%ebx, %edi
	callq	_PCC_EEP_WRITE
	movq	%r12, %rdi
	movl	%r14d, %esi
	movl	%eax, %edx
	callq	_pcan_write_reg
	movq	%r12, %rdi
	callq	_pcan_wait_spi_busy
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.14:
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	xorl	%r14d, %r14d
	testl	%eax, %eax
	jle	LBB0_20
## %bb.15:
	movq	_PCC_EEP_RDSR@GOTPCREL(%rip), %r15
	movq	_PCC_EEP_SR_WIP@GOTPCREL(%rip), %r13
	.p2align	4, 0x90
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	_PCC_SPI_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%r15), %edx
	movq	%r12, %rdi
	callq	_pcan_write_reg
	movq	%r12, %rdi
	callq	_pcan_wait_spi_busy
	testl	%eax, %eax
	jne	LBB0_5
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movq	_PCC_SPI_DIR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_pcan_read_reg
	testl	%eax, (%r13)
	je	LBB0_18
## %bb.19:                              ##   in Loop: Header=BB0_16 Depth=1
	incl	%r14d
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r14d
	jl	LBB0_16
	jmp	LBB0_20
LBB0_5:
	movl	%eax, %ebx
	jmp	LBB0_6
LBB0_8:
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	cmpl	%eax, %r14d
	jl	LBB0_13
LBB0_11:
	movq	(%r12), %rdi
	leaq	L_.str(%rip), %rsi
LBB0_12:
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_24
LBB0_18:
	movq	_PCC_WRITE_MAX_LOOP@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
LBB0_20:
	cmpl	%eax, %r14d
	jge	LBB0_21
## %bb.22:
	movq	_PCC_SPI_IR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_PCC_EEP_WRDI@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r12, %rdi
	callq	_pcan_write_reg
	movq	%r12, %rdi
	callq	_pcan_wait_spi_busy
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_6
## %bb.23:
	xorl	%ebx, %ebx
	jmp	LBB0_24
LBB0_21:
	movq	(%r12), %rdi
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_PCC_SPI_IR,4,2                 ## @PCC_SPI_IR
	.comm	_PCC_EEP_WREN,4,2               ## @PCC_EEP_WREN
	.comm	_PCC_WRITE_MAX_LOOP,4,2         ## @PCC_WRITE_MAX_LOOP
	.comm	_PCC_EEP_RDSR,4,2               ## @PCC_EEP_RDSR
	.comm	_PCC_SPI_DIR,4,2                ## @PCC_SPI_DIR
	.comm	_PCC_EEP_SR_WEN,4,2             ## @PCC_EEP_SR_WEN
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"stop waiting to be allowed to write in eeprom\n"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_PCC_SPI_ADR,4,2                ## @PCC_SPI_ADR
	.comm	_PCC_SPI_DOR,4,2                ## @PCC_SPI_DOR
	.comm	_PCC_EEP_SR_WIP,4,2             ## @PCC_EEP_SR_WIP
L_.str.1:                               ## @.str.1
	.asciz	"stop waiting for write in eeprom to complete\n"

	.comm	_PCC_EEP_WRDI,4,2               ## @PCC_EEP_WRDI
L_.str.2:                               ## @.str.2
	.asciz	"stop waiting (spi engine always busy) err %d\n"

	.no_dead_strip	_pcan_write_eeprom
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function pcan_write_eeprom
_pcan_write_eeprom:                     ; @pcan_write_eeprom
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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, x2
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x23, _PCC_SPI_IR@GOTPAGE
Lloh1:
	ldr	x23, [x23, _PCC_SPI_IR@GOTPAGEOFF]
	ldr	w1, [x23]
Lloh2:
	adrp	x8, _PCC_EEP_WREN@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PCC_EEP_WREN@GOTPAGEOFF]
Lloh4:
	ldr	w2, [x8]
	bl	_pcan_write_reg
	mov	x0, x19
	bl	_pcan_wait_spi_busy
	mov	x22, x0
	cbz	w0, LBB0_3
LBB0_1:
	ldr	x0, [x19]
	str	x22, [sp]
Lloh5:
	adrp	x1, l_.str.2@PAGE
Lloh6:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
LBB0_2:
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_3:
Lloh7:
	adrp	x24, _PCC_WRITE_MAX_LOOP@GOTPAGE
Lloh8:
	ldr	x24, [x24, _PCC_WRITE_MAX_LOOP@GOTPAGEOFF]
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.4:
	mov	w25, #0
Lloh9:
	adrp	x26, _PCC_EEP_RDSR@GOTPAGE
Lloh10:
	ldr	x26, [x26, _PCC_EEP_RDSR@GOTPAGEOFF]
Lloh11:
	adrp	x27, _PCC_SPI_DIR@GOTPAGE
Lloh12:
	ldr	x27, [x27, _PCC_SPI_DIR@GOTPAGEOFF]
Lloh13:
	adrp	x28, _PCC_EEP_SR_WEN@GOTPAGE
Lloh14:
	ldr	x28, [x28, _PCC_EEP_SR_WEN@GOTPAGEOFF]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x23]
	ldr	w2, [x26]
	mov	x0, x19
	bl	_pcan_write_reg
	mov	x0, x19
	bl	_pcan_wait_spi_busy
	cbnz	w0, LBB0_18
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w1, [x27]
	mov	x0, x19
	bl	_pcan_read_reg
	ldr	w8, [x28]
	tst	w8, w0
	b.ne	LBB0_19
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w25, w25, #1
	ldr	w8, [x24]
	cmp	w25, w8
	b.lt	LBB0_5
; %bb.8:
	cmp	w25, w8
	b.ge	LBB0_16
LBB0_9:
Lloh15:
	adrp	x8, _PCC_SPI_ADR@GOTPAGE
Lloh16:
	ldr	x8, [x8, _PCC_SPI_ADR@GOTPAGEOFF]
Lloh17:
	ldr	w1, [x8]
	and	w2, w20, #0xff
	mov	x0, x19
	bl	_pcan_write_reg
Lloh18:
	adrp	x8, _PCC_SPI_DOR@GOTPAGE
Lloh19:
	ldr	x8, [x8, _PCC_SPI_DOR@GOTPAGEOFF]
Lloh20:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	bl	_pcan_write_reg
	ldr	w21, [x23]
	mov	x0, x20
	bl	_PCC_EEP_WRITE
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_pcan_write_reg
	mov	x0, x19
	bl	_pcan_wait_spi_busy
	mov	x22, x0
	cbnz	w0, LBB0_1
; %bb.10:
	ldr	w8, [x24]
	cmp	w8, #1
	b.lt	LBB0_20
; %bb.11:
	mov	w20, #0
Lloh21:
	adrp	x21, _PCC_EEP_RDSR@GOTPAGE
Lloh22:
	ldr	x21, [x21, _PCC_EEP_RDSR@GOTPAGEOFF]
Lloh23:
	adrp	x25, _PCC_SPI_DIR@GOTPAGE
Lloh24:
	ldr	x25, [x25, _PCC_SPI_DIR@GOTPAGEOFF]
Lloh25:
	adrp	x26, _PCC_EEP_SR_WIP@GOTPAGE
Lloh26:
	ldr	x26, [x26, _PCC_EEP_SR_WIP@GOTPAGEOFF]
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x23]
	ldr	w2, [x21]
	mov	x0, x19
	bl	_pcan_write_reg
	mov	x0, x19
	bl	_pcan_wait_spi_busy
	cbnz	w0, LBB0_18
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w1, [x25]
	mov	x0, x19
	bl	_pcan_read_reg
	ldr	w8, [x26]
	tst	w8, w0
	b.eq	LBB0_23
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	add	w20, w20, #1
	ldr	w8, [x24]
	cmp	w20, w8
	b.lt	LBB0_12
	b	LBB0_21
LBB0_15:
	mov	w25, #0
	cmp	w25, w8
	b.lt	LBB0_9
LBB0_16:
	ldr	x0, [x19]
Lloh27:
	adrp	x1, l_.str@PAGE
Lloh28:
	add	x1, x1, l_.str@PAGEOFF
LBB0_17:
	bl	_dev_err
Lloh29:
	adrp	x8, _EIO@GOTPAGE
Lloh30:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh31:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_2
LBB0_18:
	mov	x22, x0
	b	LBB0_1
LBB0_19:
	ldr	w8, [x24]
	cmp	w25, w8
	b.lt	LBB0_9
	b	LBB0_16
LBB0_20:
	mov	w20, #0
LBB0_21:
	cmp	w20, w8
	b.ge	LBB0_24
LBB0_22:
	ldr	w1, [x23]
Lloh32:
	adrp	x8, _PCC_EEP_WRDI@GOTPAGE
Lloh33:
	ldr	x8, [x8, _PCC_EEP_WRDI@GOTPAGEOFF]
Lloh34:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_pcan_write_reg
	mov	x0, x19
	bl	_pcan_wait_spi_busy
	mov	x22, x0
	cbnz	w0, LBB0_1
	b	LBB0_2
LBB0_23:
	ldr	w8, [x24]
	cmp	w20, w8
	b.lt	LBB0_22
LBB0_24:
	ldr	x0, [x19]
Lloh35:
	adrp	x1, l_.str.1@PAGE
Lloh36:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_17
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGot	Lloh21, Lloh22
	.loh AdrpAdd	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh29, Lloh30, Lloh31
	.loh AdrpLdrGotLdr	Lloh32, Lloh33, Lloh34
	.loh AdrpAdd	Lloh35, Lloh36
	.cfi_endproc
                                        ; -- End function
	.comm	_PCC_SPI_IR,4,2                 ; @PCC_SPI_IR
	.comm	_PCC_EEP_WREN,4,2               ; @PCC_EEP_WREN
	.comm	_PCC_WRITE_MAX_LOOP,4,2         ; @PCC_WRITE_MAX_LOOP
	.comm	_PCC_EEP_RDSR,4,2               ; @PCC_EEP_RDSR
	.comm	_PCC_SPI_DIR,4,2                ; @PCC_SPI_DIR
	.comm	_PCC_EEP_SR_WEN,4,2             ; @PCC_EEP_SR_WEN
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"stop waiting to be allowed to write in eeprom\n"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_PCC_SPI_ADR,4,2                ; @PCC_SPI_ADR
	.comm	_PCC_SPI_DOR,4,2                ; @PCC_SPI_DOR
	.comm	_PCC_EEP_SR_WIP,4,2             ; @PCC_EEP_SR_WIP
l_.str.1:                               ; @.str.1
	.asciz	"stop waiting for write in eeprom to complete\n"

	.comm	_PCC_EEP_WRDI,4,2               ; @PCC_EEP_WRDI
l_.str.2:                               ; @.str.2
	.asciz	"stop waiting (spi engine always busy) err %d\n"

	.no_dead_strip	_pcan_write_eeprom
.subsections_via_symbols
