	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tg3_ape_scratchpad_read
_tg3_ape_scratchpad_read:               ## @tg3_ape_scratchpad_read
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r12
	movq	%rdx, %r14
	movq	%rsi, %rbx
	movq	%rdi, %r13
	movq	_APE_HAS_NCSI@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_tg3_flag
	xorl	%ecx, %ecx
	testl	%eax, %eax
	je	LBB0_14
## %bb.1:
	movq	_TG3_APE_SEG_SIG@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_read32
	movq	_APE_SEG_SIG_MAGIC@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_11
## %bb.2:
	movq	_TG3_APE_FW_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_read32
	movq	_APE_FW_STATUS_READY@GOTPCREL(%rip), %rcx
	testq	%rax, (%rcx)
	je	LBB0_12
## %bb.3:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movq	_TG3_APE_SEG_MSG_BUF_OFF@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_read32
	movq	%rax, %r14
	movq	_TG3_APE_SHMEM_BASE@GOTPCREL(%rip), %rax
	movq	(%rax), %r15
	movq	_TG3_APE_SEG_MSG_BUF_LEN@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_read32
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	testq	%r12, %r12
	je	LBB0_16
## %bb.4:
	leaq	(%r15,%r14), %rax
	leaq	(%r15,%r14), %rcx
	addq	$16, %rcx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	addq	$8, %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_6 Depth=1
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	addq	-88(%rbp), %r15                 ## 8-byte Folded Reload
	movq	-96(%rbp), %r12                 ## 8-byte Reload
	testq	%r12, %r12
	je	LBB0_16
LBB0_6:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_10 Depth 2
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	cmpq	%r14, %r12
	cmovlq	%r12, %r14
	movq	_TG3_APE_FW_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_read32
	movq	_APE_FW_STATUS_READY@GOTPCREL(%rip), %rcx
	testq	%rax, (%rcx)
	je	LBB0_12
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r13, %rdi
	movl	$1000, %esi                     ## imm = 0x3E8
	callq	_tg3_ape_event_lock
	testl	%eax, %eax
	jne	LBB0_17
## %bb.8:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	_APE_EVENT_STATUS_SCRTCHPD_READ@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	_APE_EVENT_STATUS_DRIVER_EVNT@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	_APE_EVENT_STATUS_EVENT_PENDING@GOTPCREL(%rip), %rax
	orq	(%rax), %rdx
	movq	_TG3_APE_EVENT_STATUS@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	%r13, %rdi
	callq	_tg3_ape_write32
	movq	%r13, %rdi
	movq	-72(%rbp), %rsi                 ## 8-byte Reload
	movq	%r15, %rdx
	callq	_tg3_ape_write32
	movq	%r13, %rdi
	movq	-64(%rbp), %rsi                 ## 8-byte Reload
	movq	%r14, %rdx
	callq	_tg3_ape_write32
	movq	_TG3_APE_LOCK_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_tg3_ape_unlock
	movq	_TG3_APE_EVENT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	movq	_APE_EVENT_1@GOTPCREL(%rip), %rax
	movq	(%rax), %rdx
	movq	%r13, %rdi
	callq	_tg3_ape_write32
	movq	%r13, %rdi
	movl	$30000, %esi                    ## imm = 0x7530
	callq	_tg3_ape_wait_for_event
	testq	%rax, %rax
	jne	LBB0_12
## %bb.9:                               ##   in Loop: Header=BB0_6 Depth=1
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	subq	%r14, %r12
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r14, %r15
	movq	%r14, -88(%rbp)                 ## 8-byte Spill
	testq	%r14, %r14
	leaq	-104(%rbp), %r14
	je	LBB0_5
	.p2align	4, 0x90
LBB0_10:                                ##   Parent Loop BB0_6 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movq	%r13, %rdi
	movq	%r12, %rsi
	callq	_tg3_ape_read32
	movq	%rax, -104(%rbp)
	movq	%rbx, %rdi
	movq	%r14, %rsi
	movl	$8, %edx
	callq	_memcpy
	addq	$8, %rbx
	addq	$4, %r12
	addq	$-4, %r15
	jne	LBB0_10
	jmp	LBB0_5
