	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i915_get_crtc_scanoutpos
_i915_get_crtc_scanoutpos:              ## @i915_get_crtc_scanoutpos
	.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	%rcx, %r14
	movq	%rdx, %r12
	movl	%esi, %ebx
	movq	%rdi, %r15
	movq	(%rdi), %rdi
	callq	_intel_pipe_to_cpu_transcoder
	movl	%eax, %r13d
	movq	%r15, %rdi
	movl	%ebx, %esi
	callq	_i915_pipe_enabled
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movq	%r14, -48(%rbp)                 ## 8-byte Spill
	movl	%r13d, %edi
	callq	_VTOTAL
	movl	%eax, %edi
	callq	_I915_READ
	movl	%eax, %r14d
	movq	%r15, %rdi
	callq	_INTEL_INFO
	cmpl	$4, (%rax)
	jl	LBB0_4
## %bb.3:
	movl	%ebx, %edi
	callq	_PIPEDSL
	movl	%eax, %edi
	callq	_I915_READ
	andl	$8191, %eax                     ## imm = 0x1FFF
	movl	%eax, (%r12)
	xorl	%edx, %edx
	jmp	LBB0_5
LBB0_1:
	movl	%ebx, %edi
	callq	_pipe_name
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_DRM_DEBUG_DRIVER
	xorl	%ecx, %ecx
	jmp	LBB0_10
LBB0_4:
	movl	%ebx, %edi
	callq	_PIPEFRAMEPIXEL
	movl	%eax, %edi
	callq	_I915_READ
	movl	%eax, %ebx
	movq	_PIPE_PIXEL_MASK@GOTPCREL(%rip), %rax
	andl	(%rax), %ebx
	movq	_PIPE_PIXEL_SHIFT@GOTPCREL(%rip), %rax
	movb	(%rax), %cl
	sarl	%cl, %ebx
	movl	%r13d, %edi
	callq	_HTOTAL
	movl	%eax, %edi
	callq	_I915_READ
	movl	%eax, %ecx
	shrl	$16, %ecx
	andl	$8191, %ecx                     ## imm = 0x1FFF
	incl	%ecx
	movl	%ebx, %eax
	cltd
	idivl	%ecx
	movl	%eax, (%r12)
LBB0_5:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movl	%edx, (%rax)
	movl	%r13d, %edi
	callq	_VBLANK
	movl	%eax, %edi
	callq	_I915_READ
	movl	%eax, %edx
	andl	$8191, %edx                     ## imm = 0x1FFF
	movl	(%r12), %ecx
	cmpl	%edx, %ecx
	jl	LBB0_8
## %bb.6:
	movl	%eax, %edx
	shrl	$16, %edx
	andl	$8191, %edx                     ## imm = 0x1FFF
	cmpl	%edx, %ecx
	jle	LBB0_7
LBB0_8:
	movq	_DRM_SCANOUTPOS_VALID@GOTPCREL(%rip), %rdx
	movq	_DRM_SCANOUTPOS_ACCURATE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	orl	(%rdx), %ecx
	xorl	%edx, %edx
	testl	%eax, %eax
	cmovlel	%edx, %ecx
	jmp	LBB0_9
LBB0_7:
	shrl	$16, %r14d
	notl	%r14d
	orl	$-8192, %r14d                   ## imm = 0xE000
	addl	%r14d, %ecx
	movl	%ecx, (%r12)
	movq	_DRM_SCANOUTPOS_VALID@GOTPCREL(%rip), %rcx
	movq	_DRM_SCANOUTPOS_ACCURATE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	orl	(%rcx), %edx
	xorl	%ecx, %ecx
	testl	%eax, %eax
	cmovgl	%edx, %ecx
	movq	_DRM_SCANOUTPOS_INVBL@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
LBB0_9:
	orl	%edx, %ecx
LBB0_10:
	movl	%ecx, %eax
	addq	$8, %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	"trying to get scanoutpos for disabled pipe %c\n"

	.comm	_PIPE_PIXEL_MASK,4,2            ## @PIPE_PIXEL_MASK
	.comm	_PIPE_PIXEL_SHIFT,4,2           ## @PIPE_PIXEL_SHIFT
	.comm	_DRM_SCANOUTPOS_VALID,4,2       ## @DRM_SCANOUTPOS_VALID
	.comm	_DRM_SCANOUTPOS_ACCURATE,4,2    ## @DRM_SCANOUTPOS_ACCURATE
	.comm	_DRM_SCANOUTPOS_INVBL,4,2       ## @DRM_SCANOUTPOS_INVBL
	.no_dead_strip	_i915_get_crtc_scanoutpos
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i915_get_crtc_scanoutpos
_i915_get_crtc_scanoutpos:              ; @i915_get_crtc_scanoutpos
	.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	x20, x3
	mov	x19, x2
	mov	x23, x1
	mov	x24, x0
	ldr	x0, [x0]
	bl	_intel_pipe_to_cpu_transcoder
	mov	x22, x0
	mov	x0, x24
	mov	x1, x23
	bl	_i915_pipe_enabled
	cbz	w0, LBB0_3
