	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ps3bus_alloc_resource
_ps3bus_alloc_resource:                 ## @ps3bus_alloc_resource
	.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	$56, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r9, -88(%rbp)                  ## 8-byte Spill
	movq	%r8, -80(%rbp)                  ## 8-byte Spill
	movq	%rcx, %r12
	movl	%edx, %r13d
	movl	%esi, %ebx
	movl	%edi, %r14d
	callq	_device_get_softc
	movq	%rax, -72(%rbp)                 ## 8-byte Spill
	movl	%ebx, -44(%rbp)                 ## 4-byte Spill
	movl	%ebx, %edi
	callq	_device_get_ivars
	movq	_RF_ACTIVE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %r15d
	cmpl	$129, %r13d
	je	LBB0_10
## %bb.1:
	cmpl	$128, %r13d
	jne	LBB0_9
## %bb.2:
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	movl	(%r12), %edx
	movq	%rax, %rdi
	movl	$128, %esi
	callq	_resource_list_find
	testq	%rax, %rax
	je	LBB0_3
## %bb.4:
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movq	(%rax), %r14
	movq	%r14, %r12
	movq	-80(%rbp), %rdx                 ## 8-byte Reload
	cmpq	%rdx, %r14
	jg	LBB0_6
## %bb.5:
	movq	8(%rax), %rcx
	cmpq	%rdx, %rcx
	cmovlq	%rcx, %rdx
	movq	%rdx, %r12
LBB0_6:
	movq	-88(%rbp), %rcx                 ## 8-byte Reload
	cmpq	%rcx, %r14
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	jg	LBB0_8
## %bb.7:
	movq	8(%rax), %rax
	cmpq	%rcx, %rax
	cmovlq	%rax, %rcx
	movq	%rcx, %r14
LBB0_8:
	movq	%r14, %r13
	subq	%r12, %r13
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
	addq	$4, %rdi
	jmp	LBB0_11
LBB0_10:
	movl	%r13d, -52(%rbp)                ## 4-byte Spill
	movl	%r14d, -48(%rbp)                ## 4-byte Spill
	movq	16(%rbp), %r14
	movq	%r12, -64(%rbp)                 ## 8-byte Spill
	movl	(%r12), %edx
	movq	%rax, %rdi
	movl	$129, %esi
	callq	_resource_list_find
	movq	%rax, %rbx
	movq	(%rax), %r12
	movl	16(%rax), %esi
	movq	%r14, %rdi
	callq	_ulmax
	movq	%rax, %r13
	movq	8(%rbx), %rdi
	movl	(%rbx), %eax
	leal	(%rax,%r13), %esi
	decl	%esi
	callq	_ulmax
	movq	%rax, %r14
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movq	-72(%rbp), %rdi                 ## 8-byte Reload
LBB0_11:
	movl	%r15d, %r8d
	notl	%r8d
	andl	24(%rbp), %r8d
	movq	%r12, %rsi
	movq	%r14, %rdx
	movq	%r13, %rcx
	movl	%ebx, %r9d
	callq	_rman_reserve_resource
	testq	%rax, %rax
	je	LBB0_12
## %bb.13:
	movq	%rax, %r12
	movq	-64(%rbp), %rbx                 ## 8-byte Reload
	movl	(%rbx), %esi
	movq	%rax, %rdi
	callq	_rman_set_rid
	testl	%r15d, 24(%rbp)
	je	LBB0_16
