	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function tg3_ape_lock
_tg3_ape_lock:                          ## @tg3_ape_lock
	.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	%esi, %r12d
	movq	%rdi, %r15
	movq	_ENABLE_APE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_tg3_flag
	xorl	%r14d, %r14d
	testl	%eax, %eax
	je	LBB0_14
## %bb.1:
	leal	-128(%r12), %eax
	cmpl	$4, %eax
	jae	LBB0_2
LBB0_6:
	movq	_APE_LOCK_REQ_DRIVER@GOTPCREL(%rip), %rax
	movq	(%rax), %r13
	jmp	LBB0_9
LBB0_2:
	leal	-132(%r12), %eax
	cmpl	$2, %eax
	jb	LBB0_5
## %bb.3:
	cmpl	$134, %r12d
	jne	LBB0_7
## %bb.4:
	movq	%r15, %rdi
	callq	_tg3_asic_rev
	movq	_ASIC_REV_5761@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_14
LBB0_5:
	movl	(%r15), %ecx
	testl	%ecx, %ecx
	je	LBB0_6
## %bb.8:
	movl	$1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movslq	%eax, %r13
LBB0_9:
	movq	%r15, %rdi
	callq	_tg3_asic_rev
	movq	_ASIC_REV_5761@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movq	_TG3_APE_PER_LOCK_GRANT@GOTPCREL(%rip), %rax
	cmoveq	_TG3_APE_LOCK_GRANT@GOTPCREL(%rip), %rax
	movq	_TG3_APE_PER_LOCK_REQ@GOTPCREL(%rip), %rcx
	cmoveq	_TG3_APE_LOCK_REQ@GOTPCREL(%rip), %rcx
	shll	$2, %r12d
	movq	(%rcx), %rsi
	addq	%r12, %rsi
	addq	(%rax), %r12
	movq	%r15, %rdi
	movq	%r13, %rdx
	callq	_tg3_ape_write32
	movl	$100, %ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%r15, %rdi
	movq	%r12, %rsi
	callq	_tg3_ape_read32
	cmpq	%r13, %rax
	je	LBB0_14
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movl	$10, %edi
	callq	_udelay
	decl	%ebx
	jne	LBB0_10
## %bb.12:
	movq	%r15, %rdi
	movq	%r12, %rsi
	movq	%r13, %rdx
	callq	_tg3_ape_write32
	movq	_EBUSY@GOTPCREL(%rip), %rax
	jmp	LBB0_13
LBB0_7:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_13:
	xorl	%r14d, %r14d
	subl	(%rax), %r14d
LBB0_14:
	movl	%r14d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_ENABLE_APE,4,2                 ## @ENABLE_APE
	.comm	_ASIC_REV_5761,8,3              ## @ASIC_REV_5761
	.comm	_APE_LOCK_REQ_DRIVER,8,3        ## @APE_LOCK_REQ_DRIVER
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_TG3_APE_LOCK_REQ,8,3           ## @TG3_APE_LOCK_REQ
	.comm	_TG3_APE_LOCK_GRANT,8,3         ## @TG3_APE_LOCK_GRANT
	.comm	_TG3_APE_PER_LOCK_REQ,8,3       ## @TG3_APE_PER_LOCK_REQ
	.comm	_TG3_APE_PER_LOCK_GRANT,8,3     ## @TG3_APE_PER_LOCK_GRANT
	.comm	_EBUSY,4,2                      ## @EBUSY
	.no_dead_strip	_tg3_ape_lock
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function tg3_ape_lock
_tg3_ape_lock:                          ; @tg3_ape_lock
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x20, x1
	mov	x19, x0
Lloh0:
	adrp	x8, _ENABLE_APE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _ENABLE_APE@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_tg3_flag
	cbz	w0, LBB0_15
; %bb.1:
	sub	w8, w20, #128
	cmp	w8, #4
	b.hs	LBB0_3
LBB0_2:
Lloh3:
	adrp	x8, _APE_LOCK_REQ_DRIVER@GOTPAGE
