	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nouveau_gem_pushbuf_reloc_apply
_nouveau_gem_pushbuf_reloc_apply:       ## @nouveau_gem_pushbuf_reloc_apply
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movl	(%rsi), %esi
	movl	16(%rbx), %edi
	movl	$40, %edx
	callq	_u_memcpya
	movq	%rax, %r12
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_1
## %bb.3:
	movq	%r12, %rdi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_PTR_ERR                        ## TAILCALL
LBB0_1:
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	cmpl	$0, (%rbx)
	je	LBB0_2
## %bb.4:
	movq	%r14, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, -48(%rbp)                 ## 8-byte Spill
	movq	%r12, %r15
	addq	$32, %r15
	xorl	%r13d, %r13d
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
	jmp	LBB0_5
LBB0_22:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%edx, %r12d
LBB0_26:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	%rdi, %rbx
	movq	(%rdi), %rdi
	callq	_spin_lock
	movq	%rbx, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_ttm_bo_wait
	movq	(%rbx), %rdi
	movl	%eax, %ebx
	callq	_spin_unlock
	testl	%ebx, %ebx
	jne	LBB0_27
## %bb.28:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	-16(%r15), %esi
	sarl	$2, %esi
	movq	%r14, %rdi
	movl	%r12d, %edx
	callq	_nouveau_bo_wr32
	movq	-64(%rbp), %r14                 ## 8-byte Reload
	movq	-72(%rbp), %rbx                 ## 8-byte Reload
LBB0_29:                                ##   in Loop: Header=BB0_5 Depth=1
	incq	%r13
	movl	(%rbx), %eax
	addq	$40, %r15
	cmpq	%rax, %r13
	jae	LBB0_30
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	-32(%r15), %rax
	xorl	%edi, %edi
	cmpq	8(%rbx), %rax
	seta	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_6
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-32(%r15), %r12
	shlq	$5, %r12
	cmpq	$0, 16(%r14,%r12)
	jne	LBB0_29
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	-24(%r15), %rax
	xorl	%edi, %edi
	cmpq	8(%rbx), %rax
	seta	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_10
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	-24(%r15), %rax
	shlq	$5, %rax
	movq	%r14, %rbx
	movq	24(%r14,%rax), %r14
	movl	-16(%r15), %eax
	movl	16(%r14), %edx
	movq	_PAGE_SHIFT@GOTPCREL(%rip), %rcx
	movzbl	(%rcx), %ecx
	shll	%cl, %edx
	addl	$4, %eax
	xorl	%edi, %edi
	cmpl	%edx, %eax
	setg	%dil
	callq	_unlikely
	testq	%rax, %rax
	jne	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_5 Depth=1
	leaq	8(%r14), %rdi
	cmpl	$0, 24(%r14)
	jne	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_5 Depth=1
	leaq	24(%r14), %rcx
	movl	16(%r14), %edx
	movq	%rdi, -80(%rbp)                 ## 8-byte Spill
	xorl	%esi, %esi
	callq	_ttm_bo_kmap
	testl	%eax, %eax
	jne	LBB0_15
## %bb.16:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	$1, (%r14)
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	-80(%rbp), %rdi                 ## 8-byte Reload
LBB0_17:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	-12(%r15), %eax
	movq	_NOUVEAU_GEM_RELOC_LOW@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	-8(%r15), %edx
	addl	(%rbx,%r12), %edx
	jmp	LBB0_21
LBB0_19:                                ##   in Loop: Header=BB0_5 Depth=1
                                        ## implicit-def: $edx
	movq	_NOUVEAU_GEM_RELOC_HIGH@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	jne	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	-8(%r15), %edx
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	_NOUVEAU_GEM_RELOC_OR@GOTPCREL(%rip), %rcx
	testl	%eax, (%rcx)
	je	LBB0_22
## %bb.23:                              ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%rbx,%r12), %rax
	movq	_NOUVEAU_GEM_DOMAIN_GART@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_25
## %bb.24:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	%edx, %r12d
	orl	-4(%r15), %r12d
	jmp	LBB0_26
LBB0_25:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	%edx, %r12d
	orl	(%r15), %r12d
	jmp	LBB0_26
LBB0_2:
	xorl	%ebx, %ebx
	jmp	LBB0_32
LBB0_6:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_7
LBB0_30:
	xorl	%ebx, %ebx
	jmp	LBB0_31
LBB0_10:
	leaq	L_.str.1(%rip), %rsi
	jmp	LBB0_7
LBB0_12:
	leaq	L_.str.2(%rip), %rsi
LBB0_7:
	xorl	%ebx, %ebx
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_NV_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
LBB0_31:
	movq	-48(%rbp), %r12                 ## 8-byte Reload
