	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_dp_train               ## -- Begin function nouveau_dp_train
	.p2align	4, 0x90
_nouveau_dp_train:                      ## @nouveau_dp_train
	.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	$120, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
                                        ## kill: def $r8d killed $r8d def $r8
	movq	%r8, -144(%rbp)                 ## 8-byte Spill
	movl	%ecx, %r12d
	movq	%rdx, %rbx
	movq	%rsi, %r13
	movq	%rdi, %r14
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	%rax, -48(%rbp)
	callq	_nouveau_bios
	movq	%rax, %r15
	movq	%r14, %rdi
	callq	_nouveau_i2c
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	%r12d, -136(%rbp)
	leaq	-104(%rbp), %r10
	leaq	-100(%rbp), %rcx
	xorps	%xmm0, %xmm0
	movups	%xmm0, -128(%rbp)
	movups	%xmm0, -112(%rbp)
	movq	%rbx, -96(%rbp)
	movq	%r13, -88(%rbp)
	movq	%r14, -80(%rbp)
	movl	l___const.nouveau_dp_train.bw_list+8(%rip), %edx
	movl	%edx, -56(%rbp)
	movq	l___const.nouveau_dp_train.bw_list(%rip), %rdx
	movq	%rdx, -64(%rbp)
	movl	16(%rbx), %edx
	movl	20(%rbx), %esi
	leaq	-148(%rbp), %rax
	leaq	-156(%rbp), %r8
	leaq	-152(%rbp), %r9
	movq	%r15, %rdi
	pushq	%r10
	pushq	%rax
	callq	_nvbios_dpout_match
	addq	$16, %rsp
	testl	%eax, %eax
	je	LBB0_1
## %bb.3:
	cmpq	$0, 8(%rbx)
	je	LBB0_5
## %bb.4:
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	8(%r15), %r14
	movl	4(%rbx), %edi
	callq	_NV_I2C_TYPE_EXTAUX
	jmp	LBB0_6
LBB0_1:
	leaq	L_.str(%rip), %rdi
	callq	_ERR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_2
LBB0_5:
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	(%r15), %r14
	movl	(%rbx), %edi
	callq	_NV_I2C_TYPE_DCBI2C
LBB0_6:
	movq	%r15, %rdi
	movl	%eax, %esi
	callq	*%r14
	movl	%eax, -108(%rbp)
	testl	%eax, %eax
	je	LBB0_7
## %bb.8:
	movq	-128(%rbp), %rdx
	movl	%eax, %edi
	xorl	%esi, %esi
	movl	$8, %ecx
	callq	_nv_rdaux
	testl	%eax, %eax
	je	LBB0_12
## %bb.9:
	movl	%eax, %ebx
	leaq	L_.str.2(%rip), %rdi
	callq	_ERR
	jmp	LBB0_10
LBB0_7:
	leaq	L_.str.1(%rip), %rdi
	callq	_ERR
	movq	_ENODEV@GOTPCREL(%rip), %rax
LBB0_2:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
LBB0_10:
	movq	___stack_chk_guard@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	cmpq	-48(%rbp), %rax
	jne	LBB0_11
## %bb.28:
	movl	%ebx, %eax
	addq	$120, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_12:
	movq	-144(%rbp), %rax                ## 8-byte Reload
	leal	7(%rax), %r14d
	testl	%eax, %eax
	cmovnsl	%eax, %r14d
	movq	-128(%rbp), %rax
	movl	12(%rax), %esi
	andl	$1, %esi
	leaq	-136(%rbp), %rdi
	callq	_dp_link_train_init
	movq	-128(%rbp), %rax
	imull	$27000, 4(%rax), %ecx           ## imm = 0x6978
	leaq	-64(%rbp), %rbx
	cmpl	$269999, %ecx                   ## imm = 0x41EAF
	jg	LBB0_13
	.p2align	4, 0x90
LBB0_14:                                ## =>This Inner Loop Header: Depth=1
	movl	4(%rbx), %edx
	addq	$4, %rbx
	cmpl	%ecx, %edx
	jg	LBB0_14
## %bb.15:
	testl	%edx, %edx
	sete	%cl
	testb	%cl, %cl
	jne	LBB0_24
	jmp	LBB0_17
LBB0_13:
	xorl	%ecx, %ecx
	testb	%cl, %cl
	je	LBB0_17
LBB0_24:
	leaq	-136(%rbp), %rbx
	movq	%rbx, %rdi
	xorl	%esi, %esi
	callq	_dp_set_training_pattern
	movq	%rbx, %rdi
	callq	_dp_link_train_fini
	movl	$1, %ebx
	jmp	LBB0_10
LBB0_17:
	sarl	$3, %r14d
	addl	%r14d, %r14d
	leal	(%r14,%r14,4), %r15d
	movq	_DPCD_RC02_MAX_LANE_COUNT@GOTPCREL(%rip), %r12
	leaq	-136(%rbp), %r14
	.p2align	4, 0x90
LBB0_18:                                ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_19 Depth 2
                                        ##     Child Loop BB0_20 Depth 2
	movl	(%r12), %ecx
	andl	8(%rax), %ecx
	.p2align	4, 0x90
