	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function dp_link_train_cr
_dp_link_train_cr:                      ## @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, %r12
	movq	(%rdi), %rax
	movq	_DPCD_LC03_VOLTAGE_SWING_SET@GOTPCREL(%rip), %r14
	movl	(%r14), %r15d
	andl	(%rax), %r15d
	movl	$1, %esi
	callq	_dp_set_training_pattern
	xorl	%r13d, %r13d
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_6 Depth 2
	movq	%r12, %rdi
	callq	_dp_link_train_commit
	testq	%rax, %rax
	jne	LBB0_15
## %bb.2:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	%r12, %rdi
	movl	$100, %esi
	callq	_dp_link_train_update
	testq	%rax, %rax
	jne	LBB0_15
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	8(%r12), %eax
	testl	%eax, %eax
	jle	LBB0_16
## %bb.4:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	16(%r12), %r9
	movq	_DPCD_LS02_LANE0_CR_DONE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edx
	movl	(%r9), %ecx
	andl	%edx, %ecx
	xorl	%r8d, %r8d
	testb	$15, %cl
	je	LBB0_9
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movl	$1, %esi
	movl	$4, %ebx
	.p2align	4, 0x90
LBB0_6:                                 ##   Parent Loop BB0_1 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	cmpl	%esi, %eax
	je	LBB0_11
## %bb.7:                               ##   in Loop: Header=BB0_6 Depth=2
	movl	%esi, %ecx
	shrl	%ecx
	movl	(%r9,%rcx,4), %edi
	movl	%ebx, %ecx
	andb	$4, %cl
	sarl	%cl, %edi
	andl	%edx, %edi
	incl	%esi
	addl	$4, %ebx
	testb	$15, %dil
	jne	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_1 Depth=1
	decl	%esi
	cmpl	%eax, %esi
	setl	%al
	jmp	LBB0_10
	.p2align	4, 0x90
LBB0_9:                                 ##   in Loop: Header=BB0_1 Depth=1
	movb	$1, %al
	xorl	%esi, %esi
LBB0_10:                                ##   in Loop: Header=BB0_1 Depth=1
	movq	(%r12), %rdx
	movl	%esi, %esi
	movq	_DPCD_LC03_MAX_SWING_REACHED@GOTPCREL(%rip), %rcx
	movl	(%rcx), %edi
	xorl	%ecx, %ecx
	testl	%edi, (%rdx,%rsi,4)
	setne	%cl
	testb	%al, %al
	jne	LBB0_12
	jmp	LBB0_17
	.p2align	4, 0x90
LBB0_11:                                ##   in Loop: Header=BB0_1 Depth=1
	setg	%al
	movl	$1, %r8d
	xorl	%ecx, %ecx
	testb	%al, %al
	je	LBB0_17
LBB0_12:                                ##   in Loop: Header=BB0_1 Depth=1
	testl	%ecx, %ecx
	jne	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_1 Depth=1
	movq	(%r12), %rax
	movl	(%r14), %ecx
	andl	(%rax), %ecx
	xorl	%r8d, %r8d
	cmpl	%r15d, %ecx
	cmovnel	%r8d, %r13d
	leal	1(%r13), %eax
	movl	%ecx, %r15d
	cmpl	$4, %r13d
	movl	%eax, %r13d
	jl	LBB0_1
	jmp	LBB0_17
LBB0_15:
	xorl	%r8d, %r8d
	jmp	LBB0_17
LBB0_16:
	movl	$1, %r8d
LBB0_17:
	xorl	%eax, %eax
	cmpl	$1, %r8d
	sbbl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_DPCD_LC03_VOLTAGE_SWING_SET,4,2 ## @DPCD_LC03_VOLTAGE_SWING_SET
	.comm	_DPCD_LS02_LANE0_CR_DONE,4,2    ## @DPCD_LS02_LANE0_CR_DONE
	.comm	_DPCD_LC03_MAX_SWING_REACHED,4,2 ## @DPCD_LC03_MAX_SWING_REACHED
	.no_dead_strip	_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 dp_link_train_cr
