	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_discovery_reg_base_init ## -- Begin function amdgpu_discovery_reg_base_init
	.p2align	4, 0x90
_amdgpu_discovery_reg_base_init:        ## @amdgpu_discovery_reg_base_init
	.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
	movslq	(%rdi), %r12
	testq	%r12, %r12
	je	LBB0_1
## %bb.3:
	movq	%rdi, %r15
	movq	(%r12), %rax
	movq	_IP_DISCOVERY@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %edi
	callq	_le16_to_cpu
	movq	%rax, -80(%rbp)                 ## 8-byte Spill
	movl	8(%rax,%r12), %edi
	callq	_le16_to_cpu
	movq	%rax, %rbx
	leaq	L_.str.1(%rip), %rdi
	xorl	%r14d, %r14d
	movl	%ebx, %esi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	testl	%ebx, %ebx
	jle	LBB0_20
## %bb.4:
	movq	%r15, -48(%rbp)                 ## 8-byte Spill
	movl	%ebx, %eax
	movq	%rax, -64(%rbp)                 ## 8-byte Spill
	xorl	%ebx, %ebx
	movq	%r12, -72(%rbp)                 ## 8-byte Spill
	jmp	LBB0_5
	.p2align	4, 0x90
LBB0_18:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	-88(%rbp), %rbx                 ## 8-byte Reload
	incq	%rbx
	cmpq	-64(%rbp), %rbx                 ## 8-byte Folded Reload
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	je	LBB0_19
LBB0_5:                                 ## =>This Loop Header: Depth=1
                                        ##     Child Loop BB0_9 Depth 2
                                        ##       Child Loop BB0_11 Depth 3
                                        ##       Child Loop BB0_14 Depth 3
	movq	-80(%rbp), %rax                 ## 8-byte Reload
	movq	(%r12,%rax), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_le16_to_cpu
	movq	%rax, %r13
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movslq	(%rax), %r14
	movslq	%r13d, %r15
	movl	4(%r14,%r15), %edi
	callq	_le16_to_cpu
	movq	%rax, %r12
	movl	(%r14,%r15), %edi
	callq	_le16_to_cpu
	cmpq	%rbx, %rax
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	%rbx, -88(%rbp)                 ## 8-byte Spill
	movl	(%r15,%r14), %edi
	callq	_le16_to_cpu
	leaq	L_.str.3(%rip), %rdi
	movl	%eax, %esi
	movl	%r12d, %edx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	testl	%r12d, %r12d
	jle	LBB0_18
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	addl	$8, %r13d
	xorl	%eax, %eax
	movq	%r12, -96(%rbp)                 ## 8-byte Spill
	jmp	LBB0_9
	.p2align	4, 0x90
LBB0_17:                                ##   in Loop: Header=BB0_9 Depth=2
	movl	(%r14,%r15), %eax
	leal	(%r14,%rax,4), %r13d
	addl	$36, %r13d
	movl	-52(%rbp), %eax                 ## 4-byte Reload
	incl	%eax
	movq	-96(%rbp), %r12                 ## 8-byte Reload
	cmpl	%r12d, %eax
	je	LBB0_18
LBB0_9:                                 ##   Parent Loop BB0_5 Depth=1
                                        ## =>  This Loop Header: Depth=2
                                        ##       Child Loop BB0_11 Depth 3
                                        ##       Child Loop BB0_14 Depth 3
	movl	%eax, -52(%rbp)                 ## 4-byte Spill
	movq	-48(%rbp), %rax                 ## 8-byte Reload
	movslq	(%rax), %r15
	movslq	%r13d, %r14
	movl	(%r15,%r14), %r12d
	movl	24(%r15,%r14), %edi
	movq	_hw_id_names@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	callq	_le16_to_cpu
	movl	(%rbx,%rax,4), %r13d
	movl	24(%r15,%r14), %edi
	callq	_le16_to_cpu
	movq	8(%r15,%r14), %rcx
	movl	36(%r15,%r14), %r8d
	movl	32(%r15,%r14), %r9d
	movl	28(%r15,%r14), %edx
	movl	%edx, (%rsp)
	leaq	L_.str.4(%rip), %rdi
	movl	%r13d, %esi
	movq	%rax, %rdx
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	testl	%r12d, %r12d
	leaq	L_.str.5(%rip), %r13
	jle	LBB0_12
