	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ram_attach
_ram_attach:                            ## @ram_attach
	.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
	movl	%edi, %r14d
	leaq	L_.str(%rip), %rdi
	callq	_preload_search_by_type
	testq	%rax, %rax
	jne	LBB0_2
## %bb.1:
	movq	_ELF_KERN_STR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	callq	_preload_search_by_type
LBB0_2:
	movq	_MODINFO_METADATA@GOTPCREL(%rip), %rcx
	movq	_MODINFOMD_SMAP@GOTPCREL(%rip), %rdx
	movl	(%rdx), %esi
	orl	(%rcx), %esi
	movq	%rax, %rdi
	callq	_preload_search_info
	testq	%rax, %rax
	je	LBB0_14
## %bb.3:
	movq	%rax, %rbx
	movq	-8(%rax), %r12
	addq	%rax, %r12
	movl	$0, -44(%rbp)
	cmpq	%r12, %rax
	jae	LBB0_22
## %bb.4:
	movq	_SMAP_TYPE_MEMORY@GOTPCREL(%rip), %r13
	movq	_mem_rman@GOTPCREL(%rip), %r15
	xorl	%edx, %edx
	jmp	LBB0_5
LBB0_12:                                ##   in Loop: Header=BB0_5 Depth=1
	movl	-44(%rbp), %edx
	incl	%edx
	movl	%edx, -44(%rbp)
	.p2align	4, 0x90
LBB0_13:                                ##   in Loop: Header=BB0_5 Depth=1
	addq	$24, %rbx
	cmpq	%r12, %rbx
	jae	LBB0_22
LBB0_5:                                 ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rax
	cmpq	(%r13), %rax
	jne	LBB0_13
## %bb.6:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	8(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_13
## %bb.7:                               ##   in Loop: Header=BB0_5 Depth=1
	movq	16(%rbx), %rcx
	movq	(%r15), %rsi
	movq	%rsi, %r8
	subq	%rcx, %r8
	jl	LBB0_13
## %bb.8:                               ##   in Loop: Header=BB0_5 Depth=1
	leaq	(%rcx,%rax), %rdi
	cmpq	%rsi, %rdi
	cmovleq	%rax, %r8
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	callq	_bus_set_resource
	testl	%eax, %eax
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_5 Depth=1
	movl	-44(%rbp), %esi
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_panic
LBB0_10:                                ##   in Loop: Header=BB0_5 Depth=1
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	%r14d, %edi
	leaq	-44(%rbp), %rdx
	xorl	%ecx, %ecx
	callq	_bus_alloc_resource_any
	testq	%rax, %rax
	jne	LBB0_12
## %bb.11:                              ##   in Loop: Header=BB0_5 Depth=1
	movl	-44(%rbp), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_panic
	jmp	LBB0_12
LBB0_14:
	movl	$0, -44(%rbp)
	movq	_dump_avail@GOTPCREL(%rip), %rax
	movq	(%rax), %rbx
	movq	8(%rbx), %rax
	testq	%rax, %rax
	je	LBB0_22
## %bb.15:
	movq	_mem_rman@GOTPCREL(%rip), %r15
	movq	_SYS_RES_MEMORY@GOTPCREL(%rip), %r12
	leaq	-44(%rbp), %r13
	xorl	%edx, %edx
	jmp	LBB0_16
	.p2align	4, 0x90
LBB0_21:                                ##   in Loop: Header=BB0_16 Depth=1
	movl	-44(%rbp), %edx
	incl	%edx
	movl	%edx, -44(%rbp)
	movq	24(%rbx), %rax
	addq	$16, %rbx
	testq	%rax, %rax
	je	LBB0_22
LBB0_16:                                ## =>This Inner Loop Header: Depth=1
	movq	(%rbx), %rcx
	movq	(%r15), %r8
	cmpq	%r8, %rcx
	jg	LBB0_22
## %bb.17:                              ##   in Loop: Header=BB0_16 Depth=1
	cmpq	%r8, %rax
	cmovlq	%rax, %r8
	subq	%rcx, %r8
	movl	(%r12), %esi
	movl	%r14d, %edi
	callq	_bus_set_resource
	testl	%eax, %eax
	je	LBB0_19
## %bb.18:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	-44(%rbp), %esi
	leaq	L_.str.1(%rip), %rdi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_panic
LBB0_19:                                ##   in Loop: Header=BB0_16 Depth=1
	movl	(%r12), %esi
	movl	%r14d, %edi
	movq	%r13, %rdx
	xorl	%ecx, %ecx
	callq	_bus_alloc_resource_any
	testq	%rax, %rax
	jne	LBB0_21
