	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function psb_intel_sdvo_detect
_psb_intel_sdvo_detect:                 ## @psb_intel_sdvo_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	%rbx
	pushq	%rax
	.cfi_offset %rbx, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %rbx
	callq	_intel_attached_sdvo
	movq	%rax, %r14
	movq	%rbx, %rdi
	callq	_to_psb_intel_sdvo_connector
	movq	%rax, %r15
	movq	_SDVO_CMD_GET_ATTACHED_DISPLAYS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r14, %rdi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_psb_intel_sdvo_write_cmd
	testl	%eax, %eax
	je	LBB0_8
## %bb.1:
	movq	_SDVO_OUTPUT_SVID0@GOTPCREL(%rip), %rax
	movq	_SDVO_OUTPUT_CVBS0@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rax), %ecx
	testl	%ecx, 36(%r14)
	je	LBB0_3
## %bb.2:
	movl	$30, %edi
	callq	_mdelay
LBB0_3:
	leaq	-28(%rbp), %rsi
	movq	%r14, %rdi
	movl	$2, %edx
	callq	_psb_intel_sdvo_read_response
	testl	%eax, %eax
	je	LBB0_8
## %bb.4:
	movl	-28(%rbp), %edx
	movzbl	%dl, %esi
	sarl	$8, %edx
	movl	(%r15), %ecx
	leaq	L_.str(%rip), %rdi
	callq	_DRM_DEBUG_KMS
	movl	-28(%rbp), %eax
	testl	%eax, %eax
	je	LBB0_11
## %bb.5:
	movl	%eax, (%r14)
	movq	$0, 4(%r14)
	movl	-28(%rbp), %eax
	testl	%eax, (%r15)
	je	LBB0_12
## %bb.6:
	movq	%r15, %rdi
	callq	_IS_TMDS
	testq	%rax, %rax
	je	LBB0_14
## %bb.7:
	movq	%rbx, %rdi
	callq	_psb_intel_sdvo_hdmi_sink_detect
	movl	%eax, %ebx
	jmp	LBB0_20
LBB0_8:
	movq	_connector_status_unknown@GOTPCREL(%rip), %rax
LBB0_9:
	movl	(%rax), %ebx
LBB0_10:
	movl	%ebx, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_11:
	movq	_connector_status_disconnected@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_12:
	movq	_connector_status_disconnected@GOTPCREL(%rip), %rax
LBB0_13:
	movl	(%rax), %ebx
	jmp	LBB0_20
LBB0_14:
	movq	%rbx, %rdi
	callq	_psb_intel_sdvo_get_edid
	testq	%rax, %rax
	jne	LBB0_16
## %bb.15:
	movq	%rbx, %rdi
	callq	_psb_intel_sdvo_get_analog_edid
	testq	%rax, %rax
	je	LBB0_25
LBB0_16:
	movq	_DRM_EDID_INPUT_DIGITAL@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	andl	(%rax), %ecx
	jne	LBB0_18
## %bb.17:
	movq	_connector_status_connected@GOTPCREL(%rip), %rcx
	jmp	LBB0_19
LBB0_18:
	movq	_connector_status_disconnected@GOTPCREL(%rip), %rcx
LBB0_19:
	movl	(%rcx), %ebx
	movq	%rax, %rdi
	callq	_kfree
LBB0_20:
	movq	_connector_status_connected@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	jne	LBB0_10
## %bb.21:
	movq	$0, 12(%r14)
	movl	$0, 32(%r14)
	movl	-28(%rbp), %eax
	movq	_SDVO_TV_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_23
## %bb.22:
	movl	$1, 12(%r14)
	movl	$1, 32(%r14)
LBB0_23:
	movq	_SDVO_LVDS_MASK@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_10
## %bb.24:
	xorl	%eax, %eax
	cmpq	$0, 24(%r14)
	setne	%al
	movl	%eax, 16(%r14)
	jmp	LBB0_10