LBB0_19:                                ##   Parent Loop BB0_18 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	%ecx, %eax
	movl	%ecx, -120(%rbp)
	sarl	%ecx
	movl	(%rbx), %edx
	imull	%ecx, %edx
	cmpl	%r15d, %edx
	jg	LBB0_19
	.p2align	4, 0x90
LBB0_20:                                ##   Parent Loop BB0_18 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	4(%rbx), %ecx
	imull	%eax, %ecx
	addq	$4, %rbx
	cmpl	%r15d, %ecx
	jg	LBB0_20
## %bb.21:                              ##   in Loop: Header=BB0_18 Depth=1
	movl	-4(%rbx), %eax
	movl	%eax, -116(%rbp)
	movq	%r14, %rdi
	callq	_dp_set_link_config
	testl	%eax, %eax
	je	LBB0_22
## %bb.25:                              ##   in Loop: Header=BB0_18 Depth=1
	jle	LBB0_26
	jmp	LBB0_24
	.p2align	4, 0x90
LBB0_22:                                ##   in Loop: Header=BB0_18 Depth=1
	movl	-112(%rbp), %edi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movq	%r14, %rdi
	callq	_dp_link_train_cr
	testl	%eax, %eax
	jne	LBB0_26
## %bb.23:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	%r14, %rdi
	callq	_dp_link_train_eq
	testl	%eax, %eax
	je	LBB0_24
	.p2align	4, 0x90
LBB0_26:                                ##   in Loop: Header=BB0_18 Depth=1
	cmpl	$0, (%rbx)
	je	LBB0_24
## %bb.27:                              ##   in Loop: Header=BB0_18 Depth=1
	movq	-128(%rbp), %rax
	jmp	LBB0_18
LBB0_11:
	callq	___stack_chk_fail
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__const
	.p2align	2                               ## @__const.nouveau_dp_train.bw_list
l___const.nouveau_dp_train.bw_list:
	.long	270000                          ## 0x41eb0
	.long	162000                          ## 0x278d0
	.long	0                               ## 0x0

	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bios data not found\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"no aux channel?!\n"

	.comm	_ENODEV,4,2                     ## @ENODEV
L_.str.2:                               ## @.str.2
	.asciz	"failed to read DPCD\n"

	.comm	_DPCD_RC02_MAX_LANE_COUNT,4,2   ## @DPCD_RC02_MAX_LANE_COUNT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_dp_train               ; -- Begin function nouveau_dp_train
	.p2align	2
