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

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function mlx4_buddy_alloc
_mlx4_buddy_alloc:                      ; @mlx4_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, x1
	mov	x21, x0
	add	x20, x0, #4
	mov	x0, x20
	bl	_spin_lock
	ldr	w8, [x21]
	cmp	w8, w19
	b.ge	LBB0_3
LBB0_1:
	mov	x0, x20
	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:
	sxtw	x24, w19
	neg	w26, w19
	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, [x21, #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	w23, w27, w8
	ldr	x8, [x21, #16]
	ldr	w0, [x8, x25, lsl #2]
	mov	x1, x23
	bl	_find_first_bit
	cmp	w0, w23
	b.lt	LBB0_8
; %bb.7:                                ;   in Loop: Header=BB0_5 Depth=1
	ldr	w8, [x21]
	b	LBB0_4
LBB0_8:
	mov	x22, x0
	neg	w23, w26
	ldr	x8, [x21, #16]
	ldr	w1, [x8, x25, lsl #2]
	bl	_clear_bit
	ldr	x8, [x21, #8]
	lsl	x9, x25, #3
	ldr	x10, [x8, x9]
	sub	x10, x10, #1
	str	x10, [x8, x9]
	cmp	w23, w19
	b.le	LBB0_11
; %bb.9:
	sxtw	x8, w23
	sub	x25, x8, #1
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	lsl	w23, w22, #1
	mov	w0, #1
	bfi	w0, w22, #1, #31
	ldr	x8, [x21, #16]
	ldr	w1, [x8, x25, lsl #2]
	bl	_set_bit
	ldr	x8, [x21, #8]
	lsl	x9, x25, #3
	ldr	x10, [x8, x9]
	add	x10, x10, #1
	str	x10, [x8, x9]
	sub	x8, x25, #1
	mov	x22, x23
	cmp	x25, x24
	mov	x25, x8
	b.gt	LBB0_10
	b	LBB0_12
LBB0_11:
	mov	x23, x22
LBB0_12:
	mov	x0, x20
	bl	_spin_unlock
	lsl	w0, w23, w19
	b	LBB0_2
	.cfi_endproc
                                        ; -- End function
	.no_dead_strip	_mlx4_buddy_alloc
.subsections_via_symbols
