	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_gtt_sa_allocate            ## -- Begin function kfd_gtt_sa_allocate
	.p2align	4, 0x90
_kfd_gtt_sa_allocate:                   ## @kfd_gtt_sa_allocate
	.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
	testl	%esi, %esi
	je	LBB0_15
## %bb.1:
	movl	%esi, %ebx
	movq	%rdi, %r14
	movl	4(%rdi), %eax
	imull	(%rdi), %eax
	cmpl	%esi, %eax
	jb	LBB0_14
## %bb.2:
	movq	%rdx, %r15
	movq	_GFP_KERNEL@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	$24, %edi
	callq	_kzalloc
	movq	%rax, (%r15)
	testq	%rax, %rax
	je	LBB0_14
## %bb.3:
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	leaq	L_.str(%rip), %rdi
	xorl	%r12d, %r12d
	movq	%rax, %rsi
	movl	%ebx, -52(%rbp)                 ## 4-byte Spill
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_pr_debug
	leaq	8(%r14), %rdi
	movq	%rdi, -64(%rbp)                 ## 8-byte Spill
	callq	_mutex_lock
	movl	(%r14), %esi
	movl	12(%r14), %edi
	xorl	%edx, %edx
LBB0_4:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_7 Depth 2
	callq	_find_next_zero_bit
	movq	%rax, %r15
	leaq	L_.str.1(%rip), %rdi
	movl	%r15d, %esi
	xorl	%eax, %eax
	callq	_pr_debug
	cmpl	%r15d, (%r14)
	je	LBB0_17
