	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function mt76pci_load_firmware
_mt76pci_load_firmware:                 ## @mt76pci_load_firmware
	.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	%rdi, %r13
	movq	_MT7662_FIRMWARE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	(%rdi), %edx
	leaq	-48(%rbp), %rdi
	callq	_request_firmware
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_15
## %bb.1:
	movq	-48(%rbp), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.2:
	movq	8(%rax), %r14
	testq	%r14, %r14
	je	LBB0_13
## %bb.3:
	cmpl	$20, (%rax)
	jb	LBB0_13
## %bb.4:
	movl	4(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, %ebx
	movl	(%r14), %edi
	callq	_le32_to_cpu
                                        ## kill: def $eax killed $eax def $rax
	addl	%ebx, %eax
	addl	$20, %eax
	movq	-48(%rbp), %rcx
	cmpl	%eax, (%rcx)
	jne	LBB0_13
## %bb.5:
	movl	16(%r14), %edi
	callq	_le16_to_cpu
	movl	(%r13), %edi
	movl	%eax, %edx
	shrl	$12, %edx
	andl	$15, %edx
	movl	%eax, %ecx
	shrl	$8, %ecx
	andl	$15, %ecx
	andl	$15, %eax
	leaq	L_.str(%rip), %rsi
	movl	%eax, %r8d
	xorl	%eax, %eax
	callq	_dev_info
	movl	12(%r14), %edi
	callq	_le16_to_cpu
	movl	(%r13), %edi
	leaq	L_.str.1(%rip), %rsi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_dev_info
	movl	(%r13), %edi
	movl	8(%r14), %edx
	leaq	L_.str.2(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_info
	movq	-48(%rbp), %rax
	movq	8(%rax), %r12
	leaq	20(%r12), %r15
	movl	4(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, %ebx
	movq	_MT_MCU_PCIE_REMAP_BASE4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MT_MCU_ILM_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mt76_wr
	movq	_MT_MCU_ILM_ADDR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movq	%r15, %rdx
	movl	%ebx, %ecx
	callq	_mt76_wr_copy
	movslq	%ebx, %rax
	andq	$-4, %rax
	addq	%rax, %r12
	addq	$20, %r12
	movl	(%r14), %edi
	callq	_le32_to_cpu
	movl	%eax, %r15d
	movq	%r13, %rdi
	callq	_mt76xx_rev
	movq	_MT76XX_REV_E3@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jge	LBB0_6
## %bb.7:
	movq	_MT_MCU_DLM_ADDR@GOTPCREL(%rip), %rax
	jmp	LBB0_8
LBB0_13:
	movl	(%r13), %edi
	leaq	L_.str.5(%rip), %rsi
	callq	_dev_err
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	movq	_ENOENT@GOTPCREL(%rip), %rax
LBB0_14:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_15:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_6:
	movq	_MT_MCU_DLM_ADDR_E3@GOTPCREL(%rip), %rax
LBB0_8:
	movl	(%rax), %ebx
	movq	_MT_MCU_PCIE_REMAP_BASE4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	_MT_MCU_DLM_OFFSET@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r13, %rdi
	callq	_mt76_wr
	movq	%r13, %rdi
	movl	%ebx, %esi
	movq	%r12, %rdx
	movl	%r15d, %ecx
	callq	_mt76_wr_copy
	movq	_MT_MCU_PCIE_REMAP_BASE4@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	xorl	%edx, %edx
	callq	_mt76_wr
	movq	_MT_EE_NIC_CONF_2@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_mt76x02_eeprom_get
	movq	_MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	movl	%eax, %esi
	callq	_FIELD_GET
	cmpl	$1, %eax
	jne	LBB0_10
## %bb.9:
	movq	_MT_MCU_COM_REG0@GOTPCREL(%rip), %rax
	movl	(%rax), %ebx
	movl	$30, %edi
	callq	_BIT
	movq	%r13, %rdi
	movl	%ebx, %esi
	movl	%eax, %edx
	callq	_mt76_set
LBB0_10:
	movq	_MT_MCU_INT_LEVEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$2, %edx
	callq	_mt76_wr
	movq	_MT_MCU_COM_REG0@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	movl	$1, %edx
	movl	$1, %ecx
	movl	$200, %r8d
	callq	_mt76_poll_msec
	testl	%eax, %eax
	je	LBB0_11
## %bb.12:
	movq	%r13, %rdi
	movq	%r14, %rsi
	callq	_mt76x02_set_ethtool_fwver
	movl	(%r13), %edi
	leaq	L_.str.4(%rip), %rsi
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	callq	_dev_info
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	jmp	LBB0_15
LBB0_11:
	movl	(%r13), %edi
	leaq	L_.str.3(%rip), %rsi
	callq	_dev_err
	movq	-48(%rbp), %rdi
	callq	_release_firmware
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_MT7662_FIRMWARE,4,2            ## @MT7662_FIRMWARE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Firmware Version: %d.%d.%02d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Build: %x\n"

L_.str.2:                               ## @.str.2
	.asciz	"Build Time: %.16s\n"

	.comm	_MT_MCU_PCIE_REMAP_BASE4,4,2    ## @MT_MCU_PCIE_REMAP_BASE4
	.comm	_MT_MCU_ILM_OFFSET,4,2          ## @MT_MCU_ILM_OFFSET
	.comm	_MT_MCU_ILM_ADDR,4,2            ## @MT_MCU_ILM_ADDR
	.comm	_MT76XX_REV_E3,8,3              ## @MT76XX_REV_E3
	.comm	_MT_MCU_DLM_ADDR_E3,4,2         ## @MT_MCU_DLM_ADDR_E3
	.comm	_MT_MCU_DLM_ADDR,4,2            ## @MT_MCU_DLM_ADDR
	.comm	_MT_MCU_DLM_OFFSET,4,2          ## @MT_MCU_DLM_OFFSET
	.comm	_MT_EE_NIC_CONF_2,4,2           ## @MT_EE_NIC_CONF_2
	.comm	_MT_EE_NIC_CONF_2_XTAL_OPTION,4,2 ## @MT_EE_NIC_CONF_2_XTAL_OPTION
	.comm	_MT_MCU_COM_REG0,4,2            ## @MT_MCU_COM_REG0
	.comm	_MT_MCU_INT_LEVEL,4,2           ## @MT_MCU_INT_LEVEL
L_.str.3:                               ## @.str.3
	.asciz	"Firmware failed to start\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.4:                               ## @.str.4
	.asciz	"Firmware running!\n"

L_.str.5:                               ## @.str.5
	.asciz	"Invalid firmware\n"

	.comm	_ENOENT,4,2                     ## @ENOENT
	.no_dead_strip	_mt76pci_load_firmware
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mt76pci_load_firmware
_mt76pci_load_firmware:                 ; @mt76pci_load_firmware
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	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
	mov	x19, x0
Lloh0:
	adrp	x8, _MT7662_FIRMWARE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _MT7662_FIRMWARE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	ldr	w2, [x0]
	add	x0, sp, #24
	bl	_request_firmware
	cbnz	w0, LBB0_11
; %bb.1:
	ldr	x8, [sp, #24]
	cbz	x8, LBB0_9
; %bb.2:
	ldr	x20, [x8, #8]
	cbz	x20, LBB0_9
; %bb.3:
	ldr	w8, [x8]
	cmp	w8, #20
	b.lo	LBB0_9
; %bb.4:
	ldr	w0, [x20, #4]
	bl	_le32_to_cpu
	mov	x21, x0
	ldr	w0, [x20]
	bl	_le32_to_cpu
	add	w8, w21, w0
	add	w8, w8, #20
	ldr	x9, [sp, #24]
	ldr	w9, [x9]
	cmp	w9, w8
	b.ne	LBB0_9
; %bb.5:
	ldr	w0, [x20, #16]
	bl	_le16_to_cpu
	ldr	w8, [x19]
	ubfx	w9, w0, #12, #4
	ubfx	w10, w0, #8, #4
	and	w11, w0, #0xf
	stp	x10, x11, [sp, #8]
	str	x9, [sp]
Lloh3:
	adrp	x1, l_.str@PAGE
Lloh4:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x8
	bl	_dev_info
	ldr	w0, [x20, #12]
	bl	_le16_to_cpu
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	w8, [x19]
	str	x0, [sp]
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x8
	bl	_dev_info
	ldr	w0, [x19]
	ldr	w8, [x20, #8]
	str	x8, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_info
	ldr	x8, [sp, #24]
	ldr	x8, [x8, #8]
	add	x21, x8, #20
	ldr	w0, [x20, #4]
	bl	_le32_to_cpu
	mov	x22, x0
Lloh9:
	adrp	x24, _MT_MCU_PCIE_REMAP_BASE4@GOTPAGE
Lloh10:
	ldr	x24, [x24, _MT_MCU_PCIE_REMAP_BASE4@GOTPAGEOFF]
	ldr	w1, [x24]
Lloh11:
	adrp	x8, _MT_MCU_ILM_OFFSET@GOTPAGE
Lloh12:
	ldr	x8, [x8, _MT_MCU_ILM_OFFSET@GOTPAGEOFF]
Lloh13:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mt76_wr
Lloh14:
	adrp	x8, _MT_MCU_ILM_ADDR@GOTPAGE
Lloh15:
	ldr	x8, [x8, _MT_MCU_ILM_ADDR@GOTPAGEOFF]
Lloh16:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x21
	mov	x3, x22
	bl	_mt76_wr_copy
	sxtw	x8, w22
	and	x8, x8, #0xfffffffffffffffc
	add	x21, x21, x8
	ldr	w0, [x20]
	bl	_le32_to_cpu
	mov	x22, x0
	mov	x0, x19
	bl	_mt76xx_rev
Lloh17:
	adrp	x8, _MT76XX_REV_E3@GOTPAGE
Lloh18:
	ldr	x8, [x8, _MT76XX_REV_E3@GOTPAGEOFF]
Lloh19:
	ldr	x8, [x8]
Lloh20:
	adrp	x9, _MT_MCU_DLM_ADDR@GOTPAGE
Lloh21:
	ldr	x9, [x9, _MT_MCU_DLM_ADDR@GOTPAGEOFF]
Lloh22:
	adrp	x10, _MT_MCU_DLM_ADDR_E3@GOTPAGE
Lloh23:
	ldr	x10, [x10, _MT_MCU_DLM_ADDR_E3@GOTPAGEOFF]
	cmp	x0, x8
	csel	x8, x9, x10, lt
	ldr	w23, [x8]
	ldr	w1, [x24]
Lloh24:
	adrp	x8, _MT_MCU_DLM_OFFSET@GOTPAGE
Lloh25:
	ldr	x8, [x8, _MT_MCU_DLM_OFFSET@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x19
	bl	_mt76_wr
	mov	x0, x19
	mov	x1, x23
	mov	x2, x21
	mov	x3, x22
	bl	_mt76_wr_copy
	ldr	w1, [x24]
	mov	x0, x19
	mov	w2, #0
	bl	_mt76_wr
Lloh27:
	adrp	x8, _MT_EE_NIC_CONF_2@GOTPAGE
Lloh28:
	ldr	x8, [x8, _MT_EE_NIC_CONF_2@GOTPAGEOFF]
Lloh29:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_mt76x02_eeprom_get
	mov	x1, x0
Lloh30:
	adrp	x8, _MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPAGE
Lloh31:
	ldr	x8, [x8, _MT_EE_NIC_CONF_2_XTAL_OPTION@GOTPAGEOFF]
Lloh32:
	ldr	w0, [x8]
	bl	_FIELD_GET
Lloh33:
	adrp	x22, _MT_MCU_COM_REG0@GOTPAGE
Lloh34:
	ldr	x22, [x22, _MT_MCU_COM_REG0@GOTPAGEOFF]
	cmp	w0, #1
	b.ne	LBB0_7
; %bb.6:
	ldr	w21, [x22]
	mov	w0, #30
	bl	_BIT
	mov	x2, x0
	mov	x0, x19
	mov	x1, x21
	bl	_mt76_set
LBB0_7:
Lloh35:
	adrp	x8, _MT_MCU_INT_LEVEL@GOTPAGE
Lloh36:
	ldr	x8, [x8, _MT_MCU_INT_LEVEL@GOTPAGEOFF]
Lloh37:
	ldr	w1, [x8]
	mov	x0, x19
	mov	w2, #2
	bl	_mt76_wr
	ldr	w1, [x22]
	mov	x0, x19
	mov	w2, #1
	mov	w3, #1
	mov	w4, #200
	bl	_mt76_poll_msec
	cbz	w0, LBB0_12
; %bb.8:
	mov	x0, x19
	mov	x1, x20
	bl	_mt76x02_set_ethtool_fwver
	ldr	w0, [x19]
Lloh38:
	adrp	x1, l_.str.4@PAGE
Lloh39:
	add	x1, x1, l_.str.4@PAGEOFF
	bl	_dev_info
	ldr	x0, [sp, #24]
	bl	_release_firmware
	mov	w0, #0
	b	LBB0_11
LBB0_9:
	ldr	w0, [x19]
Lloh40:
	adrp	x1, l_.str.5@PAGE
Lloh41:
	add	x1, x1, l_.str.5@PAGEOFF
	bl	_dev_err
	ldr	x0, [sp, #24]
	bl	_release_firmware
Lloh42:
	adrp	x8, _ENOENT@GOTPAGE
Lloh43:
	ldr	x8, [x8, _ENOENT@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_11:
	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
	add	sp, sp, #96
	ret
LBB0_12:
	ldr	w0, [x19]
Lloh44:
	adrp	x1, l_.str.3@PAGE
Lloh45:
	add	x1, x1, l_.str.3@PAGEOFF
	bl	_dev_err
	ldr	x0, [sp, #24]
	bl	_release_firmware
Lloh46:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh47:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_10
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh33, Lloh34
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh35, Lloh36, Lloh37
	.loh AdrpAdd	Lloh38, Lloh39
	.loh AdrpLdrGot	Lloh42, Lloh43
	.loh AdrpAdd	Lloh40, Lloh41
	.loh AdrpLdrGot	Lloh46, Lloh47
	.loh AdrpAdd	Lloh44, Lloh45
	.cfi_endproc
                                        ; -- End function
	.comm	_MT7662_FIRMWARE,4,2            ; @MT7662_FIRMWARE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Firmware Version: %d.%d.%02d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Build: %x\n"

l_.str.2:                               ; @.str.2
	.asciz	"Build Time: %.16s\n"

	.comm	_MT_MCU_PCIE_REMAP_BASE4,4,2    ; @MT_MCU_PCIE_REMAP_BASE4
	.comm	_MT_MCU_ILM_OFFSET,4,2          ; @MT_MCU_ILM_OFFSET
	.comm	_MT_MCU_ILM_ADDR,4,2            ; @MT_MCU_ILM_ADDR
	.comm	_MT76XX_REV_E3,8,3              ; @MT76XX_REV_E3
	.comm	_MT_MCU_DLM_ADDR_E3,4,2         ; @MT_MCU_DLM_ADDR_E3
	.comm	_MT_MCU_DLM_ADDR,4,2            ; @MT_MCU_DLM_ADDR
	.comm	_MT_MCU_DLM_OFFSET,4,2          ; @MT_MCU_DLM_OFFSET
	.comm	_MT_EE_NIC_CONF_2,4,2           ; @MT_EE_NIC_CONF_2
	.comm	_MT_EE_NIC_CONF_2_XTAL_OPTION,4,2 ; @MT_EE_NIC_CONF_2_XTAL_OPTION
	.comm	_MT_MCU_COM_REG0,4,2            ; @MT_MCU_COM_REG0
	.comm	_MT_MCU_INT_LEVEL,4,2           ; @MT_MCU_INT_LEVEL
l_.str.3:                               ; @.str.3
	.asciz	"Firmware failed to start\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.4:                               ; @.str.4
	.asciz	"Firmware running!\n"

l_.str.5:                               ; @.str.5
	.asciz	"Invalid firmware\n"

	.comm	_ENOENT,4,2                     ; @ENOENT
	.no_dead_strip	_mt76pci_load_firmware
.subsections_via_symbols