_dp_link_train_cr:                      ; @dp_link_train_cr
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	mov	x19, x0
	ldr	x8, [x0]
	ldr	w8, [x8]
Lloh0:
	adrp	x20, _DPCD_LC03_VOLTAGE_SWING_SET@GOTPAGE
Lloh1:
	ldr	x20, [x20, _DPCD_LC03_VOLTAGE_SWING_SET@GOTPAGEOFF]
	ldr	w9, [x20]
	and	w21, w9, w8
	mov	w1, #1
	bl	_dp_set_training_pattern
	mov	w22, #0
Lloh2:
	adrp	x23, _DPCD_LS02_LANE0_CR_DONE@GOTPAGE
Lloh3:
	ldr	x23, [x23, _DPCD_LS02_LANE0_CR_DONE@GOTPAGEOFF]
Lloh4:
	adrp	x24, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGE
Lloh5:
	ldr	x24, [x24, _DPCD_LC03_MAX_SWING_REACHED@GOTPAGEOFF]
LBB0_1:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_6 Depth 2
	mov	x0, x19
	bl	_dp_link_train_commit
	cbnz	x0, LBB0_14
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	x0, x19
	mov	w1, #100
	bl	_dp_link_train_update
	cbnz	x0, LBB0_14
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [x19, #8]
	cmp	w8, #1
	b.lt	LBB0_15
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x9, [x19, #16]
	ldr	w10, [x23]
	ldr	w11, [x9]
	and	w11, w11, w10
	tst	w11, #0xf
	b.eq	LBB0_9
; %bb.5:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w11, #1
	mov	w12, #4
LBB0_6:                                 ;   Parent Loop BB0_1 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	cmp	w8, w11
	b.eq	LBB0_11
; %bb.7:                                ;   in Loop: Header=BB0_6 Depth=2
	lsr	w13, w11, #1
	ldr	w13, [x9, w13, uxtw #2]
	and	w14, w12, #0x4
	asr	w13, w13, w14
	and	w13, w13, w10
	add	w11, w11, #1
	add	w12, w12, #4
	tst	w13, #0xf
	b.ne	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_1 Depth=1
	sub	w10, w11, #1
	cmp	w10, w8
	cset	w9, lt
	b	LBB0_10
LBB0_9:                                 ;   in Loop: Header=BB0_1 Depth=1
	mov	w10, #0
	mov	w9, #1
LBB0_10:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w8, #0
	ldr	x11, [x19]
	ldr	w10, [x11, w10, uxtw #2]
	ldr	w11, [x24]
	tst	w11, w10
	cset	w10, ne
	cbnz	w9, LBB0_12
	b	LBB0_16
LBB0_11:                                ;   in Loop: Header=BB0_1 Depth=1
	mov	w10, #0
	cmp	w11, w8
	cset	w9, lt
	mov	w8, #1
	cbz	w9, LBB0_16
LBB0_12:                                ;   in Loop: Header=BB0_1 Depth=1
	cbnz	w10, LBB0_16
; %bb.13:                               ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [x19]
	ldr	w8, [x8]
	ldr	w9, [x20]
	and	w8, w9, w8
	cmp	w8, w21
	csel	w9, w22, wzr, eq
	add	w22, w9, #1
	mov	x21, x8
	cmp	w9, #4
	b.lt	LBB0_1
LBB0_14:
	mov	w8, #0
	b	LBB0_16
LBB0_15:
	mov	w8, #1
LBB0_16:
	cmp	w8, #0
	csetm	w0, eq
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.cfi_endproc
                                        ; -- End function
	.comm	_DPCD_LC03_VOLTAGE_SWING_SET,4,2 ; @DPCD_LC03_VOLTAGE_SWING_SET
	.comm	_DPCD_LS02_LANE0_CR_DONE,4,2    ; @DPCD_LS02_LANE0_CR_DONE
	.comm	_DPCD_LC03_MAX_SWING_REACHED,4,2 ; @DPCD_LC03_MAX_SWING_REACHED
	.no_dead_strip	_dp_link_train_cr
.subsections_via_symbols
