	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function ps3bus_get_dma_tag
_ps3bus_get_dma_tag:                    ## @ps3bus_get_dma_tag
	.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	$104, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movl	%edi, %r12d
	movl	%esi, %edi
	callq	_device_get_ivars
	movq	%rax, %rbx
	movl	%r12d, %edi
	callq	_device_get_softc
	movq	%rax, %r13
	movq	(%rbx), %rax
	movq	_PS3_BUSTYPE_SYSBUS@GOTPCREL(%rip), %rdx
	movq	_PS3_BUSTYPE_STORAGE@GOTPCREL(%rip), %rcx
	cmpq	(%rdx), %rax
	je	LBB0_2
## %bb.1:
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.20:
	movl	%r12d, %edi
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_bus_get_dma_tag                ## TAILCALL
LBB0_2:
	movl	%r14d, -44(%rbp)                ## 4-byte Spill
	leaq	24(%rbx), %r15
	movq	%r15, %rdi
	callq	_mtx_lock
	movq	%rbx, %r14
	addq	$16, %r14
	cmpq	$0, 16(%rbx)
	je	LBB0_4
## %bb.3:
	movq	%r15, %rdi
	callq	_mtx_unlock
	movq	(%r14), %rax
	jmp	LBB0_19
LBB0_4:
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movl	%r12d, -52(%rbp)                ## 4-byte Spill
	movq	%r15, -64(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rax
	movl	$0, -48(%rbp)                   ## 4-byte Folded Spill
	movq	_PS3_BUSTYPE_SYSBUS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_6
## %bb.5:
	movq	8(%rbx), %rcx
	movq	_PS3_DEVTYPE_USB@GOTPCREL(%rip), %rdx
	xorl	%esi, %esi
	cmpq	(%rdx), %rcx
	sete	%sil
	addl	%esi, %esi
	movl	%esi, -48(%rbp)                 ## 4-byte Spill
LBB0_6:
	movq	_PS3_BUSTYPE_STORAGE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	movl	$12, %eax
	movl	$24, %r15d
	cmovel	%eax, %r15d
	cmpl	$0, (%r13)
	jle	LBB0_14
## %bb.7:
	xorl	%r14d, %r14d
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movl	40(%rbx), %esi
	movl	44(%rbx), %edi
	movq	8(%r13), %rax
	movl	(%rax,%r14,2), %edx
	movq	32(%rbx), %r9
	addq	%r14, %r9
	movl	%r15d, %ecx
	movl	-48(%rbp), %r8d                 ## 4-byte Reload
	callq	_lv1_allocate_device_dma_region
	testl	%eax, %eax
	jne	LBB0_9
## %bb.11:                              ##   in Loop: Header=BB0_8 Depth=1
	movl	44(%rbx), %edi
	movl	40(%rbx), %esi
	movq	8(%r13), %rax
	movl	(%rax,%r14,2), %r8d
	movl	4(%rax,%r14,2), %edx
	movq	32(%rbx), %rax
	movl	(%rax,%r14), %ecx
	movl	$2048, %r9d                     ## imm = 0x800
	callq	_lv1_map_device_dma_region
	testl	%eax, %eax
	jne	LBB0_12
## %bb.13:                              ##   in Loop: Header=BB0_8 Depth=1
	incq	%r12
	movslq	(%r13), %rax
	addq	$4, %r14
	cmpq	%rax, %r12
	jl	LBB0_8
LBB0_14:
	movl	-52(%rbp), %r15d                ## 4-byte Reload
	movl	%r15d, %edi
	callq	_bus_get_dma_tag
	movq	_BUS_SPACE_MAXADDR@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	movq	_BUS_SPACE_MAXSIZE@GOTPCREL(%rip), %rdx
	movl	(%rdx), %edx
	movq	-72(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, 56(%rsp)
	xorps	%xmm0, %xmm0
	movups	%xmm0, 40(%rsp)
	movl	%edx, 24(%rsp)
	movl	%edx, 8(%rsp)
	movl	$0, 32(%rsp)
	movl	$0, 16(%rsp)
	movq	$0, (%rsp)
	movq	%rax, %rdi
	movl	$1, %esi
	xorl	%edx, %edx
	movl	%ecx, %r8d
	xorl	%r9d, %r9d
	callq	_bus_dma_tag_create
	movl	%eax, %r14d
	movq	(%rbx), %rax
	movq	_PS3_BUSTYPE_STORAGE@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_16
## %bb.15:
	movq	16(%rbx), %rdi
	movl	%r15d, %esi
	movq	%rbx, %rdx
	callq	_bus_dma_tag_set_iommu
LBB0_16:
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	testl	%r14d, %r14d
	je	LBB0_18
## %bb.17:
	xorl	%eax, %eax
	jmp	LBB0_19
LBB0_9:
	leaq	L_.str(%rip), %rsi
	jmp	LBB0_10
LBB0_12:
	leaq	L_.str.1(%rip), %rsi
LBB0_10:
	movl	-44(%rbp), %edi                 ## 4-byte Reload
	movl	%r12d, %edx
	movl	%eax, %ecx
	callq	_device_printf
	movq	-64(%rbp), %rdi                 ## 8-byte Reload
	callq	_mtx_unlock
	xorl	%eax, %eax
	jmp	LBB0_19
LBB0_18:
	movq	(%r12), %rax
LBB0_19:
	addq	$104, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_PS3_BUSTYPE_SYSBUS,8,3         ## @PS3_BUSTYPE_SYSBUS
	.comm	_PS3_BUSTYPE_STORAGE,8,3        ## @PS3_BUSTYPE_STORAGE
	.comm	_PS3_DEVTYPE_USB,8,3            ## @PS3_DEVTYPE_USB
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"could not allocate DMA region %d: %d\n"

L_.str.1:                               ## @.str.1
	.asciz	"could not map DMA region %d: %d\n"

	.comm	_BUS_SPACE_MAXADDR,4,2          ## @BUS_SPACE_MAXADDR
	.comm	_BUS_SPACE_MAXSIZE,4,2          ## @BUS_SPACE_MAXSIZE
	.no_dead_strip	_ps3bus_get_dma_tag
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function ps3bus_get_dma_tag
_ps3bus_get_dma_tag:                    ; @ps3bus_get_dma_tag
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #144
	.cfi_def_cfa_offset 144
	stp	x28, x27, [sp, #48]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #64]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #80]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #96]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #112]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #128]            ; 16-byte Folded Spill
	add	x29, sp, #128
	.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
	mov	x22, x1
	mov	x20, x0
	mov	x0, x1
	bl	_device_get_ivars
	mov	x21, x0
	mov	x0, x20
	bl	_device_get_softc
	ldr	x8, [x21]
Lloh0:
	adrp	x19, _PS3_BUSTYPE_SYSBUS@GOTPAGE
Lloh1:
	ldr	x19, [x19, _PS3_BUSTYPE_SYSBUS@GOTPAGEOFF]
	ldr	x9, [x19]
Lloh2:
	adrp	x25, _PS3_BUSTYPE_STORAGE@GOTPAGE
Lloh3:
	ldr	x25, [x25, _PS3_BUSTYPE_STORAGE@GOTPAGEOFF]
	ldr	x10, [x25]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_4
; %bb.1:
	mov	x23, x0
	add	x24, x21, #24
	mov	x0, x24
	bl	_mtx_lock
	mov	x27, x21
	ldr	x8, [x27, #16]!
	cbz	x8, LBB0_5
; %bb.2:
	mov	x0, x24
	bl	_mtx_unlock
LBB0_3:
	ldr	x0, [x27]
	b	LBB0_20
LBB0_4:
	mov	x0, x20
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	b	_bus_get_dma_tag
LBB0_5:
	str	x24, [sp, #40]                  ; 8-byte Folded Spill
	ldr	x8, [x21]
	ldr	x9, [x19]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.6:
	ldr	x9, [x21, #8]
Lloh4:
	adrp	x10, _PS3_DEVTYPE_USB@GOTPAGE
Lloh5:
	ldr	x10, [x10, _PS3_DEVTYPE_USB@GOTPAGEOFF]
Lloh6:
	ldr	x10, [x10]
	cmp	x9, x10
	cset	w9, eq
	lsl	w24, w9, #1
	b	LBB0_8
LBB0_7:
	mov	w24, #0
LBB0_8:
	ldr	x9, [x25]
	cmp	x8, x9
	mov	w8, #24
	mov	w9, #12
	csel	w26, w9, w8, eq
	ldr	w8, [x23]
	cmp	w8, #1
	b.lt	LBB0_13
; %bb.9:
	mov	x28, #0
	mov	x19, #0
	mov	x25, #0
LBB0_10:                                ; =>This Inner Loop Header: Depth=1
	ldp	w1, w0, [x21, #40]
	ldr	x8, [x23, #8]
	ldr	w2, [x8, x28]
	ldr	x8, [x21, #32]
	add	x5, x8, x19
	mov	x3, x26
	mov	x4, x24
	bl	_lv1_allocate_device_dma_region
	cbnz	w0, LBB0_16
; %bb.11:                               ;   in Loop: Header=BB0_10 Depth=1
	ldp	w1, w0, [x21, #40]
	ldr	x8, [x23, #8]
	add	x8, x8, x28
	ldr	x9, [x21, #32]
	ldr	w3, [x9, x25, lsl #2]
	ldp	w4, w2, [x8]
	mov	w5, #2048
	bl	_lv1_map_device_dma_region
	cbnz	w0, LBB0_17
; %bb.12:                               ;   in Loop: Header=BB0_10 Depth=1
	add	x25, x25, #1
	ldrsw	x8, [x23]
	add	x19, x19, #4
	add	x28, x28, #8
	cmp	x25, x8
	b.lt	LBB0_10
LBB0_13:
	mov	x0, x20
	bl	_bus_get_dma_tag
Lloh7:
	adrp	x8, _BUS_SPACE_MAXADDR@GOTPAGE
Lloh8:
	ldr	x8, [x8, _BUS_SPACE_MAXADDR@GOTPAGEOFF]
Lloh9:
	ldr	w3, [x8]
Lloh10:
	adrp	x8, _BUS_SPACE_MAXSIZE@GOTPAGE
Lloh11:
	ldr	x8, [x8, _BUS_SPACE_MAXSIZE@GOTPAGEOFF]
Lloh12:
	ldr	w7, [x8]
	stp	xzr, xzr, [sp, #16]
	str	x27, [sp, #32]
	stp	w7, wzr, [sp, #4]
	str	wzr, [sp]
	mov	w1, #1
	mov	w2, #0
	mov	x4, x3
	mov	x5, #0
	mov	x6, #0
	bl	_bus_dma_tag_create
	mov	x22, x0
	ldr	x8, [x21]
Lloh13:
	adrp	x9, _PS3_BUSTYPE_STORAGE@GOTPAGE
Lloh14:
	ldr	x9, [x9, _PS3_BUSTYPE_STORAGE@GOTPAGEOFF]
Lloh15:
	ldr	x9, [x9]
	cmp	x8, x9
	b.eq	LBB0_15
; %bb.14:
	ldr	x0, [x21, #16]
	mov	x1, x20
	mov	x2, x21
	bl	_bus_dma_tag_set_iommu
LBB0_15:
	ldr	x0, [sp, #40]                   ; 8-byte Folded Reload
	bl	_mtx_unlock
	cbnz	w22, LBB0_19
	b	LBB0_3
LBB0_16:
	mov	x3, x0
Lloh16:
	adrp	x1, l_.str@PAGE
Lloh17:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_18
LBB0_17:
	mov	x3, x0
Lloh18:
	adrp	x1, l_.str.1@PAGE
Lloh19:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_18:
	mov	x0, x22
	mov	x2, x25
	bl	_device_printf
	ldr	x0, [sp, #40]                   ; 8-byte Folded Reload
	bl	_mtx_unlock
LBB0_19:
	mov	x0, #0
LBB0_20:
	ldp	x29, x30, [sp, #128]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #112]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #96]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #80]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #64]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #48]             ; 16-byte Folded Reload
	add	sp, sp, #144
	ret
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGotLdr	Lloh10, Lloh11, Lloh12
	.loh AdrpLdrGotLdr	Lloh7, Lloh8, Lloh9
	.loh AdrpAdd	Lloh16, Lloh17
	.loh AdrpAdd	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_PS3_BUSTYPE_SYSBUS,8,3         ; @PS3_BUSTYPE_SYSBUS
	.comm	_PS3_BUSTYPE_STORAGE,8,3        ; @PS3_BUSTYPE_STORAGE
	.comm	_PS3_DEVTYPE_USB,8,3            ; @PS3_DEVTYPE_USB
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"could not allocate DMA region %d: %d\n"

l_.str.1:                               ; @.str.1
	.asciz	"could not map DMA region %d: %d\n"

	.comm	_BUS_SPACE_MAXADDR,4,2          ; @BUS_SPACE_MAXADDR
	.comm	_BUS_SPACE_MAXSIZE,4,2          ; @BUS_SPACE_MAXSIZE
	.no_dead_strip	_ps3bus_get_dma_tag
.subsections_via_symbols
