	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function amdgpu_atombios_dp_link_train_cr
_amdgpu_atombios_dp_link_train_cr:      ## @amdgpu_atombios_dp_link_train_cr
	.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, %rbx
	movq	_DP_TRAINING_PATTERN_1@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	callq	_amdgpu_atombios_dp_set_tp
	movq	(%rbx), %rdi
	xorl	%esi, %esi
	movl	$4, %edx
	callq	_memset
	movq	%rbx, %rdi
	callq	_amdgpu_atombios_dp_update_vs_emph
	movl	$400, %edi                      ## imm = 0x190
	callq	_udelay
	movl	$0, 8(%rbx)
	movl	24(%rbx), %edi
	callq	_drm_dp_link_train_clock_recovery_delay
	movl	16(%rbx), %esi
	movl	20(%rbx), %edi
	callq	_drm_dp_dpcd_read_link_status
	leaq	L_.str(%rip), %r14
	testq	%rax, %rax
	jle	LBB0_14
## %bb.1:
	movl	$255, %r13d
	movq	_DP_TRAIN_VOLTAGE_SWING_MASK@GOTPCREL(%rip), %r12
LBB0_2:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_5 Depth 2
	movl	12(%rbx), %esi
	movl	16(%rbx), %edi
	callq	_drm_dp_clock_recovery_ok
	testq	%rax, %rax
	jne	LBB0_16
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	12(%rbx), %esi
	testl	%esi, %esi
	jle	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rcx
	movq	_DP_TRAIN_MAX_SWING_REACHED@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	xorl	%eax, %eax
	.p2align	4, 0x90
LBB0_5:                                 ##   Parent Loop BB0_2 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	testl	%edx, (%rcx,%rax,4)
	je	LBB0_8
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=2
	incq	%rax
	cmpq	%rax, %rsi
	jne	LBB0_5
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_7:                                 ##   in Loop: Header=BB0_2 Depth=1
	xorl	%eax, %eax
LBB0_8:                                 ##   in Loop: Header=BB0_2 Depth=1
	cmpl	%esi, %eax
	je	LBB0_13
## %bb.9:                               ##   in Loop: Header=BB0_2 Depth=1
	movq	(%rbx), %rdx
	movl	(%r12), %r15d
	movl	(%rdx), %eax
	andl	%r15d, %eax
	cmpl	%r13d, %eax
	jne	LBB0_11
## %bb.10:                              ##   in Loop: Header=BB0_2 Depth=1
	movl	8(%rbx), %eax
	incl	%eax
	movl	%eax, 8(%rbx)
	cmpl	$5, %eax
	jne	LBB0_12
	jmp	LBB0_18
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_2 Depth=1
	movl	$0, 8(%rbx)
LBB0_12:                                ##   in Loop: Header=BB0_2 Depth=1
	andl	(%rdx), %r15d
	movl	16(%rbx), %edi
                                        ## kill: def $esi killed $esi killed $rsi
	callq	_amdgpu_atombios_dp_get_adjust_train
	movq	%rbx, %rdi
	callq	_amdgpu_atombios_dp_update_vs_emph
	movl	24(%rbx), %edi
	callq	_drm_dp_link_train_clock_recovery_delay
	movl	16(%rbx), %esi
	movl	20(%rbx), %edi
	callq	_drm_dp_dpcd_read_link_status
	movl	%r15d, %r13d
	testq	%rax, %rax
	jg	LBB0_2
	jmp	LBB0_14
LBB0_13:
	leaq	L_.str.1(%rip), %r14
LBB0_14:
	movq	%r14, %rdi
	callq	_DRM_ERROR
	leaq	L_.str.3(%rip), %rdi
	callq	_DRM_ERROR
	movl	$-1, %eax
LBB0_15:
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	(%rbx), %rax
	movl	(%rax), %edx
	movl	(%r12), %esi
	andl	%edx, %esi
	movq	_DP_TRAIN_PRE_EMPHASIS_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %edx
	movq	_DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %edx
	leaq	L_.str.4(%rip), %rdi
	callq	_DRM_DEBUG_KMS
	xorl	%eax, %eax
	jmp	LBB0_15