LBB0_32:
	movq	%r12, %rdi
	callq	_kfree
	movl	%ebx, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_27:
	leaq	L_.str.4(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_NV_ERROR
	jmp	LBB0_31
LBB0_15:
	movl	%eax, %ebx
	leaq	L_.str.3(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	xorl	%eax, %eax
	callq	_NV_ERROR
	jmp	LBB0_31
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"reloc bo index invalid\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"reloc container bo index invalid\n"

	.comm	_PAGE_SHIFT,4,2                 ## @PAGE_SHIFT
L_.str.2:                               ## @.str.2
	.asciz	"reloc outside of bo\n"

L_.str.3:                               ## @.str.3
	.asciz	"failed kmap for reloc\n"

	.comm	_NOUVEAU_GEM_RELOC_LOW,4,2      ## @NOUVEAU_GEM_RELOC_LOW
	.comm	_NOUVEAU_GEM_RELOC_HIGH,4,2     ## @NOUVEAU_GEM_RELOC_HIGH
	.comm	_NOUVEAU_GEM_RELOC_OR,4,2       ## @NOUVEAU_GEM_RELOC_OR
	.comm	_NOUVEAU_GEM_DOMAIN_GART,8,3    ## @NOUVEAU_GEM_DOMAIN_GART
L_.str.4:                               ## @.str.4
	.asciz	"reloc wait_idle failed: %d\n"

	.no_dead_strip	_nouveau_gem_pushbuf_reloc_apply
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nouveau_gem_pushbuf_reloc_apply
_nouveau_gem_pushbuf_reloc_apply:       ; @nouveau_gem_pushbuf_reloc_apply
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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	x21, x2
	mov	x22, x1
	mov	x20, x0
	ldr	w0, [x1, #16]
	ldr	w1, [x1]
	mov	w2, #40
	bl	_u_memcpya
	mov	x19, x0
	bl	_IS_ERR
	cbz	x0, LBB0_2
; %bb.1:
	mov	x0, x19
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	b	_PTR_ERR
LBB0_2:
	ldr	w8, [x22]
	cbz	w8, LBB0_23
; %bb.3:
	str	x20, [sp, #8]                   ; 8-byte Folded Spill
	mov	x27, #0
	add	x28, x19, #16
	b	LBB0_9
LBB0_4:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x28, #16]
LBB0_5:                                 ;   in Loop: Header=BB0_9 Depth=1
	orr	w25, w8, w25
LBB0_6:                                 ;   in Loop: Header=BB0_9 Depth=1
	ldr	x0, [x24]
	bl	_spin_lock
	mov	x0, x24
	mov	w1, #0
	mov	w2, #0
	mov	w3, #0
	bl	_ttm_bo_wait
	mov	x26, x0
	ldr	x0, [x24]
	bl	_spin_unlock
	cbnz	w26, LBB0_28
; %bb.7:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x28]
	asr	w1, w8, #2
	mov	x0, x23
	mov	x2, x25
	bl	_nouveau_bo_wr32
LBB0_8:                                 ;   in Loop: Header=BB0_9 Depth=1
	add	x27, x27, #1
	ldr	w8, [x22]
	add	x28, x28, #40
	cmp	x27, x8
	b.hs	LBB0_23
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldur	x8, [x28, #-16]
	ldr	x9, [x22, #8]
	cmp	x8, x9
	cset	w0, hi
	bl	_unlikely
	cbnz	x0, LBB0_24
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	ldur	x20, [x28, #-16]
	add	x8, x21, x20, lsl #5
	ldr	x8, [x8, #16]
	cbnz	x8, LBB0_8
; %bb.11:                               ;   in Loop: Header=BB0_9 Depth=1
	ldur	x8, [x28, #-8]
	ldr	x9, [x22, #8]
	cmp	x8, x9
	cset	w0, hi
	bl	_unlikely
	cbnz	x0, LBB0_25
; %bb.12:                               ;   in Loop: Header=BB0_9 Depth=1
	ldur	x8, [x28, #-8]
	add	x8, x21, x8, lsl #5
	ldr	x23, [x8, #24]
	ldr	w8, [x28]
	add	w8, w8, #4
	ldr	w9, [x23, #16]
Lloh0:
	adrp	x10, _PAGE_SHIFT@GOTPAGE
Lloh1:
	ldr	x10, [x10, _PAGE_SHIFT@GOTPAGEOFF]
Lloh2:
	ldr	w10, [x10]
	lsl	w9, w9, w10
	cmp	w8, w9
	cset	w0, gt
	bl	_unlikely
	cbnz	x0, LBB0_26
; %bb.13:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x24, x23, #8
	mov	x3, x23
	ldr	w8, [x3, #24]!
	cbnz	w8, LBB0_16
; %bb.14:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w2, [x23, #16]
	mov	x0, x24
	mov	w1, #0
	bl	_ttm_bo_kmap
	cbnz	w0, LBB0_29
; %bb.15:                               ;   in Loop: Header=BB0_9 Depth=1
	mov	w8, #1
	str	w8, [x23]
LBB0_16:                                ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x28, #4]
Lloh3:
	adrp	x9, _NOUVEAU_GEM_RELOC_LOW@GOTPAGE
Lloh4:
	ldr	x9, [x9, _NOUVEAU_GEM_RELOC_LOW@GOTPAGEOFF]
Lloh5:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_18
; %bb.17:                               ;   in Loop: Header=BB0_9 Depth=1
	lsl	x9, x20, #5
	ldr	w9, [x21, x9]
	ldr	w10, [x28, #8]
	add	w25, w10, w9
	b	LBB0_20
LBB0_18:                                ;   in Loop: Header=BB0_9 Depth=1
Lloh6:
	adrp	x9, _NOUVEAU_GEM_RELOC_HIGH@GOTPAGE
Lloh7:
	ldr	x9, [x9, _NOUVEAU_GEM_RELOC_HIGH@GOTPAGEOFF]
Lloh8:
	ldr	w9, [x9]
                                        ; implicit-def: $w25
	tst	w9, w8
	b.ne	LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w25, [x28, #8]
LBB0_20:                                ;   in Loop: Header=BB0_9 Depth=1
Lloh9:
	adrp	x9, _NOUVEAU_GEM_RELOC_OR@GOTPAGE
Lloh10:
	ldr	x9, [x9, _NOUVEAU_GEM_RELOC_OR@GOTPAGEOFF]
Lloh11:
	ldr	w9, [x9]
	tst	w9, w8
	b.eq	LBB0_6
; %bb.21:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x8, x21, x20, lsl #5
	ldr	x8, [x8, #8]
Lloh12:
	adrp	x9, _NOUVEAU_GEM_DOMAIN_GART@GOTPAGE
Lloh13:
	ldr	x9, [x9, _NOUVEAU_GEM_DOMAIN_GART@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_4
; %bb.22:                               ;   in Loop: Header=BB0_9 Depth=1
	ldr	w8, [x28, #12]
	b	LBB0_5
LBB0_23:
	mov	w26, #0
	b	LBB0_31
LBB0_24:
Lloh15:
	adrp	x1, l_.str@PAGE
Lloh16:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_27
LBB0_25:
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_27
LBB0_26:
Lloh19:
	adrp	x1, l_.str.2@PAGE
Lloh20:
	add	x1, x1, l_.str.2@PAGEOFF
LBB0_27:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_NV_ERROR
Lloh21:
	adrp	x8, _EINVAL@GOTPAGE
Lloh22:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh23:
	ldr	w8, [x8]
	neg	w26, w8
	b	LBB0_31
LBB0_28:
	str	x26, [sp]
Lloh24:
	adrp	x1, l_.str.4@PAGE
Lloh25:
	add	x1, x1, l_.str.4@PAGEOFF
	b	LBB0_30
LBB0_29:
	mov	x26, x0
Lloh26:
	adrp	x1, l_.str.3@PAGE
Lloh27:
	add	x1, x1, l_.str.3@PAGEOFF
LBB0_30:
	ldr	x0, [sp, #8]                    ; 8-byte Folded Reload
	bl	_NV_ERROR
LBB0_31:
	mov	x0, x19
	bl	_kfree
	mov	x0, x26
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"reloc bo index invalid\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"reloc container bo index invalid\n"

	.comm	_PAGE_SHIFT,4,2                 ; @PAGE_SHIFT
l_.str.2:                               ; @.str.2
	.asciz	"reloc outside of bo\n"

l_.str.3:                               ; @.str.3
	.asciz	"failed kmap for reloc\n"

	.comm	_NOUVEAU_GEM_RELOC_LOW,4,2      ; @NOUVEAU_GEM_RELOC_LOW
	.comm	_NOUVEAU_GEM_RELOC_HIGH,4,2     ; @NOUVEAU_GEM_RELOC_HIGH
	.comm	_NOUVEAU_GEM_RELOC_OR,4,2       ; @NOUVEAU_GEM_RELOC_OR
	.comm	_NOUVEAU_GEM_DOMAIN_GART,8,3    ; @NOUVEAU_GEM_DOMAIN_GART
l_.str.4:                               ; @.str.4
	.asciz	"reloc wait_idle failed: %d\n"

	.no_dead_strip	_nouveau_gem_pushbuf_reloc_apply
.subsections_via_symbols
