	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_i915_get_crtc_scanoutpos       ## -- Begin function i915_get_crtc_scanoutpos
	.p2align	4, 0x90
_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
	subq	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -72(%rbp)                  ## 8-byte Spill
	movq	%r8, %r14
	movq	%rcx, %rbx
	movl	%esi, %r13d
	movq	24(%rbp), %r15
	callq	_to_i915
	movq	%rax, %r12
	movq	%rax, %rdi
	movl	%r13d, %esi
	callq	_intel_get_crtc_for_pipe
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	callq	_INTEL_GEN
	movb	$1, -41(%rbp)                   ## 1-byte Folded Spill
	cmpl	$4, %eax
	jg	LBB0_4
## %bb.1:
	movq	%r12, %rdi
	callq	_IS_G4X
	testq	%rax, %rax
	jne	LBB0_4
## %bb.2:
	movq	%r12, %rdi
	movl	$2, %esi
	callq	_IS_GEN
	testq	%rax, %rax
	jne	LBB0_4
## %bb.3:
	movq	_I915_MODE_FLAG_USE_SCANLINE_COUNTER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, (%r15)
	setne	-41(%rbp)                       ## 1-byte Folded Spill
LBB0_4:
	xorl	%edi, %edi
	cmpl	$0, 28(%r15)
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_6
## %bb.5:
	movl	%r13d, %edi
	callq	_pipe_name
	leaq	L_.str(%rip), %rdi
	movl	%eax, %esi
	callq	_DRM_DEBUG_DRIVER
	xorl	%eax, %eax
	jmp	LBB0_20
LBB0_6:
	movq	%rbx, -64(%rbp)                 ## 8-byte Spill
	movq	%r14, -80(%rbp)                 ## 8-byte Spill
	movl	4(%r15), %eax
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	8(%r15), %ecx
	movl	12(%r15), %ebx
	movl	16(%r15), %edi
	movl	20(%r15), %r14d
	movq	_DRM_MODE_FLAG_INTERLACE@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	testl	%eax, 24(%r15)
	movl	%ecx, -56(%rbp)                 ## 4-byte Spill
	je	LBB0_7
## %bb.8:
	movl	$2, %esi
	callq	_DIV_ROUND_UP
	movl	%eax, -48(%rbp)                 ## 4-byte Spill
	movl	%r14d, %eax
	shrl	$31, %eax
	addl	%r14d, %eax
	sarl	%eax
	movl	%ebx, %ecx
	shrl	$31, %ecx
	addl	%ebx, %ecx
	sarl	%ecx
	movl	%eax, %r14d
	movl	%ecx, %ebx
	jmp	LBB0_9
LBB0_7:
	movl	%edi, -48(%rbp)                 ## 4-byte Spill
LBB0_9:
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	%r12, %rdi
	callq	_spin_lock_irqsave
	testq	%r15, %r15
	je	LBB0_11