## %bb.10:                              ##   in Loop: Header=BB0_9 Depth=2
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_11:                                ##   Parent Loop BB0_5 Depth=1
                                        ##     Parent Loop BB0_9 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	16(%r14,%r15), %rax
	movl	(%rax,%rbx,4), %edi
	callq	_le32_to_cpu
	movq	16(%r14,%r15), %rcx
	movl	%eax, (%rcx,%rbx,4)
	movq	%r13, %rdi
	movl	%eax, %esi
	xorl	%eax, %eax
	callq	_DRM_DEBUG
	incq	%rbx
	cmpq	%rbx, %r12
	jne	LBB0_11
LBB0_12:                                ##   in Loop: Header=BB0_9 Depth=2
	movq	_MAX_HWIP@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	jle	LBB0_17
## %bb.13:                              ##   in Loop: Header=BB0_9 Depth=2
	xorl	%ebx, %ebx
	jmp	LBB0_14
	.p2align	4, 0x90
LBB0_16:                                ##   in Loop: Header=BB0_14 Depth=3
	incq	%rbx
	movq	_MAX_HWIP@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	cmpq	%rax, %rbx
	jge	LBB0_17
LBB0_14:                                ##   Parent Loop BB0_5 Depth=1
                                        ##     Parent Loop BB0_9 Depth=2
                                        ## =>    This Inner Loop Header: Depth=3
	movq	_hw_id_map@GOTPCREL(%rip), %rax
	movq	(%rax), %rax
	movq	(%rax,%rbx,8), %r12
	movl	24(%r14,%r15), %edi
	callq	_le16_to_cpu
	cmpq	%rax, %r12
	jne	LBB0_16
## %bb.15:                              ##   in Loop: Header=BB0_14 Depth=3
	movq	_hw_id_names@GOTPCREL(%rip), %rax
	movq	(%rax), %r12
	movl	24(%r14,%r15), %edi
	callq	_le16_to_cpu
	movl	(%r12,%rax,4), %esi
	leaq	L_.str.6(%rip), %rdi
	callq	_DRM_INFO
	movq	8(%r14,%r15), %rax
	movq	16(%r14,%r15), %rcx
	movq	8(%r13), %rdx
	movq	(%rdx,%rbx,8), %rdx
	movq	%rcx, (%rdx,%rax,8)
	jmp	LBB0_16
LBB0_1:
	leaq	L_.str(%rip), %rdi
	xorl	%r14d, %r14d
	xorl	%eax, %eax
	callq	_DRM_ERROR
	jmp	LBB0_2
LBB0_19:
	xorl	%r14d, %r14d
	jmp	LBB0_20
LBB0_6:
	movl	(%r15,%r14), %edi
	callq	_le16_to_cpu
	leaq	L_.str.2(%rip), %rdi
	xorl	%r14d, %r14d
	movq	%rax, %rsi
	movl	%ebx, %edx
	xorl	%eax, %eax
	callq	_DRM_ERROR
LBB0_2:
	movq	_EINVAL@GOTPCREL(%rip), %rax
	subl	(%rax), %r14d
LBB0_20:
	movl	%r14d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"ip discovery uninitialized\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_IP_DISCOVERY,8,3               ## @IP_DISCOVERY
L_.str.1:                               ## @.str.1
	.asciz	"number of dies: %d\n"

L_.str.2:                               ## @.str.2
	.asciz	"invalid die id %d, expected %d\n"

L_.str.3:                               ## @.str.3
	.asciz	"number of hardware IPs on die%d: %d\n"

L_.str.4:                               ## @.str.4
	.asciz	"%s(%d) #%d v%d.%d.%d:\n"

	.comm	_hw_id_names,8,3                ## @hw_id_names
L_.str.5:                               ## @.str.5
	.asciz	"\t0x%08x\n"

	.comm	_MAX_HWIP,4,2                   ## @MAX_HWIP
	.comm	_hw_id_map,8,3                  ## @hw_id_map
L_.str.6:                               ## @.str.6
	.asciz	"set register base offset for %s\n"

.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_amdgpu_discovery_reg_base_init ; -- Begin function amdgpu_discovery_reg_base_init
	.p2align	2