_nouveau_dp_train:                      ; @nouveau_dp_train
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #192
	.cfi_def_cfa_offset 192
	stp	x26, x25, [sp, #112]            ; 16-byte Folded Spill
	stp	x24, x23, [sp, #128]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #144]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #160]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #176]            ; 16-byte Folded Spill
	add	x29, sp, #176
	.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
	mov	x19, x4
	mov	x22, x3
	mov	x21, x2
	mov	x23, x1
	mov	x24, x0
Lloh0:
	adrp	x8, ___stack_chk_guard@GOTPAGE
Lloh1:
	ldr	x8, [x8, ___stack_chk_guard@GOTPAGEOFF]
Lloh2:
	ldr	x8, [x8]
	stur	x8, [x29, #-72]
	bl	_nouveau_bios
	mov	x25, x0
	mov	x0, x24
	bl	_nouveau_i2c
	mov	x20, x0
	str	w22, [sp, #24]
	add	x8, sp, #24
	add	x7, x8, #32
	add	x3, x8, #36
	movi.2d	v0, #0000000000000000
	stp	q0, q0, [sp, #32]
	stp	x21, x23, [sp, #64]
Lloh3:
	adrp	x8, l___const.nouveau_dp_train.bw_list@PAGE
Lloh4:
	add	x8, x8, l___const.nouveau_dp_train.bw_list@PAGEOFF
	ldr	x9, [x8]
	stp	x24, x9, [sp, #80]
	ldr	w8, [x8, #8]
	str	w8, [sp, #96]
	ldp	w2, w1, [x21, #16]
	add	x4, sp, #20
	add	x5, sp, #16
	add	x6, sp, #12
	mov	x0, x25
	bl	_nvbios_dpout_match
	cbz	w0, LBB0_3
; %bb.1:
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_4
; %bb.2:
	ldr	x22, [x20, #8]
	ldr	w0, [x21, #4]
	bl	_NV_I2C_TYPE_EXTAUX
	b	LBB0_5
LBB0_3:
Lloh5:
	adrp	x0, l_.str@PAGE
Lloh6:
	add	x0, x0, l_.str@PAGEOFF
	bl	_ERR
Lloh7:
	adrp	x8, _EINVAL@GOTPAGE
Lloh8:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_9
LBB0_4:
	ldr	x22, [x20]
	ldr	w0, [x21]
	bl	_NV_I2C_TYPE_DCBI2C
LBB0_5:
	mov	x1, x0
	mov	x0, x20
	blr	x22
	str	w0, [sp, #52]
	cbz	w0, LBB0_8
; %bb.6:
	ldr	x2, [sp, #32]
	mov	w1, #0
	mov	w3, #8
	bl	_nv_rdaux
	cbz	w0, LBB0_12
; %bb.7:
	mov	x20, x0
Lloh9:
	adrp	x0, l_.str.2@PAGE
Lloh10:
	add	x0, x0, l_.str.2@PAGEOFF
	bl	_ERR
	b	LBB0_10
LBB0_8:
Lloh11:
	adrp	x0, l_.str.1@PAGE
Lloh12:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_ERR
Lloh13:
	adrp	x8, _ENODEV@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENODEV@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w20, w8
LBB0_10:
	ldur	x8, [x29, #-72]
Lloh15:
	adrp	x9, ___stack_chk_guard@GOTPAGE
Lloh16:
	ldr	x9, [x9, ___stack_chk_guard@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	cmp	x9, x8
	b.ne	LBB0_28
; %bb.11:
	mov	x0, x20
	ldp	x29, x30, [sp, #176]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #160]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #144]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #128]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #112]            ; 16-byte Folded Reload
	add	sp, sp, #192
	ret
LBB0_12:
	add	w8, w19, #7
	cmp	w19, #0
	csel	w20, w8, w19, lt
	ldr	x8, [sp, #32]
	ldr	w8, [x8, #12]
	and	w1, w8, #0x1
	add	x0, sp, #24
	bl	_dp_link_train_init
	ldr	x8, [sp, #32]
	ldr	w9, [x8, #4]
	mov	w10, #27000
	mul	w9, w9, w10
	mov	w10, #7855
	movk	w10, #4, lsl #16
	cmp	w9, w10
	b.gt	LBB0_16
; %bb.13:
	add	x19, sp, #88
LBB0_14:                                ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x19, #4]!
	cmp	w10, w9
	b.gt	LBB0_14
; %bb.15:
	cmp	w10, #0
	cset	w9, eq
	tbnz	w9, #0, LBB0_17
	b	LBB0_18
LBB0_16:
	mov	w9, #0
	add	x19, sp, #88
	tbz	w9, #0, LBB0_18
LBB0_17:
	add	x0, sp, #24
	mov	w1, #0
	bl	_dp_set_training_pattern
	add	x0, sp, #24
	bl	_dp_link_train_fini
	mov	w20, #1
	b	LBB0_10
LBB0_18:
	asr	w9, w20, #3
	add	w9, w9, w9, lsl #2
	lsl	w20, w9, #1
Lloh18:
	adrp	x21, _DPCD_RC02_MAX_LANE_COUNT@GOTPAGE
Lloh19:
	ldr	x21, [x21, _DPCD_RC02_MAX_LANE_COUNT@GOTPAGEOFF]
LBB0_19:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_20 Depth 2
                                        ;     Child Loop BB0_21 Depth 2
	ldr	w8, [x8, #8]
	ldr	w9, [x21]
	and	w9, w9, w8
LBB0_20:                                ;   Parent Loop BB0_19 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	mov	x8, x9
	str	w9, [sp, #40]
	asr	w9, w9, #1
	ldr	w10, [x19]
	mul	w10, w10, w9
	cmp	w10, w20
	b.gt	LBB0_20
LBB0_21:                                ;   Parent Loop BB0_19 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w9, [x19, #4]!
	mul	w9, w9, w8
	cmp	w9, w20
	b.gt	LBB0_21
; %bb.22:                               ;   in Loop: Header=BB0_19 Depth=1
	ldur	w8, [x19, #-4]
	str	w8, [sp, #44]
	add	x0, sp, #24
	bl	_dp_set_link_config
	cbz	w0, LBB0_24
; %bb.23:                               ;   in Loop: Header=BB0_19 Depth=1
	cmp	w0, #0
	b.le	LBB0_26
	b	LBB0_17
LBB0_24:                                ;   in Loop: Header=BB0_19 Depth=1
	ldr	w0, [sp, #48]
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	add	x0, sp, #24
	bl	_dp_link_train_cr
	cbnz	w0, LBB0_26
; %bb.25:                               ;   in Loop: Header=BB0_19 Depth=1
	add	x0, sp, #24
	bl	_dp_link_train_eq
	cbz	w0, LBB0_17
LBB0_26:                                ;   in Loop: Header=BB0_19 Depth=1
	ldr	w8, [x19]
	cbz	w8, LBB0_17
; %bb.27:                               ;   in Loop: Header=BB0_19 Depth=1
	ldr	x8, [sp, #32]
	b	LBB0_19
LBB0_28:
	bl	___stack_chk_fail
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__const
	.p2align	2                               ; @__const.nouveau_dp_train.bw_list
l___const.nouveau_dp_train.bw_list:
	.long	270000                          ; 0x41eb0
	.long	162000                          ; 0x278d0
	.long	0                               ; 0x0

	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bios data not found\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"no aux channel?!\n"

	.comm	_ENODEV,4,2                     ; @ENODEV
l_.str.2:                               ; @.str.2
	.asciz	"failed to read DPCD\n"

	.comm	_DPCD_RC02_MAX_LANE_COUNT,4,2   ; @DPCD_RC02_MAX_LANE_COUNT
.subsections_via_symbols
