	.file	"extr_dac.c_nv04_dac_detect.c"
	.intel_syntax noprefix
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"Load detected on head A\n"
	.text
	.p2align 4
	.type	nv04_dac_detect, @function
nv04_dac_detect:
.LFB0:
	.cfi_startproc
	endbr64
	push	r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	push	r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	push	r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	push	r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	push	rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	push	rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	sub	rsp, 88
	.cfi_def_cfa_offset 144
	mov	rbp, QWORD PTR [rdi]
	mov	rax, QWORD PTR fs:40
	mov	QWORD PTR 72[rsp], rax
	xor	eax, eax
	mov	rdi, rbp
	call	nouveau_drm@PLT
	mov	rdi, rbp
	mov	r12, rax
	call	nouveau_drm@PLT
	mov	rdi, rbp
	mov	QWORD PTR 40[rsp], rax
	call	nv_two_heads@PLT
	test	rax, rax
	jne	.L30
.L2:
	mov	edx, DWORD PTR NV_CIO_CR_MODE_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	lea	r14, 72[rsp]
	lea	r13, 60[rsp]
	call	NVReadVgaCrtc@PLT
	mov	edx, DWORD PTR NV_CIO_CR_MODE_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	mov	ecx, eax
	mov	DWORD PTR 4[rsp], eax
	or	cl, -128
	call	NVWriteVgaCrtc@PLT
	mov	edx, DWORD PTR NV_VIO_SR_CLOCK_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVReadVgaSeq@PLT
	mov	edx, DWORD PTR NV_VIO_SR_CLOCK_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	mov	ecx, eax
	mov	DWORD PTR 8[rsp], eax
	and	ecx, -33
	call	NVWriteVgaSeq@PLT
	mov	edx, DWORD PTR NV_PRAMDAC_TEST_CONTROL[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVReadRAMDAC@PLT
	mov	ecx, DWORD PTR NV_PRAMDAC_TEST_CONTROL_PWRDWN_DAC_OFF[rip]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_PRAMDAC_TEST_CONTROL[rip]
	mov	DWORD PTR 12[rsp], eax
	not	ecx
	and	ecx, eax
	call	NVWriteRAMDAC@PLT
	mov	edi, 10
	call	msleep@PLT
	mov	edx, DWORD PTR NV_CIO_CRE_PIXEL_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVReadVgaCrtc@PLT
	mov	edi, DWORD PTR NV_CIO_CRE_PIXEL_FORMAT[rip]
	mov	ebx, eax
	mov	DWORD PTR 16[rsp], eax
	call	MASK@PLT
	mov	edx, DWORD PTR NV_CIO_CRE_PIXEL_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	mov	ecx, eax
	or	cl, -128
	not	ecx
	and	ecx, ebx
	mov	rbx, r13
	call	NVWriteVgaCrtc@PLT
	mov	edx, DWORD PTR NV_CIO_CRE_RPC1_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVReadVgaCrtc@PLT
	mov	edx, DWORD PTR NV_CIO_CRE_RPC1_INDEX[rip]
	xor	esi, esi
	mov	rdi, rbp
	mov	ecx, eax
	mov	DWORD PTR 20[rsp], eax
	and	cl, 63
	call	NVWriteVgaCrtc@PLT
	mov	esi, DWORD PTR NV_PRMDIO_READ_MODE_ADDRESS[rip]
	xor	edx, edx
	mov	rdi, r12
	call	nvif_wr08@PLT
	mov	QWORD PTR 32[rsp], r14
.L3:
	mov	esi, DWORD PTR NV_PRMDIO_PALETTE_DATA[rip]
	mov	rdi, r12
	add	rbx, 4
	call	nvif_rd08@PLT
	mov	DWORD PTR -4[rbx], eax
	cmp	rbx, r14
	jne	.L3
	mov	esi, DWORD PTR NV_PRMDIO_PIXEL_MASK[rip]
	mov	rdi, r12
	mov	r14d, 8
	lea	rbx, 52[rsp]
	call	nvif_rd08@PLT
	mov	esi, DWORD PTR NV_PRMDIO_PIXEL_MASK[rip]
	xor	edx, edx
	mov	rdi, r12
	mov	DWORD PTR 24[rsp], eax
	call	nvif_wr08@PLT
	mov	edx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVReadRAMDAC@PLT
	mov	ecx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS[rip]
	xor	esi, esi
	mov	rdi, rbp
	or	ecx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_75OHM[rip]
	mov	edx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL[rip]
	mov	DWORD PTR 28[rsp], eax
	not	ecx
	and	ecx, eax
	or	ecx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON[rip]
	call	NVWriteRAMDAC@PLT
.L9:
	mov	esi, DWORD PTR NV_PRMDIO_WRITE_MODE_ADDRESS[rip]
	xor	edx, edx
	mov	rdi, r12
	xor	r15d, r15d
	call	nvif_wr08@PLT
	mov	esi, DWORD PTR NV_PRMDIO_PALETTE_DATA[rip]
	xor	edx, edx
	mov	rdi, r12
	call	nvif_wr08@PLT
	mov	esi, DWORD PTR NV_PRMDIO_PALETTE_DATA[rip]
	xor	edx, edx
	mov	rdi, r12
	call	nvif_wr08@PLT
	mov	esi, DWORD PTR NV_PRMDIO_PALETTE_DATA[rip]
	mov	edx, r14d
	mov	rdi, r12
	call	nvif_wr08@PLT
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L32:
	mov	ecx, DWORD PTR 52[rsp]
	mov	eax, DWORD PTR 56[rsp]
	mov	edx, DWORD PTR MAX_SAMPLE_PAIRS[rip]
	cmp	ecx, eax
	je	.L6
	add	r15d, 1
	cmp	r15d, edx
	jge	.L31
.L7:
	mov	rsi, rbx
	mov	rdi, rbp
	call	sample_load_twice@PLT
	test	rax, rax
	je	.L32
.L5:
	mov	edx, DWORD PTR 24[rsp]
	mov	esi, DWORD PTR NV_PRMDIO_PIXEL_MASK[rip]
	mov	rdi, r12
	call	nvif_wr08@PLT
	mov	ecx, DWORD PTR 28[rsp]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_PRAMDAC_GENERAL_CONTROL[rip]
	call	NVWriteRAMDAC@PLT
	mov	esi, DWORD PTR NV_PRMDIO_WRITE_MODE_ADDRESS[rip]
	xor	edx, edx
	mov	rdi, r12
	call	nvif_wr08@PLT
	mov	rbx, QWORD PTR 32[rsp]
.L10:
	mov	edx, DWORD PTR 0[r13]
	mov	esi, DWORD PTR NV_PRMDIO_PALETTE_DATA[rip]
	mov	rdi, r12
	add	r13, 4
	call	nvif_wr08@PLT
	cmp	r13, rbx
	jne	.L10
	mov	ecx, DWORD PTR 12[rsp]
	mov	edx, DWORD PTR NV_PRAMDAC_TEST_CONTROL[rip]
	xor	esi, esi
	mov	rdi, rbp
	call	NVWriteRAMDAC@PLT
	mov	ecx, DWORD PTR 16[rsp]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_CIO_CRE_PIXEL_INDEX[rip]
	call	NVWriteVgaCrtc@PLT
	mov	ecx, DWORD PTR 20[rsp]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_CIO_CRE_RPC1_INDEX[rip]
	call	NVWriteVgaCrtc@PLT
	mov	ecx, DWORD PTR 8[rsp]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_VIO_SR_CLOCK_INDEX[rip]
	call	NVWriteVgaSeq@PLT
	mov	ecx, DWORD PTR 4[rsp]
	xor	esi, esi
	mov	rdi, rbp
	mov	edx, DWORD PTR NV_CIO_CR_MODE_INDEX[rip]
	call	NVWriteVgaCrtc@PLT
	mov	eax, DWORD PTR connector_status_disconnected[rip]
	cmp	r14d, 24
	je	.L33
.L1:
	mov	rbx, QWORD PTR 72[rsp]
	xor	rbx, QWORD PTR fs:40
	jne	.L34
	add	rsp, 88
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	pop	rbx
	.cfi_def_cfa_offset 48
	pop	rbp
	.cfi_def_cfa_offset 40
	pop	r12
	.cfi_def_cfa_offset 32
	pop	r13
	.cfi_def_cfa_offset 24
	pop	r14
	.cfi_def_cfa_offset 16
	pop	r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L31:
	.cfi_restore_state
	mov	eax, ecx
.L6:
	add	r14d, 1
	cmp	r15d, edx
	je	.L5
	cmp	r14d, 24
	je	.L5
	test	eax, eax
	jne	.L9
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L30:
	xor	esi, esi
	mov	rdi, rbp
	call	NVSetOwner@PLT
	jmp	.L2
.L33:
	mov	rdi, QWORD PTR 40[rsp]
	lea	rsi, .LC0[rip]
	call	NV_DEBUG@PLT
	mov	eax, DWORD PTR connector_status_connected[rip]
	jmp	.L1
.L34:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE0:
	.size	nv04_dac_detect, .-nv04_dac_detect
	.comm	connector_status_disconnected,4,4
	.comm	connector_status_connected,4,4
	.comm	NV_VIO_SR_CLOCK_INDEX,4,4
	.comm	NV_PRMDIO_WRITE_MODE_ADDRESS,4,4
	.comm	NV_PRMDIO_READ_MODE_ADDRESS,4,4
	.comm	NV_PRMDIO_PIXEL_MASK,4,4
	.comm	NV_PRMDIO_PALETTE_DATA,4,4
	.comm	NV_PRAMDAC_TEST_CONTROL_PWRDWN_DAC_OFF,4,4
	.comm	NV_PRAMDAC_TEST_CONTROL,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_75OHM,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL,4,4
	.comm	NV_CIO_CR_MODE_INDEX,4,4
	.comm	NV_CIO_CRE_RPC1_INDEX,4,4
	.comm	NV_CIO_CRE_PIXEL_INDEX,4,4
	.comm	NV_CIO_CRE_PIXEL_FORMAT,4,4
	.comm	MAX_SAMPLE_PAIRS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	 1f - 0f
	.long	 4f - 1f
	.long	 5
0:
	.string	 "GNU"
1:
	.align 8
	.long	 0xc0000002
	.long	 3f - 2f
2:
	.long	 0x3
3:
	.align 8
4:

	.arch armv5t
	.eabi_attribute 20, 1
	.eabi_attribute 21, 1
	.eabi_attribute 23, 3
	.eabi_attribute 24, 1
	.eabi_attribute 25, 1
	.eabi_attribute 26, 2
	.eabi_attribute 30, 2
	.eabi_attribute 34, 0
	.eabi_attribute 18, 4
	.file	"extr_dac.c_nv04_dac_detect.c"
	.text
	.section	.rodata.str1.4,"aMS",%progbits,1
	.align	2
.LC0:
	.ascii	"Load detected on head A\012\000"
	.section	.rodata.cst4,"aM",%progbits,4
	.align	2
.LC1:
	.word	__stack_chk_guard
	.text
	.align	2
	.syntax unified
	.arm
	.fpu softvfp
	.type	nv04_dac_detect, %function
nv04_dac_detect:
	@ args = 0, pretend = 0, frame = 56
	@ frame_needed = 0, uses_anonymous_args = 0
	push	{r4, r5, r6, r7, r8, r9, r10, fp, lr}
	ldr	r4, [r0]
	ldr	r3, .L35
	sub	sp, sp, #60
	mov	r0, r4
	ldr	r3, [r3]
	str	r3, [sp, #52]
	mov	r3,#0
	bl	nouveau_drm
	mov	r5, r0
	mov	r0, r4
	bl	nouveau_drm
	mov	r3, r0
	mov	r0, r4
	str	r3, [sp, #28]
	bl	nv_two_heads
	cmp	r0, #0
	bne	.L30
.L2:
	ldr	r6, .L35+4
	mov	r1, #0
	ldr	r2, [r6]
	mov	r0, r4
	bl	NVReadVgaCrtc
	ldr	r2, [r6]
	ldr	r6, .L35+8
	orr	r3, r0, #128
	mov	r1, #0
	str	r0, [sp]
	mov	r0, r4
	bl	NVWriteVgaCrtc
	ldr	r2, [r6]
	mov	r1, #0
	mov	r0, r4
	bl	NVReadVgaSeq
	ldr	r2, [r6]
	ldr	r6, .L35+12
	bic	r3, r0, #32
	mov	r1, #0
	str	r0, [sp, #4]
	mov	r0, r4
	bl	NVWriteVgaSeq
	ldr	r2, [r6]
	mov	r1, #0
	mov	r0, r4
	bl	NVReadRAMDAC
	ldr	r3, .L35+16
	ldr	r2, [r6]
	ldr	r3, [r3]
	mov	r1, #0
	bic	r3, r0, r3
	ldr	r6, .L35+20
	str	r0, [sp, #8]
	mov	r0, r4
	bl	NVWriteRAMDAC
	mov	r0, #10
	bl	msleep
	ldr	r2, [r6]
	mov	r1, #0
	mov	r0, r4
	bl	NVReadVgaCrtc
	ldr	r3, .L35+24
	mov	r7, r0
	str	r0, [sp, #12]
	ldr	r0, [r3]
	ldr	r6, [r6]
	bl	MASK
	mov	r2, r6
	orr	r3, r0, #128
	ldr	r6, .L35+28
	bic	r3, r7, r3
	mov	r1, #0
	mov	r0, r4
	bl	NVWriteVgaCrtc
	ldr	r2, [r6]
	mov	r1, #0
	mov	r0, r4
	bl	NVReadVgaCrtc
	ldr	r2, [r6]
	bic	r3, r0, #192
	mov	r1, #0
	str	r0, [sp, #16]
	mov	r0, r4
	bl	NVWriteVgaCrtc
	ldr	r3, .L35+32
	mov	r2, #0
	mov	r0, r5
	ldr	r1, [r3]
	add	r8, sp, #40
	bl	nvif_wr08
	mov	r6, r8
	ldr	r7, .L35+36
	add	r10, sp, #52
.L3:
	mov	r0, r5
	ldr	r1, [r7]
	bl	nvif_rd08
	str	r0, [r6], #4
	cmp	r6, r10
	bne	.L3
	ldr	r6, .L35+40
	mov	r0, r5
	ldr	r1, [r6]
	bl	nvif_rd08
	mov	r3, r0
	ldr	r1, [r6]
	ldr	r6, .L35+44
	mov	r2, #0
	mov	r0, r5
	str	r3, [sp, #20]
	bl	nvif_wr08
	ldr	r2, [r6]
	mov	r1, #0
	mov	r0, r4
	bl	NVReadRAMDAC
	ldr	r2, .L35+48
	ldr	r3, .L35+52
	ldr	r1, [r2]
	ldr	r3, [r3]
	ldr	r2, .L35+56
	orr	r3, r3, r1
	ldr	r2, [r2]
	bic	r3, r0, r3
	str	r0, [sp, #24]
	orr	r3, r3, r2
	mov	r1, #0
	ldr	r2, [r6]
	mov	r0, r4
	bl	NVWriteRAMDAC
	mov	r9, #8
	ldr	r6, .L35+60
.L9:
	ldr	r3, .L35+64
	mov	r2, #0
	ldr	r1, [r3]
	mov	r0, r5
	bl	nvif_wr08
	mov	r2, #0
	ldr	r1, [r7]
	mov	r0, r5
	bl	nvif_wr08
	mov	r2, #0
	ldr	r1, [r7]
	mov	r0, r5
	bl	nvif_wr08
	mov	r2, r9
	mov	r0, r5
	ldr	r1, [r7]
	bl	nvif_wr08
	mov	fp, #0
	b	.L7
.L32:
	ldr	r1, [sp, #32]
	ldr	r3, [sp, #36]
	ldr	r2, [r6]
	cmp	r1, r3
	beq	.L6
	add	fp, fp, #1
	cmp	fp, r2
	bge	.L31
.L7:
	mov	r0, r4
	add	r1, sp, #32
	bl	sample_load_twice
	cmp	r0, #0
	beq	.L32
.L5:
	ldr	r3, .L35+40
	ldr	r2, [sp, #20]
	ldr	r1, [r3]
	mov	r0, r5
	bl	nvif_wr08
	ldr	r2, .L35+44
	mov	r1, #0
	ldr	r3, [sp, #24]
	ldr	r2, [r2]
	mov	r0, r4
	bl	NVWriteRAMDAC
	ldr	r3, .L35+64
	mov	r2, #0
	mov	r0, r5
	ldr	r1, [r3]
	bl	nvif_wr08
.L10:
	ldr	r2, [r8], #4
	mov	r0, r5
	ldr	r1, [r7]
	bl	nvif_wr08
	cmp	r8, r10
	bne	.L10
	ldr	r2, .L35+12
	mov	r1, #0
	ldr	r3, [sp, #8]
	ldr	r2, [r2]
	mov	r0, r4
	bl	NVWriteRAMDAC
	ldr	r2, .L35+20
	mov	r1, #0
	ldr	r3, [sp, #12]
	ldr	r2, [r2]
	mov	r0, r4
	bl	NVWriteVgaCrtc
	ldr	r2, .L35+28
	mov	r1, #0
	ldr	r3, [sp, #16]
	ldr	r2, [r2]
	mov	r0, r4
	bl	NVWriteVgaCrtc
	ldr	r2, .L35+8
	mov	r1, #0
	ldr	r3, [sp, #4]
	ldr	r2, [r2]
	mov	r0, r4
	bl	NVWriteVgaSeq
	ldr	r2, .L35+4
	mov	r0, r4
	mov	r1, #0
	ldr	r3, [sp]
	ldr	r2, [r2]
	bl	NVWriteVgaCrtc
	cmp	r9, #24
	beq	.L33
	ldr	r3, .L35+68
	ldr	r0, [r3]
.L1:
	ldr	r3, .L35
	ldr	r2, [r3]
	ldr	r3, [sp, #52]
	eors	r2, r3, r2
	mov	r3, #0
	bne	.L34
	add	sp, sp, #60
	@ sp needed
	pop	{r4, r5, r6, r7, r8, r9, r10, fp, pc}
.L31:
	mov	r3, r1
.L6:
	cmp	fp, r2
	add	r9, r9, #1
	beq	.L5
	cmp	r9, #24
	beq	.L5
	cmp	r3, #0
	bne	.L9
	b	.L5
.L30:
	mov	r1, #0
	mov	r0, r4
	bl	NVSetOwner
	b	.L2
.L33:
	ldr	r0, [sp, #28]
	ldr	r1, .L35+72
	bl	NV_DEBUG
	ldr	r3, .L35+76
	ldr	r0, [r3]
	b	.L1
.L34:
	bl	__stack_chk_fail
.L36:
	.align	2
.L35:
	.word	.LC1
	.word	NV_CIO_CR_MODE_INDEX
	.word	NV_VIO_SR_CLOCK_INDEX
	.word	NV_PRAMDAC_TEST_CONTROL
	.word	NV_PRAMDAC_TEST_CONTROL_PWRDWN_DAC_OFF
	.word	NV_CIO_CRE_PIXEL_INDEX
	.word	NV_CIO_CRE_PIXEL_FORMAT
	.word	NV_CIO_CRE_RPC1_INDEX
	.word	NV_PRMDIO_READ_MODE_ADDRESS
	.word	NV_PRMDIO_PALETTE_DATA
	.word	NV_PRMDIO_PIXEL_MASK
	.word	NV_PRAMDAC_GENERAL_CONTROL
	.word	NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_75OHM
	.word	NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS
	.word	NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON
	.word	MAX_SAMPLE_PAIRS
	.word	NV_PRMDIO_WRITE_MODE_ADDRESS
	.word	connector_status_disconnected
	.word	.LC0
	.word	connector_status_connected
	.size	nv04_dac_detect, .-nv04_dac_detect
	.comm	connector_status_disconnected,4,4
	.comm	connector_status_connected,4,4
	.comm	NV_VIO_SR_CLOCK_INDEX,4,4
	.comm	NV_PRMDIO_WRITE_MODE_ADDRESS,4,4
	.comm	NV_PRMDIO_READ_MODE_ADDRESS,4,4
	.comm	NV_PRMDIO_PIXEL_MASK,4,4
	.comm	NV_PRMDIO_PALETTE_DATA,4,4
	.comm	NV_PRAMDAC_TEST_CONTROL_PWRDWN_DAC_OFF,4,4
	.comm	NV_PRAMDAC_TEST_CONTROL,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_TERMINATION_75OHM,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_PIXMIX_ON,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL_BPC_8BITS,4,4
	.comm	NV_PRAMDAC_GENERAL_CONTROL,4,4
	.comm	NV_CIO_CR_MODE_INDEX,4,4
	.comm	NV_CIO_CRE_RPC1_INDEX,4,4
	.comm	NV_CIO_CRE_PIXEL_INDEX,4,4
	.comm	NV_CIO_CRE_PIXEL_FORMAT,4,4
	.comm	MAX_SAMPLE_PAIRS,4,4
	.ident	"GCC: (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0"
	.section	.note.GNU-stack,"",%progbits
