	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function flexrm_new_request
_flexrm_new_request:                    ## @flexrm_new_request
	.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	%rdx, %r12
	movq	%rdi, %r13
	movq	%rdx, %rdi
	callq	_flexrm_sanity_check
	testl	%eax, %eax
	je	LBB0_1
## %bb.2:
	movl	$0, (%r12)
	leaq	16(%r13), %r14
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	20(%r13), %edi
	movq	_RING_MAX_REQ_COUNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	xorl	%ebx, %ebx
	xorl	%edx, %edx
	callq	_bitmap_find_free_region
	movl	%eax, %r15d
	movq	%r14, %rdi
	callq	_spin_unlock_irqrestore
	testl	%r15d, %r15d
	js	LBB0_3
## %bb.4:
	movq	24(%r13), %rax
	movl	%r15d, %ecx
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%r12, (%rax,%rcx,8)
	movq	32(%r13), %rax
	movl	(%rax), %edi
	movq	%r12, %rsi
	callq	_flexrm_dma_map
	movl	%eax, %ebx
	testl	%eax, %eax
	js	LBB0_5
## %bb.6:
	movl	%ebx, -64(%rbp)                 ## 4-byte Spill
	movl	%r15d, -44(%rbp)                ## 4-byte Spill
	movq	%r14, -72(%rbp)                 ## 8-byte Spill
	movq	_RING_BD_READ_PTR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%r13), %rdi
	callq	_readl_relaxed
	movq	%r13, %rbx
	movl	%eax, %r13d
	movq	_RING_BD_START_ADDR@GOTPCREL(%rip), %rax
	movq	(%rax), %rdi
	addq	56(%rbx), %rdi
	callq	_readl_relaxed
	movq	_RING_DESC_SIZE@GOTPCREL(%rip), %rcx
	imull	(%rcx), %r13d
	movl	%eax, %edi
	callq	_BD_START_ADDR_DECODE
	movq	%rax, %r14
	subl	48(%rbx), %r14d
	movq	%r12, -80(%rbp)                 ## 8-byte Spill
	movq	%r12, %rdi
	movq	%rbx, %r12
	callq	_flexrm_estimate_nonheader_desc_count
	movl	%eax, %ebx
	movl	%eax, %edi
	callq	_flexrm_estimate_header_desc_count
	movl	%eax, %r15d
	addl	%ebx, %r15d
	incl	%r15d
	je	LBB0_12
## %bb.7:
	movl	%ebx, -60(%rbp)                 ## 4-byte Spill
	addl	%r14d, %r13d
	movq	%r12, %r14
	movl	(%r12), %ebx
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_8:                                 ## =>This Inner Loop Header: Depth=1
	movslq	%ebx, %rbx
	movq	8(%r14), %rdi
	addq	%rbx, %rdi
	callq	_flexrm_is_next_table_desc
	cmpl	$1, %eax
	sbbl	$0, %r15d
	movq	_RING_DESC_SIZE@GOTPCREL(%rip), %rax
	addl	(%rax), %ebx
	movq	_RING_BD_SIZE@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ebx
	cmovel	%r12d, %ebx
	cmpl	%r13d, %ebx
	je	LBB0_10
## %bb.9:                               ##   in Loop: Header=BB0_8 Depth=1
	testl	%r15d, %r15d
	jne	LBB0_8
LBB0_10:
	testl	%r15d, %r15d
	movq	%r14, %r12
	movl	-60(%rbp), %ebx                 ## 4-byte Reload
	je	LBB0_12
## %bb.11:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	-80(%rbp), %rsi                 ## 8-byte Reload
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	jmp	LBB0_14
LBB0_1:
	movq	_EIO@GOTPCREL(%rip), %rax
	xorl	%ebx, %ebx
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_3:
	movq	_ENOSPC@GOTPCREL(%rip), %rax
	subl	(%rax), %ebx
	jmp	LBB0_16
LBB0_5:
	movq	24(%r13), %rax
	movq	-56(%rbp), %rcx                 ## 8-byte Reload
	movq	$0, (%rax,%rcx,8)
	movq	%r14, %rdi
	callq	_spin_lock_irqsave
	movl	20(%r13), %edi
	movl	%r15d, %esi
	xorl	%edx, %edx
	callq	_bitmap_release_region
	movq	%r14, %rdi
	jmp	LBB0_15