## %bb.20:                              ##   in Loop: Header=BB0_16 Depth=1
	movl	-44(%rbp), %esi
	leaq	L_.str.2(%rip), %rdi
	xorl	%eax, %eax
	callq	_panic
	jmp	LBB0_21
LBB0_22:
	xorl	%eax, %eax
	addq	$8, %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	"elf kernel"

	.comm	_ELF_KERN_STR,8,3               ## @ELF_KERN_STR
	.comm	_MODINFO_METADATA,4,2           ## @MODINFO_METADATA
	.comm	_MODINFOMD_SMAP,4,2             ## @MODINFOMD_SMAP
	.comm	_SMAP_TYPE_MEMORY,8,3           ## @SMAP_TYPE_MEMORY
	.comm	_mem_rman,8,3                   ## @mem_rman
	.comm	_SYS_RES_MEMORY,4,2             ## @SYS_RES_MEMORY
L_.str.1:                               ## @.str.1
	.asciz	"ram_attach: resource %d failed set with %d"

L_.str.2:                               ## @.str.2
	.asciz	"ram_attach: resource %d failed to attach"

	.comm	_dump_avail,8,3                 ## @dump_avail
	.no_dead_strip	_ram_attach
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ram_attach
_ram_attach:                            ; @ram_attach
	.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
	mov	x19, x0
Lloh0:
	adrp	x0, l_.str@PAGE
Lloh1:
	add	x0, x0, l_.str@PAGEOFF
	bl	_preload_search_by_type
	cbnz	x0, LBB0_2
; %bb.1:
Lloh2:
	adrp	x8, _ELF_KERN_STR@GOTPAGE
Lloh3:
	ldr	x8, [x8, _ELF_KERN_STR@GOTPAGEOFF]
Lloh4:
	ldr	x0, [x8]
	bl	_preload_search_by_type
LBB0_2:
Lloh5:
	adrp	x8, _MODINFO_METADATA@GOTPAGE
Lloh6:
	ldr	x8, [x8, _MODINFO_METADATA@GOTPAGEOFF]
Lloh7:
	ldr	w8, [x8]
Lloh8:
	adrp	x9, _MODINFOMD_SMAP@GOTPAGE
Lloh9:
	ldr	x9, [x9, _MODINFOMD_SMAP@GOTPAGEOFF]
Lloh10:
	ldr	w9, [x9]
	orr	w1, w9, w8
	bl	_preload_search_info
	cbz	x0, LBB0_14
