	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function hns_roce_buddy_alloc
_hns_roce_buddy_alloc:                  ## @hns_roce_buddy_alloc
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, -72(%rbp)                 ## 8-byte Spill
	movl	%esi, %ebx
	movq	%rdi, %r13
	addq	$4, %rdi
	movq	%rdi, -56(%rbp)                 ## 8-byte Spill
	callq	_spin_lock
	movl	(%r13), %ecx
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	cmpl	%ebx, %ecx
	jge	LBB0_1
LBB0_6:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movl	$-1, %eax
LBB0_11:
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_1:
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movslq	%eax, %rdx
	movq	%rdx, %r15
	shlq	$32, %r15
	leaq	-1(%rdx), %rsi
	movq	%rsi, -96(%rbp)                 ## 8-byte Spill
	movl	%eax, %r14d
	negl	%r14d
	leaq	(,%rdx,8), %rax
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	leaq	(,%rdx,4), %rax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%r12d, %r12d
	jmp	LBB0_2
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_2 Depth=1
	movslq	%ecx, %rax
	movabsq	$4294967296, %rdx               ## imm = 0x100000000
	addq	%rdx, %r15
	movq	-96(%rbp), %rdx                 ## 8-byte Reload
	addq	%r12, %rdx
	incq	%rdx
	incq	%r12
	decl	%r14d
	cmpq	%rax, %rdx
	jge	LBB0_6
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	8(%r13), %rax
	addq	-80(%rbp), %rax                 ## 8-byte Folded Reload
	cmpq	$0, (%rax,%r12,8)
	je	LBB0_5
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	addl	%r14d, %ecx
	movl	$1, %eax
                                        ## kill: def $cl killed $cl killed $ecx
	shll	%cl, %eax
	movslq	%eax, %rbx
	movq	16(%r13), %rax
	addq	-64(%rbp), %rax                 ## 8-byte Folded Reload
	movl	(%rax,%r12,4), %edi
	movq	%rbx, %rsi
	callq	_find_first_bit
	movq	-72(%rbp), %rcx                 ## 8-byte Reload
	movq	%rax, (%rcx)
	cmpq	%rbx, %rax
	jb	LBB0_7
## %bb.4:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	(%r13), %ecx
	jmp	LBB0_5
LBB0_7:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	leal	(%rbx,%r12), %r14d
	movq	-64(%rbp), %rcx                 ## 8-byte Reload
	addq	16(%r13), %rcx
	movl	(%rcx,%r12,4), %esi
	movq	%rax, %rdi
	callq	_clear_bit
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	addq	8(%r13), %rax
	decq	(%rax,%r12,8)
	cmpl	%ebx, %r14d
	movq	-72(%rbp), %r14                 ## 8-byte Reload
	movq	-88(%rbp), %r12                 ## 8-byte Reload
	jle	LBB0_10
## %bb.8:
	sarq	$32, %r15
	.p2align	4, 0x90
LBB0_9:                                 ## =>This Inner Loop Header: Depth=1
	leaq	-1(%r15), %rbx
	movq	(%r14), %rax
	leaq	(%rax,%rax), %rcx
	movq	%rcx, (%r14)
	leaq	(%rax,%rax), %rdi
	incq	%rdi
	movq	16(%r13), %rax
	movl	-4(%rax,%r15,4), %esi
	callq	_set_bit
	movq	8(%r13), %rax
	incq	-8(%rax,%r15,8)
	movq	%rbx, %r15
	cmpq	%r12, %rbx
	jg	LBB0_9
LBB0_10:
	movq	-56(%rbp), %rdi                 ## 8-byte Reload
	callq	_spin_unlock
	movq	-48(%rbp), %rcx                 ## 8-byte Reload
                                        ## kill: def $cl killed $cl killed $rcx
	shlq	%cl, (%r14)
	xorl	%eax, %eax
	jmp	LBB0_11
	.cfi_endproc
                                        ## -- End function
	.no_dead_strip	_hns_roce_buddy_alloc
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function hns_roce_buddy_alloc
_hns_roce_buddy_alloc:                  ; @hns_roce_buddy_alloc
	.cfi_startproc
; %bb.0:
	stp	x28, x27, [sp, #-96]!           ; 16-byte Folded Spill
	.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
	.cfi_offset w27, -88
	.cfi_offset w28, -96
	mov	x19, x2
	mov	x20, x1
	mov	x22, x0
	add	x21, x0, #4
	mov	x0, x21
	bl	_spin_lock
	ldr	w8, [x22]
	cmp	w8, w20
	b.ge	LBB0_3
LBB0_1:
	mov	x0, x21
	bl	_spin_unlock
	mov	w0, #-1
LBB0_2:
	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
	ldp	x28, x27, [sp], #96             ; 16-byte Folded Reload
	ret
LBB0_3:
	mov	x9, x20
	sxtw	x24, w9
	neg	w26, w20
	mov	w27, #1
	mov	x25, x24
	b	LBB0_5
LBB0_4:                                 ;   in Loop: Header=BB0_5 Depth=1
	cmp	x25, w8, sxtw
	add	x25, x25, #1
	sub	w26, w26, #1
	b.ge	LBB0_1
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x9, [x22, #8]
	ldr	x9, [x9, x25, lsl #3]
	cbz	x9, LBB0_4
; %bb.6:                                ;   in Loop: Header=BB0_5 Depth=1
	add	w8, w8, w26
	lsl	w8, w27, w8
	sxtw	x23, w8
	ldr	x8, [x22, #16]
	ldr	w0, [x8, x25, lsl #2]
	mov	x1, x23
	bl	_find_first_bit
	str	x0, [x19]
	cmp	x0, x23
	b.lo	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x22]
	b	LBB0_4
LBB0_8:
	neg	w23, w26
	ldr	x8, [x22, #16]
	ldr	w1, [x8, x25, lsl #2]
	bl	_clear_bit
	ldr	x8, [x22, #8]
	lsl	x9, x25, #3
	ldr	x10, [x8, x9]
	sub	x10, x10, #1
	str	x10, [x8, x9]
	cmp	w23, w20
	b.le	LBB0_11
; %bb.9:
	sxtw	x8, w23
	sub	x23, x8, #1
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x19]
	lsl	x9, x8, #1
	str	x9, [x19]
	mov	w0, #1
	bfi	x0, x8, #1, #63
	ldr	x8, [x22, #16]
	ldr	w1, [x8, x23, lsl #2]
	bl	_set_bit
	ldr	x8, [x22, #8]
	lsl	x9, x23, #3
	ldr	x10, [x8, x9]
	add	x10, x10, #1
	str	x10, [x8, x9]
	sub	x8, x23, #1
	cmp	x23, x24
	mov	x23, x8
	b.gt	LBB0_10
LBB0_11:
	mov	x0, x21
	bl	_spin_unlock
	mov	w0, #0
	ldr	x8, [x19]
	lsl	x8, x8, x20
	str	x8, [x19]
	b	LBB0_2
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_hns_roce_buddy_alloc
.subsections_via_symbols