LBB0_12:
	movslq	(%r12), %rdi
	movq	8(%r12), %r15
	addq	%rdi, %r15
	callq	_RING_BD_TOGGLE_VALID
	movq	8(%r12), %r9
	movq	_RING_BD_SIZE@GOTPCREL(%rip), %rcx
	movslq	(%rcx), %rcx
	addq	%r9, %rcx
	movq	%rcx, (%rsp)
	movq	-80(%rbp), %r14                 ## 8-byte Reload
	movq	%r14, %rdi
	movl	%ebx, %esi
	movl	-44(%rbp), %r13d                ## 4-byte Reload
	movl	%r13d, %edx
	movq	%r15, %rcx
	movl	%eax, %r8d
	callq	_flexrm_write_descs
	movq	%rax, %r15
	movq	%rax, %rdi
	callq	_IS_ERR
	testq	%rax, %rax
	je	LBB0_17
## %bb.13:
	movq	%r15, %rdi
	callq	_PTR_ERR
	movl	%eax, %ebx
	movq	-72(%rbp), %r15                 ## 8-byte Reload
	movq	%r14, %rsi
LBB0_14:
	movq	-56(%rbp), %r14                 ## 8-byte Reload
	movl	%ebx, (%rsi)
	movq	32(%r12), %rax
	movl	(%rax), %edi
	callq	_flexrm_dma_unmap
	movq	24(%r12), %rax
	movq	$0, (%rax,%r14,8)
	movq	%r15, %rdi
	callq	_spin_lock_irqsave
	movl	20(%r12), %edi
	movl	%r13d, %esi
	xorl	%edx, %edx
	callq	_bitmap_release_region
	movq	%r15, %rdi
LBB0_15:
	callq	_spin_unlock_irqrestore
LBB0_16:
	movl	%ebx, %eax
	addq	$56, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_17:
	movl	8(%r12), %eax
	subl	%eax, %r15d
	movl	%r15d, (%r12)
	addq	$40, %r12
	movq	%r12, %rdi
	callq	_atomic_inc_return
	movl	-64(%rbp), %ebx                 ## 4-byte Reload
	movl	%ebx, (%r14)
	jmp	LBB0_16
	.cfi_endproc
                                        ## -- End function
	.comm	_EIO,4,2                        ## @EIO
	.comm	_RING_MAX_REQ_COUNT,4,2         ## @RING_MAX_REQ_COUNT
	.comm	_ENOSPC,4,2                     ## @ENOSPC
	.comm	_RING_BD_READ_PTR,8,3           ## @RING_BD_READ_PTR
	.comm	_RING_BD_START_ADDR,8,3         ## @RING_BD_START_ADDR
	.comm	_RING_DESC_SIZE,4,2             ## @RING_DESC_SIZE
	.comm	_RING_BD_SIZE,4,2               ## @RING_BD_SIZE
	.no_dead_strip	_flexrm_new_request
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function flexrm_new_request
_flexrm_new_request:                    ; @flexrm_new_request
	.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
	mov	x22, x2
	mov	x20, x0
	mov	x0, x2
	bl	_flexrm_sanity_check
	cbz	w0, LBB0_8
