	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function vsc7385_upload_ucode
_vsc7385_upload_ucode:                  ## @vsc7385_upload_ucode
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r15
	movq	8(%rdi), %r14
	movq	(%rdi), %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	leaq	L_.str(%rip), %rsi
	cmovneq	%rax, %rsi
	leaq	-48(%rbp), %rdi
	movq	%r14, %rdx
	callq	_request_firmware
	testl	%eax, %eax
	je	LBB0_2
## %bb.1:
	movl	%eax, %r13d
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_26
LBB0_2:
	movq	%r15, %rdi
	callq	_vsc7385_icpu_stop
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_25
## %bb.3:
	movq	%r15, %rdi
	callq	_vsc7385_icpu_reset
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_25
## %bb.4:
	leaq	L_.str.2(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_info
	movq	-48(%rbp), %rax
	cmpl	$0, (%rax)
	jle	LBB0_10
## %bb.5:
	movq	8(%rax), %r12
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_6:                                 ## =>This Inner Loop Header: Depth=1
	movq	_VSC73XX_BLOCK_SYSTEM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_VSC73XX_ICPU_SRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movzbl	(%r12,%rbx), %r8d
	movq	%r15, %rdi
	xorl	%edx, %edx
	callq	_vsc7385_write
	testl	%eax, %eax
	jne	LBB0_7
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	-48(%rbp), %rax
	incq	%rbx
	cmpl	(%rax), %ebx
	jl	LBB0_6
LBB0_10:
	movq	%r15, %rdi
	callq	_vsc7385_icpu_reset
	movl	%eax, %r13d
	testl	%eax, %eax
	jne	LBB0_25
## %bb.11:
	leaq	L_.str.4(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_info
	movq	-48(%rbp), %rax
	cmpl	$0, (%rax)
	jle	LBB0_24
## %bb.12:
	movq	8(%rax), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	jmp	LBB0_13
LBB0_20:                                ##   in Loop: Header=BB0_13 Depth=1
	movq	-48(%rbp), %rax
	incq	%r12
	cmpl	(%rax), %r12d
	jge	LBB0_21
LBB0_13:                                ## =>This Inner Loop Header: Depth=1
	movq	_VSC73XX_BLOCK_SYSTEM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_VSC73XX_ICPU_SRAM@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	%r15, %rdi
	xorl	%edx, %edx
	leaq	-52(%rbp), %r8
	callq	_vsc7385_read
	testl	%eax, %eax
	jne	LBB0_14
## %bb.15:                              ##   in Loop: Header=BB0_13 Depth=1
	movl	-52(%rbp), %r8d
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movzbl	(%rax,%r12), %ecx
	cmpl	$256, %r8d                      ## imm = 0x100
	jae	LBB0_16
## %bb.17:                              ##   in Loop: Header=BB0_13 Depth=1
	cmpl	%ecx, %r8d
	je	LBB0_20
## %bb.18:                              ##   in Loop: Header=BB0_13 Depth=1
	movq	%r14, %rdi
	leaq	L_.str.7(%rip), %rsi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	cmpl	$3, %ebx
	jg	LBB0_22
## %bb.19:                              ##   in Loop: Header=BB0_13 Depth=1
	incl	%ebx
	jmp	LBB0_20
LBB0_7:
	movl	%eax, %r13d
	leaq	L_.str.3(%rip), %rsi
LBB0_8:
	movq	%r14, %rdi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_25
LBB0_21:
	testl	%ebx, %ebx
	je	LBB0_24
LBB0_22:
	leaq	L_.str.8(%rip), %rsi
	xorl	%r13d, %r13d
	movq	%r14, %rdi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_23
LBB0_24:
	leaq	L_.str.9(%rip), %rsi
	movq	%r14, %rdi
	callq	_dev_info
	movq	%r15, %rdi
	callq	_vsc7385_icpu_start
	movl	%eax, %r13d
	jmp	LBB0_25
LBB0_14:
	movl	%eax, %r13d
	leaq	L_.str.5(%rip), %rsi
	jmp	LBB0_8
LBB0_16:
	leaq	L_.str.6(%rip), %rsi
	xorl	%r13d, %r13d
	movq	%r14, %rdi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_dev_err
LBB0_23:
	movq	_EIO@GOTPCREL(%rip), %rax
	subl	(%rax), %r13d
LBB0_25:
	movq	-48(%rbp), %rdi
	callq	_release_firmware
LBB0_26:
	movl	%r13d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"vsc7385_ucode.bin"

L_.str.1:                               ## @.str.1
	.asciz	"request_firmware failed, err=%d\n"

L_.str.2:                               ## @.str.2
	.asciz	"uploading microcode...\n"

	.comm	_VSC73XX_BLOCK_SYSTEM,4,2       ## @VSC73XX_BLOCK_SYSTEM
	.comm	_VSC73XX_ICPU_SRAM,4,2          ## @VSC73XX_ICPU_SRAM
L_.str.3:                               ## @.str.3
	.asciz	"could not load microcode, err=%d\n"

L_.str.4:                               ## @.str.4
	.asciz	"verifying microcode...\n"

L_.str.5:                               ## @.str.5
	.asciz	"could not read microcode %d\n"

L_.str.6:                               ## @.str.6
	.asciz	"bad val read: %04x : %02x  %02x\n"

	.comm	_EIO,4,2                        ## @EIO
L_.str.7:                               ## @.str.7
	.asciz	"verify error: %04x : %02x  %02x\n"

L_.str.8:                               ## @.str.8
	.asciz	"microcode verification failed\n"

L_.str.9:                               ## @.str.9
	.asciz	"microcode uploaded\n"

	.no_dead_strip	_vsc7385_upload_ucode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function vsc7385_upload_ucode
_vsc7385_upload_ucode:                  ; @vsc7385_upload_ucode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x20, x0
	ldp	x8, x19, [x0]
	ldr	x8, [x8]
Lloh0:
	adrp	x9, l_.str@PAGE
Lloh1:
	add	x9, x9, l_.str@PAGEOFF
	cmp	x8, #0
	csel	x1, x9, x8, eq
	add	x0, sp, #40
	mov	x2, x19
	bl	_request_firmware
	cbz	w0, LBB0_2
; %bb.1:
	mov	x21, x0
	str	x21, [sp]
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	b	LBB0_25
LBB0_2:
	mov	x0, x20
	bl	_vsc7385_icpu_stop
	mov	x21, x0
	cbnz	w0, LBB0_24
; %bb.3:
	mov	x0, x20
	bl	_vsc7385_icpu_reset
	mov	x21, x0
	cbnz	w0, LBB0_24
; %bb.4:
Lloh4:
	adrp	x1, l_.str.2@PAGE
Lloh5:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	ldr	x8, [sp, #40]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_8
; %bb.5:
	mov	x22, #0
	ldr	x23, [x8, #8]
Lloh6:
	adrp	x24, _VSC73XX_BLOCK_SYSTEM@GOTPAGE
Lloh7:
	ldr	x24, [x24, _VSC73XX_BLOCK_SYSTEM@GOTPAGEOFF]
Lloh8:
	adrp	x25, _VSC73XX_ICPU_SRAM@GOTPAGE
Lloh9:
	ldr	x25, [x25, _VSC73XX_ICPU_SRAM@GOTPAGEOFF]
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x24]
	ldr	w3, [x25]
	ldrb	w4, [x23, x22]
	mov	x0, x20
	mov	w2, #0
	bl	_vsc7385_write
	cbnz	w0, LBB0_17
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	ldr	x8, [sp, #40]
	ldr	w8, [x8]
	add	x22, x22, #1
	cmp	w22, w8
	b.lt	LBB0_6
LBB0_8:
	mov	x0, x20
	bl	_vsc7385_icpu_reset
	mov	x21, x0
	cbnz	w0, LBB0_24
; %bb.9:
Lloh10:
	adrp	x1, l_.str.4@PAGE
Lloh11:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	ldr	x8, [sp, #40]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_20
; %bb.10:
	mov	x23, #0
	mov	w24, #0
	ldr	x25, [x8, #8]
Lloh12:
	adrp	x26, _VSC73XX_BLOCK_SYSTEM@GOTPAGE
Lloh13:
	ldr	x26, [x26, _VSC73XX_BLOCK_SYSTEM@GOTPAGEOFF]
Lloh14:
	adrp	x27, _VSC73XX_ICPU_SRAM@GOTPAGE
Lloh15:
	ldr	x27, [x27, _VSC73XX_ICPU_SRAM@GOTPAGEOFF]
Lloh16:
	adrp	x21, l_.str.7@PAGE
Lloh17:
	add	x21, x21, l_.str.7@PAGEOFF
	b	LBB0_12
LBB0_11:                                ;   in Loop: Header=BB0_12 Depth=1
	ldr	x8, [sp, #40]
	ldr	w8, [x8]
	add	x23, x23, #1
	cmp	w23, w8
	b.ge	LBB0_18
LBB0_12:                                ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x26]
	ldr	w3, [x27]
	add	x4, sp, #36
	mov	x0, x20
	mov	w2, #0
	bl	_vsc7385_read
	cbnz	w0, LBB0_21
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=1
	ldr	w9, [sp, #36]
	ldrb	w8, [x25, x23]
	cmp	w9, #256
	b.hs	LBB0_22
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=1
	cmp	w9, w8
	b.eq	LBB0_11
; %bb.15:                               ;   in Loop: Header=BB0_12 Depth=1
	stp	x8, x9, [sp, #8]
	str	x23, [sp]
	mov	x0, x19
	mov	x1, x21
	bl	_dev_err
	cmp	w24, #3
	b.gt	LBB0_19
; %bb.16:                               ;   in Loop: Header=BB0_12 Depth=1
	add	w24, w24, #1
	b	LBB0_11
LBB0_17:
	mov	x21, x0
	str	x21, [sp]
Lloh18:
	adrp	x1, l_.str.3@PAGE
Lloh19:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_dev_err
                                        ; kill: def $w21 killed $w21 killed $x21 def $x21
	b	LBB0_24
LBB0_18:
	cbz	w24, LBB0_20
LBB0_19:
Lloh20:
	adrp	x1, l_.str.8@PAGE
Lloh21:
	add	x1, x1, l_.str.8@PAGEOFF
	b	LBB0_23
LBB0_20:
Lloh22:
	adrp	x1, l_.str.9@PAGE
Lloh23:
	add	x1, x1, l_.str.9@PAGEOFF
	mov	x0, x19
	bl	_dev_info
	mov	x0, x20
	bl	_vsc7385_icpu_start
	mov	x21, x0
	b	LBB0_24
LBB0_21:
	mov	x22, x0
	str	x22, [sp]
Lloh24:
	adrp	x1, l_.str.5@PAGE
Lloh25:
	add	x1, x1, l_.str.5@PAGEOFF
	mov	x0, x19
	bl	_dev_err
	mov	x21, x22
	b	LBB0_24
LBB0_22:
                                        ; kill: def $w9 killed $w9 killed $x9 def $x9
	stp	x8, x9, [sp, #8]
	str	x23, [sp]
Lloh26:
	adrp	x1, l_.str.6@PAGE
Lloh27:
	add	x1, x1, l_.str.6@PAGEOFF
LBB0_23:
	mov	x0, x19
	bl	_dev_err
Lloh28:
	adrp	x8, _EIO@GOTPAGE
Lloh29:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh30:
	ldr	w8, [x8]
	neg	w21, w8
LBB0_24:
	ldr	x0, [sp, #40]
	bl	_release_firmware
LBB0_25:
	mov	x0, x21
	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
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh10, Lloh11
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh12, Lloh13
	.loh AdrpAdd	Lloh18, Lloh19
	.loh AdrpAdd	Lloh20, Lloh21
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"vsc7385_ucode.bin"

l_.str.1:                               ; @.str.1
	.asciz	"request_firmware failed, err=%d\n"

l_.str.2:                               ; @.str.2
	.asciz	"uploading microcode...\n"

	.comm	_VSC73XX_BLOCK_SYSTEM,4,2       ; @VSC73XX_BLOCK_SYSTEM
	.comm	_VSC73XX_ICPU_SRAM,4,2          ; @VSC73XX_ICPU_SRAM
l_.str.3:                               ; @.str.3
	.asciz	"could not load microcode, err=%d\n"

l_.str.4:                               ; @.str.4
	.asciz	"verifying microcode...\n"

l_.str.5:                               ; @.str.5
	.asciz	"could not read microcode %d\n"

l_.str.6:                               ; @.str.6
	.asciz	"bad val read: %04x : %02x  %02x\n"

	.comm	_EIO,4,2                        ; @EIO
l_.str.7:                               ; @.str.7
	.asciz	"verify error: %04x : %02x  %02x\n"

l_.str.8:                               ; @.str.8
	.asciz	"microcode verification failed\n"

l_.str.9:                               ; @.str.9
	.asciz	"microcode uploaded\n"

	.no_dead_strip	_vsc7385_upload_ucode
.subsections_via_symbols