## %bb.10:
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, (%r15)
LBB0_11:
	cmpb	$0, -41(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_13
## %bb.12:
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	callq	___intel_get_crtc_scanline
	movl	%eax, %r15d
	jmp	LBB0_14
LBB0_13:
	movl	%r13d, %edi
	callq	_PIPEFRAMEPIXEL
	movl	%eax, %edi
	callq	_I915_READ_FW
	movq	_PIPE_PIXEL_MASK@GOTPCREL(%rip), %rcx
	andl	(%rcx), %eax
	movq	_PIPE_PIXEL_SHIFT@GOTPCREL(%rip), %rcx
	movb	(%rcx), %cl
	sarl	%cl, %eax
	movl	-52(%rbp), %edx                 ## 4-byte Reload
	movl	-48(%rbp), %ecx                 ## 4-byte Reload
	imull	%edx, %ecx
	movl	%ecx, -48(%rbp)                 ## 4-byte Spill
	imull	%edx, %r14d
	imull	%edx, %ebx
	leal	-1(%rbx), %ecx
	cmpl	%ebx, %eax
	cmovgel	%ecx, %eax
	movl	%edx, %ecx
	subl	-56(%rbp), %ecx                 ## 4-byte Folded Reload
	addl	%ecx, %eax
	cltd
	idivl	%ebx
	movl	%edx, %r15d
LBB0_14:
	movq	16(%rbp), %r13
	testq	%r13, %r13
	je	LBB0_16
## %bb.15:
	xorl	%eax, %eax
	callq	_ktime_get
	movl	%eax, (%r13)
LBB0_16:
	movq	%r12, %rdi
	callq	_spin_unlock_irqrestore
	xorl	%edx, %edx
	cmpl	-48(%rbp), %r15d                ## 4-byte Folded Reload
	cmovgel	%edx, %ebx
	subl	%r14d, %ebx
	addl	%r15d, %ebx
	cmpb	$0, -41(%rbp)                   ## 1-byte Folded Reload
	je	LBB0_18
## %bb.17:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	%ebx, (%rax)
	jmp	LBB0_19
LBB0_18:
	movl	%ebx, %eax
	cltd
	idivl	-52(%rbp)                       ## 4-byte Folded Reload
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, (%rcx)
LBB0_19:
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movl	%edx, (%rax)
	movl	$1, %eax
LBB0_20:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_I915_MODE_FLAG_USE_SCANLINE_COUNTER,4,2 ## @I915_MODE_FLAG_USE_SCANLINE_COUNTER
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"trying to get scanoutpos for disabled pipe %c\n"

	.comm	_DRM_MODE_FLAG_INTERLACE,4,2    ## @DRM_MODE_FLAG_INTERLACE
	.comm	_PIPE_PIXEL_MASK,4,2            ## @PIPE_PIXEL_MASK
	.comm	_PIPE_PIXEL_SHIFT,4,2           ## @PIPE_PIXEL_SHIFT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_i915_get_crtc_scanoutpos       ; -- Begin function i915_get_crtc_scanoutpos
	.p2align	2
_i915_get_crtc_scanoutpos:              ; @i915_get_crtc_scanoutpos
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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	x27, x7
	mov	x21, x6
	mov	x24, x5
	mov	x19, x4
	mov	x20, x3
	mov	x23, x1
	bl	_to_i915
	mov	x22, x0
	mov	x1, x23
	bl	_intel_get_crtc_for_pipe
	mov	x25, x0
	mov	x0, x22
	bl	_INTEL_GEN
	cmp	w0, #4
	b.gt	LBB0_3
; %bb.1:
	mov	x0, x22
	bl	_IS_G4X
	cbnz	x0, LBB0_3
; %bb.2:
	mov	x0, x22
	mov	w1, #2
	bl	_IS_GEN
	cbz	x0, LBB0_19
LBB0_3:
	mov	w28, #1
LBB0_4:
	ldr	w8, [x27, #28]
	cmp	w8, #0
	cset	w0, eq
	bl	_WARN_ON
	cbz	x0, LBB0_6
; %bb.5:
	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_18
LBB0_6:
	stp	x21, x20, [sp, #8]              ; 16-byte Folded Spill
	str	x19, [sp, #24]                  ; 8-byte Folded Spill
	ldp	w19, w10, [x27, #4]
	ldp	w20, w26, [x27, #12]
	ldp	w21, w8, [x27, #20]
Lloh2:
	adrp	x9, _DRM_MODE_FLAG_INTERLACE@GOTPAGE
Lloh3:
	ldr	x9, [x9, _DRM_MODE_FLAG_INTERLACE@GOTPAGEOFF]
Lloh4:
	ldr	w9, [x9]
	mov	x27, x10
	tst	w9, w8
	b.eq	LBB0_8
; %bb.7:
	mov	x0, x26
	mov	w1, #2
	bl	_DIV_ROUND_UP
	mov	x26, x0
	cmp	w21, #0
	cinc	w8, w21, lt
	asr	w21, w8, #1
	cmp	w20, #0
	cinc	w8, w20, lt
	asr	w20, w8, #1
LBB0_8:
	mov	x0, x22
	bl	_spin_lock_irqsave
	cbz	x24, LBB0_10
; %bb.9:
	bl	_ktime_get
	str	w0, [x24]
LBB0_10:
	cbz	w28, LBB0_12
; %bb.11:
	mov	x0, x25
	bl	___intel_get_crtc_scanline
	mov	x23, x0
	ldr	x24, [sp, #8]                   ; 8-byte Folded Reload
	cbnz	x24, LBB0_13
	b	LBB0_14
LBB0_12:
	mov	x0, x23
	bl	_PIPEFRAMEPIXEL
	bl	_I915_READ_FW
Lloh5:
	adrp	x8, _PIPE_PIXEL_MASK@GOTPAGE
Lloh6:
	ldr	x8, [x8, _PIPE_PIXEL_MASK@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
	and	w8, w8, w0
Lloh8:
	adrp	x9, _PIPE_PIXEL_SHIFT@GOTPAGE
Lloh9:
	ldr	x9, [x9, _PIPE_PIXEL_SHIFT@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	asr	w8, w8, w9
	mul	w26, w26, w19
	mul	w21, w21, w19
	mul	w20, w20, w19
	sub	w9, w20, #1
	cmp	w8, w20
	csel	w8, w8, w9, lt
	sub	w9, w19, w27
	add	w8, w9, w8
	sdiv	w9, w8, w20
	msub	w23, w9, w20, w8
	ldr	x24, [sp, #8]                   ; 8-byte Folded Reload
	cbz	x24, LBB0_14
LBB0_13:
	bl	_ktime_get
	str	w0, [x24]
LBB0_14:
	mov	x0, x22
	bl	_spin_unlock_irqrestore
	cmp	w23, w26
	csel	w8, w20, wzr, lt
	sub	w8, w8, w21
	add	w9, w8, w23
	cbz	w28, LBB0_16
; %bb.15:
	mov	w8, #0
	ldr	x10, [sp, #16]                  ; 8-byte Folded Reload
	str	w9, [x10]
	b	LBB0_17
LBB0_16:
	sdiv	w8, w9, w19
	ldr	x10, [sp, #16]                  ; 8-byte Folded Reload
	str	w8, [x10]
	msub	w8, w8, w19, w9
LBB0_17:
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	str	w8, [x9]
	mov	w0, #1
LBB0_18:
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
LBB0_19:
	ldr	w8, [x27]
Lloh11:
	adrp	x9, _I915_MODE_FLAG_USE_SCANLINE_COUNTER@GOTPAGE
Lloh12:
	ldr	x9, [x9, _I915_MODE_FLAG_USE_SCANLINE_COUNTER@GOTPAGEOFF]
Lloh13:
	ldr	w9, [x9]
	tst	w9, w8
	cset	w28, ne
	b	LBB0_4
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_I915_MODE_FLAG_USE_SCANLINE_COUNTER,4,2 ; @I915_MODE_FLAG_USE_SCANLINE_COUNTER
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"trying to get scanoutpos for disabled pipe %c\n"

	.comm	_DRM_MODE_FLAG_INTERLACE,4,2    ; @DRM_MODE_FLAG_INTERLACE
	.comm	_PIPE_PIXEL_MASK,4,2            ; @PIPE_PIXEL_MASK
	.comm	_PIPE_PIXEL_SHIFT,4,2           ; @PIPE_PIXEL_SHIFT
.subsections_via_symbols