Lloh4:
	ldr	x8, [x8, _APE_LOCK_REQ_DRIVER@GOTPAGEOFF]
Lloh5:
	ldr	x21, [x8]
	b	LBB0_6
LBB0_3:
	sub	w8, w20, #132
	cmp	w8, #2
	b.hs	LBB0_10
LBB0_4:
	ldr	w8, [x19]
	cbz	w8, LBB0_2
; %bb.5:
	mov	w9, #1
	lsl	w8, w9, w8
	sxtw	x21, w8
LBB0_6:
	mov	x0, x19
	bl	_tg3_asic_rev
Lloh6:
	adrp	x8, _ASIC_REV_5761@GOTPAGE
Lloh7:
	ldr	x8, [x8, _ASIC_REV_5761@GOTPAGEOFF]
Lloh8:
	adrp	x9, _TG3_APE_LOCK_GRANT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _TG3_APE_LOCK_GRANT@GOTPAGEOFF]
Lloh10:
	adrp	x10, _TG3_APE_PER_LOCK_GRANT@GOTPAGE
Lloh11:
	ldr	x10, [x10, _TG3_APE_PER_LOCK_GRANT@GOTPAGEOFF]
Lloh12:
	ldr	x8, [x8]
	cmp	x0, x8
	csel	x8, x9, x10, eq
	ldr	x22, [x8]
Lloh13:
	adrp	x8, _TG3_APE_LOCK_REQ@GOTPAGE
Lloh14:
	ldr	x8, [x8, _TG3_APE_LOCK_REQ@GOTPAGEOFF]
Lloh15:
	adrp	x9, _TG3_APE_PER_LOCK_REQ@GOTPAGE
Lloh16:
	ldr	x9, [x9, _TG3_APE_PER_LOCK_REQ@GOTPAGEOFF]
	csel	x8, x8, x9, eq
	ldr	x8, [x8]
	lsl	w20, w20, #2
	add	x1, x8, x20
	mov	x0, x19
	mov	x2, x21
	bl	_tg3_ape_write32
	add	x20, x22, x20
	mov	w22, #100
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x20
	bl	_tg3_ape_read32
	cmp	x0, x21
	b.eq	LBB0_12
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	mov	w0, #10
	bl	_udelay
	subs	w22, w22, #1
	b.ne	LBB0_7
; %bb.9:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_tg3_ape_write32
Lloh17:
	adrp	x8, _EBUSY@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
	b	LBB0_14
LBB0_10:
	cmp	w20, #134
	b.ne	LBB0_13
; %bb.11:
	mov	x0, x19
	bl	_tg3_asic_rev
Lloh19:
	adrp	x8, _ASIC_REV_5761@GOTPAGE
Lloh20:
	ldr	x8, [x8, _ASIC_REV_5761@GOTPAGEOFF]
Lloh21:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_4
LBB0_12:
	mov	w0, #0
	b	LBB0_15
LBB0_13:
Lloh22:
	adrp	x8, _EINVAL@GOTPAGE
Lloh23:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_14:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_15:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpLdrGot	Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh12
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh22, Lloh23
	.cfi_endproc
                                        ; -- End function
	.comm	_ENABLE_APE,4,2                 ; @ENABLE_APE
	.comm	_ASIC_REV_5761,8,3              ; @ASIC_REV_5761
	.comm	_APE_LOCK_REQ_DRIVER,8,3        ; @APE_LOCK_REQ_DRIVER
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_TG3_APE_LOCK_REQ,8,3           ; @TG3_APE_LOCK_REQ
	.comm	_TG3_APE_LOCK_GRANT,8,3         ; @TG3_APE_LOCK_GRANT
	.comm	_TG3_APE_PER_LOCK_REQ,8,3       ; @TG3_APE_PER_LOCK_REQ
	.comm	_TG3_APE_PER_LOCK_GRANT,8,3     ; @TG3_APE_PER_LOCK_GRANT
	.comm	_EBUSY,4,2                      ; @EBUSY
	.no_dead_strip	_tg3_ape_lock
.subsections_via_symbols
