	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function read_config_rom
_read_config_rom:                       ## @read_config_rom
	.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
	movl	%esi, %r15d
	movq	%rdi, %r14
	movq	40(%rdi), %rbx
	movq	_MAX_CONFIG_ROM_SIZE@GOTPCREL(%rip), %r12
	movl	(%r12), %edi
	shll	$3, %edi
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_kmalloc
	testq	%rax, %rax
	je	LBB0_1
## %bb.2:
	movq	%rax, %r13
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movslq	(%r12), %rbx
	leal	(,%rbx,4), %edx
	movq	%rax, %rdi
	xorl	%esi, %esi
	callq	_memset
	movq	_SCODE_100@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	movq	%r14, %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	movq	%r13, %rcx
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.3:
	cmpl	$0, (%r13)
	je	LBB0_4
## %bb.5:
	leaq	4(%r13), %rcx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$1, %edx
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.6:
	leaq	8(%r13), %rcx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$2, %edx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.7:
	leaq	12(%r13), %rcx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$3, %edx
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.8:
	leaq	16(%r13), %rcx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$4, %edx
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.9:
	movq	32(%r14), %rax
	movl	(%rax), %eax
	movl	%eax, (%r14)
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %edx
	andl	$7, %edx
	movq	_SCODE_BETA@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	cmpl	%eax, %edx
	jl	LBB0_12
## %bb.10:
	cmpl	%ecx, %eax
	je	LBB0_12
## %bb.11:
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	cmpq	$0, 8(%rdx)
	je	LBB0_18
LBB0_12:
	cmpl	%ecx, %eax
	jne	LBB0_14
## %bb.13:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %eax
	movl	%eax, (%r14)
LBB0_14:
	movq	_SCODE_100@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jle	LBB0_18
## %bb.15:
	leaq	-60(%rbp), %r12
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	%r14, %rdi
	movl	%r15d, %esi
	xorl	%edx, %edx
	movq	%r12, %rcx
	callq	_read_rom
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_18
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	(%r14), %eax
	decl	%eax
	movl	%eax, (%r14)
	movq	_SCODE_100@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jg	LBB0_16
LBB0_18:
	movl	$-1073741819, (%r13,%rbx,4)     ## imm = 0xC0000005
	xorl	%edi, %edi
	movq	_MAX_CONFIG_ROM_SIZE@GOTPCREL(%rip), %rax
	cmpl	$6, (%rax)
	setl	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_21
## %bb.19:
	movq	_ENXIO@GOTPCREL(%rip), %rax
LBB0_20:
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_31
LBB0_1:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	xorl	%r12d, %r12d
	subl	(%rax), %r12d
	jmp	LBB0_32
LBB0_4:
	movq	_RCODE_BUSY@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
LBB0_31:
	movq	%r13, %rdi
	callq	_kfree
LBB0_32:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_21:
	leaq	20(%r13), %rbx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movl	$5, %edx
	movq	%rbx, %rcx
	callq	_read_rom
	movl	%eax, %r12d
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	jne	LBB0_31
## %bb.22:
	movl	(%rbx), %edx
	movl	%edx, %eax
	sarl	$16, %eax
	leal	5(%rax), %ecx
	movq	_MAX_CONFIG_ROM_SIZE@GOTPCREL(%rip), %rsi
	cmpl	(%rsi), %ecx
	jge	LBB0_24
## %bb.23:
	addl	$6, %eax
	jmp	LBB0_25
LBB0_24:
	movq	_CSR_REGISTER_BASE@GOTPCREL(%rip), %rax
	movl	(%rax), %ecx
	movq	_CSR_CONFIG_ROM@GOTPCREL(%rip), %rax
	orl	(%rax), %ecx
	orl	$20, %ecx
	leaq	L_.str(%rip), %rsi
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_fw_err
	movl	$0, (%rbx)
	movl	$5, %eax
LBB0_25:
	cmpl	$7, %eax
	movl	$6, %ecx
	cmovgel	%eax, %ecx
	decl	%ecx
	movq	%rcx, -48(%rbp)                 ## 8-byte Spill
	movl	$5, %edx
	movl	$24, %ebx
LBB0_26:                                ## =>This Inner Loop Header: Depth=1
	cmpq	%rdx, -48(%rbp)                 ## 8-byte Folded Reload
	je	LBB0_28
## %bb.27:                              ##   in Loop: Header=BB0_26 Depth=1
	leaq	(%rbx,%r13), %rcx
	incq	%rdx
	movq	%r14, %rdi
	movl	%r15d, %esi
	movq	%rdx, %r12
	callq	_read_rom
	movq	%r12, %rdx
	movl	%eax, %r12d
	addq	$4, %rbx
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %r12d
	je	LBB0_26
	jmp	LBB0_31
LBB0_28:
	movq	%rdx, %r15
	movq	8(%r14), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_kmemdup
	testq	%rax, %rax
	je	LBB0_29
