	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rsxx_hw_buffers_init           ## -- Begin function rsxx_hw_buffers_init
	.p2align	4, 0x90
_rsxx_hw_buffers_init:                  ## @rsxx_hw_buffers_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	_STATUS_BUFFER_SIZE8@GOTPCREL(%rip), %r12
	movl	(%r12), %esi
	leaq	40(%rbx), %rdx
	callq	_pci_alloc_consistent
	movq	%rax, 48(%rbx)
	movq	_COMMAND_BUFFER_SIZE8@GOTPCREL(%rip), %r15
	movl	(%r15), %esi
	leaq	16(%rbx), %rdx
	movq	%r14, %rdi
	callq	_pci_alloc_consistent
	movq	%rax, 24(%rbx)
	movq	48(%rbx), %rdi
	testq	%rdi, %rdi
	je	LBB0_2
## %bb.1:
	testq	%rax, %rax
	je	LBB0_2
## %bb.4:
	movl	(%r12), %edx
	movl	$172, %esi
	callq	_memset
	movl	40(%rbx), %edi
	callq	_lower_32_bits
	movq	_SB_ADD_LO@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movl	40(%rbx), %edi
	callq	_upper_32_bits
	movq	_SB_ADD_HI@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movq	24(%rbx), %rdi
	movl	(%r15), %edx
	movl	$131, %esi
	callq	_memset
	movl	16(%rbx), %edi
	callq	_lower_32_bits
	movq	_CB_ADD_LO@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movl	16(%rbx), %edi
	callq	_upper_32_bits
	movq	_CB_ADD_HI@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movq	_HW_STATUS_CNT@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	addq	(%rbx), %rdi
	callq	_ioread32
	movq	%rax, 32(%rbx)
	movq	_RSXX_MAX_OUTSTANDING_CMDS@GOTPCREL(%rip), %r15
	cmpq	%rax, (%r15)
	jge	LBB0_7
## %bb.5:
	leaq	L_.str(%rip), %rsi
	movq	%r14, %rdi
	movq	%rax, %rdx
	jmp	LBB0_6
LBB0_2:
	movq	_ENOMEM@GOTPCREL(%rip), %rcx
	jmp	LBB0_3
LBB0_7:
	movq	(%r12), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movq	32(%rbx), %rdi
	movq	_SW_STATUS_CNT@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_iowrite32
	movq	_HW_CMD_IDX@GOTPCREL(%rip), %r12
	movq	(%r12), %rdi
	addq	(%rbx), %rdi
	callq	_ioread32
	movq	%rax, 8(%rbx)
	cmpq	%rax, (%r15)
	jge	LBB0_9
## %bb.8:
	movq	32(%rbx), %rdx
	leaq	L_.str.1(%rip), %rsi
	movq	%r14, %rdi
LBB0_6:
	callq	_dev_crit
	movq	_EINVAL@GOTPCREL(%rip), %rcx
LBB0_3:
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_10:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_9:
	movq	(%r12), %rsi
	addq	(%rbx), %rsi
	movq	%rax, %rdi
	callq	_iowrite32
	movq	8(%rbx), %rdi
	movq	_SW_CMD_IDX@GOTPCREL(%rip), %rax
	movq	(%rax), %rsi
	addq	(%rbx), %rsi
	callq	_iowrite32
	xorl	%eax, %eax
	jmp	LBB0_10
	.cfi_endproc
                                        ## -- End function
	.comm	_STATUS_BUFFER_SIZE8,4,2        ## @STATUS_BUFFER_SIZE8
	.comm	_COMMAND_BUFFER_SIZE8,4,2       ## @COMMAND_BUFFER_SIZE8
	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.comm	_SB_ADD_LO,8,3                  ## @SB_ADD_LO
	.comm	_SB_ADD_HI,8,3                  ## @SB_ADD_HI
	.comm	_CB_ADD_LO,8,3                  ## @CB_ADD_LO
	.comm	_CB_ADD_HI,8,3                  ## @CB_ADD_HI
	.comm	_HW_STATUS_CNT,8,3              ## @HW_STATUS_CNT
	.comm	_RSXX_MAX_OUTSTANDING_CMDS,8,3  ## @RSXX_MAX_OUTSTANDING_CMDS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed reading status cnt x%x\n"

	.comm	_EINVAL,4,2                     ## @EINVAL
	.comm	_SW_STATUS_CNT,8,3              ## @SW_STATUS_CNT
	.comm	_HW_CMD_IDX,8,3                 ## @HW_CMD_IDX