LBB0_18:
	leaq	L_.str.2(%rip), %r14
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.comm	_DP_TRAINING_PATTERN_1,4,2      ## @DP_TRAINING_PATTERN_1
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"displayport link status failed\n"

	.comm	_DP_TRAIN_MAX_SWING_REACHED,4,2 ## @DP_TRAIN_MAX_SWING_REACHED
L_.str.1:                               ## @.str.1
	.asciz	"clock recovery reached max voltage\n"

	.comm	_DP_TRAIN_VOLTAGE_SWING_MASK,4,2 ## @DP_TRAIN_VOLTAGE_SWING_MASK
L_.str.2:                               ## @.str.2
	.asciz	"clock recovery tried 5 times\n"

L_.str.3:                               ## @.str.3
	.asciz	"clock recovery failed\n"

L_.str.4:                               ## @.str.4
	.asciz	"clock recovery at voltage %d pre-emphasis %d\n"

	.comm	_DP_TRAIN_PRE_EMPHASIS_MASK,4,2 ## @DP_TRAIN_PRE_EMPHASIS_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_SHIFT,4,2 ## @DP_TRAIN_PRE_EMPHASIS_SHIFT
	.no_dead_strip	_amdgpu_atombios_dp_link_train_cr
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function amdgpu_atombios_dp_link_train_cr
_amdgpu_atombios_dp_link_train_cr:      ; @amdgpu_atombios_dp_link_train_cr
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x0
Lloh0:
	adrp	x8, _DP_TRAINING_PATTERN_1@GOTPAGE
