	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function i915_gem_object_bind_to_gtt
_i915_gem_object_bind_to_gtt:           ## @i915_gem_object_bind_to_gtt
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%ecx, -76(%rbp)                 ## 4-byte Spill
	movl	%edx, %r13d
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	16(%rdi), %rbx
	movq	(%rbx), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	movl	8(%rdi), %esi
	movl	44(%rdi), %edx
	movq	%rbx, %rdi
	callq	_i915_gem_get_gtt_size
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movl	8(%r15), %esi
	movl	44(%r15), %edx
	movq	%rbx, %rdi
	movl	$1, %ecx
	callq	_i915_gem_get_gtt_alignment
	movl	%eax, %r12d
	movl	8(%r15), %esi
	movl	44(%r15), %edx
	movq	%rbx, -72(%rbp)                 ## 8-byte Spill
	movq	%rbx, %rdi
	xorl	%ecx, %ecx
	callq	_i915_gem_get_gtt_alignment
	movq	%r12, %rsi
	movl	%eax, %r12d
	testl	%r13d, %r13d
	cmovnel	%esi, %r12d
	testl	%r14d, %r14d
	cmovnel	%r14d, %r12d
	movl	%r13d, %r14d
	testl	%r13d, %r13d
	je	LBB0_3
## %bb.1:
	leal	-1(%rsi), %eax
	testl	%eax, %r12d
	je	LBB0_4
## %bb.2:
	leaq	L_.str(%rip), %rdi
	xorl	%r13d, %r13d
	movl	%r12d, %esi
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_EINVAL@GOTPCREL(%rip), %rax
	jmp	LBB0_20
LBB0_3:
	movl	8(%r15), %eax
	movl	%eax, %edi
	jmp	LBB0_5
LBB0_4:
	movl	8(%r15), %eax
	movl	-52(%rbp), %edi                 ## 4-byte Reload
LBB0_5:
	xorl	%ecx, %ecx
	testl	%r14d, %r14d
	sete	%cl
	cltq
	movq	-64(%rbp), %rdx                 ## 8-byte Reload
	cmpq	%rax, (%rdx,%rcx,8)
	jge	LBB0_7
## %bb.6:
	leaq	L_.str.1(%rip), %rdi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_DRM_ERROR
	movq	_E2BIG@GOTPCREL(%rip), %rax
LBB0_20:
	subl	(%rax), %r13d
	jmp	LBB0_21
LBB0_7:
	movl	%edi, -56(%rbp)                 ## 4-byte Spill
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	callq	_i915_gem_object_get_pages
	movl	%eax, %r13d
	testl	%eax, %eax
	je	LBB0_8
LBB0_21:
	movl	%r13d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_8:
	movq	%r15, %rdi
	callq	_i915_gem_object_pin_pages
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$8, %edi
	callq	_kzalloc
	testq	%rax, %rax
	je	LBB0_16
## %bb.9:
	movq	%rax, -48(%rbp)                 ## 8-byte Spill
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	addq	$24, %rax
	movq	%rax, -88(%rbp)                 ## 8-byte Spill
	.p2align	4, 0x90
LBB0_10:                                ## =>This Inner Loop Header: Depth=1
	movl	40(%r15), %r8d
	testl	%r14d, %r14d
	je	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	-64(%rbp), %rax                 ## 8-byte Reload
	movq	(%rax), %rax
	movq	%rax, (%rsp)
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	movl	%r12d, %ecx
	xorl	%r9d, %r9d
	callq	_drm_mm_insert_node_in_range_generic
	jmp	LBB0_13
	.p2align	4, 0x90