_amdgpu_discovery_reg_base_init:        ; @amdgpu_discovery_reg_base_init
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #176
	.cfi_def_cfa_offset 176
	stp	x28, x27, [sp, #80]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #96]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #112]            ; 16-byte Folded Spill
	stp	x22, x21, [sp, #128]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #144]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #160]            ; 16-byte Folded Spill
	add	x29, sp, #160
	.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
	ldrsw	x20, [x0]
	cbz	w20, LBB0_17
; %bb.1:
	mov	x19, x0
	ldr	x8, [x20]
Lloh0:
	adrp	x9, _IP_DISCOVERY@GOTPAGE
Lloh1:
	ldr	x9, [x9, _IP_DISCOVERY@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
	ldr	w0, [x8, x9, lsl #2]
	bl	_le16_to_cpu
	add	x8, x0, x20
	str	x8, [sp, #56]                   ; 8-byte Folded Spill
	ldr	w0, [x8, #8]
	bl	_le16_to_cpu
	mov	x20, x0
Lloh3:
	adrp	x0, l_.str.1@PAGE
Lloh4:
	add	x0, x0, l_.str.1@PAGEOFF
	mov	x1, x20
	bl	_DRM_DEBUG
	cmp	w20, #1
	b.lt	LBB0_16
; %bb.2:
	mov	x25, #0
	and	x8, x20, #0xffffffff
	str	x8, [sp, #48]                   ; 8-byte Folded Spill
Lloh5:
	adrp	x20, _hw_id_names@GOTPAGE
Lloh6:
	ldr	x20, [x20, _hw_id_names@GOTPAGEOFF]
Lloh7:
	adrp	x22, l_.str.5@PAGE
Lloh8:
	add	x22, x22, l_.str.5@PAGEOFF
Lloh9:
	adrp	x28, _MAX_HWIP@GOTPAGE
Lloh10:
	ldr	x28, [x28, _MAX_HWIP@GOTPAGEOFF]
Lloh11:
	adrp	x26, _hw_id_map@GOTPAGE
Lloh12:
	ldr	x26, [x26, _hw_id_map@GOTPAGEOFF]
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	ldr	x25, [sp, #64]                  ; 8-byte Folded Reload
	add	x25, x25, #1
	ldr	x8, [sp, #48]                   ; 8-byte Folded Reload
	cmp	x25, x8
	b.eq	LBB0_16
LBB0_4:                                 ; =>This Loop Header: Depth=1
                                        ;     Child Loop BB0_8 Depth 2
                                        ;       Child Loop BB0_10 Depth 3
                                        ;       Child Loop BB0_14 Depth 3
	ldr	x8, [sp, #56]                   ; 8-byte Folded Reload
	ldr	x8, [x8]
	ldr	w0, [x8, x25, lsl #2]
	bl	_le16_to_cpu
	ldrsw	x23, [x19]
	sxtw	x21, w0
	add	x24, x23, x21
	ldr	w0, [x24, #4]
	bl	_le16_to_cpu
	mov	x27, x0
	ldr	w0, [x24]
	bl	_le16_to_cpu
	cmp	x0, x25
	b.ne	LBB0_18
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	str	x25, [sp, #64]                  ; 8-byte Folded Spill
	ldr	w0, [x21, x23]
	bl	_le16_to_cpu
	mov	x1, x0
	mov	x8, x27
	str	x8, [sp]
Lloh13:
	adrp	x0, l_.str.3@PAGE
Lloh14:
	add	x0, x0, l_.str.3@PAGEOFF
                                        ; kill: def $w1 killed $w1 killed $x1
	bl	_DRM_DEBUG
	str	x27, [sp, #72]                  ; 8-byte Folded Spill
	cmp	w27, #1
	b.lt	LBB0_3
; %bb.6:                                ;   in Loop: Header=BB0_4 Depth=1
	mov	w27, #0
	add	w21, w21, #8
	b	LBB0_8
LBB0_7:                                 ;   in Loop: Header=BB0_8 Depth=2
	ldr	w8, [x24]
	add	w8, w21, w8, lsl #2
	add	w21, w8, #36
	add	w27, w27, #1
	ldr	x8, [sp, #72]                   ; 8-byte Folded Reload
	cmp	w27, w8
	b.eq	LBB0_3
LBB0_8:                                 ;   Parent Loop BB0_4 Depth=1
                                        ; =>  This Loop Header: Depth=2
                                        ;       Child Loop BB0_10 Depth 3
                                        ;       Child Loop BB0_14 Depth 3
	ldrsw	x8, [x19]
	add	x24, x8, w21, sxtw
	ldr	w23, [x24]
	ldr	x25, [x20]
	ldr	w0, [x24, #24]
	bl	_le16_to_cpu
	ldr	w25, [x25, x0, lsl #2]
	ldr	w0, [x24, #24]
	bl	_le16_to_cpu
	ldr	x8, [x24, #8]
	ldp	w10, w9, [x24, #32]
	ldr	w11, [x24, #28]
	stp	x10, x11, [sp, #24]
	stp	x8, x9, [sp, #8]
	str	x0, [sp]
Lloh15:
	adrp	x0, l_.str.4@PAGE
Lloh16:
	add	x0, x0, l_.str.4@PAGEOFF
	mov	x1, x25
	bl	_DRM_DEBUG
	cmp	w23, #1
	b.lt	LBB0_11
; %bb.9:                                ;   in Loop: Header=BB0_8 Depth=2
	mov	x25, #0
	lsl	x23, x23, #2
LBB0_10:                                ;   Parent Loop BB0_4 Depth=1
                                        ;     Parent Loop BB0_8 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	x8, [x24, #16]
	ldr	w0, [x8, x25]
	bl	_le32_to_cpu
	mov	x1, x0
	ldr	x8, [x24, #16]
	str	w0, [x8, x25]
	mov	x0, x22
	bl	_DRM_DEBUG
	add	x25, x25, #4
	cmp	x23, x25
	b.ne	LBB0_10
LBB0_11:                                ;   in Loop: Header=BB0_8 Depth=2
	ldr	w8, [x28]
	cmp	w8, #1
	b.lt	LBB0_7
; %bb.12:                               ;   in Loop: Header=BB0_8 Depth=2
	mov	x25, #0
	b	LBB0_14
LBB0_13:                                ;   in Loop: Header=BB0_14 Depth=3
	add	x25, x25, #1
	ldrsw	x8, [x28]
	cmp	x25, x8
	b.ge	LBB0_7
LBB0_14:                                ;   Parent Loop BB0_4 Depth=1
                                        ;     Parent Loop BB0_8 Depth=2
                                        ; =>    This Inner Loop Header: Depth=3
	ldr	x8, [x26]
	ldr	x23, [x8, x25, lsl #3]
	ldr	w0, [x24, #24]
	bl	_le16_to_cpu
	cmp	x23, x0
	b.ne	LBB0_13
; %bb.15:                               ;   in Loop: Header=BB0_14 Depth=3
	ldr	x23, [x20]
	ldr	w0, [x24, #24]
	bl	_le16_to_cpu
	ldr	w1, [x23, x0, lsl #2]
Lloh17:
	adrp	x0, l_.str.6@PAGE
Lloh18:
	add	x0, x0, l_.str.6@PAGEOFF
	bl	_DRM_INFO
	ldr	x8, [x19, #8]
	ldr	x8, [x8, x25, lsl #3]
	ldp	x10, x9, [x24, #8]
	str	x9, [x8, x10, lsl #3]
	b	LBB0_13
LBB0_16:
	mov	w0, #0
	b	LBB0_20
LBB0_17:
Lloh19:
	adrp	x0, l_.str@PAGE
Lloh20:
	add	x0, x0, l_.str@PAGEOFF
	b	LBB0_19
LBB0_18:
	ldr	w0, [x21, x23]
	bl	_le16_to_cpu
	stp	x0, x25, [sp]
Lloh21:
	adrp	x0, l_.str.2@PAGE
Lloh22:
	add	x0, x0, l_.str.2@PAGEOFF
LBB0_19:
	bl	_DRM_ERROR
Lloh23:
	adrp	x8, _EINVAL@GOTPAGE
Lloh24:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh25:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_20:
	ldp	x29, x30, [sp, #160]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #144]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #128]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #112]            ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #96]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #80]             ; 16-byte Folded Reload
	add	sp, sp, #176
	ret
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh21, Lloh22
	.loh AdrpLdrGotLdr	Lloh23, Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"ip discovery uninitialized\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_IP_DISCOVERY,8,3               ; @IP_DISCOVERY
l_.str.1:                               ; @.str.1
	.asciz	"number of dies: %d\n"

l_.str.2:                               ; @.str.2
	.asciz	"invalid die id %d, expected %d\n"

l_.str.3:                               ; @.str.3
	.asciz	"number of hardware IPs on die%d: %d\n"

l_.str.4:                               ; @.str.4
	.asciz	"%s(%d) #%d v%d.%d.%d:\n"

	.comm	_hw_id_names,8,3                ; @hw_id_names
l_.str.5:                               ; @.str.5
	.asciz	"\t0x%08x\n"

	.comm	_MAX_HWIP,4,2                   ; @MAX_HWIP
	.comm	_hw_id_map,8,3                  ; @hw_id_map
l_.str.6:                               ; @.str.6
	.asciz	"set register base offset for %s\n"

.subsections_via_symbols
