	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nvkm_hwsq_wait_vblank          ## -- Begin function nvkm_hwsq_wait_vblank
	.p2align	4, 0x90
_nvkm_hwsq_wait_vblank:                 ## @nvkm_hwsq_wait_vblank
	.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	%rdi, -48(%rbp)                 ## 8-byte Spill
	movq	(%rdi), %r15
	movq	(%r15), %r13
	movq	%r13, %rdi
	movl	$6357072, %esi                  ## imm = 0x610050
	callq	_nvkm_rd32
	movl	%eax, %ebx
	xorl	%r12d, %r12d
	movl	$0, %r14d
	testb	$2, %bl
	jne	LBB0_1
## %bb.2:
	testl	$512, %ebx                      ## imm = 0x200
	jne	LBB0_3
LBB0_4:
	testl	%r14d, %r14d
	je	LBB0_5
LBB0_6:
	leaq	L_.str.1(%rip), %rsi
	movq	%r15, %rdi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_nvkm_debug
	leal	(%r12,%r12), %r14d
	incl	%r14d
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movl	%r14d, %esi
	xorl	%edx, %edx
	callq	_nvkm_hwsq_wait
	movq	%rbx, %rdi
	movl	%r14d, %esi
	movl	$1, %edx
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nvkm_hwsq_wait                 ## TAILCALL
LBB0_1:
	movq	%r13, %rdi
	movl	$6359872, %esi                  ## imm = 0x610B40
	callq	_nvkm_rd32
	movzwl	%ax, %r14d
	shrl	$16, %eax
	imull	%eax, %r14d
	testl	$512, %ebx                      ## imm = 0x200
	je	LBB0_4
LBB0_3:
	movq	%r13, %rdi
	movl	$6361216, %esi                  ## imm = 0x611080
	callq	_nvkm_rd32
	movzwl	%ax, %ecx
	shrl	$16, %eax
	imull	%eax, %ecx
	xorl	%r12d, %r12d
	cmpl	%r14d, %ecx
	setg	%r12b
	cmovgl	%ecx, %r14d
	testl	%r14d, %r14d
	jne	LBB0_6
LBB0_5:
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nvkm_debug                     ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"WAIT VBLANK !NO ACTIVE HEAD\n"

L_.str.1:                               ## @.str.1
	.asciz	"WAIT VBLANK HEAD%d\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nvkm_hwsq_wait_vblank          ; -- Begin function nvkm_hwsq_wait_vblank
	.p2align	2
_nvkm_hwsq_wait_vblank:                 ; @nvkm_hwsq_wait_vblank
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #80
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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	x19, x0
	mov	w23, #80
	movk	w23, #97, lsl #16
	ldr	x20, [x0]
	ldr	x21, [x20]
	mov	x0, x21
	mov	w1, #80
	movk	w1, #97, lsl #16
	bl	_nvkm_rd32
	mov	x22, x0
	tbnz	w0, #1, LBB0_4
; %bb.1:
	mov	w23, #0
	tbz	w22, #9, LBB0_5
LBB0_2:
	mov	x0, x21
	mov	w1, #4224
	movk	w1, #97, lsl #16
	bl	_nvkm_rd32
	lsr	w8, w0, #16
	and	w9, w0, #0xffff
	mul	w8, w9, w8
	cmp	w8, w23
	csel	w23, w8, w23, gt
	cset	w21, gt
	cbz	w23, LBB0_6
LBB0_3:
	str	x21, [sp]
Lloh0:
	adrp	x1, l_.str.1@PAGE
Lloh1:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x20
	bl	_nvkm_debug
	cmp	w21, #0
	mov	w8, #3
	csinc	w20, w8, wzr, ne
	mov	x0, x19
	mov	x1, x20
	mov	w2, #0
	bl	_nvkm_hwsq_wait
	mov	x0, x19
	mov	x1, x20
	mov	w2, #1
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_nvkm_hwsq_wait
LBB0_4:
	add	w1, w23, #2800
	mov	x0, x21
	bl	_nvkm_rd32
	lsr	w8, w0, #16
	and	w9, w0, #0xffff
	mul	w23, w9, w8
	tbnz	w22, #9, LBB0_2
LBB0_5:
	mov	w21, #0
	cbnz	w23, LBB0_3
LBB0_6:
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x20
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #80
	b	_nvkm_debug
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"WAIT VBLANK !NO ACTIVE HEAD\n"

l_.str.1:                               ; @.str.1
	.asciz	"WAIT VBLANK HEAD%d\n"

.subsections_via_symbols
