	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function yenta_allocate_res
_yenta_allocate_res:                    ## @yenta_allocate_res
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%r8d, %r14d
	movq	(%rdi), %rbx
	movq	_PCI_BRIDGE_RESOURCES@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	leaq	(%rax,%rax,2), %r10
	shlq	$3, %r10
	addq	16(%rbx), %r10
	movslq	%esi, %rax
	leaq	(%rax,%rax,2), %r9
	xorl	%r8d, %r8d
	cmpq	$0, 16(%r10,%r9,8)
	je	LBB0_2
LBB0_1:
	movl	%r8d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_2:
	movl	%esi, -52(%rbp)                 ## 4-byte Spill
	leaq	(%r10,%r9,8), %rsi
	movq	_IORESOURCE_IO@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	andl	%edx, %eax
	movl	$-4096, %eax                    ## imm = 0xF000
	movq	%rdi, %r15
	movl	$-4, %r13d
	cmovel	%eax, %r13d
	movq	8(%rbx), %rax
	movl	(%rax), %eax
	movl	%eax, 12(%rsi)
	movl	%edx, -56(%rbp)                 ## 4-byte Spill
	movq	%rsi, -48(%rbp)                 ## 8-byte Spill
	movl	%edx, (%rsi)
	movl	%ecx, %esi
	callq	_config_readl
	movl	%eax, %r12d
	andl	%r13d, %eax
	movl	%eax, -72(%rbp)
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	%r15, %rdi
	movl	%r14d, %esi
	callq	_config_readl
	movl	%r13d, %ecx
	notl	%ecx
	orl	%eax, %ecx
	movl	%ecx, -68(%rbp)
	andl	%r12d, %r13d
	movq	%rbx, %r12
	je	LBB0_7
## %bb.3:
	cmpl	%r13d, %ecx
	jbe	LBB0_7
## %bb.4:
	movq	_override_bios@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jne	LBB0_7
## %bb.5:
	movl	4(%r12), %edi
	leaq	-72(%rbp), %rdx
	movq	-48(%rbp), %rsi                 ## 8-byte Reload
	callq	_pcibios_bus_to_resource
	movq	_PCI_BRIDGE_RESOURCES@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movl	-52(%rbp), %ebx                 ## 4-byte Reload
	addl	%ebx, %esi
	movq	%r12, %rdi
	callq	_pci_claim_resource
	testq	%rax, %rax
	je	LBB0_18
## %bb.6:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	movl	%ebx, %edx
	callq	_dev_info
LBB0_7:
	movl	-56(%rbp), %r14d                ## 4-byte Reload
	movq	_IORESOURCE_IO@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	je	LBB0_11
## %bb.8:
	movq	_BRIDGE_IO_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movq	%rbx, %rdi
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	%r13, %rsi
	callq	_yenta_search_res
	movl	$1, %r8d
	testq	%rax, %rax
	jne	LBB0_1
## %bb.9:
	movq	_BRIDGE_IO_ACC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	testq	%rax, %rax
	jne	LBB0_10
## %bb.15:
	movq	_BRIDGE_IO_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%rbx, %rdi
LBB0_16:
	movq	%r13, %rsi
	callq	_yenta_search_res
	testq	%rax, %rax
	movl	$1, %r8d
	jne	LBB0_1
## %bb.17:
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	movl	%r14d, %edx
	callq	_dev_info
	movq	$0, (%r13)
	movl	$0, 8(%r13)
LBB0_18:
	xorl	%r8d, %r8d
	jmp	LBB0_1
LBB0_11:
	movq	_IORESOURCE_PREFETCH@GOTPCREL(%rip), %rax
	testl	%r14d, (%rax)
	movq	-48(%rbp), %r13                 ## 8-byte Reload
	movq	-64(%rbp), %r15                 ## 8-byte Reload
	je	LBB0_21
## %bb.12:
	movq	_BRIDGE_MEM_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	movl	$1, %r8d
	testq	%rax, %rax
	jne	LBB0_1
## %bb.13:
	movq	_BRIDGE_MEM_ACC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	testq	%rax, %rax
	jne	LBB0_10
## %bb.19:
	movq	_BRIDGE_MEM_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	testq	%rax, %rax
	movl	$1, %r8d
	jne	LBB0_1
## %bb.20:
	movq	_IORESOURCE_MEM@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, (%r13)
LBB0_21:
	movq	_BRIDGE_MEM_MAX@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	movl	$1, %r8d
	testq	%rax, %rax
	jne	LBB0_1
## %bb.22:
	movq	_BRIDGE_MEM_ACC@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	movq	%r13, %rsi
	callq	_yenta_search_res
	testq	%rax, %rax
	je	LBB0_24