LBB0_11:
	movq	_ENODEV@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_12:
	movq	_EAGAIN@GOTPCREL(%rip), %rax
LBB0_13:
	xorl	%ecx, %ecx
	subl	(%rax), %ecx
LBB0_14:
	movl	%ecx, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	xorl	%ecx, %ecx
	jmp	LBB0_14
LBB0_17:
	movl	%eax, %ecx
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_APE_HAS_NCSI,4,2               ## @APE_HAS_NCSI
	.comm	_TG3_APE_SEG_SIG,8,3            ## @TG3_APE_SEG_SIG
	.comm	_APE_SEG_SIG_MAGIC,8,3          ## @APE_SEG_SIG_MAGIC
	.comm	_ENODEV,4,2                     ## @ENODEV
	.comm	_TG3_APE_FW_STATUS,8,3          ## @TG3_APE_FW_STATUS
	.comm	_APE_FW_STATUS_READY,8,3        ## @APE_FW_STATUS_READY
	.comm	_EAGAIN,4,2                     ## @EAGAIN
	.comm	_TG3_APE_SEG_MSG_BUF_OFF,8,3    ## @TG3_APE_SEG_MSG_BUF_OFF
	.comm	_TG3_APE_SHMEM_BASE,8,3         ## @TG3_APE_SHMEM_BASE
	.comm	_TG3_APE_SEG_MSG_BUF_LEN,8,3    ## @TG3_APE_SEG_MSG_BUF_LEN
	.comm	_APE_EVENT_STATUS_DRIVER_EVNT,8,3 ## @APE_EVENT_STATUS_DRIVER_EVNT
	.comm	_APE_EVENT_STATUS_SCRTCHPD_READ,8,3 ## @APE_EVENT_STATUS_SCRTCHPD_READ
	.comm	_APE_EVENT_STATUS_EVENT_PENDING,8,3 ## @APE_EVENT_STATUS_EVENT_PENDING
	.comm	_TG3_APE_EVENT_STATUS,8,3       ## @TG3_APE_EVENT_STATUS
	.comm	_TG3_APE_LOCK_MEM,4,2           ## @TG3_APE_LOCK_MEM
	.comm	_TG3_APE_EVENT,8,3              ## @TG3_APE_EVENT
	.comm	_APE_EVENT_1,8,3                ## @APE_EVENT_1
	.no_dead_strip	_tg3_ape_scratchpad_read
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tg3_ape_scratchpad_read
_tg3_ape_scratchpad_read:               ; @tg3_ape_scratchpad_read
	.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	x19, x3
	mov	x20, x2
	mov	x21, x1
	mov	x22, x0
Lloh0:
	adrp	x8, _APE_HAS_NCSI@GOTPAGE
Lloh1:
	ldr	x8, [x8, _APE_HAS_NCSI@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_tg3_flag
	cbz	w0, LBB0_14
; %bb.1:
Lloh3:
	adrp	x8, _TG3_APE_SEG_SIG@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TG3_APE_SEG_SIG@GOTPAGEOFF]
Lloh5:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_read32
Lloh6:
	adrp	x8, _APE_SEG_SIG_MAGIC@GOTPAGE
Lloh7:
	ldr	x8, [x8, _APE_SEG_SIG_MAGIC@GOTPAGEOFF]
Lloh8:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_11
; %bb.2:
Lloh9:
	adrp	x8, _TG3_APE_FW_STATUS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _TG3_APE_FW_STATUS@GOTPAGEOFF]
Lloh11:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_read32
Lloh12:
	adrp	x8, _APE_FW_STATUS_READY@GOTPAGE
Lloh13:
	ldr	x8, [x8, _APE_FW_STATUS_READY@GOTPAGEOFF]
Lloh14:
	ldr	x8, [x8]
	tst	x8, x0
	b.eq	LBB0_12
; %bb.3:
Lloh15:
	adrp	x8, _TG3_APE_SEG_MSG_BUF_OFF@GOTPAGE