LBB0_25:
	movq	_connector_status_connected@GOTPCREL(%rip), %rax
	jmp	LBB0_13
	.cfi_endproc
                                        ## -- End function
	.comm	_SDVO_CMD_GET_ATTACHED_DISPLAYS,4,2 ## @SDVO_CMD_GET_ATTACHED_DISPLAYS
	.comm	_connector_status_unknown,4,2   ## @connector_status_unknown
	.comm	_SDVO_OUTPUT_SVID0,4,2          ## @SDVO_OUTPUT_SVID0
	.comm	_SDVO_OUTPUT_CVBS0,4,2          ## @SDVO_OUTPUT_CVBS0
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"SDVO response %d %d [%x]\n"

	.comm	_connector_status_disconnected,4,2 ## @connector_status_disconnected
	.comm	_DRM_EDID_INPUT_DIGITAL,4,2     ## @DRM_EDID_INPUT_DIGITAL
	.comm	_connector_status_connected,4,2 ## @connector_status_connected
	.comm	_SDVO_TV_MASK,4,2               ## @SDVO_TV_MASK
	.comm	_SDVO_LVDS_MASK,4,2             ## @SDVO_LVDS_MASK
	.no_dead_strip	_psb_intel_sdvo_detect
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function psb_intel_sdvo_detect
_psb_intel_sdvo_detect:                 ; @psb_intel_sdvo_detect
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #64
	.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
	mov	x20, x0
	bl	_intel_attached_sdvo
	mov	x19, x0
	mov	x0, x20
	bl	_to_psb_intel_sdvo_connector
	mov	x21, x0
Lloh0:
	adrp	x8, _SDVO_CMD_GET_ATTACHED_DISPLAYS@GOTPAGE
