	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_bo_pin                 ## -- Begin function nouveau_bo_pin
	.p2align	4, 0x90
_nouveau_bo_pin:                        ## @nouveau_bo_pin
	.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
	movl	%edx, %r14d
	movl	%esi, -68(%rbp)                 ## 4-byte Spill
	movq	%rdi, %r13
	leaq	16(%rdi), %r12
	movl	24(%rdi), %edi
	callq	_nouveau_bdev
	movq	%rax, %rbx
	movq	%r12, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	callq	_ttm_bo_reserve
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_25
## %bb.1:
	movq	8(%rbx), %rax
	movq	_NV_DEVICE_INFO_V0_TESLA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	-68(%rbp), %r8d                 ## 4-byte Reload
	movq	%rbx, -56(%rbp)                 ## 8-byte Spill
	movq	%r13, -64(%rbp)                 ## 8-byte Spill
	jl	LBB0_5
## %bb.2:
	testl	%r14d, %r14d
	je	LBB0_5
## %bb.3:
	movq	_TTM_PL_FLAG_VRAM@GOTPCREL(%rip), %rax
	cmpl	%r8d, (%rax)
	jne	LBB0_5
## %bb.4:
	cmpl	$0, (%r13)
	je	LBB0_7
LBB0_5:
	leaq	8(%r13), %rsi
	movq	8(%r13), %rdx
	xorl	%ebx, %ebx
	testq	%rdx, %rdx
	je	LBB0_6
## %bb.9:
	movl	(%r12), %ecx
	movl	$1, %eax
	shll	%cl, %eax
	btl	%ecx, %r8d
	movl	$0, %r14d
	jb	LBB0_11
	jmp	LBB0_10
LBB0_6:
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	$1, %eax
	xorl	%r14d, %r14d
LBB0_19:
	movq	%rax, 8(%r13)
	xorl	%r15d, %r15d
	movq	%r13, %rdi
	movl	%r8d, %esi
	xorl	%edx, %edx
	callq	_nouveau_bo_placement_set
	decq	8(%r13)
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_nouveau_bo_validate
	movl	%eax, %ebx
	testl	%eax, %eax
	jne	LBB0_12
## %bb.20:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	incq	(%rax)
	movl	(%r12), %eax
	cmpl	$129, %eax
	je	LBB0_23
## %bb.21:
	cmpl	$128, %eax
	jne	LBB0_24
## %bb.22:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	20(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	subl	%eax, 4(%rcx)
	jmp	LBB0_24
LBB0_7:
	movl	$1, (%r13)
	leaq	8(%r13), %rsi
	cmpq	$0, 8(%r13)
	je	LBB0_16
## %bb.8:
	movb	(%r12), %cl
	movl	$1, %eax
	shll	%cl, %eax
	movb	$1, %bl
LBB0_10:
	movq	%rsi, %r14
	leaq	L_.str(%rip), %rsi
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	movq	%r12, %rdx
	movl	%eax, %ecx
	callq	_NV_ERROR
	movq	%r14, %rsi
	movq	_EBUSY@GOTPCREL(%rip), %rax
	movl	%ebx, %r14d
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	(%rsi), %rdx
LBB0_11:
	incq	%rdx
	movq	%rdx, (%rsi)
LBB0_12:
	testb	%r14b, %r14b
	je	LBB0_15
LBB0_13:
	testl	%ebx, %ebx
	je	LBB0_15
## %bb.14:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	$0, (%rax)
LBB0_15:
	movl	%ebx, %r15d
LBB0_24:
	movq	%r12, %rdi
	callq	_ttm_bo_unreserve
LBB0_25:
	movl	%r15d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_23:
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movl	20(%rax), %eax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	subl	%eax, (%rcx)
	jmp	LBB0_24
LBB0_16:
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	%r8d, %r15d
	movq	_TTM_PL_FLAG_TT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r13, %rdi
	xorl	%edx, %edx
	callq	_nouveau_bo_placement_set
	movq	%r13, %rdi
	xorl	%esi, %esi
	xorl	%edx, %edx
	callq	_nouveau_bo_validate
	testl	%eax, %eax
	je	LBB0_18
## %bb.17:
	movl	%eax, %ebx
	movb	$1, %r14b
	testb	%r14b, %r14b
	jne	LBB0_13
	jmp	LBB0_15
LBB0_18:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	incq	%rax
	movb	$1, %r14b
	movl	%r15d, %r8d
	jmp	LBB0_19
	.cfi_endproc
                                        ## -- End function
	.comm	_NV_DEVICE_INFO_V0_TESLA,8,3    ## @NV_DEVICE_INFO_V0_TESLA
	.comm	_TTM_PL_FLAG_VRAM,4,2           ## @TTM_PL_FLAG_VRAM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"bo %p pinned elsewhere: 0x%08x vs 0x%08x\n"

	.comm	_EBUSY,4,2                      ## @EBUSY
	.comm	_TTM_PL_FLAG_TT,4,2             ## @TTM_PL_FLAG_TT
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_nouveau_bo_pin                 ; -- Begin function nouveau_bo_pin
	.p2align	2