Lloh16:
	ldr	x8, [x8, _TG3_APE_SEG_MSG_BUF_OFF@GOTPAGEOFF]
Lloh17:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_read32
	mov	x24, x0
Lloh18:
	adrp	x8, _TG3_APE_SHMEM_BASE@GOTPAGE
Lloh19:
	ldr	x8, [x8, _TG3_APE_SHMEM_BASE@GOTPAGEOFF]
Lloh20:
	ldr	x25, [x8]
Lloh21:
	adrp	x8, _TG3_APE_SEG_MSG_BUF_LEN@GOTPAGE
Lloh22:
	ldr	x8, [x8, _TG3_APE_SEG_MSG_BUF_LEN@GOTPAGEOFF]
Lloh23:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_read32
	cbz	x19, LBB0_15
; %bb.4:
	mov	x23, x0
	add	x24, x25, x24
	add	x8, x24, #16
	str	x8, [sp]                        ; 8-byte Folded Spill
	add	x25, x24, #8
	b	LBB0_6
LBB0_5:                                 ;   in Loop: Header=BB0_6 Depth=1
	add	x20, x20, x28
	cbz	x19, LBB0_15
LBB0_6:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_10 Depth 2
	cmp	x19, x23
	csel	x28, x19, x23, lt
Lloh24:
	adrp	x8, _TG3_APE_FW_STATUS@GOTPAGE
Lloh25:
	ldr	x8, [x8, _TG3_APE_FW_STATUS@GOTPAGEOFF]
Lloh26:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_read32
Lloh27:
	adrp	x8, _APE_FW_STATUS_READY@GOTPAGE
Lloh28:
	ldr	x8, [x8, _APE_FW_STATUS_READY@GOTPAGEOFF]
Lloh29:
	ldr	x8, [x8]
	tst	x8, x0
	b.eq	LBB0_12
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=1
	mov	x0, x22
	mov	w1, #1000
	bl	_tg3_ape_event_lock
	cbnz	w0, LBB0_14
; %bb.8:                                ;   in Loop: Header=BB0_6 Depth=1
Lloh30:
	adrp	x8, _APE_EVENT_STATUS_DRIVER_EVNT@GOTPAGE
Lloh31:
	ldr	x8, [x8, _APE_EVENT_STATUS_DRIVER_EVNT@GOTPAGEOFF]
Lloh32:
	ldr	x8, [x8]
Lloh33:
	adrp	x9, _APE_EVENT_STATUS_SCRTCHPD_READ@GOTPAGE