Lloh1:
	ldr	x8, [x8, _SDVO_CMD_GET_ATTACHED_DISPLAYS@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, #0
	mov	w3, #0
	bl	_psb_intel_sdvo_write_cmd
	cbz	w0, LBB0_8
; %bb.1:
	ldr	w8, [x19, #36]
Lloh3:
	adrp	x9, _SDVO_OUTPUT_SVID0@GOTPAGE
Lloh4:
	ldr	x9, [x9, _SDVO_OUTPUT_SVID0@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
Lloh6:
	adrp	x10, _SDVO_OUTPUT_CVBS0@GOTPAGE
Lloh7:
	ldr	x10, [x10, _SDVO_OUTPUT_CVBS0@GOTPAGEOFF]
Lloh8:
	ldr	w10, [x10]
	orr	w9, w10, w9
	tst	w9, w8
	b.eq	LBB0_3
; %bb.2:
	mov	w0, #30
	bl	_mdelay
LBB0_3:
	add	x1, sp, #12
	mov	x0, x19
	mov	w2, #2
	bl	_psb_intel_sdvo_read_response
	cbz	w0, LBB0_8
; %bb.4:
	ldr	w8, [sp, #12]
	and	w1, w8, #0xff
	asr	w2, w8, #8
	ldr	w3, [x21]
Lloh9:
	adrp	x0, l_.str@PAGE
Lloh10:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_KMS
	ldr	w8, [sp, #12]
	cbz	w8, LBB0_11
; %bb.5:
	stp	wzr, wzr, [x19, #4]
	str	w8, [x19]
	ldr	w8, [x21]
	ldr	w9, [sp, #12]
Lloh11:
	adrp	x22, _connector_status_connected@GOTPAGE
Lloh12:
	ldr	x22, [x22, _connector_status_connected@GOTPAGEOFF]
	tst	w9, w8
	b.eq	LBB0_12
; %bb.6:
	mov	x0, x21
	bl	_IS_TMDS
	cbz	x0, LBB0_13
; %bb.7:
	mov	x0, x20
	bl	_psb_intel_sdvo_hdmi_sink_detect
	mov	x20, x0
	b	LBB0_16
LBB0_8:
Lloh13:
	adrp	x8, _connector_status_unknown@GOTPAGE
Lloh14:
	ldr	x8, [x8, _connector_status_unknown@GOTPAGEOFF]
LBB0_9:
	ldr	w20, [x8]
LBB0_10:
	mov	x0, x20
	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
	add	sp, sp, #64
	ret
LBB0_11:
Lloh15:
	adrp	x8, _connector_status_disconnected@GOTPAGE
Lloh16:
	ldr	x8, [x8, _connector_status_disconnected@GOTPAGEOFF]
	b	LBB0_9
LBB0_12:
Lloh17:
	adrp	x8, _connector_status_disconnected@GOTPAGE
Lloh18:
	ldr	x8, [x8, _connector_status_disconnected@GOTPAGEOFF]
Lloh19:
	ldr	w20, [x8]
	b	LBB0_16
LBB0_13:
	mov	x0, x20
	bl	_psb_intel_sdvo_get_edid
	cbnz	x0, LBB0_15
; %bb.14:
	mov	x0, x20
	bl	_psb_intel_sdvo_get_analog_edid
	cbz	x0, LBB0_21
LBB0_15:
	ldr	w8, [x0]
Lloh20:
	adrp	x9, _DRM_EDID_INPUT_DIGITAL@GOTPAGE
Lloh21:
	ldr	x9, [x9, _DRM_EDID_INPUT_DIGITAL@GOTPAGEOFF]
Lloh22:
	ldr	w9, [x9]
Lloh23:
	adrp	x10, _connector_status_disconnected@GOTPAGE
Lloh24:
	ldr	x10, [x10, _connector_status_disconnected@GOTPAGEOFF]
	tst	w9, w8
	csel	x8, x22, x10, eq
	ldr	w20, [x8]
	bl	_kfree
LBB0_16:
	ldr	w8, [x22]
	cmp	w20, w8
	b.ne	LBB0_10
; %bb.17:
	stp	wzr, wzr, [x19, #12]
	str	wzr, [x19, #32]
	ldr	w8, [sp, #12]
Lloh25:
	adrp	x9, _SDVO_TV_MASK@GOTPAGE
Lloh26:
	ldr	x9, [x9, _SDVO_TV_MASK@GOTPAGEOFF]
Lloh27:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_19
; %bb.18:
	mov	w9, #1
	str	w9, [x19, #12]
	str	w9, [x19, #32]
LBB0_19:
Lloh28:
	adrp	x9, _SDVO_LVDS_MASK@GOTPAGE
Lloh29:
	ldr	x9, [x9, _SDVO_LVDS_MASK@GOTPAGEOFF]
Lloh30:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_10
; %bb.20:
	ldr	x8, [x19, #24]
	cmp	x8, #0
	cset	w8, ne
	str	w8, [x19, #16]
	b	LBB0_10
LBB0_21:
	ldr	w20, [x22]
	b	LBB0_16
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGot	Lloh23, Lloh24
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh25, Lloh26, Lloh27
	.loh AdrpLdrGotLdr	Lloh28, Lloh29, Lloh30
	.cfi_endproc
                                        ; -- End function
	.comm	_SDVO_CMD_GET_ATTACHED_DISPLAYS,4,2 ; @SDVO_CMD_GET_ATTACHED_DISPLAYS
	.comm	_connector_status_unknown,4,2   ; @connector_status_unknown
	.comm	_SDVO_OUTPUT_SVID0,4,2          ; @SDVO_OUTPUT_SVID0
	.comm	_SDVO_OUTPUT_CVBS0,4,2          ; @SDVO_OUTPUT_CVBS0
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"SDVO response %d %d [%x]\n"

	.comm	_connector_status_disconnected,4,2 ; @connector_status_disconnected
	.comm	_DRM_EDID_INPUT_DIGITAL,4,2     ; @DRM_EDID_INPUT_DIGITAL
	.comm	_connector_status_connected,4,2 ; @connector_status_connected
	.comm	_SDVO_TV_MASK,4,2               ; @SDVO_TV_MASK
	.comm	_SDVO_LVDS_MASK,4,2             ; @SDVO_LVDS_MASK
	.no_dead_strip	_psb_intel_sdvo_detect
.subsections_via_symbols