LBB0_10:
	movl	$1, %r8d
	jmp	LBB0_1
LBB0_24:
	movq	_BRIDGE_MEM_MIN@GOTPCREL(%rip), %rax
	movl	(%rax), %edx
	movq	%r15, %rdi
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_PCI_BRIDGE_RESOURCES,4,2       ## @PCI_BRIDGE_RESOURCES
	.comm	_IORESOURCE_IO,4,2              ## @IORESOURCE_IO
	.comm	_override_bios,4,2              ## @override_bios
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Preassigned resource %d busy or not available, reconfiguring...\n"

	.comm	_BRIDGE_IO_MAX,4,2              ## @BRIDGE_IO_MAX
	.comm	_BRIDGE_IO_ACC,4,2              ## @BRIDGE_IO_ACC
	.comm	_BRIDGE_IO_MIN,4,2              ## @BRIDGE_IO_MIN
	.comm	_IORESOURCE_PREFETCH,4,2        ## @IORESOURCE_PREFETCH
	.comm	_BRIDGE_MEM_MAX,4,2             ## @BRIDGE_MEM_MAX
	.comm	_BRIDGE_MEM_ACC,4,2             ## @BRIDGE_MEM_ACC
	.comm	_BRIDGE_MEM_MIN,4,2             ## @BRIDGE_MEM_MIN
	.comm	_IORESOURCE_MEM,4,2             ## @IORESOURCE_MEM