; %bb.1:
	str	wzr, [x22]
	add	x19, x20, #16
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	w0, [x20, #20]
Lloh0:
	adrp	x8, _RING_MAX_REQ_COUNT@GOTPAGE
Lloh1:
	ldr	x8, [x8, _RING_MAX_REQ_COUNT@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	w2, #0
	bl	_bitmap_find_free_region
	mov	x23, x0
	mov	x0, x19
	bl	_spin_unlock_irqrestore
	tbnz	w23, #31, LBB0_9
; %bb.2:
	ldr	x8, [x20, #24]
	mov	w24, w23
	str	x22, [x8, w23, uxtw #3]
	ldr	x8, [x20, #32]
	ldr	w0, [x8]
	mov	x1, x22
	bl	_flexrm_dma_map
	mov	x21, x0
	tbnz	w0, #31, LBB0_14
; %bb.3:
	str	x24, [sp, #24]                  ; 8-byte Folded Spill
	ldr	x8, [x20, #56]
Lloh3:
	adrp	x9, _RING_BD_READ_PTR@GOTPAGE
Lloh4:
	ldr	x9, [x9, _RING_BD_READ_PTR@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl_relaxed
	str	w0, [sp, #16]                   ; 4-byte Folded Spill
	ldr	x8, [x20, #56]
Lloh6:
	adrp	x9, _RING_BD_START_ADDR@GOTPAGE
Lloh7:
	ldr	x9, [x9, _RING_BD_START_ADDR@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	add	x0, x9, x8
	bl	_readl_relaxed
Lloh9:
	adrp	x28, _RING_DESC_SIZE@GOTPAGE
Lloh10:
	ldr	x28, [x28, _RING_DESC_SIZE@GOTPAGEOFF]
	ldr	w8, [x28]
	str	w8, [sp, #12]                   ; 4-byte Folded Spill
	bl	_BD_START_ADDR_DECODE
	mov	x26, x0
	ldr	w24, [x20, #48]
	mov	x0, x22
	bl	_flexrm_estimate_nonheader_desc_count
	mov	x25, x0
	bl	_flexrm_estimate_header_desc_count
	str	w25, [sp, #20]                  ; 4-byte Folded Spill
	add	w8, w25, w0
Lloh11:
	adrp	x27, _RING_BD_SIZE@GOTPAGE
Lloh12:
	ldr	x27, [x27, _RING_BD_SIZE@GOTPAGEOFF]
	adds	w25, w8, #1
	b.eq	LBB0_11
; %bb.4:
	sub	w8, w26, w24
	ldp	w10, w9, [sp, #12]              ; 8-byte Folded Reload
	madd	w26, w10, w9, w8
	ldr	w24, [x20]
LBB0_5:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x8, [x20, #8]
	add	x0, x8, w24, sxtw
	bl	_flexrm_is_next_table_desc
	cmp	w0, #0
	cset	w8, eq
	sub	w25, w25, w8
	ldr	w8, [x28]
	ldr	w9, [x27]
	add	w8, w8, w24
	cmp	w8, w9
	csel	w24, wzr, w8, eq
	cmp	w24, w26
	ccmp	w25, #0, #4, ne
	b.ne	LBB0_5
; %bb.6:
	cbz	w25, LBB0_11
; %bb.7:
Lloh13:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh14:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
Lloh15:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_13
LBB0_8:
Lloh16:
	adrp	x8, _EIO@GOTPAGE
Lloh17:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
	b	LBB0_10
LBB0_9:
Lloh18:
	adrp	x8, _ENOSPC@GOTPAGE
Lloh19:
	ldr	x8, [x8, _ENOSPC@GOTPAGEOFF]
LBB0_10:
	ldr	w8, [x8]
	neg	w21, w8
	b	LBB0_15
LBB0_11:
	ldr	x8, [x20, #8]
	ldrsw	x0, [x20]
	add	x25, x8, x0
	bl	_RING_BD_TOGGLE_VALID
	mov	x4, x0
	ldr	x5, [x20, #8]
	ldrsw	x8, [x27]
	add	x6, x5, x8
	mov	x0, x22
	ldr	w1, [sp, #20]                   ; 4-byte Folded Reload
	mov	x2, x23
	mov	x3, x25
	bl	_flexrm_write_descs
	mov	x24, x0
	bl	_IS_ERR
	cbz	x0, LBB0_16
; %bb.12:
	mov	x0, x24
	bl	_PTR_ERR
	mov	x21, x0
LBB0_13:
	ldr	x24, [sp, #24]                  ; 8-byte Folded Reload
	str	w21, [x22]
	ldr	x8, [x20, #32]
	ldr	w0, [x8]
	mov	x1, x22
	bl	_flexrm_dma_unmap
LBB0_14:
	ldr	x8, [x20, #24]
	str	xzr, [x8, x24, lsl #3]
	mov	x0, x19
	bl	_spin_lock_irqsave
	ldr	w0, [x20, #20]
	mov	x1, x23
	mov	w2, #0
	bl	_bitmap_release_region
	mov	x0, x19
	bl	_spin_unlock_irqrestore
LBB0_15:
	mov	x0, x21
	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
LBB0_16:
	ldr	w8, [x20, #8]
	sub	w8, w24, w8
	str	w8, [x20]
	add	x0, x20, #40
	bl	_atomic_inc_return
	str	w21, [x22]
	b	LBB0_15
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpLdrGot	Lloh9, Lloh10
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh13, Lloh14, Lloh15
	.loh AdrpLdrGot	Lloh16, Lloh17
	.loh AdrpLdrGot	Lloh18, Lloh19
	.cfi_endproc
                                        ; -- End function
	.comm	_EIO,4,2                        ; @EIO
	.comm	_RING_MAX_REQ_COUNT,4,2         ; @RING_MAX_REQ_COUNT
	.comm	_ENOSPC,4,2                     ; @ENOSPC
	.comm	_RING_BD_READ_PTR,8,3           ; @RING_BD_READ_PTR
	.comm	_RING_BD_START_ADDR,8,3         ; @RING_BD_START_ADDR
	.comm	_RING_DESC_SIZE,4,2             ; @RING_DESC_SIZE
	.comm	_RING_BD_SIZE,4,2               ; @RING_BD_SIZE
	.no_dead_strip	_flexrm_new_request
.subsections_via_symbols