## %bb.14:
	movl	(%rbx), %edx
	movl	-44(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, %edi
	movl	-52(%rbp), %esi                 ## 4-byte Reload
	movq	%r12, %rcx
	callq	_bus_activate_resource
	testq	%rax, %rax
	je	LBB0_16
## %bb.15:
	movl	%ebx, %edi
	callq	_device_get_nameunit
	leaq	L_.str.3(%rip), %rsi
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_device_printf
	movq	%r12, %rdi
	callq	_rman_release_resource
	xorl	%r12d, %r12d
	jmp	LBB0_16
LBB0_9:
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_device_get_nameunit
	leaq	L_.str.1(%rip), %rsi
	xorl	%r12d, %r12d
	movl	%r14d, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_16
LBB0_12:
	movl	%ebx, %edi
	movq	%r12, %rbx
	callq	_device_get_nameunit
	leaq	L_.str.2(%rip), %rsi
	xorl	%r12d, %r12d
	movl	-48(%rbp), %edi                 ## 4-byte Reload
	movl	%ebx, %edx
	movq	%r14, %rcx
	movq	%r13, %r8
	movl	%eax, %r9d
	xorl	%eax, %eax
	callq	_device_printf
	jmp	LBB0_16
LBB0_3:
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	callq	_device_get_nameunit
	movl	(%r12), %ecx
	leaq	L_.str(%rip), %rsi
	xorl	%r12d, %r12d
	movl	%r14d, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	callq	_device_printf
LBB0_16:
	movq	%r12, %rax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_RF_ACTIVE,4,2                  ## @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"no rle for %s memory %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"unknown resource request from %s\n"

L_.str.2:                               ## @.str.2
	.asciz	"failed to reserve resource %#lx - %#lx (%#lx) for %s\n"

L_.str.3:                               ## @.str.3
	.asciz	"failed to activate resource for %s\n"

	.no_dead_strip	_ps3bus_alloc_resource
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ps3bus_alloc_resource
_ps3bus_alloc_resource:                 ; @ps3bus_alloc_resource
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #128
	.cfi_def_cfa_offset 128
	stp	x28, x27, [sp, #32]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #48]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #64]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #80]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #96]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #112]            ; 16-byte Folded Spill
	add	x29, sp, #112
	.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
	str	w7, [sp, #28]                   ; 4-byte Folded Spill
	mov	x26, x6
	mov	x27, x5
	mov	x28, x4
	mov	x21, x3
	mov	x22, x2
	mov	x20, x1
	mov	x19, x0
	bl	_device_get_softc
	mov	x24, x0
	mov	x0, x20
	bl	_device_get_ivars
Lloh0:
	adrp	x8, _RF_ACTIVE@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RF_ACTIVE@GOTPAGEOFF]
Lloh2:
	ldr	w23, [x8]
	cmp	w22, #129
	b.eq	LBB0_8
; %bb.1:
	cmp	w22, #128
	b.ne	LBB0_13
; %bb.2:
	ldr	w2, [x21]
	mov	w1, #128
	bl	_resource_list_find
	cbz	x0, LBB0_15
; %bb.3:
	ldr	x26, [x0]
	mov	x25, x26
	cmp	x26, x28
	b.gt	LBB0_5
; %bb.4:
	ldr	x8, [x0, #8]
	cmp	x8, x28
	csel	x25, x8, x28, lt
LBB0_5:
	cmp	x26, x27
	b.gt	LBB0_7
; %bb.6:
	ldr	x8, [x0, #8]
	cmp	x8, x27
	csel	x26, x8, x27, lt
LBB0_7:
	sub	x27, x26, x25
	add	x24, x24, #4
	b	LBB0_9
LBB0_8:
	ldr	w2, [x21]
	mov	w1, #129
	bl	_resource_list_find
	mov	x28, x0
	ldr	x25, [x0]
	ldr	w1, [x0, #16]
	mov	x0, x26
	bl	_ulmax
	mov	x27, x0
	ldr	x0, [x28, #8]
	ldr	w8, [x28]
	add	w8, w8, w27
	sub	w1, w8, #1
	bl	_ulmax
	mov	x26, x0
LBB0_9:
	ldr	w28, [sp, #28]                  ; 4-byte Folded Reload
	bic	w4, w28, w23
	mov	x0, x24
	mov	x1, x25
	mov	x2, x26
	mov	x3, x27
	mov	x5, x20
	bl	_rman_reserve_resource
	mov	x24, x0
	cbz	x0, LBB0_14
; %bb.10:
	and	w23, w23, w28
	ldr	w1, [x21]
	mov	x0, x24
	bl	_rman_set_rid
	cbz	w23, LBB0_18
; %bb.11:
	ldr	w2, [x21]
	mov	x0, x20
	mov	x1, x22
	mov	x3, x24
	bl	_bus_activate_resource
	cbz	x0, LBB0_18
; %bb.12:
	mov	x0, x20
	bl	_device_get_nameunit
	mov	x2, x0
Lloh3:
	adrp	x1, l_.str.3@PAGE
Lloh4:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	bl	_device_printf
	mov	x0, x24
	bl	_rman_release_resource
	b	LBB0_17
LBB0_13:
	mov	x0, x20
	bl	_device_get_nameunit
	mov	x2, x0
Lloh5:
	adrp	x1, l_.str.1@PAGE
Lloh6:
	add	x1, x1, l_.str.1@PAGEOFF
	b	LBB0_16
LBB0_14:
	mov	x0, x20
	bl	_device_get_nameunit
                                        ; kill: def $w0 killed $w0 def $x0
	stp	x27, x0, [sp, #8]
	str	x26, [sp]
Lloh7:
	adrp	x1, l_.str.2@PAGE
Lloh8:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	mov	x2, x25
	bl	_device_printf
	b	LBB0_18
LBB0_15:
	mov	x0, x20
	bl	_device_get_nameunit
	mov	x2, x0
	ldr	w8, [x21]
	str	x8, [sp]
Lloh9:
	adrp	x1, l_.str@PAGE
Lloh10:
	add	x1, x1, l_.str@PAGEOFF
LBB0_16:
	mov	x0, x19
	bl	_device_printf
LBB0_17:
	mov	x24, #0
LBB0_18:
	mov	x0, x24
	ldp	x29, x30, [sp, #112]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #96]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #80]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #64]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #48]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #32]             ; 16-byte Folded Reload
	add	sp, sp, #128
	ret
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpAdd	Lloh5, Lloh6
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh9, Lloh10
	.cfi_endproc
                                        ; -- End function
	.comm	_RF_ACTIVE,4,2                  ; @RF_ACTIVE
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"no rle for %s memory %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"unknown resource request from %s\n"

l_.str.2:                               ; @.str.2
	.asciz	"failed to reserve resource %#lx - %#lx (%#lx) for %s\n"

l_.str.3:                               ; @.str.3
	.asciz	"failed to activate resource for %s\n"

	.no_dead_strip	_ps3bus_alloc_resource
.subsections_via_symbols