; %bb.1:
	mov	x0, x22
	bl	_VTOTAL
	bl	_I915_READ
	mov	x21, x0
	mov	x0, x24
	bl	_INTEL_INFO
	ldr	w8, [x0]
	mov	x0, x23
	cmp	w8, #4
	b.lt	LBB0_4
; %bb.2:
	bl	_PIPEDSL
	bl	_I915_READ
	mov	w8, #0
	and	w9, w0, #0x1fff
	str	w9, [x19]
	b	LBB0_5
LBB0_3:
	mov	x0, x23
	bl	_pipe_name
	mov	x1, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_DEBUG_DRIVER
	mov	w0, #0
	b	LBB0_10
LBB0_4:
	bl	_PIPEFRAMEPIXEL
	bl	_I915_READ
Lloh2:
	adrp	x8, _PIPE_PIXEL_MASK@GOTPAGE
Lloh3:
	ldr	x8, [x8, _PIPE_PIXEL_MASK@GOTPAGEOFF]
Lloh4:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh5:
	adrp	x9, _PIPE_PIXEL_SHIFT@GOTPAGE
Lloh6:
	ldr	x9, [x9, _PIPE_PIXEL_SHIFT@GOTPAGEOFF]
Lloh7:
	ldr	w9, [x9]
	asr	w23, w8, w9
	mov	x0, x22
	bl	_HTOTAL
	bl	_I915_READ
	ubfx	w8, w0, #16, #13
	add	w8, w8, #1
	sdiv	w9, w23, w8
	str	w9, [x19]
	msub	w8, w8, w9, w23
LBB0_5:
	str	w8, [x20]
	mov	x0, x22
	bl	_VBLANK
	bl	_I915_READ
	and	w9, w0, #0x1fff
	ldr	w8, [x19]
	cmp	w8, w9
	b.lt	LBB0_7
; %bb.6:
	ubfx	w9, w0, #16, #13
	cmp	w8, w9
	b.le	LBB0_8
LBB0_7:
	mov	w8, #0
Lloh8:
	adrp	x9, _DRM_SCANOUTPOS_VALID@GOTPAGE
Lloh9:
	ldr	x9, [x9, _DRM_SCANOUTPOS_VALID@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
Lloh11:
	adrp	x10, _DRM_SCANOUTPOS_ACCURATE@GOTPAGE
Lloh12:
	ldr	x10, [x10, _DRM_SCANOUTPOS_ACCURATE@GOTPAGEOFF]
Lloh13:
	ldr	w10, [x10]
	orr	w9, w10, w9
	cmp	w0, #0
	csel	w9, w9, wzr, gt
	b	LBB0_9
LBB0_8:
	mov	w9, #-8192
	orn	w9, w9, w21, lsr #16
	add	w8, w8, w9
	str	w8, [x19]
Lloh14:
	adrp	x8, _DRM_SCANOUTPOS_VALID@GOTPAGE
Lloh15:
	ldr	x8, [x8, _DRM_SCANOUTPOS_VALID@GOTPAGEOFF]
Lloh16:
	ldr	w8, [x8]
Lloh17:
	adrp	x9, _DRM_SCANOUTPOS_ACCURATE@GOTPAGE
Lloh18:
	ldr	x9, [x9, _DRM_SCANOUTPOS_ACCURATE@GOTPAGEOFF]
Lloh19:
	ldr	w9, [x9]
	orr	w8, w9, w8
	cmp	w0, #0
	csel	w9, w8, wzr, gt
Lloh20:
	adrp	x8, _DRM_SCANOUTPOS_INVBL@GOTPAGE
Lloh21:
	ldr	x8, [x8, _DRM_SCANOUTPOS_INVBL@GOTPAGEOFF]
Lloh22:
	ldr	w8, [x8]
LBB0_9:
	orr	w0, w9, w8
LBB0_10:
	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 AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh20, Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh17, Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh14, Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"trying to get scanoutpos for disabled pipe %c\n"

	.comm	_PIPE_PIXEL_MASK,4,2            ; @PIPE_PIXEL_MASK
	.comm	_PIPE_PIXEL_SHIFT,4,2           ; @PIPE_PIXEL_SHIFT
	.comm	_DRM_SCANOUTPOS_VALID,4,2       ; @DRM_SCANOUTPOS_VALID
	.comm	_DRM_SCANOUTPOS_ACCURATE,4,2    ; @DRM_SCANOUTPOS_ACCURATE
	.comm	_DRM_SCANOUTPOS_INVBL,4,2       ; @DRM_SCANOUTPOS_INVBL
	.no_dead_strip	_i915_get_crtc_scanoutpos
.subsections_via_symbols
