	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function gp102_run_secure_scrub
_gp102_run_secure_scrub:                ## @gp102_run_secure_scrub
	.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	$24, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r12
	movq	(%rdi), %r14
	leaq	L_.str(%rip), %rsi
	callq	_nvkm_debug
	movq	(%r14), %rax
	movq	(%rax), %rdi
	addq	$8, %rdi
	callq	_nvkm_engine_ref
	movq	%rax, %rbx
	movq	%rax, -56(%rbp)
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	jne	LBB0_9
## %bb.1:
	movq	(%r14), %rax
	movq	(%rax), %rax
	movq	(%rax), %r14
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_nvkm_falcon_get
	leaq	L_.str.1(%rip), %rdx
	movq	%r12, %rdi
	movq	%r14, %rsi
	callq	_hs_ucode_load_blob
	movq	%rax, %rbx
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_2
LBB0_9:
	movq	%rbx, %rdi
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_2:
	movq	%r14, %rdi
	callq	_nvkm_falcon_reset
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_nvkm_falcon_bind_context
	movslq	(%rbx), %rax
	movslq	(%rbx,%rax), %r13
	movslq	4(%rbx), %rax
	movq	%rbx, %rsi
	addq	%rax, %rsi
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	(%rbx,%r13), %edx
	movl	4(%rbx,%r13), %ecx
	movl	%edx, %r8d
	sarl	$8, %r8d
	movl	$0, (%rsp)
	movq	%r14, %rdi
	xorl	%r9d, %r9d
	callq	_nvkm_falcon_load_imem
	movq	8(%rbx,%r13), %rax
	movslq	(%rax), %rdi
	movq	%rdi, %r15
	addq	-48(%rbp), %r15                 ## 8-byte Folded Reload
                                        ## kill: def $edi killed $edi killed $rdi
	movl	$256, %esi                      ## imm = 0x100
	callq	_ALIGN
	movq	8(%rbx,%r13), %rcx
	movl	(%rcx), %r8d
	movl	4(%rcx), %ecx
	sarl	$8, %r8d
	movl	$1, (%rsp)
	movq	%r14, %rdi
	movq	%r15, %rsi
	movl	%eax, %edx
	xorl	%r9d, %r9d
	callq	_nvkm_falcon_load_imem
	movslq	16(%rbx,%r13), %rsi
	addq	-48(%rbp), %rsi                 ## 8-byte Folded Reload
	movl	20(%rbx,%r13), %ecx
	movq	%r14, %rdi
	xorl	%edx, %edx
	xorl	%r8d, %r8d
	callq	_nvkm_falcon_load_dmem
	movq	%rbx, %rdi
	callq	_kfree
	movq	%r14, %rdi
	xorl	%esi, %esi
	callq	_nvkm_falcon_set_start_addr
	movq	%r14, %rdi
	callq	_nvkm_falcon_start
	movq	%r14, %rdi
	movl	$500, %esi                      ## imm = 0x1F4
	callq	_nvkm_falcon_wait_for_halt
	testl	%eax, %eax
	js	LBB0_3
## %bb.5:
	movl	%eax, %ebx
	movq	%r14, %rdi
	callq	_nvkm_falcon_reset
	movq	%r12, %rdi
	callq	_gp102_secboot_scrub_required
	testq	%rax, %rax
	je	LBB0_7
## %bb.6:
	leaq	L_.str.3(%rip), %rsi
	movq	%r12, %rdi
	callq	_nvkm_error
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_4
LBB0_3:
	leaq	L_.str.2(%rip), %rsi
	movq	%r12, %rdi
	callq	_nvkm_error
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
LBB0_4:
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_8
LBB0_7:
	leaq	L_.str.4(%rip), %rsi
	movq	%r12, %rdi
	callq	_nvkm_debug
                                        ## kill: def $ebx killed $ebx def $rbx
LBB0_8:
	movq	%r14, %rdi
	movq	%r12, %rsi
	callq	_nvkm_falcon_put
	leaq	-56(%rbp), %rdi
	callq	_nvkm_engine_unref
	movl	%ebx, %eax
	addq	$24, %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	"running VPR scrubber binary on NVDEC...\n"

L_.str.1:                               ## @.str.1
	.asciz	"nvdec/scrubber"

L_.str.2:                               ## @.str.2
	.asciz	"failed to run VPR scrubber binary!\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