_nouveau_bo_pin:                        ; @nouveau_bo_pin
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w25, -72
	.cfi_offset w26, -80
	mov	x24, x2
	mov	x22, x1
	mov	x20, x0
	add	x19, x0, #16
	ldr	w0, [x0, #24]
	bl	_nouveau_bdev
	mov	x21, x0
	mov	x0, x19
	mov	w1, #0
	mov	w2, #0
	mov	x3, #0
	bl	_ttm_bo_reserve
	mov	x23, x0
	cbnz	w0, LBB0_22
; %bb.1:
	ldr	x8, [x21, #8]
Lloh0:
	adrp	x9, _NV_DEVICE_INFO_V0_TESLA@GOTPAGE
Lloh1:
	ldr	x9, [x9, _NV_DEVICE_INFO_V0_TESLA@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	cmp	x8, x9
	b.lt	LBB0_5
; %bb.2:
	cbz	w24, LBB0_5
; %bb.3:
Lloh3:
	adrp	x8, _TTM_PL_FLAG_VRAM@GOTPAGE
Lloh4:
	ldr	x8, [x8, _TTM_PL_FLAG_VRAM@GOTPAGEOFF]
Lloh5:
	ldr	w8, [x8]
	cmp	w8, w22
	b.ne	LBB0_5
; %bb.4:
	ldr	w8, [x20]
	cbz	w8, LBB0_14
LBB0_5:
	mov	x24, x20
	ldr	x8, [x24, #8]!
	mov	w9, #1
	cbz	x8, LBB0_8
; %bb.6:
	ldr	w10, [x19]
	lsl	w3, w9, w10
	tst	w3, w22
	b.eq	LBB0_13
; %bb.7:
	mov	w25, #0
	mov	w23, #0
	b	LBB0_17
LBB0_8:
	mov	w25, #0
LBB0_9:
	str	x9, [x20, #8]
	mov	x0, x20
	mov	x1, x22
	mov	w2, #0
	bl	_nouveau_bo_placement_set
	ldr	x8, [x20, #8]
	sub	x8, x8, #1
	str	x8, [x20, #8]
	mov	x0, x20
	mov	w1, #0
	mov	w2, #0
	bl	_nouveau_bo_validate
	mov	x23, x0
	cbnz	w0, LBB0_18
; %bb.10:
	ldr	x8, [x24]
	add	x8, x8, #1
	str	x8, [x24]
	ldr	w8, [x19]
	cmp	w8, #129
	b.eq	LBB0_23
; %bb.11:
	cmp	w8, #128
	b.ne	LBB0_24
; %bb.12:
	mov	w23, #0
	ldr	w8, [x20, #20]
	ldr	w9, [x21, #4]
	sub	w8, w9, w8
	str	w8, [x21, #4]
	b	LBB0_21
LBB0_13:
	mov	w25, #0
	b	LBB0_16
LBB0_14:
	mov	w25, #1
	str	w25, [x20]
	mov	x24, x20
	ldr	x8, [x24, #8]!
	cbz	x8, LBB0_25
; %bb.15:
	ldr	w8, [x19]
	lsl	w3, w25, w8
LBB0_16:
Lloh6:
	adrp	x1, l_.str@PAGE
Lloh7:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x19
	mov	x4, x22
	bl	_NV_ERROR
Lloh8:
	adrp	x8, _EBUSY@GOTPAGE
Lloh9:
	ldr	x8, [x8, _EBUSY@GOTPAGEOFF]
Lloh10:
	ldr	w8, [x8]
	neg	w23, w8
	ldr	x8, [x24]
LBB0_17:
	add	x8, x8, #1
	str	x8, [x24]
LBB0_18:
	cbz	w25, LBB0_21
LBB0_19:
	cbz	w23, LBB0_21
; %bb.20:
	str	wzr, [x20]
LBB0_21:
	mov	x0, x19
	bl	_ttm_bo_unreserve
LBB0_22:
	mov	x0, x23
	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
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
LBB0_23:
	mov	w23, #0
	ldr	w8, [x20, #20]
	ldr	w9, [x21]
	sub	w8, w9, w8
	str	w8, [x21]
	b	LBB0_21
LBB0_24:
	mov	w23, #0
	b	LBB0_21
LBB0_25:
Lloh11:
	adrp	x8, _TTM_PL_FLAG_TT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _TTM_PL_FLAG_TT@GOTPAGEOFF]
Lloh13:
	ldr	w1, [x8]
	mov	x0, x20
	mov	w2, #0
	bl	_nouveau_bo_placement_set
	mov	x0, x20
	mov	w1, #0
	mov	w2, #0
	bl	_nouveau_bo_validate
	cbz	w0, LBB0_27
; %bb.26:
	mov	x23, x0
	mov	w25, #1
	cbnz	w25, LBB0_19
	b	LBB0_21
LBB0_27:
	ldr	x8, [x24]
	add	x9, x8, #1
	mov	w25, #1
	b	LBB0_9
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh6, Lloh7
	.loh AdrpLdrGotLdr	Lloh11, Lloh12, Lloh13
	.cfi_endproc
                                        ; -- End function
	.comm	_NV_DEVICE_INFO_V0_TESLA,8,3    ; @NV_DEVICE_INFO_V0_TESLA
	.comm	_TTM_PL_FLAG_VRAM,4,2           ; @TTM_PL_FLAG_VRAM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"bo %p pinned elsewhere: 0x%08x vs 0x%08x\n"

	.comm	_EBUSY,4,2                      ; @EBUSY
	.comm	_TTM_PL_FLAG_TT,4,2             ; @TTM_PL_FLAG_TT
.subsections_via_symbols
