	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvkm_dp_train_drive
_nvkm_dp_train_drive:                   ## @nvkm_dp_train_drive
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	movq	32(%rdi), %rax
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	16(%rax), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	cmpl	$0, 8(%rax)
	jle	LBB0_10
## %bb.1:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	addq	$8, %rax
	movq	%rax, -120(%rbp)                ## 8-byte Spill
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	16(%rax), %rax
	movq	(%rax), %rax
	movq	(%rax), %rax
	movq	%rax, -96(%rbp)                 ## 8-byte Spill
	xorl	%ecx, %ecx
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_2 Depth=1
	incq	%r12
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movslq	8(%rax), %rax
	addl	$2, %r14d
	movq	-128(%rbp), %rcx                ## 8-byte Reload
	addl	$4, %ecx
	cmpq	%rax, %r12
	jge	LBB0_10
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	movq	(%rsi), %rax
	movl	%r12d, %edx
	shrl	%edx
	movl	16(%rax,%rdx,4), %r13d
	movq	%rcx, -128(%rbp)                ## 8-byte Spill
	movl	%ecx, %eax
	andl	$4, %eax
	movl	%eax, %ecx
	sarl	%cl, %r13d
	movl	8(%rsi), %esi
	movl	%r14d, %ecx
	sarl	%cl, %esi
	andl	$3, %esi
	movl	%r13d, %r15d
	shrl	$2, %r15d
	andl	$3, %r15d
	movq	_DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ebx
	orl	$3, %ebx
	cmpl	$3, %esi
	cmovnel	%esi, %ebx
	cmpl	$3, %r15d
	jne	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_DPCD_LC03_MAX_SWING_REACHED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	orl	$3, %r15d
	xorl	%r13d, %r13d
	jmp	LBB0_6
	.p2align	4, 0x90
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	%r15d, %ecx
	xorl	$3, %ecx
	andl	$3, %r13d
	cmpl	%ecx, %r13d
	jb	LBB0_6
## %bb.5:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	_DPCD_LC03_MAX_SWING_REACHED@GOTPCREL(%rip), %rsi
	orl	(%rsi), %ecx
	movl	%ecx, %r13d
LBB0_6:                                 ##   in Loop: Header=BB0_2 Depth=1
	leal	(,%r15,8), %esi
	orl	%r13d, %esi
	movl	%ebx, %edi
	movl	%eax, %ecx
	shll	%cl, %edi
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	16(%rcx), %rax
	movl	%esi, (%rax,%r12,4)
	movq	24(%rcx), %rcx
	movl	%edx, %edx
	orl	%edi, (%rcx,%rdx,4)
	movl	(%rax,%r12,4), %ecx
	movq	-120(%rbp), %rdi                ## 8-byte Reload
	leaq	L_.str(%rip), %rsi
	movl	%r12d, %edx
	movl	%ebx, %r8d
	callq	_OUTP_TRACE
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	8(%rax), %edx
	movl	12(%rax), %esi
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	leaq	-84(%rbp), %rcx
	leaq	-80(%rbp), %r8
	leaq	-76(%rbp), %r9
	leaq	-136(%rbp), %rax
	pushq	%rax
	leaq	-72(%rbp), %rax
	pushq	%rax
	callq	_nvbios_dpout_match
	addq	$16, %rsp
	testl	%eax, %eax
	je	LBB0_9
## %bb.7:                               ##   in Loop: Header=BB0_2 Depth=1
	andl	$3, %ebx
	andl	$3, %r13d
	andl	$3, %r15d
	movq	-96(%rbp), %rdi                 ## 8-byte Reload
	movl	%eax, %esi
	movl	%ebx, %edx
	movl	%r13d, %ecx
	movl	%r15d, %r8d
	leaq	-84(%rbp), %r9
	leaq	-112(%rbp), %rax
	pushq	%rax
	leaq	-72(%rbp), %rax
	pushq	%rax
	leaq	-76(%rbp), %rax
	pushq	%rax
	leaq	-80(%rbp), %rax
	pushq	%rax
	callq	_nvbios_dpcfg_match
	addq	$32, %rsp
	testl	%eax, %eax
	je	LBB0_9
## %bb.8:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	movq	(%rdi), %rax
	movl	-100(%rbp), %edx
	movl	-104(%rbp), %ecx
	movl	-112(%rbp), %r9d
	movl	-108(%rbp), %r8d
	movl	%r12d, %esi
	callq	*(%rax)
	jmp	LBB0_9
LBB0_10:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %ebx
	xorl	%edi, %edi
	callq	_DPCD_LC03
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	16(%rcx), %rdx
	movl	%ebx, %edi
	movl	%eax, %esi
	movl	$4, %ecx
	callq	_nvkm_wraux
	testl	%eax, %eax
	jne	LBB0_14
## %bb.11:
	cmpl	$0, -68(%rbp)                   ## 4-byte Folded Reload
	je	LBB0_13
## %bb.12:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	(%rax), %edi
	movq	_DPCD_LC0F@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	-56(%rbp), %rax                 ## 8-byte Reload
	movq	24(%rax), %rdx
	movl	$2, %ecx
	callq	_nvkm_wraux
	testl	%eax, %eax
	jne	LBB0_14
LBB0_13:
	xorl	%eax, %eax