L_.str.3:                               ## @.str.3
	.asciz	"VPR scrubber binary failed!\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.4:                               ## @.str.4
	.asciz	"VPR scrub successfully completed\n"

	.no_dead_strip	_gp102_run_secure_scrub
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function gp102_run_secure_scrub
_gp102_run_secure_scrub:                ; @gp102_run_secure_scrub
	.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
	ldr	x21, [x0]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_nvkm_debug
	ldr	x8, [x21]
	ldr	x8, [x8]
	add	x0, x8, #8
	bl	_nvkm_engine_ref
	mov	x20, x0
	str	x0, [sp, #8]
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x20
	b	LBB0_4
LBB0_2:
	ldr	x8, [x21]
	ldr	x8, [x8]
	ldr	x20, [x8]
	mov	x0, x20
	mov	x1, x19
	bl	_nvkm_falcon_get
Lloh2:
	adrp	x2, l_.str.1@PAGE
Lloh3:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	mov	x1, x20
	bl	_hs_ucode_load_blob
	mov	x21, x0
	bl	_IS_ERR
	cbz	x0, LBB0_5
; %bb.3:
	mov	x0, x21
LBB0_4:
	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	_PTR_ERR
LBB0_5:
	mov	x0, x20
	bl	_nvkm_falcon_reset
	mov	x0, x20
	mov	x1, #0
	bl	_nvkm_falcon_bind_context
	ldpsw	x8, x9, [x21]
	ldrsw	x8, [x21, x8]
	add	x24, x21, x8
	add	x22, x21, x9
	ldp	w2, w3, [x24]
	asr	w4, w2, #8
	mov	x0, x20
	mov	x1, x22
	mov	w5, #0
	mov	w6, #0
	bl	_nvkm_falcon_load_imem
	ldr	x8, [x24, #8]
	ldrsw	x0, [x8]
	add	x23, x22, x0
                                        ; kill: def $w0 killed $w0 killed $x0
	mov	w1, #256
	bl	_ALIGN
	mov	x2, x0
	ldr	x8, [x24, #8]
	ldp	w8, w3, [x8]
	asr	w4, w8, #8
	mov	x0, x20
	mov	x1, x23
	mov	w5, #0
	mov	w6, #1
	bl	_nvkm_falcon_load_imem
	ldp	w8, w3, [x24, #16]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	add	x1, x22, x8
	mov	x0, x20
	mov	w2, #0
	mov	w4, #0
	bl	_nvkm_falcon_load_dmem
	mov	x0, x21
	bl	_kfree
	mov	x0, x20
	mov	w1, #0
	bl	_nvkm_falcon_set_start_addr
	mov	x0, x20
	bl	_nvkm_falcon_start
	mov	x0, x20
	mov	w1, #500
	bl	_nvkm_falcon_wait_for_halt
	tbnz	w0, #31, LBB0_8
; %bb.6:
	mov	x21, x0
	mov	x0, x20
	bl	_nvkm_falcon_reset
	mov	x0, x19
	bl	_gp102_secboot_scrub_required
	cbz	x0, LBB0_10
; %bb.7:
Lloh4:
	adrp	x1, l_.str.3@PAGE
Lloh5:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_nvkm_error
Lloh6:
	adrp	x8, _EINVAL@GOTPAGE
Lloh7:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_9
LBB0_8:
Lloh8:
	adrp	x1, l_.str.2@PAGE
Lloh9:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_nvkm_error
Lloh10:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh11:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_11
LBB0_10:
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_nvkm_debug
LBB0_11:
	mov	x0, x20
	mov	x1, x19
	bl	_nvkm_falcon_put
	add	x0, sp, #8
	bl	_nvkm_engine_unref
	mov	x0, x21
	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
	ret
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh10, Lloh11
	.loh AdrpAdd	Lloh8, Lloh9
	.loh AdrpAdd	Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"running VPR scrubber binary on NVDEC...\n"

l_.str.1:                               ; @.str.1
	.asciz	"nvdec/scrubber"

l_.str.2:                               ; @.str.2
	.asciz	"failed to run VPR scrubber binary!\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
l_.str.3:                               ; @.str.3
	.asciz	"VPR scrubber binary failed!\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.4:                               ; @.str.4
	.asciz	"VPR scrub successfully completed\n"

	.no_dead_strip	_gp102_run_secure_scrub
.subsections_via_symbols