L_.str.1:                               ## @.str.1
	.asciz	"no resource of type %x available, trying to continue...\n"

	.no_dead_strip	_yenta_allocate_res
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function yenta_allocate_res
_yenta_allocate_res:                    ; @yenta_allocate_res
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	stp	x28, x27, [sp, #16]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #32]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #48]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #64]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #80]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #96]             ; 16-byte Folded Spill
	add	x29, sp, #96
	.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
	ldr	x21, [x0]
Lloh0:
	adrp	x26, _PCI_BRIDGE_RESOURCES@GOTPAGE
Lloh1:
	ldr	x26, [x26, _PCI_BRIDGE_RESOURCES@GOTPAGEOFF]
	ldr	x8, [x21, #16]
	ldrsw	x9, [x26]
	mov	w10, #24
	madd	x8, x9, x10, x8
	smaddl	x20, w1, w10, x8
	ldr	x8, [x20, #16]
	cbz	x8, LBB0_2
; %bb.1:
	mov	w0, #0
	b	LBB0_20
LBB0_2:
	mov	x24, x4
	mov	x19, x2
	mov	x23, x1
	mov	x22, x0
Lloh2:
	adrp	x25, _IORESOURCE_IO@GOTPAGE
Lloh3:
	ldr	x25, [x25, _IORESOURCE_IO@GOTPAGEOFF]
	ldr	w8, [x25]
	tst	w8, w2
	mov	w8, #-4
	mov	w9, #-4096
	csel	w28, w9, w8, eq
	ldr	x8, [x21, #8]
	ldr	w8, [x8]
	str	w8, [x20, #12]
	str	w2, [x20]
	mov	x1, x3
	bl	_config_readl
	and	w27, w0, w28
	str	w27, [sp, #8]
	mov	x0, x22
	mov	x1, x24
	bl	_config_readl
	orn	w8, w0, w28
	str	w8, [sp, #12]
	cbz	w27, LBB0_6
; %bb.3:
Lloh4:
	adrp	x9, _override_bios@GOTPAGE
Lloh5:
	ldr	x9, [x9, _override_bios@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	cmp	w8, w27
	ccmp	w9, #0, #0, hi
	b.ne	LBB0_6
; %bb.4:
	ldr	w0, [x21, #4]
	add	x2, sp, #8
	mov	x1, x20
	bl	_pcibios_bus_to_resource
	ldr	w8, [x26]
	add	w1, w8, w23
	mov	x0, x21
	bl	_pci_claim_resource
	cbz	x0, LBB0_20
; %bb.5:
Lloh7:
	adrp	x1, l_.str@PAGE
Lloh8:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x21
	mov	x2, x23
	bl	_dev_info
LBB0_6:
	ldr	w8, [x25]
	tst	w8, w19
	b.eq	LBB0_12
; %bb.7:
Lloh9:
	adrp	x8, _BRIDGE_IO_MAX@GOTPAGE
Lloh10:
	ldr	x8, [x8, _BRIDGE_IO_MAX@GOTPAGEOFF]
Lloh11:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.8:
Lloh12:
	adrp	x8, _BRIDGE_IO_ACC@GOTPAGE
Lloh13:
	ldr	x8, [x8, _BRIDGE_IO_ACC@GOTPAGEOFF]
Lloh14:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.9:
Lloh15:
	adrp	x8, _BRIDGE_IO_MIN@GOTPAGE
Lloh16:
	ldr	x8, [x8, _BRIDGE_IO_MIN@GOTPAGEOFF]
LBB0_10:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.11:
Lloh17:
	adrp	x1, l_.str.1@PAGE
Lloh18:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x21
	mov	x2, x19
	bl	_dev_info
	mov	w0, #0
	str	wzr, [x20, #8]
	str	xzr, [x20]
	b	LBB0_20
LBB0_12:
Lloh19:
	adrp	x8, _IORESOURCE_PREFETCH@GOTPAGE
Lloh20:
	ldr	x8, [x8, _IORESOURCE_PREFETCH@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
Lloh22:
	adrp	x23, _BRIDGE_MEM_MAX@GOTPAGE
Lloh23:
	ldr	x23, [x23, _BRIDGE_MEM_MAX@GOTPAGEOFF]
	tst	w8, w19
	b.eq	LBB0_17
; %bb.13:
	ldr	w2, [x23]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.14:
Lloh24:
	adrp	x8, _BRIDGE_MEM_ACC@GOTPAGE
Lloh25:
	ldr	x8, [x8, _BRIDGE_MEM_ACC@GOTPAGEOFF]
Lloh26:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.15:
Lloh27:
	adrp	x8, _BRIDGE_MEM_MIN@GOTPAGE
Lloh28:
	ldr	x8, [x8, _BRIDGE_MEM_MIN@GOTPAGEOFF]
Lloh29:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.16:
Lloh30:
	adrp	x8, _IORESOURCE_MEM@GOTPAGE
Lloh31:
	ldr	x8, [x8, _IORESOURCE_MEM@GOTPAGEOFF]
Lloh32:
	ldr	w8, [x8]
	str	w8, [x20]
LBB0_17:
	ldr	w2, [x23]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbnz	x0, LBB0_19
; %bb.18:
Lloh33:
	adrp	x8, _BRIDGE_MEM_ACC@GOTPAGE
Lloh34:
	ldr	x8, [x8, _BRIDGE_MEM_ACC@GOTPAGEOFF]
Lloh35:
	ldr	w2, [x8]
	mov	x0, x22
	mov	x1, x20
	bl	_yenta_search_res
	cbz	x0, LBB0_21
LBB0_19:
	mov	w0, #1
LBB0_20:
	ldp	x29, x30, [sp, #96]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #80]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #64]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #48]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #32]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #112
	ret
LBB0_21:
Lloh36:
	adrp	x8, _BRIDGE_MEM_MIN@GOTPAGE
Lloh37:
	ldr	x8, [x8, _BRIDGE_MEM_MIN@GOTPAGEOFF]
	b	LBB0_10
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpLdrGot	Lloh22, Lloh23
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpLdrGotLdr	Lloh27, Lloh28, Lloh29
	.loh AdrpLdrGotLdr	Lloh30, Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.loh AdrpLdrGot	Lloh36, Lloh37
	.cfi_endproc
                                        ; -- End function
	.comm	_PCI_BRIDGE_RESOURCES,4,2       ; @PCI_BRIDGE_RESOURCES
	.comm	_IORESOURCE_IO,4,2              ; @IORESOURCE_IO
	.comm	_override_bios,4,2              ; @override_bios
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Preassigned resource %d busy or not available, reconfiguring...\n"

	.comm	_BRIDGE_IO_MAX,4,2              ; @BRIDGE_IO_MAX
	.comm	_BRIDGE_IO_ACC,4,2              ; @BRIDGE_IO_ACC
	.comm	_BRIDGE_IO_MIN,4,2              ; @BRIDGE_IO_MIN
	.comm	_IORESOURCE_PREFETCH,4,2        ; @IORESOURCE_PREFETCH
	.comm	_BRIDGE_MEM_MAX,4,2             ; @BRIDGE_MEM_MAX
	.comm	_BRIDGE_MEM_ACC,4,2             ; @BRIDGE_MEM_ACC
	.comm	_BRIDGE_MEM_MIN,4,2             ; @BRIDGE_MEM_MIN
	.comm	_IORESOURCE_MEM,4,2             ; @IORESOURCE_MEM
l_.str.1:                               ; @.str.1
	.asciz	"no resource of type %x available, trying to continue...\n"

	.no_dead_strip	_yenta_allocate_res
.subsections_via_symbols