## %bb.30:
	movq	%rax, %r12
	incq	%r15
	movq	_fw_device_rwsem@GOTPCREL(%rip), %rbx
	movq	%rbx, %rdi
	callq	_down_write
	movq	%r12, 8(%r14)
	movl	%r15d, 16(%r14)
	movq	%rbx, %rdi
	callq	_up_write
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	movq	_RCODE_COMPLETE@GOTPCREL(%rip), %rax
	movl	(%rax), %r12d
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movl	(%rcx), %eax
	shrl	$12, %eax
	andl	$15, %eax
	movl	%eax, 20(%r14)
	movl	(%rcx), %eax
	shrl	$30, %eax
	andl	$1, %eax
	movl	%eax, 24(%r14)
	movl	(%rcx), %eax
	shrl	$31, %eax
	movl	%eax, 28(%r14)
	jmp	LBB0_31
LBB0_29:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_20
	.cfi_endproc
                                        ## -- End function
	.comm	_MAX_CONFIG_ROM_SIZE,4,2        ## @MAX_CONFIG_ROM_SIZE
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SCODE_100,4,2                  ## @SCODE_100
	.comm	_RCODE_COMPLETE,4,2             ## @RCODE_COMPLETE
	.comm	_RCODE_BUSY,4,2                 ## @RCODE_BUSY
	.comm	_SCODE_BETA,4,2                 ## @SCODE_BETA
	.comm	_ENXIO,4,2                      ## @ENXIO
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"skipped invalid ROM block %x at %llx\n"

	.comm	_CSR_REGISTER_BASE,4,2          ## @CSR_REGISTER_BASE
	.comm	_CSR_CONFIG_ROM,4,2             ## @CSR_CONFIG_ROM
	.comm	_fw_device_rwsem,4,2            ## @fw_device_rwsem
	.no_dead_strip	_read_config_rom
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function read_config_rom
_read_config_rom:                       ; @read_config_rom
	.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, x1
	mov	x20, x0
Lloh0:
	adrp	x28, _MAX_CONFIG_ROM_SIZE@GOTPAGE