L_.str.1:                               ## @.str.1
	.asciz	"Failed reading cmd cnt x%x\n"

	.comm	_SW_CMD_IDX,8,3                 ## @SW_CMD_IDX
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.globl	_rsxx_hw_buffers_init           ; -- Begin function rsxx_hw_buffers_init
	.p2align	2
_rsxx_hw_buffers_init:                  ; @rsxx_hw_buffers_init
	.cfi_startproc
; %bb.0:
	stp	x22, x21, [sp, #-48]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 48
	stp	x20, x19, [sp, #16]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #32]             ; 16-byte Folded Spill
	add	x29, sp, #32
	.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
	mov	x19, x1
	mov	x20, x0
Lloh0:
	adrp	x22, _STATUS_BUFFER_SIZE8@GOTPAGE
Lloh1:
	ldr	x22, [x22, _STATUS_BUFFER_SIZE8@GOTPAGEOFF]
	ldr	w1, [x22]
	add	x2, x19, #40
	bl	_pci_alloc_consistent
	str	x0, [x19, #48]
Lloh2:
	adrp	x21, _COMMAND_BUFFER_SIZE8@GOTPAGE
Lloh3:
	ldr	x21, [x21, _COMMAND_BUFFER_SIZE8@GOTPAGEOFF]
	ldr	w1, [x21]
	add	x2, x19, #16
	mov	x0, x20
	bl	_pci_alloc_consistent
	mov	x8, x0
	str	x0, [x19, #24]
	ldr	x0, [x19, #48]
	cmp	x0, #0
	ccmp	x8, #0, #4, ne
	b.ne	LBB0_2
; %bb.1:
Lloh4:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh5:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
	b	LBB0_7
LBB0_2:
	ldr	w2, [x22]
	mov	w1, #172
	bl	_memset
	ldr	w0, [x19, #40]
	bl	_lower_32_bits
	ldr	x8, [x19]
Lloh6:
	adrp	x9, _SB_ADD_LO@GOTPAGE
Lloh7:
	ldr	x9, [x9, _SB_ADD_LO@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	w0, [x19, #40]
	bl	_upper_32_bits
	ldr	x8, [x19]
Lloh9:
	adrp	x9, _SB_ADD_HI@GOTPAGE
Lloh10:
	ldr	x9, [x9, _SB_ADD_HI@GOTPAGEOFF]
Lloh11:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x0, [x19, #24]
	ldr	w2, [x21]
	mov	w1, #131
	bl	_memset
	ldr	w0, [x19, #16]
	bl	_lower_32_bits
	ldr	x8, [x19]
Lloh12:
	adrp	x9, _CB_ADD_LO@GOTPAGE
Lloh13:
	ldr	x9, [x9, _CB_ADD_LO@GOTPAGEOFF]
Lloh14:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	w0, [x19, #16]
	bl	_upper_32_bits
	ldr	x8, [x19]
Lloh15:
	adrp	x9, _CB_ADD_HI@GOTPAGE
Lloh16:
	ldr	x9, [x9, _CB_ADD_HI@GOTPAGEOFF]
Lloh17:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x19]
Lloh18:
	adrp	x22, _HW_STATUS_CNT@GOTPAGE
Lloh19:
	ldr	x22, [x22, _HW_STATUS_CNT@GOTPAGEOFF]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_ioread32
	mov	x2, x0
	str	x0, [x19, #32]
Lloh20:
	adrp	x21, _RSXX_MAX_OUTSTANDING_CMDS@GOTPAGE
Lloh21:
	ldr	x21, [x21, _RSXX_MAX_OUTSTANDING_CMDS@GOTPAGEOFF]
	ldr	x8, [x21]
	cmp	x8, x0
	b.ge	LBB0_4
; %bb.3:
Lloh22:
	adrp	x1, l_.str@PAGE
Lloh23:
	add	x1, x1, l_.str@PAGEOFF
	b	LBB0_6
LBB0_4:
	ldr	x8, [x19]
	ldr	x9, [x22]
	add	x1, x9, x8
	mov	x0, x2
	bl	_iowrite32
	ldr	x0, [x19, #32]
	ldr	x8, [x19]
Lloh24:
	adrp	x9, _SW_STATUS_CNT@GOTPAGE
Lloh25:
	ldr	x9, [x9, _SW_STATUS_CNT@GOTPAGEOFF]
Lloh26:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	ldr	x8, [x19]
Lloh27:
	adrp	x22, _HW_CMD_IDX@GOTPAGE
Lloh28:
	ldr	x22, [x22, _HW_CMD_IDX@GOTPAGEOFF]
	ldr	x9, [x22]
	add	x0, x9, x8
	bl	_ioread32
	str	x0, [x19, #8]
	ldr	x8, [x21]
	cmp	x8, x0
	b.ge	LBB0_9
; %bb.5:
	ldr	x2, [x19, #32]
Lloh29:
	adrp	x1, l_.str.1@PAGE
Lloh30:
	add	x1, x1, l_.str.1@PAGEOFF
LBB0_6:
	mov	x0, x20
	bl	_dev_crit
Lloh31:
	adrp	x8, _EINVAL@GOTPAGE
Lloh32:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
LBB0_7:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_8:
	ldp	x29, x30, [sp, #32]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #16]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp], #48             ; 16-byte Folded Reload
	ret
LBB0_9:
	ldr	x8, [x19]
	ldr	x9, [x22]
	add	x1, x9, x8
	bl	_iowrite32
	ldp	x8, x0, [x19]
Lloh33:
	adrp	x9, _SW_CMD_IDX@GOTPAGE
Lloh34:
	ldr	x9, [x9, _SW_CMD_IDX@GOTPAGEOFF]
Lloh35:
	ldr	x9, [x9]
	add	x1, x9, x8
	bl	_iowrite32
	mov	w0, #0
	b	LBB0_8
	.loh AdrpLdrGot	Lloh2, Lloh3
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpLdrGot	Lloh4, Lloh5
	.loh AdrpLdrGot	Lloh20, Lloh21
	.loh AdrpLdrGot	Lloh18, Lloh19
	.loh AdrpLdrGotLdr	Lloh15, Lloh16, Lloh17
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpAdd	Lloh22, Lloh23
	.loh AdrpLdrGot	Lloh27, Lloh28
	.loh AdrpLdrGotLdr	Lloh24, Lloh25, Lloh26
	.loh AdrpAdd	Lloh29, Lloh30
	.loh AdrpLdrGot	Lloh31, Lloh32
	.loh AdrpLdrGotLdr	Lloh33, Lloh34, Lloh35
	.cfi_endproc
                                        ; -- End function
	.comm	_STATUS_BUFFER_SIZE8,4,2        ; @STATUS_BUFFER_SIZE8
	.comm	_COMMAND_BUFFER_SIZE8,4,2       ; @COMMAND_BUFFER_SIZE8
	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.comm	_SB_ADD_LO,8,3                  ; @SB_ADD_LO
	.comm	_SB_ADD_HI,8,3                  ; @SB_ADD_HI
	.comm	_CB_ADD_LO,8,3                  ; @CB_ADD_LO
	.comm	_CB_ADD_HI,8,3                  ; @CB_ADD_HI
	.comm	_HW_STATUS_CNT,8,3              ; @HW_STATUS_CNT
	.comm	_RSXX_MAX_OUTSTANDING_CMDS,8,3  ; @RSXX_MAX_OUTSTANDING_CMDS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed reading status cnt x%x\n"

	.comm	_EINVAL,4,2                     ; @EINVAL
	.comm	_SW_STATUS_CNT,8,3              ; @SW_STATUS_CNT
	.comm	_HW_CMD_IDX,8,3                 ; @HW_CMD_IDX
l_.str.1:                               ; @.str.1
	.asciz	"Failed reading cmd cnt x%x\n"

	.comm	_SW_CMD_IDX,8,3                 ; @SW_CMD_IDX
.subsections_via_symbols
