	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_get_xgmi_hive           ## -- Begin function amdgpu_get_xgmi_hive
	.p2align	4, 0x90
_amdgpu_get_xgmi_hive:                  ## @amdgpu_get_xgmi_hive
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	xorl	%ebx, %ebx
	cmpq	$0, (%rdi)
	je	LBB0_16
## %bb.1:
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	_xgmi_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_lock
	movq	_hive_count@GOTPCREL(%rip), %rax
	movslq	(%rax), %r12
	testq	%r12, %r12
	jle	LBB0_6
## %bb.2:
	movl	%r12d, %ecx
	movq	_xgmi_hives@GOTPCREL(%rip), %rdx
	movq	(%rdx), %rbx
	movq	(%r15), %rdx
	.p2align	4, 0x90
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpq	%rdx, (%rbx)
	je	LBB0_10
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	addq	$32, %rbx
	decq	%rcx
	jne	LBB0_3
## %bb.5:
	movl	%r12d, %ebx
LBB0_6:
	movq	_AMDGPU_MAX_XGMI_HIVE@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %ebx
	jge	LBB0_9
## %bb.7:
	movq	_xgmi_hives@GOTPCREL(%rip), %rcx
	movq	(%rcx), %r13
	leal	1(%r12), %ecx
	movl	%ecx, (%rax)
	shlq	$5, %r12
	leaq	(%r12,%r13), %rbx
	movq	%r15, %rdi
	movq	%rbx, %rsi
	callq	_amdgpu_xgmi_sysfs_create
	testq	%rax, %rax
	je	LBB0_12
LBB0_9:
	xorl	%ebx, %ebx
	jmp	LBB0_15
LBB0_10:
	testl	%r14d, %r14d
	je	LBB0_15
## %bb.11:
	leaq	12(%rbx), %rdi
	callq	_mutex_lock
	jmp	LBB0_15
LBB0_12:
	movq	%r15, 24(%r13,%r12)
	movq	(%r15), %rax
	movq	%rax, (%rbx)
	leaq	(%r12,%r13), %rdi
	addq	$20, %rdi
	callq	_INIT_LIST_HEAD
	leaq	(%r12,%r13), %r15
	addq	$12, %r15
	movq	%r15, %rdi
	callq	_mutex_init
	leaq	(%r12,%r13), %rdi
	addq	$16, %rdi
	callq	_mutex_init
	testl	%r14d, %r14d
	je	LBB0_14
## %bb.13:
	movq	%r15, %rdi
	callq	_mutex_lock
LBB0_14:
	movl	$-1, 8(%r13,%r12)
LBB0_15:
	movq	_xgmi_mutex@GOTPCREL(%rip), %rdi
	callq	_mutex_unlock
LBB0_16:
	movq	%rbx, %rax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_xgmi_mutex,4,2                 ## @xgmi_mutex
	.comm	_hive_count,4,2                 ## @hive_count
	.comm	_xgmi_hives,8,3                 ## @xgmi_hives
	.comm	_AMDGPU_MAX_XGMI_HIVE,4,2       ## @AMDGPU_MAX_XGMI_HIVE
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_get_xgmi_hive           ; -- Begin function amdgpu_get_xgmi_hive
	.p2align	2
_amdgpu_get_xgmi_hive:                  ; @amdgpu_get_xgmi_hive
	.cfi_startproc
; %bb.0:
	stp	x24, x23, [sp, #-64]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 64
	stp	x22, x21, [sp, #16]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #32]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #48]             ; 16-byte Folded Spill
	add	x29, sp, #48
	.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
	ldr	x8, [x0]
	cbz	x8, LBB0_6
; %bb.1:
	mov	x20, x1
	mov	x21, x0
Lloh0:
	adrp	x0, _xgmi_mutex@GOTPAGE
Lloh1:
	ldr	x0, [x0, _xgmi_mutex@GOTPAGEOFF]
	bl	_mutex_lock
Lloh2:
	adrp	x8, _hive_count@GOTPAGE
Lloh3:
	ldr	x8, [x8, _hive_count@GOTPAGEOFF]
	ldr	w9, [x8]
	cmp	w9, #1
	b.lt	LBB0_7
; %bb.2:
Lloh4:
	adrp	x10, _xgmi_hives@GOTPAGE
Lloh5:
	ldr	x10, [x10, _xgmi_hives@GOTPAGEOFF]
Lloh6:
	ldr	x19, [x10]
	ldr	x10, [x21]
	mov	x11, x9
LBB0_3:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x12, [x19]
	cmp	x12, x10
	b.eq	LBB0_11
; %bb.4:                                ;   in Loop: Header=BB0_3 Depth=1
	add	x19, x19, #32
	subs	x11, x11, #1
	b.ne	LBB0_3
; %bb.5:
	mov	x10, x9
	b	LBB0_8
LBB0_6:
	mov	x19, #0
	b	LBB0_17
LBB0_7:
	mov	w10, #0
LBB0_8:
Lloh7:
	adrp	x11, _AMDGPU_MAX_XGMI_HIVE@GOTPAGE
Lloh8:
	ldr	x11, [x11, _AMDGPU_MAX_XGMI_HIVE@GOTPAGEOFF]
Lloh9:
	ldr	w11, [x11]
	cmp	w10, w11
	b.ge	LBB0_10
; %bb.9:
	mov	x10, x9
	sxtw	x22, w10
Lloh10:
	adrp	x10, _xgmi_hives@GOTPAGE
Lloh11:
	ldr	x10, [x10, _xgmi_hives@GOTPAGEOFF]
Lloh12:
	ldr	x23, [x10]
	add	w9, w9, #1
	str	w9, [x8]
	add	x19, x23, x22, lsl #5
	mov	x0, x21
	mov	x1, x19
	bl	_amdgpu_xgmi_sysfs_create
	cbz	x0, LBB0_13
LBB0_10:
	mov	x19, #0
	b	LBB0_16
LBB0_11:
	cbz	w20, LBB0_16
; %bb.12:
	add	x0, x19, #12
	bl	_mutex_lock
	b	LBB0_16
LBB0_13:
	str	x21, [x19, #24]
	ldr	x8, [x21]
	str	x8, [x19]
	add	x0, x19, #20
	bl	_INIT_LIST_HEAD
	add	x21, x19, #12
	mov	x0, x21
	bl	_mutex_init
	add	x0, x19, #16
	bl	_mutex_init
	cbz	w20, LBB0_15
; %bb.14:
	mov	x0, x21
	bl	_mutex_lock
LBB0_15:
	add	x8, x23, x22, lsl #5
	mov	w9, #-1
	str	w9, [x8, #8]
LBB0_16:
Lloh13:
	adrp	x0, _xgmi_mutex@GOTPAGE
Lloh14:
	ldr	x0, [x0, _xgmi_mutex@GOTPAGEOFF]
	bl	_mutex_unlock
LBB0_17:
	mov	x0, x19
	ldp	x29, x30, [sp, #48]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #32]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #16]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp], #64             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh13, Lloh14
	.cfi_endproc
                                        ; -- End function
	.comm	_xgmi_mutex,4,2                 ; @xgmi_mutex
	.comm	_hive_count,4,2                 ; @hive_count
	.comm	_xgmi_hives,8,3                 ; @xgmi_hives
	.comm	_AMDGPU_MAX_XGMI_HIVE,4,2       ; @AMDGPU_MAX_XGMI_HIVE
.subsections_via_symbols