Lloh1:
	ldr	x28, [x28, _MAX_CONFIG_ROM_SIZE@GOTPAGEOFF]
	ldr	x23, [x0, #40]
	ldr	w8, [x28]
	lsl	w0, w8, #3
Lloh2:
	adrp	x26, _GFP_KERNEL@GOTPAGE
Lloh3:
	ldr	x26, [x26, _GFP_KERNEL@GOTPAGEOFF]
	ldr	w1, [x26]
	bl	_kmalloc
	cbz	x0, LBB0_11
; %bb.1:
	mov	x19, x0
	ldrsw	x25, [x28]
	lsl	w2, w25, #2
	mov	w1, #0
	bl	_memset
Lloh4:
	adrp	x22, _SCODE_100@GOTPAGE
Lloh5:
	ldr	x22, [x22, _SCODE_100@GOTPAGEOFF]
	ldr	w8, [x22]
	str	w8, [x20]
	mov	x0, x20
	mov	x1, x21
	mov	w2, #0
	mov	x3, x19
	bl	_read_rom
	mov	x24, x0
Lloh6:
	adrp	x27, _RCODE_COMPLETE@GOTPAGE
Lloh7:
	ldr	x27, [x27, _RCODE_COMPLETE@GOTPAGEOFF]
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.2:
	ldr	w8, [x19]
	cbz	w8, LBB0_12
; %bb.3:
	add	x3, x19, #4
	mov	x0, x20
	mov	x1, x21
	mov	w2, #1
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.4:
	add	x3, x19, #8
	mov	x0, x20
	mov	x1, x21
	mov	w2, #2
	str	x3, [sp]                        ; 8-byte Folded Spill
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.5:
	add	x3, x19, #12
	mov	x0, x20
	mov	x1, x21
	mov	w2, #3
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.6:
	add	x3, x19, #16
	mov	x0, x20
	mov	x1, x21
	mov	w2, #4
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.7:
	ldr	x8, [x20, #32]
	ldr	w8, [x8]
	str	w8, [x20]
	ldr	x9, [sp]                        ; 8-byte Folded Reload
	ldr	w9, [x9]
	and	w10, w9, #0x7
Lloh8:
	adrp	x9, _SCODE_BETA@GOTPAGE
Lloh9:
	ldr	x9, [x9, _SCODE_BETA@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	cmp	w10, w8
	ccmp	w8, w9, #4, ge
	b.eq	LBB0_9
; %bb.8:
	ldr	x10, [x23, #8]
	cbz	x10, LBB0_19
LBB0_9:
	cmp	w8, w9
	b.ne	LBB0_16
; %bb.10:
	ldr	w8, [x23]
	b	LBB0_15
LBB0_11:
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh13:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_14
LBB0_12:
Lloh14:
	adrp	x8, _RCODE_BUSY@GOTPAGE
Lloh15:
	ldr	x8, [x8, _RCODE_BUSY@GOTPAGEOFF]
Lloh16:
	ldr	w24, [x8]
LBB0_13:
	mov	x0, x19
	bl	_kfree
LBB0_14:
	mov	x0, x24
	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_15:
	str	w8, [x20]
LBB0_16:
	ldr	w9, [x22]
	cmp	w8, w9
	b.le	LBB0_19
; %bb.17:
	add	x3, sp, #12
	mov	x0, x20
	mov	x1, x21
	mov	w2, #0
	bl	_read_rom
	ldr	w8, [x27]
	cmp	w0, w8
	b.eq	LBB0_19
; %bb.18:
	ldr	w8, [x20]
	sub	w8, w8, #1
	b	LBB0_15
LBB0_19:
	mov	w8, #5
	movk	w8, #49152, lsl #16
	str	w8, [x19, x25, lsl #2]
	ldr	w8, [x28]
	cmp	w8, #6
	cset	w0, lt
	bl	_WARN_ON
	cbz	x0, LBB0_22
; %bb.20:
Lloh17:
	adrp	x8, _ENXIO@GOTPAGE
Lloh18:
	ldr	x8, [x8, _ENXIO@GOTPAGEOFF]
LBB0_21:
	ldr	w8, [x8]
	neg	w24, w8
	b	LBB0_13
LBB0_22:
	add	x25, x19, #20
	mov	x0, x20
	mov	x1, x21
	mov	w2, #5
	mov	x3, x25
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	cmp	w0, w8
	b.ne	LBB0_13
; %bb.23:
	ldr	w2, [x25]
	asr	w8, w2, #16
	add	w9, w8, #5
	ldr	w10, [x28]
	cmp	w9, w10
	b.ge	LBB0_25
; %bb.24:
	add	w8, w8, #6
	b	LBB0_26
LBB0_25:
Lloh19:
	adrp	x8, _CSR_REGISTER_BASE@GOTPAGE
Lloh20:
	ldr	x8, [x8, _CSR_REGISTER_BASE@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x9, _CSR_CONFIG_ROM@GOTPAGE
Lloh23:
	ldr	x9, [x9, _CSR_CONFIG_ROM@GOTPAGEOFF]
Lloh24:
	ldr	w9, [x9]
	orr	w8, w8, w9
	mov	w9, #20
	orr	w3, w8, w9
Lloh25:
	adrp	x1, l_.str@PAGE
Lloh26:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x23
	bl	_fw_err
	str	wzr, [x25]
	mov	w8, #5
LBB0_26:
	mov	w9, #6
	cmp	w8, #6
	csel	w8, w8, w9, gt
	sub	w22, w8, #1
	mov	w23, #5
	mov	w25, #24
LBB0_27:                                ; =>This Inner Loop Header: Depth=1
	cmp	x22, x23
	b.eq	LBB0_29
; %bb.28:                               ;   in Loop: Header=BB0_27 Depth=1
	add	x3, x19, x25
	add	x23, x23, #1
	mov	x0, x20
	mov	x1, x21
	mov	x2, x23
	bl	_read_rom
	mov	x24, x0
	ldr	w8, [x27]
	add	x25, x25, #4
	cmp	w0, w8
	b.eq	LBB0_27
	b	LBB0_13
LBB0_29:
	ldr	x21, [x20, #8]
	ldr	w2, [x26]
	mov	x0, x19
	mov	x1, x25
	bl	_kmemdup
	cbz	x0, LBB0_31
; %bb.30:
	mov	x24, x0
	add	x22, x23, #1
Lloh27:
	adrp	x23, _fw_device_rwsem@GOTPAGE
Lloh28:
	ldr	x23, [x23, _fw_device_rwsem@GOTPAGEOFF]
	mov	x0, x23
	bl	_down_write
	str	x24, [x20, #8]
	str	w22, [x20, #16]
	mov	x0, x23
	bl	_up_write
	mov	x0, x21
	bl	_kfree
	ldr	w24, [x27]
	ldr	x9, [sp]                        ; 8-byte Folded Reload
	ldr	w8, [x9]
	ubfx	w8, w8, #12, #4
	str	w8, [x20, #20]
	ldr	w8, [x9]
	ubfx	w8, w8, #30, #1
	str	w8, [x20, #24]
	ldr	w8, [x9]
	lsr	w8, w8, #31
	str	w8, [x20, #28]
	b	LBB0_13
LBB0_31:
Lloh29:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh30:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_21
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh22, Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGot	Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_MAX_CONFIG_ROM_SIZE,4,2        ; @MAX_CONFIG_ROM_SIZE
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SCODE_100,4,2                  ; @SCODE_100
	.comm	_RCODE_COMPLETE,4,2             ; @RCODE_COMPLETE
	.comm	_RCODE_BUSY,4,2                 ; @RCODE_BUSY
	.comm	_SCODE_BETA,4,2                 ; @SCODE_BETA
	.comm	_ENXIO,4,2                      ; @ENXIO
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"skipped invalid ROM block %x at %llx\n"

	.comm	_CSR_REGISTER_BASE,4,2          ; @CSR_REGISTER_BASE
	.comm	_CSR_CONFIG_ROM,4,2             ; @CSR_CONFIG_ROM
	.comm	_fw_device_rwsem,4,2            ; @fw_device_rwsem
	.no_dead_strip	_read_config_rom
.subsections_via_symbols
