	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function intel_crt_load_detect
_intel_crt_load_detect:                 ## @intel_crt_load_detect
	.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	$40, %rsp
	.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), %rdi
	callq	_to_i915
	movq	%rax, %r13
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_KMS
	movl	%r12d, %edi
	callq	_BCLRPAT
	movl	%eax, %ebx
	movl	%r12d, %edi
	callq	_VTOTAL
	movl	%eax, %r14d
	movl	%r12d, %edi
	callq	_VBLANK
	movl	%eax, -56(%rbp)                 ## 4-byte Spill
	movl	%r12d, %edi
	callq	_VSYNC
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movl	%r12d, %edi
	callq	_PIPECONF
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%r12d, %edi
	callq	_PIPEDSL
	movl	%eax, %r15d
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_intel_uncore_read
	movl	%eax, -64(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	movl	%r14d, %esi
	callq	_intel_uncore_read
	movl	%eax, %r14d
	movq	%r13, %rdi
	movl	-56(%rbp), %esi                 ## 4-byte Reload
	callq	_intel_uncore_read
	movl	%eax, -60(%rbp)                 ## 4-byte Spill
	movq	%r13, %rdi
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %esi
	movl	$5242960, %edx                  ## imm = 0x500050
	callq	_intel_uncore_write
	movq	%r13, %rdi
	movl	$2, %esi
	callq	_IS_GEN
	testl	%eax, %eax
	je	LBB0_1
## %bb.5:
	movl	%r14d, %eax
	shrl	$16, %eax
	andl	$4095, %eax                     ## imm = 0xFFF
	leal	1(%rax), %edx
	andl	$2047, %r14d                    ## imm = 0x7FF
	leal	1(%r14), %esi
	movl	-60(%rbp), %ecx                 ## 4-byte Reload
	movl	%ecx, %ebx
	shrl	$16, %ebx
	andl	$4095, %ebx                     ## imm = 0xFFF
	leal	1(%rbx), %edi
	movl	%ecx, %r12d
	andl	$4095, %r12d                    ## imm = 0xFFF
	cmpl	%r14d, %r12d
	seta	%cl
	cmpl	%ebx, %eax
	seta	%al
	orb	%cl, %al
	movb	%al, -48(%rbp)                  ## 1-byte Spill
	jne	LBB0_7
## %bb.6:
	movl	%edi, -68(%rbp)                 ## 4-byte Spill
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%edx, -44(%rbp)                 ## 4-byte Spill
	movq	%rsi, -80(%rbp)                 ## 8-byte Spill
	callq	_I915_READ
	movzwl	%ax, %r12d
	shll	$16, %ebx
	orl	%r12d, %ebx
	movq	%r13, %rdi
	movl	-56(%rbp), %esi                 ## 4-byte Reload
	movl	%ebx, %edx
	callq	_intel_uncore_write
	movl	-68(%rbp), %edi                 ## 4-byte Reload
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %edx                 ## 4-byte Reload
LBB0_7:
	leal	1(%r12), %eax
	subl	%esi, %eax
	movl	%edx, %ecx
	subl	%edi, %ecx
	addl	%edx, %edi
	cmpl	%ecx, %eax
	leal	1(%r12,%rsi), %ebx
	cmovll	%edi, %ebx
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_intel_uncore_read
	cmpl	%r14d, %eax
	jg	LBB0_8
## %bb.9:
	shrl	%ebx
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_intel_uncore_read
	cmpl	%ebx, %eax
	jle	LBB0_10
## %bb.11:
	movl	%eax, %r14d
	xorl	%r12d, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_12:                                ## =>This Inner Loop Header: Depth=1
	movq	__VGA_MSR_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_intel_uncore_read8
	btl	$4, %eax
	adcl	$0, %ebx
	movq	%r13, %rdi
	movl	%r15d, %esi
	callq	_intel_uncore_read
	addl	$3, %r12d
	cmpl	%r14d, %eax
	je	LBB0_12
## %bb.13:
	cmpb	$0, -48(%rbp)                   ## 1-byte Folded Reload
	jne	LBB0_15
## %bb.14:
	movq	%r13, %rdi
	movl	-56(%rbp), %esi                 ## 4-byte Reload
	movl	-60(%rbp), %edx                 ## 4-byte Reload
	callq	_intel_uncore_write
LBB0_15:
	shll	$2, %ebx
	cmpl	%r12d, %ebx
	jbe	LBB0_16
## %bb.17:
	movq	_connector_status_connected@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_1:
	movq	%r13, %rdi
	movl	-48(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %esi
	callq	_intel_uncore_read
	movl	%eax, %r14d
	movq	_PIPECONF_FORCE_BORDER@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	orl	%r14d, %edx
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_intel_uncore_write
	movq	%r13, %rdi
	movl	%ebx, %esi
	callq	_intel_uncore_posting_read
	movq	%r13, %rdi
	movl	%r12d, %esi
	callq	_intel_wait_for_vblank
	movq	__VGA_MSR_WRITE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	callq	_intel_uncore_read8
	testb	$16, %al
	movl	%ebx, %esi
	jne	LBB0_2
## %bb.3:
	movq	_connector_status_disconnected@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_16:
	movq	_connector_status_disconnected@GOTPCREL(%rip), %rax
LBB0_18:
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movl	(%rax), %ebx
	jmp	LBB0_19
LBB0_2:
	movq	_connector_status_connected@GOTPCREL(%rip), %rax
LBB0_4:
	movl	(%rax), %ebx
	movq	%r13, %rdi
	movl	%r14d, %edx
	callq	_intel_uncore_write
	movl	-52(%rbp), %esi                 ## 4-byte Reload
LBB0_19:
	movl	-64(%rbp), %edx                 ## 4-byte Reload
	movq	%r13, %rdi
	callq	_intel_uncore_write
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"starting load-detect on CRT\n"

	.comm	_PIPECONF_FORCE_BORDER,4,2      ## @PIPECONF_FORCE_BORDER
	.comm	__VGA_MSR_WRITE,4,2             ## @_VGA_MSR_WRITE
	.comm	_connector_status_connected,4,2 ## @connector_status_connected
	.comm	_connector_status_disconnected,4,2 ## @connector_status_disconnected
	.no_dead_strip	_intel_crt_load_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function intel_crt_load_detect
_intel_crt_load_detect:                 ; @intel_crt_load_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	mov	x25, x1
	ldr	x0, [x0]
	bl	_to_i915
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_KMS
	mov	x0, x25
	bl	_BCLRPAT
	mov	x20, x0
	mov	x0, x25
	bl	_VTOTAL
	mov	x24, x0
	mov	x0, x25
	bl	_VBLANK
	mov	x22, x0
	mov	x0, x25
	bl	_VSYNC
	mov	x27, x0
	mov	x0, x25
	bl	_PIPECONF
	mov	x26, x0
	mov	x0, x25
	bl	_PIPEDSL
	mov	x23, x0
	mov	x0, x19
	mov	x1, x20
	bl	_intel_uncore_read
	mov	x21, x0
	mov	x0, x19
	mov	x1, x24
	bl	_intel_uncore_read
	mov	x28, x0
	mov	x0, x19
	mov	x1, x22
	bl	_intel_uncore_read
	mov	x24, x0
	mov	x0, x19
	mov	x1, x20
	mov	w2, #80
	movk	w2, #80, lsl #16
	bl	_intel_uncore_write
	mov	x0, x19
	mov	w1, #2
	bl	_IS_GEN
	cbz	w0, LBB0_12
; %bb.1:
	mov	x0, x27
	stp	w22, w21, [sp, #8]              ; 8-byte Folded Spill
	ubfx	w8, w28, #16, #12
	add	w21, w8, #1
	and	w25, w28, #0x7ff
	add	w28, w25, #1
	ubfx	w27, w24, #16, #12
	add	w26, w27, #1
	and	w22, w24, #0xfff
	cmp	w22, w25
	ccmp	w8, w27, #2, ls
	cset	w8, hi
	str	w8, [sp, #4]                    ; 4-byte Folded Spill
	b.hi	LBB0_3
; %bb.2:
	bl	_I915_READ
	and	w22, w0, #0xffff
	mov	x2, x22
	bfi	w2, w27, #16, #12
	mov	x0, x19
	ldr	w1, [sp, #8]                    ; 4-byte Folded Reload
	bl	_intel_uncore_write
LBB0_3:
	add	w8, w22, #1
	sub	w9, w8, w28
	add	w8, w8, w28
	add	w10, w26, w21
	sub	w11, w21, w26
	cmp	w9, w11
	csel	w21, w10, w8, lt
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x23
	bl	_intel_uncore_read
	cmp	w0, w25
	b.gt	LBB0_4
; %bb.5:
	lsr	w21, w21, #1
LBB0_6:                                 ; =>This Inner Loop Header: Depth=1
	mov	x0, x19
	mov	x1, x23
	bl	_intel_uncore_read
	cmp	w0, w21
	b.le	LBB0_6
; %bb.7:
	mov	x25, x0
	mov	w27, #0
	mov	w28, #0
Lloh2:
	adrp	x21, __VGA_MSR_WRITE@GOTPAGE
Lloh3:
	ldr	x21, [x21, __VGA_MSR_WRITE@GOTPAGEOFF]
LBB0_8:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x21]
	mov	x0, x19
	bl	_intel_uncore_read8
	ubfx	w8, w0, #4, #1
	add	w28, w8, w28
	mov	x0, x19
	mov	x1, x23
	bl	_intel_uncore_read
	add	w27, w27, #3
	cmp	w0, w25
	b.eq	LBB0_8
; %bb.9:
	ldr	w8, [sp, #4]                    ; 4-byte Folded Reload
	tbnz	w8, #0, LBB0_11
; %bb.10:
	mov	x0, x19
	ldr	w1, [sp, #8]                    ; 4-byte Folded Reload
	mov	x2, x24
	bl	_intel_uncore_write
LBB0_11:
Lloh4:
	adrp	x8, _connector_status_connected@GOTPAGE
Lloh5:
	ldr	x8, [x8, _connector_status_connected@GOTPAGEOFF]
Lloh6:
	adrp	x9, _connector_status_disconnected@GOTPAGE
Lloh7:
	ldr	x9, [x9, _connector_status_disconnected@GOTPAGEOFF]
	cmp	w27, w28, lsl #2
	csel	x8, x8, x9, lo
	ldr	w22, [x8]
	ldr	w21, [sp, #12]                  ; 4-byte Folded Reload
	b	LBB0_13
LBB0_12:
	mov	x0, x19
	mov	x1, x26
	bl	_intel_uncore_read
	mov	x23, x0
Lloh8:
	adrp	x8, _PIPECONF_FORCE_BORDER@GOTPAGE
Lloh9:
	ldr	x8, [x8, _PIPECONF_FORCE_BORDER@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	orr	w2, w8, w0
	mov	x0, x19
	mov	x1, x26
	bl	_intel_uncore_write
	mov	x0, x19
	mov	x1, x26
	bl	_intel_uncore_posting_read
	mov	x0, x19
	mov	x1, x25
	bl	_intel_wait_for_vblank
Lloh11:
	adrp	x8, __VGA_MSR_WRITE@GOTPAGE
Lloh12:
	ldr	x8, [x8, __VGA_MSR_WRITE@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_intel_uncore_read8
Lloh14:
	adrp	x8, _connector_status_connected@GOTPAGE
Lloh15:
	ldr	x8, [x8, _connector_status_connected@GOTPAGEOFF]
Lloh16:
	adrp	x9, _connector_status_disconnected@GOTPAGE
Lloh17:
	ldr	x9, [x9, _connector_status_disconnected@GOTPAGEOFF]
	tst	w0, #0x10
	csel	x8, x9, x8, eq
	ldr	w22, [x8]
	mov	x0, x19
	mov	x1, x26
	mov	x2, x23
	bl	_intel_uncore_write
LBB0_13:
	mov	x0, x19
	mov	x1, x20
	mov	x2, x21
	bl	_intel_uncore_write
	mov	x0, x22
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"starting load-detect on CRT\n"

	.comm	_PIPECONF_FORCE_BORDER,4,2      ; @PIPECONF_FORCE_BORDER
	.comm	__VGA_MSR_WRITE,4,2             ; @_VGA_MSR_WRITE
	.comm	_connector_status_connected,4,2 ; @connector_status_connected
	.comm	_connector_status_disconnected,4,2 ; @connector_status_disconnected
	.no_dead_strip	_intel_crt_load_detect
.subsections_via_symbols