## %bb.5:                               ##   in Loop: Header=BB0_4 Depth=1
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	(%rbx), %rax
	movl	%r15d, (%rax)
	movl	%r15d, 4(%rax)
	movl	4(%r14), %edx
	movl	20(%r14), %edi
	movl	%r15d, %esi
	callq	_kfd_gtt_sa_calc_gpu_addr
	movq	(%rbx), %rcx
	movq	%rax, 16(%rcx)
	movl	4(%r14), %edx
	movl	16(%r14), %edi
	movl	%r15d, %esi
	callq	_kfd_gtt_sa_calc_cpu_addr
	movq	(%rbx), %rcx
	movl	%eax, 8(%rcx)
	movq	16(%rcx), %rsi
	leaq	L_.str.2(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_pr_debug
	movl	4(%r14), %eax
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	cmpl	%ebx, %eax
	jae	LBB0_20
## %bb.6:                               ##   in Loop: Header=BB0_4 Depth=1
	subl	%eax, %ebx
	movl	(%r14), %esi
	.p2align	4, 0x90
LBB0_7:                                 ##   Parent Loop BB0_4 Depth=1
                                        ## =>  This Inner Loop Header: Depth=2
	movl	12(%r14), %edi
	leal	1(%r15), %r13d
	movl	%r13d, %edx
	callq	_find_next_zero_bit
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
	movq	(%rcx), %rcx
	movl	%eax, 4(%rcx)
	cmpl	%eax, %r13d
	jne	LBB0_13
## %bb.8:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	(%r14), %esi
	cmpl	%esi, %r13d
	je	LBB0_17
## %bb.9:                               ##   in Loop: Header=BB0_7 Depth=2
	movl	%r13d, %r15d
	subl	4(%r14), %ebx
	ja	LBB0_7
	jmp	LBB0_10
LBB0_13:                                ##   in Loop: Header=BB0_4 Depth=1
	movl	(%r14), %esi
	movl	12(%r14), %edi
	incl	%r15d
	movl	%r15d, %edx
	jmp	LBB0_4
LBB0_14:
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_16
LBB0_15:
	movq	_EINVAL@GOTPCREL(%rip), %rax
LBB0_16:
	xorl	%r12d, %r12d
LBB0_18:
	subl	(%rax), %r12d
LBB0_19:
	movl	%r12d, %eax
	addq	$24, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	leaq	L_.str.5(%rip), %rdi
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rsi
	xorl	%eax, %eax
	callq	_pr_debug
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	movq	%rbx, %rdi
	callq	_kfree
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	jmp	LBB0_18
LBB0_10:
	movl	(%rcx), %esi
	leaq	L_.str.4(%rip), %rdi
	movl	%r13d, %edx
	xorl	%eax, %eax
	callq	_pr_debug
	movq	-48(%rbp), %r15                 ## 8-byte Reload
	movq	(%r15), %rax
	movl	(%rax), %ebx
	cmpl	4(%rax), %ebx
	ja	LBB0_12
	.p2align	4, 0x90
LBB0_11:                                ## =>This Inner Loop Header: Depth=1
	movl	12(%r14), %esi
	movl	%ebx, %edi
	callq	_set_bit
	incl	%ebx
	movq	(%r15), %rax
	cmpl	4(%rax), %ebx
	jbe	LBB0_11
LBB0_12:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mutex_unlock
	xorl	%r12d, %r12d
	jmp	LBB0_19
LBB0_20:
	leaq	L_.str.3(%rip), %rdi
	xorl	%eax, %eax
	callq	_pr_debug
	movl	12(%r14), %esi
	movl	%r15d, %edi
	callq	_set_bit
	jmp	LBB0_12
	.cfi_endproc
                                        ## -- End function
	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ## @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Allocated mem_obj = %p for size = %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"Found = %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"gpu_addr = %p, cpu_addr = %p\n"

L_.str.3:                               ## @.str.3
	.asciz	"Single bit\n"

L_.str.4:                               ## @.str.4
	.asciz	"range_start = %d, range_end = %d\n"

L_.str.5:                               ## @.str.5
	.asciz	"Allocation failed with mem_obj = %p\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_kfd_gtt_sa_allocate            ; -- Begin function kfd_gtt_sa_allocate
	.p2align	2
_kfd_gtt_sa_allocate:                   ; @kfd_gtt_sa_allocate
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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
	cbz	w1, LBB0_6
; %bb.1:
	mov	x22, x1
	mov	x20, x0
	ldp	w8, w9, [x0]
	mul	w8, w9, w8
	cmp	w8, w1
	b.lo	LBB0_5
; %bb.2:
	mov	x19, x2
Lloh0:
	adrp	x8, _GFP_KERNEL@GOTPAGE
Lloh1:
	ldr	x8, [x8, _GFP_KERNEL@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w0, #24
	bl	_kzalloc
	str	x0, [x19]
	cbz	x0, LBB0_5
; %bb.3:
	stp	x0, x22, [sp]
Lloh3:
	adrp	x0, l_.str@PAGE
Lloh4:
	add	x0, x0, l_.str@PAGEOFF
	bl	_pr_debug
	add	x21, x20, #8
	mov	x0, x21
	bl	_mutex_lock
	ldr	w0, [x20, #12]
	ldr	w1, [x20]
	mov	w2, #0
	bl	_find_next_zero_bit
	mov	x23, x0
	str	x0, [sp]
Lloh5:
	adrp	x0, l_.str.1@PAGE
Lloh6:
	add	x0, x0, l_.str.1@PAGEOFF
	bl	_pr_debug
	ldr	w8, [x20]
	cmp	w8, w23
	b.ne	LBB0_9
LBB0_4:
	str	x19, [sp]
Lloh7:
	adrp	x0, l_.str.5@PAGE
Lloh8:
	add	x0, x0, l_.str.5@PAGEOFF
	bl	_pr_debug
	mov	x0, x21
	bl	_mutex_unlock
	mov	x0, x19
	bl	_kfree
LBB0_5:
Lloh9:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_7
LBB0_6:
Lloh11:
	adrp	x8, _EINVAL@GOTPAGE
Lloh12:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_9:
Lloh13:
	adrp	x24, l_.str.2@PAGE
Lloh14:
	add	x24, x24, l_.str.2@PAGEOFF
Lloh15:
	adrp	x25, l_.str.1@PAGE
Lloh16:
	add	x25, x25, l_.str.1@PAGEOFF
LBB0_10:                                ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_12 Depth 2
	ldr	x8, [x19]
	stp	w23, w23, [x8]
	ldr	w0, [x20, #20]
	ldr	w2, [x20, #4]
	mov	x1, x23
	bl	_kfd_gtt_sa_calc_gpu_addr
	ldr	x8, [x19]
	str	x0, [x8, #16]
	ldr	w0, [x20, #16]
	ldr	w2, [x20, #4]
	mov	x1, x23
	bl	_kfd_gtt_sa_calc_cpu_addr
                                        ; kill: def $w0 killed $w0 def $x0
	ldr	x8, [x19]
	str	w0, [x8, #8]
	ldr	x8, [x8, #16]
	stp	x8, x0, [sp]
	mov	x0, x24
	bl	_pr_debug
	ldr	w8, [x20, #4]
	cmp	w8, w22
	b.hs	LBB0_19
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	sub	w26, w22, w8
	ldr	w1, [x20]
LBB0_12:                                ;   Parent Loop BB0_10 Depth=1
                                        ; =>  This Inner Loop Header: Depth=2
	ldr	w0, [x20, #12]
	add	w23, w23, #1
	mov	x2, x23
	bl	_find_next_zero_bit
	ldr	x8, [x19]
	str	w0, [x8, #4]
	cmp	w23, w0
	b.ne	LBB0_15
; %bb.13:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	w1, [x20]
	cmp	w23, w1
	b.eq	LBB0_4
; %bb.14:                               ;   in Loop: Header=BB0_12 Depth=2
	ldr	w9, [x20, #4]
	subs	w26, w26, w9
	b.hi	LBB0_12
	b	LBB0_16
LBB0_15:                                ;   in Loop: Header=BB0_10 Depth=1
	ldr	w0, [x20, #12]
	ldr	w1, [x20]
	mov	x2, x23
	bl	_find_next_zero_bit
	mov	x23, x0
	str	x0, [sp]
	mov	x0, x25
	bl	_pr_debug
	ldr	w8, [x20]
	cmp	w8, w23
	b.ne	LBB0_10
	b	LBB0_4
LBB0_16:
                                        ; kill: def $w23 killed $w23 killed $x23 def $x23
	ldr	w8, [x8]
	stp	x8, x23, [sp]
Lloh17:
	adrp	x0, l_.str.4@PAGE
Lloh18:
	add	x0, x0, l_.str.4@PAGEOFF
	bl	_pr_debug
	ldr	x8, [x19]
	ldr	w22, [x8]
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	w8, [x8, #4]
	cmp	w22, w8
	b.hi	LBB0_20
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	w1, [x20, #12]
	mov	x0, x22
	bl	_set_bit
	add	w22, w22, #1
	ldr	x8, [x19]
	b	LBB0_17
LBB0_19:
Lloh19:
	adrp	x0, l_.str.3@PAGE
Lloh20:
	add	x0, x0, l_.str.3@PAGEOFF
	bl	_pr_debug
	ldr	w1, [x20, #12]
	mov	x0, x23
	bl	_set_bit
LBB0_20:
	mov	x0, x21
	bl	_mutex_unlock
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.cfi_endproc
                                        ; -- End function
	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_GFP_KERNEL,4,2                 ; @GFP_KERNEL
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Allocated mem_obj = %p for size = %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"Found = %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"gpu_addr = %p, cpu_addr = %p\n"

l_.str.3:                               ; @.str.3
	.asciz	"Single bit\n"

l_.str.4:                               ; @.str.4
	.asciz	"range_start = %d, range_end = %d\n"

l_.str.5:                               ; @.str.5
	.asciz	"Allocation failed with mem_obj = %p\n"

.subsections_via_symbols