LBB0_14:
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED,4,2 ## @DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED
	.comm	_DPCD_LC03_MAX_SWING_REACHED,4,2 ## @DPCD_LC03_MAX_SWING_REACHED
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"config lane %d %02x %02x"

	.comm	_DPCD_LC0F,4,2                  ## @DPCD_LC0F
	.no_dead_strip	_nvkm_dp_train_drive
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvkm_dp_train_drive
_nvkm_dp_train_drive:                   ; @nvkm_dp_train_drive
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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
	str	w1, [sp, #28]                   ; 4-byte Folded Spill
	mov	x19, x0
	ldr	x27, [x0, #32]
	ldr	x21, [x27, #16]
	ldr	w8, [x21, #8]
	cmp	w8, #1
	b.lt	LBB0_10
; %bb.1:
	mov	w28, #0
	mov	w20, #0
	mov	x22, #0
	add	x8, x27, #8
	str	x8, [sp, #32]                   ; 8-byte Folded Spill
	ldr	x8, [x21, #16]
	ldr	x8, [x8]
	ldr	x24, [x8]
	b	LBB0_3
LBB0_2:                                 ;   in Loop: Header=BB0_3 Depth=1
	add	x22, x22, #1
	ldrsw	x8, [x21, #8]
	add	w20, w20, #2
	add	w28, w28, #4
	cmp	x22, x8
	b.ge	LBB0_10
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x19]
	ubfx	x8, x22, #1, #31
	add	w10, w8, #4
	ldr	w10, [x9, w10, uxtw #2]
	and	w9, w28, #0x4
	asr	w10, w10, w9
	ldr	w11, [x19, #8]
	asr	w11, w11, w20
	and	w11, w11, #0x3
	ubfx	w25, w10, #2, #2
Lloh0:
	adrp	x12, _DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED@GOTPAGE
Lloh1:
	ldr	x12, [x12, _DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED@GOTPAGEOFF]
Lloh2:
	ldr	w12, [x12]
	orr	w12, w12, #0x3
	cmp	w11, #3
	csel	w26, w12, w11, eq
	cmp	w25, #3
	b.ne	LBB0_5
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	w23, #0
Lloh3:
	adrp	x10, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGE
Lloh4:
	ldr	x10, [x10, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGEOFF]
Lloh5:
	ldr	w10, [x10]
	orr	w25, w10, #0x3
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_3 Depth=1
	eor	w11, w25, #0x3
	and	w23, w10, #0x3
	cmp	w23, w11
	b.lo	LBB0_7
; %bb.6:                                ;   in Loop: Header=BB0_3 Depth=1
Lloh6:
	adrp	x10, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGE
Lloh7:
	ldr	x10, [x10, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w23, w10, w11
LBB0_7:                                 ;   in Loop: Header=BB0_3 Depth=1
	orr	w10, w23, w25, lsl #3
	ldr	x11, [x19, #16]
	lsl	x12, x22, #2
	str	w10, [x11, x12]
	ldr	x10, [x19, #24]
	mov	w8, w8
	lsl	x8, x8, #2
	ldr	w13, [x10, x8]
	lsl	w9, w26, w9
	orr	w9, w13, w9
	str	w9, [x10, x8]
	ldr	w3, [x11, x12]
	ldr	x0, [sp, #32]                   ; 8-byte Folded Reload
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
	mov	x2, x22
	mov	x4, x26
	bl	_OUTP_TRACE
	ldp	w2, w1, [x27, #8]
	add	x3, sp, #52
	add	x4, sp, #48
	add	x5, sp, #44
	add	x6, sp, #40
	add	x7, sp, #72
	mov	x0, x24
	bl	_nvbios_dpout_match
	cbz	w0, LBB0_2
; %bb.8:                                ;   in Loop: Header=BB0_3 Depth=1
	mov	x1, x0
	and	w2, w26, #0x3
	and	w3, w23, #0x3
	and	w4, w25, #0x3
	add	x8, sp, #56
	str	x8, [sp, #8]
	add	x8, sp, #40
	str	x8, [sp]
	add	x5, sp, #52
	add	x6, sp, #48
	add	x7, sp, #44
	mov	x0, x24
	bl	_nvbios_dpcfg_match
	cbz	w0, LBB0_2
; %bb.9:                                ;   in Loop: Header=BB0_3 Depth=1
	ldr	x8, [x21]
	ldr	x8, [x8]
	ldp	w3, w2, [sp, #64]
	ldp	w5, w4, [sp, #56]
	mov	x0, x21
	mov	x1, x22
	blr	x8
	b	LBB0_2
LBB0_10:
	ldr	w21, [x27]
	mov	w0, #0
	bl	_DPCD_LC03
	mov	x1, x0
	ldr	x2, [x19, #16]
	mov	x0, x21
	mov	w3, #4
	bl	_nvkm_wraux
	cbnz	w0, LBB0_14
; %bb.11:
	ldr	w8, [sp, #28]                   ; 4-byte Folded Reload
	cbz	w8, LBB0_13
; %bb.12:
	ldr	w0, [x27]
Lloh11:
	adrp	x8, _DPCD_LC0F@GOTPAGE
Lloh12:
	ldr	x8, [x8, _DPCD_LC0F@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	ldr	x2, [x19, #24]
	mov	w3, #2
	bl	_nvkm_wraux
	cbnz	w0, LBB0_14
LBB0_13:
	mov	w0, #0
LBB0_14:
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED,4,2 ; @DPCD_LC0F_LANE0_MAX_POST_CURSOR2_REACHED
	.comm	_DPCD_LC03_MAX_SWING_REACHED,4,2 ; @DPCD_LC03_MAX_SWING_REACHED
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"config lane %d %02x %02x"

	.comm	_DPCD_LC0F,4,2                  ; @DPCD_LC0F
	.no_dead_strip	_nvkm_dp_train_drive
.subsections_via_symbols