Lloh1:
	ldr	x8, [x8, _DP_TRAINING_PATTERN_1@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	bl	_amdgpu_atombios_dp_set_tp
	ldr	x0, [x19]
	mov	w1, #0
	mov	w2, #4
	bl	_memset
	mov	x0, x19
	bl	_amdgpu_atombios_dp_update_vs_emph
	mov	w0, #400
	bl	_udelay
	str	wzr, [x19, #8]
	ldr	w0, [x19, #24]
	bl	_drm_dp_link_train_clock_recovery_delay
	ldp	w1, w0, [x19, #16]
	bl	_drm_dp_dpcd_read_link_status
	cmp	x0, #1
	b.lt	LBB0_14
; %bb.1:
	mov	w25, #255
Lloh3:
	adrp	x22, _DP_TRAIN_MAX_SWING_REACHED@GOTPAGE
Lloh4:
	ldr	x22, [x22, _DP_TRAIN_MAX_SWING_REACHED@GOTPAGEOFF]
Lloh5:
	adrp	x20, l_.str.1@PAGE
Lloh6:
	add	x20, x20, l_.str.1@PAGEOFF
Lloh7:
	adrp	x21, _DP_TRAIN_VOLTAGE_SWING_MASK@GOTPAGE
Lloh8:
	ldr	x21, [x21, _DP_TRAIN_VOLTAGE_SWING_MASK@GOTPAGEOFF]
Lloh9:
	adrp	x23, l_.str.2@PAGE
Lloh10:
	add	x23, x23, l_.str.2@PAGEOFF
Lloh11:
	adrp	x24, l_.str@PAGE
Lloh12:
	add	x24, x24, l_.str@PAGEOFF
LBB0_2:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_5 Depth 2
	ldp	w1, w0, [x19, #12]
	bl	_drm_dp_clock_recovery_ok
	cbnz	x0, LBB0_17
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w1, [x19, #12]
	cmp	w1, #1
	b.lt	LBB0_7
; %bb.4:                                ;   in Loop: Header=BB0_2 Depth=1
	mov	x8, #0
	ldr	x9, [x19]
	ldr	w10, [x22]
LBB0_5:                                 ;   Parent Loop BB0_2 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w11, [x9, x8, lsl #2]
	tst	w10, w11
	b.eq	LBB0_8
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=2
	add	x8, x8, #1
	cmp	x1, x8
	b.ne	LBB0_5
	b	LBB0_15
LBB0_7:                                 ;   in Loop: Header=BB0_2 Depth=1
	mov	w8, #0
LBB0_8:                                 ;   in Loop: Header=BB0_2 Depth=1
	cmp	w8, w1
	b.eq	LBB0_15
; %bb.9:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	x2, [x19]
	ldr	w9, [x2]
	ldr	w8, [x21]
	and	w9, w8, w9
	cmp	w9, w25
	b.ne	LBB0_11
; %bb.10:                               ;   in Loop: Header=BB0_2 Depth=1
	ldr	w9, [x19, #8]
	add	w9, w9, #1
	str	w9, [x19, #8]
	cmp	w9, #5
	b.ne	LBB0_12
	b	LBB0_18
LBB0_11:                                ;   in Loop: Header=BB0_2 Depth=1
	str	wzr, [x19, #8]
LBB0_12:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w9, [x2]
	and	w25, w9, w8
	ldr	w0, [x19, #16]
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_amdgpu_atombios_dp_get_adjust_train
	mov	x0, x19
	bl	_amdgpu_atombios_dp_update_vs_emph
	ldr	w0, [x19, #24]
	bl	_drm_dp_link_train_clock_recovery_delay
	ldp	w1, w0, [x19, #16]
	bl	_drm_dp_dpcd_read_link_status
	cmp	x0, #0
	b.gt	LBB0_2
; %bb.13:
	mov	x20, x24
	b	LBB0_15
LBB0_14:
Lloh13:
	adrp	x20, l_.str@PAGE
Lloh14:
	add	x20, x20, l_.str@PAGEOFF
LBB0_15:
	mov	x0, x20
	bl	_DRM_ERROR
Lloh15:
	adrp	x0, l_.str.3@PAGE
Lloh16:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_DRM_ERROR
	mov	w0, #-1
LBB0_16:
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_17:
	ldr	x8, [x19]
	ldr	w8, [x8]
	ldr	w9, [x21]
	and	w1, w9, w8
Lloh17:
	adrp	x9, _DP_TRAIN_PRE_EMPHASIS_MASK@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DP_TRAIN_PRE_EMPHASIS_MASK@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	and	w8, w9, w8
Lloh20:
	adrp	x9, _DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPAGE
Lloh21:
	ldr	x9, [x9, _DP_TRAIN_PRE_EMPHASIS_SHIFT@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
	asr	w2, w8, w9
Lloh23:
	adrp	x0, l_.str.4@PAGE
Lloh24:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_DRM_DEBUG_KMS
	mov	w0, #0
	b	LBB0_16
LBB0_18:
	mov	x20, x23
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_DP_TRAINING_PATTERN_1,4,2      ; @DP_TRAINING_PATTERN_1
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"displayport link status failed\n"

	.comm	_DP_TRAIN_MAX_SWING_REACHED,4,2 ; @DP_TRAIN_MAX_SWING_REACHED
l_.str.1:                               ; @.str.1
	.asciz	"clock recovery reached max voltage\n"

	.comm	_DP_TRAIN_VOLTAGE_SWING_MASK,4,2 ; @DP_TRAIN_VOLTAGE_SWING_MASK
l_.str.2:                               ; @.str.2
	.asciz	"clock recovery tried 5 times\n"

l_.str.3:                               ; @.str.3
	.asciz	"clock recovery failed\n"

l_.str.4:                               ; @.str.4
	.asciz	"clock recovery at voltage %d pre-emphasis %d\n"

	.comm	_DP_TRAIN_PRE_EMPHASIS_MASK,4,2 ; @DP_TRAIN_PRE_EMPHASIS_MASK
	.comm	_DP_TRAIN_PRE_EMPHASIS_SHIFT,4,2 ; @DP_TRAIN_PRE_EMPHASIS_SHIFT
	.no_dead_strip	_amdgpu_atombios_dp_link_train_cr
.subsections_via_symbols