; %bb.3:
	mov	x20, x0
	ldur	x8, [x0, #-8]
	str	wzr, [sp, #12]
	add	x23, x8, x0
	cmp	x0, x23
	b.hs	LBB0_22
; %bb.4:
	mov	w2, #0
Lloh11:
	adrp	x24, _SMAP_TYPE_MEMORY@GOTPAGE
Lloh12:
	ldr	x24, [x24, _SMAP_TYPE_MEMORY@GOTPAGEOFF]
Lloh13:
	adrp	x25, _mem_rman@GOTPAGE
Lloh14:
	ldr	x25, [x25, _mem_rman@GOTPAGEOFF]
Lloh15:
	adrp	x26, _SYS_RES_MEMORY@GOTPAGE
Lloh16:
	ldr	x26, [x26, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh17:
	adrp	x21, l_.str.2@PAGE
Lloh18:
	add	x21, x21, l_.str.2@PAGEOFF
Lloh19:
	adrp	x22, l_.str.1@PAGE
Lloh20:
	add	x22, x22, l_.str.1@PAGEOFF
	b	LBB0_7
LBB0_5:                                 ;   in Loop: Header=BB0_7 Depth=1
	ldr	w8, [sp, #12]
	add	w2, w8, #1
	str	w2, [sp, #12]
LBB0_6:                                 ;   in Loop: Header=BB0_7 Depth=1
	add	x20, x20, #24
	cmp	x20, x23
	b.hs	LBB0_22
LBB0_7:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20]
	ldr	x9, [x24]
	cmp	x8, x9
	b.ne	LBB0_6
; %bb.8:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x8, [x20, #8]
	cbz	x8, LBB0_6
; %bb.9:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	x3, [x20, #16]
	ldr	x9, [x25]
	subs	x10, x9, x3
	b.lt	LBB0_6
; %bb.10:                               ;   in Loop: Header=BB0_7 Depth=1
	add	x11, x3, x8
	cmp	x11, x9
	csel	x4, x10, x8, gt
	ldr	w1, [x26]
	mov	x0, x19
	bl	_bus_set_resource
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_12
; %bb.11:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w1, [sp, #12]
	str	x0, [sp]
	mov	x0, x22
	bl	_panic
LBB0_12:                                ;   in Loop: Header=BB0_7 Depth=1
	ldr	w1, [x26]
	add	x2, sp, #12
	mov	x0, x19
	mov	w3, #0
	bl	_bus_alloc_resource_any
	cbnz	x0, LBB0_5
; %bb.13:                               ;   in Loop: Header=BB0_7 Depth=1
	ldr	w1, [sp, #12]
	mov	x0, x21
	bl	_panic
	b	LBB0_5
LBB0_14:
	str	wzr, [sp, #12]
Lloh21:
	adrp	x8, _dump_avail@GOTPAGE
Lloh22:
	ldr	x8, [x8, _dump_avail@GOTPAGEOFF]
Lloh23:
	ldr	x22, [x8]
	ldr	x8, [x22, #8]
	cbz	x8, LBB0_22
; %bb.15:
	mov	w2, #0
Lloh24:
	adrp	x23, _mem_rman@GOTPAGE
Lloh25:
	ldr	x23, [x23, _mem_rman@GOTPAGEOFF]
Lloh26:
	adrp	x24, _SYS_RES_MEMORY@GOTPAGE
Lloh27:
	ldr	x24, [x24, _SYS_RES_MEMORY@GOTPAGEOFF]
Lloh28:
	adrp	x20, l_.str.2@PAGE
Lloh29:
	add	x20, x20, l_.str.2@PAGEOFF
Lloh30:
	adrp	x21, l_.str.1@PAGE
Lloh31:
	add	x21, x21, l_.str.1@PAGEOFF
	b	LBB0_17
LBB0_16:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	w8, [sp, #12]
	add	w2, w8, #1
	str	w2, [sp, #12]
	ldr	x8, [x22, #24]
	add	x22, x22, #16
	cbz	x8, LBB0_22
LBB0_17:                                ; =>This Inner Loop Header: Depth=1
	ldr	x3, [x22]
	ldr	x9, [x23]
	cmp	x3, x9
	b.gt	LBB0_22
; %bb.18:                               ;   in Loop: Header=BB0_17 Depth=1
	cmp	x8, x9
	csel	x8, x8, x9, lt
	sub	x4, x8, x3
	ldr	w1, [x24]
	mov	x0, x19
	bl	_bus_set_resource
                                        ; kill: def $w0 killed $w0 def $x0
	cbz	w0, LBB0_20
; %bb.19:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	w1, [sp, #12]
	str	x0, [sp]
	mov	x0, x21
	bl	_panic
LBB0_20:                                ;   in Loop: Header=BB0_17 Depth=1
	ldr	w1, [x24]
	add	x2, sp, #12
	mov	x0, x19
	mov	w3, #0
	bl	_bus_alloc_resource_any
	cbnz	x0, LBB0_16
; %bb.21:                               ;   in Loop: Header=BB0_17 Depth=1
	ldr	w1, [sp, #12]
	mov	x0, x20
	bl	_panic
	b	LBB0_16
LBB0_22:
	mov	w0, #0
	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
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh2, Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGot	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh30, Lloh31
	.loh AdrpAdd	Lloh28, Lloh29
	.loh AdrpLdrGot	Lloh26, Lloh27
	.loh AdrpLdrGot	Lloh24, Lloh25
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"elf kernel"

	.comm	_ELF_KERN_STR,8,3               ; @ELF_KERN_STR
	.comm	_MODINFO_METADATA,4,2           ; @MODINFO_METADATA
	.comm	_MODINFOMD_SMAP,4,2             ; @MODINFOMD_SMAP
	.comm	_SMAP_TYPE_MEMORY,8,3           ; @SMAP_TYPE_MEMORY
	.comm	_mem_rman,8,3                   ; @mem_rman
	.comm	_SYS_RES_MEMORY,4,2             ; @SYS_RES_MEMORY
l_.str.1:                               ; @.str.1
	.asciz	"ram_attach: resource %d failed set with %d"

l_.str.2:                               ; @.str.2
	.asciz	"ram_attach: resource %d failed to attach"

	.comm	_dump_avail,8,3                 ; @dump_avail
	.no_dead_strip	_ram_attach
.subsections_via_symbols