LBB0_12:                                ##   in Loop: Header=BB0_10 Depth=1
	movq	-88(%rbp), %rdi                 ## 8-byte Reload
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	-56(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edx
	movl	%r12d, %ecx
	callq	_drm_mm_insert_node_generic
LBB0_13:                                ##   in Loop: Header=BB0_10 Depth=1
	movl	40(%r15), %ecx
	testl	%eax, %eax
	je	LBB0_17
## %bb.14:                              ##   in Loop: Header=BB0_10 Depth=1
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movl	%ebx, %esi
	movl	%r12d, %edx
	movl	%r14d, %r8d
	movl	-76(%rbp), %r9d                 ## 4-byte Reload
	callq	_i915_gem_evict_something
	testl	%eax, %eax
	je	LBB0_10
## %bb.15:
	movl	%eax, %r13d
	movq	%r15, %rdi
	callq	_i915_gem_object_unpin_pages
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_kfree
	jmp	LBB0_21
LBB0_16:
	movq	%r15, %rdi
	callq	_i915_gem_object_unpin_pages
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_19
LBB0_17:
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	movq	%r13, %rsi
	movl	%ecx, %edx
	callq	_i915_gem_valid_gtt_space
	xorl	%edi, %edi
	testl	%eax, %eax
	sete	%dil
	callq	_WARN_ON
	testq	%rax, %rax
	je	LBB0_22
## %bb.18:
	movq	%r15, %rdi
	callq	_i915_gem_object_unpin_pages
	movq	%r13, %rdi
	callq	_drm_mm_put_block
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_19:
	xorl	%r13d, %r13d
	jmp	LBB0_20
LBB0_22:
	movq	%r15, %rdi
	callq	_i915_gem_gtt_prepare_object
	testl	%eax, %eax
	je	LBB0_24
## %bb.23:
	movl	%eax, %r13d
	movq	%r15, %rdi
	callq	_i915_gem_object_unpin_pages
	movq	-48(%rbp), %rdi                 ## 8-byte Reload
	callq	_drm_mm_put_block
	jmp	LBB0_21
LBB0_24:
	leaq	36(%r15), %rdi
	movl	%r14d, %r12d
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	leaq	16(%rbx), %r13
	leaq	20(%rbx), %rsi
	callq	_list_move_tail
	leaq	32(%r15), %rdi
	movq	%r13, %rsi
	callq	_list_add_tail
	movq	-48(%rbp), %rdx                 ## 8-byte Reload
	movq	%rdx, 24(%r15)
	movslq	(%rdx), %rax
	movl	%eax, (%r15)
	movl	-52(%rbp), %ecx                 ## 4-byte Reload
	cmpl	%ecx, 4(%rdx)
	sete	%cl
	movq	-96(%rbp), %r14                 ## 8-byte Reload
	decl	%r14d
	testl	%r14d, %eax
	sete	%dl
	movslq	8(%r15), %rsi
	addq	%rax, %rsi
	cmpq	%rsi, (%rbx)
	setge	%al
	andb	%cl, %dl
	andb	%al, %dl
	movzbl	%dl, %eax
	movl	%eax, 4(%r15)
	movq	%r15, %rdi
	callq	_i915_gem_object_unpin_pages
	movq	%r15, %rdi
	movl	%r12d, %esi
	callq	_trace_i915_gem_object_bind
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	callq	_i915_gem_verify_gtt
	xorl	%r13d, %r13d
	jmp	LBB0_21
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Invalid object alignment requested %u\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.1:                               ## @.str.1
	.asciz	"Attempting to bind an object larger than the aperture\n"

	.comm	_E2BIG,4,2                      ## @E2BIG
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_i915_gem_object_bind_to_gtt
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function i915_gem_object_bind_to_gtt
_i915_gem_object_bind_to_gtt:           ; @i915_gem_object_bind_to_gtt
	.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	x24, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	ldr	x20, [x0, #16]
	ldr	x25, [x20]
	ldr	w1, [x0, #8]
	ldr	w2, [x0, #44]
	mov	x0, x20
	bl	_i915_gem_get_gtt_size
	mov	x28, x0
	ldr	w1, [x19, #8]
	ldr	w2, [x19, #44]
	mov	x0, x20
	mov	w3, #1
	bl	_i915_gem_get_gtt_alignment
	mov	x23, x0
	ldr	w1, [x19, #8]
	ldr	w2, [x19, #44]
	mov	x0, x20
	mov	w3, #0
	bl	_i915_gem_get_gtt_alignment
	cmp	w21, #0
	csel	w8, w0, w23, eq
	cmp	w22, #0
	csel	w26, w8, w22, eq
	cbz	w21, LBB0_4
; %bb.1:
	sub	w8, w23, #1
	tst	w26, w8
	b.eq	LBB0_5
; %bb.2:
	str	x26, [sp]
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_DRM_ERROR
LBB0_3:
Lloh2:
	adrp	x8, _EINVAL@GOTPAGE
Lloh3:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
	b	LBB0_8
LBB0_4:
	ldr	w8, [x19, #8]
	mov	x27, x8
	b	LBB0_6
LBB0_5:
	ldr	w8, [x19, #8]
	mov	x27, x28
LBB0_6:
	cmp	w21, #0
	cset	w9, eq
	ldr	x9, [x25, w9, uxtw #3]
	cmp	x9, w8, sxtw
	b.ge	LBB0_9
; %bb.7:
Lloh4:
	adrp	x0, l_.str.1@PAGE
Lloh5:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_DRM_ERROR
Lloh6:
	adrp	x8, _E2BIG@GOTPAGE
Lloh7:
	ldr	x8, [x8, _E2BIG@GOTPAGEOFF]
LBB0_8:
	ldr	w8, [x8]
	neg	w22, w8
	b	LBB0_10
LBB0_9:
	mov	x0, x19
	bl	_i915_gem_object_get_pages
	mov	x22, x0
	cbz	w0, LBB0_11
LBB0_10:
	mov	x0, x22
	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_11:
	mov	x0, x19
	bl	_i915_gem_object_pin_pages
Lloh8:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh9:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh10:
	ldr	w1, [x8]
	mov	w0, #8
	bl	_kzalloc
	cbz	x0, LBB0_18
; %bb.12:
	str	x0, [sp, #24]                   ; 8-byte Folded Spill
	str	w28, [sp, #20]                  ; 4-byte Folded Spill
	add	x28, x25, #24
LBB0_13:                                ; =>This Inner Loop Header: Depth=1
	ldr	w4, [x19, #40]
	cbz	w21, LBB0_15
; %bb.14:                               ;   in Loop: Header=BB0_13 Depth=1
	ldr	x6, [x25]
	mov	x0, x28
	ldr	x22, [sp, #24]                  ; 8-byte Folded Reload
	mov	x1, x22
	mov	x2, x27
	mov	x3, x26
	mov	w5, #0
	bl	_drm_mm_insert_node_in_range_generic
	ldr	w3, [x19, #40]
	cbnz	w0, LBB0_16
	b	LBB0_19
LBB0_15:                                ;   in Loop: Header=BB0_13 Depth=1
	mov	x0, x28
	ldr	x22, [sp, #24]                  ; 8-byte Folded Reload
	mov	x1, x22
	mov	x2, x27
	mov	x3, x26
	bl	_drm_mm_insert_node_generic
	ldr	w3, [x19, #40]
	cbz	w0, LBB0_19
LBB0_16:                                ;   in Loop: Header=BB0_13 Depth=1
	mov	x0, x20
	mov	x1, x27
	mov	x2, x26
	mov	x4, x21
	mov	x5, x24
	bl	_i915_gem_evict_something
	cbz	w0, LBB0_13
; %bb.17:
	mov	x22, x0
	mov	x0, x19
	bl	_i915_gem_object_unpin_pages
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	bl	_kfree
	b	LBB0_10
LBB0_18:
	mov	x0, x19
	bl	_i915_gem_object_unpin_pages
Lloh11:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_8
LBB0_19:
	mov	x0, x20
	mov	x1, x22
	mov	x2, x3
	bl	_i915_gem_valid_gtt_space
	cmp	w0, #0
	cset	w0, eq
	bl	_WARN_ON
	cbz	x0, LBB0_21
; %bb.20:
	mov	x0, x19
	bl	_i915_gem_object_unpin_pages
	mov	x0, x22
	bl	_drm_mm_put_block
	b	LBB0_3
LBB0_21:
	mov	x0, x19
	bl	_i915_gem_gtt_prepare_object
	cbz	w0, LBB0_23
; %bb.22:
	mov	x22, x0
	mov	x0, x19
	bl	_i915_gem_object_unpin_pages
	ldr	x0, [sp, #24]                   ; 8-byte Folded Reload
	bl	_drm_mm_put_block
	b	LBB0_10
LBB0_23:
	add	x0, x19, #36
	add	x22, x25, #16
	add	x1, x25, #20
	bl	_list_move_tail
	add	x0, x19, #32
	mov	x1, x22
	bl	_list_add_tail
	ldr	x9, [sp, #24]                   ; 8-byte Folded Reload
	str	x9, [x19, #24]
	ldp	w8, w9, [x9]
                                        ; kill: def $w8 killed $w8 def $x8
	sxtw	x8, w8
	sub	w10, w23, #1
	tst	w8, w10
	cset	w10, eq
	ldrsw	x11, [x19, #8]
	ldr	x12, [x25]
	add	x11, x11, x8
	cmp	x12, x11
	ldr	w11, [sp, #20]                  ; 4-byte Folded Reload
	ccmp	w9, w11, #0, ge
	cset	w9, eq
	and	w9, w9, w10
	stp	w8, w9, [x19]
	mov	x0, x19
	bl	_i915_gem_object_unpin_pages
	mov	x0, x19
	mov	x1, x21
	bl	_trace_i915_gem_object_bind
	mov	x0, x20
	bl	_i915_gem_verify_gtt
	mov	w22, #0
	b	LBB0_10
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh6, Lloh7
	.loh AdrpAdd	Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Invalid object alignment requested %u\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.1:                               ; @.str.1
	.asciz	"Attempting to bind an object larger than the aperture\n"

	.comm	_E2BIG,4,2                      ; @E2BIG
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_i915_gem_object_bind_to_gtt
.subsections_via_symbols