Lloh34:
	ldr	x9, [x9, _APE_EVENT_STATUS_SCRTCHPD_READ@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	orr	x8, x9, x8
Lloh36:
	adrp	x9, _APE_EVENT_STATUS_EVENT_PENDING@GOTPAGE
Lloh37:
	ldr	x9, [x9, _APE_EVENT_STATUS_EVENT_PENDING@GOTPAGEOFF]
Lloh38:
	ldr	x9, [x9]
	orr	x2, x8, x9
Lloh39:
	adrp	x8, _TG3_APE_EVENT_STATUS@GOTPAGE
Lloh40:
	ldr	x8, [x8, _TG3_APE_EVENT_STATUS@GOTPAGEOFF]
Lloh41:
	ldr	x1, [x8]
	mov	x0, x22
	bl	_tg3_ape_write32
	mov	x0, x22
	mov	x1, x24
	mov	x2, x20
	bl	_tg3_ape_write32
	mov	x0, x22
	mov	x1, x25
	mov	x2, x28
	bl	_tg3_ape_write32
Lloh42:
	adrp	x8, _TG3_APE_LOCK_MEM@GOTPAGE
Lloh43:
	ldr	x8, [x8, _TG3_APE_LOCK_MEM@GOTPAGEOFF]
Lloh44:
	ldr	w1, [x8]
	mov	x0, x22
	bl	_tg3_ape_unlock
Lloh45:
	adrp	x8, _TG3_APE_EVENT@GOTPAGE
Lloh46:
	ldr	x8, [x8, _TG3_APE_EVENT@GOTPAGEOFF]
Lloh47:
	ldr	x1, [x8]
Lloh48:
	adrp	x8, _APE_EVENT_1@GOTPAGE
Lloh49:
	ldr	x8, [x8, _APE_EVENT_1@GOTPAGEOFF]
Lloh50:
	ldr	x2, [x8]
	mov	x0, x22
	bl	_tg3_ape_write32
	mov	x0, x22
	mov	w1, #30000
	bl	_tg3_ape_wait_for_event
	cbnz	x0, LBB0_12
; %bb.9:                                ;   in Loop: Header=BB0_6 Depth=1
	sub	x19, x19, x28
	ldr	x27, [sp]                       ; 8-byte Folded Reload
	mov	x26, x28
	cbz	x28, LBB0_5
LBB0_10:                                ;   Parent Loop BB0_6 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x0, x22
	mov	x1, x27
	bl	_tg3_ape_read32
	str	x0, [sp, #8]
	add	x1, sp, #8
	mov	x0, x21
	mov	w2, #8
	bl	_memcpy
	add	x21, x21, #8
	add	x27, x27, #4
	subs	x26, x26, #4
	b.ne	LBB0_10
	b	LBB0_5
LBB0_11:
Lloh51:
	adrp	x8, _ENODEV@GOTPAGE
Lloh52:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
	b	LBB0_13
LBB0_12:
Lloh53:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh54:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
LBB0_13:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_14:
	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:
	mov	w0, #0
	b	LBB0_14
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh18, Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh48, Lloh49, Lloh50
	.loh AdrpLdrGotLdr	Lloh45, Lloh46, Lloh47
	.loh AdrpLdrGotLdr	Lloh42, Lloh43, Lloh44
	.loh AdrpLdrGotLdr	Lloh39, Lloh40, Lloh41
	.loh AdrpLdrGotLdr	Lloh36, Lloh37, Lloh38
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGot	Lloh51, Lloh52
	.loh AdrpLdrGot	Lloh53, Lloh54
	.cfi_endproc
                                        ; -- End function
	.comm	_APE_HAS_NCSI,4,2               ; @APE_HAS_NCSI
	.comm	_TG3_APE_SEG_SIG,8,3            ; @TG3_APE_SEG_SIG
	.comm	_APE_SEG_SIG_MAGIC,8,3          ; @APE_SEG_SIG_MAGIC
	.comm	_ENODEV,4,2                     ; @ENODEV
	.comm	_TG3_APE_FW_STATUS,8,3          ; @TG3_APE_FW_STATUS
	.comm	_APE_FW_STATUS_READY,8,3        ; @APE_FW_STATUS_READY
	.comm	_EAGAIN,4,2                     ; @EAGAIN
	.comm	_TG3_APE_SEG_MSG_BUF_OFF,8,3    ; @TG3_APE_SEG_MSG_BUF_OFF
	.comm	_TG3_APE_SHMEM_BASE,8,3         ; @TG3_APE_SHMEM_BASE
	.comm	_TG3_APE_SEG_MSG_BUF_LEN,8,3    ; @TG3_APE_SEG_MSG_BUF_LEN
	.comm	_APE_EVENT_STATUS_DRIVER_EVNT,8,3 ; @APE_EVENT_STATUS_DRIVER_EVNT
	.comm	_APE_EVENT_STATUS_SCRTCHPD_READ,8,3 ; @APE_EVENT_STATUS_SCRTCHPD_READ
	.comm	_APE_EVENT_STATUS_EVENT_PENDING,8,3 ; @APE_EVENT_STATUS_EVENT_PENDING
	.comm	_TG3_APE_EVENT_STATUS,8,3       ; @TG3_APE_EVENT_STATUS
	.comm	_TG3_APE_LOCK_MEM,4,2           ; @TG3_APE_LOCK_MEM
	.comm	_TG3_APE_EVENT,8,3              ; @TG3_APE_EVENT
	.comm	_APE_EVENT_1,8,3                ; @APE_EVENT_1
	.no_dead_strip	_tg3_ape_scratchpad_read
.subsections_via_symbols
