	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function altera_cvp_v2_wait_for_credit
_altera_cvp_v2_wait_for_credit:         ## @altera_cvp_v2_wait_for_credit
	.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
	pushq	%rax
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movl	%esi, %r14d
	movq	%rdi, %r15
	movq	_V2_CREDIT_TIMEOUT_US@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movq	_V2_CHECK_CREDIT_US@GOTPCREL(%rip), %rcx
	cltd
	idivl	(%rcx)
	movl	%eax, %ebx
	movq	(%rdi), %r12
	incl	%ebx
	.p2align	4, 0x90
LBB0_1:                                 ## =>This Inner Loop Header: Depth=1
	movq	_VSE_CVP_TX_CREDITS@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	leaq	-48(%rbp), %rdx
	callq	_altera_read_config_byte
	testl	%eax, %eax
	jne	LBB0_2
## %bb.3:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	-48(%rbp), %rax
	cmpq	8(%r12), %rax
	jne	LBB0_4
## %bb.5:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_ALTERA_CVP_V2_SIZE@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	imull	%r14d, %esi
	movq	%r15, %rdi
	callq	_altera_cvp_chk_error
	testl	%eax, %eax
	jne	LBB0_6
## %bb.7:                               ##   in Loop: Header=BB0_1 Depth=1
	movq	_V2_CHECK_CREDIT_US@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	leal	1(%rdi), %esi
                                        ## kill: def $edi killed $edi killed $rdi
	callq	_usleep_range
	decl	%ebx
	jne	LBB0_1
## %bb.8:
	movq	(%r12), %rdi
	leaq	L_.str.2(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_ETIMEDOUT@GOTPCREL(%rip), %rax
	jmp	LBB0_9
LBB0_2:
	movl	%eax, %r13d
	movq	(%r12), %rdi
	leaq	L_.str(%rip), %rsi
	xorl	%eax, %eax
	callq	_dev_err
	jmp	LBB0_10
LBB0_4:
	xorl	%r13d, %r13d
	jmp	LBB0_10
LBB0_6:
	movq	-48(%rbp), %rdx
	movq	(%r12), %rdi
	movq	8(%r12), %rcx
	leaq	L_.str.1(%rip), %rsi
	xorl	%r13d, %r13d
	xorl	%eax, %eax
	callq	_dev_err
	movq	_EAGAIN@GOTPCREL(%rip), %rax
LBB0_9:
	subl	(%rax), %r13d
LBB0_10:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_V2_CREDIT_TIMEOUT_US,4,2       ## @V2_CREDIT_TIMEOUT_US
	.comm	_V2_CHECK_CREDIT_US,4,2         ## @V2_CHECK_CREDIT_US
	.comm	_VSE_CVP_TX_CREDITS,4,2         ## @VSE_CVP_TX_CREDITS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Error reading CVP Credit Register\n"

	.comm	_ALTERA_CVP_V2_SIZE,4,2         ## @ALTERA_CVP_V2_SIZE
L_.str.1:                               ## @.str.1
	.asciz	"CE Bit error credit reg[0x%x]:sent[0x%x]\n"

	.comm	_EAGAIN,4,2                     ## @EAGAIN
L_.str.2:                               ## @.str.2
	.asciz	"Timeout waiting for credit\n"

	.comm	_ETIMEDOUT,4,2                  ## @ETIMEDOUT
	.no_dead_strip	_altera_cvp_v2_wait_for_credit
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function altera_cvp_v2_wait_for_credit
_altera_cvp_v2_wait_for_credit:         ; @altera_cvp_v2_wait_for_credit
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #112
	.cfi_def_cfa_offset 112
	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
	mov	x19, x1
	mov	x21, x0
Lloh0:
	adrp	x8, _V2_CREDIT_TIMEOUT_US@GOTPAGE
Lloh1:
	ldr	x8, [x8, _V2_CREDIT_TIMEOUT_US@GOTPAGEOFF]
Lloh2:
	ldr	w8, [x8]
Lloh3:
	adrp	x23, _V2_CHECK_CREDIT_US@GOTPAGE
Lloh4:
	ldr	x23, [x23, _V2_CHECK_CREDIT_US@GOTPAGEOFF]
	ldr	w9, [x23]
	sdiv	w8, w8, w9
	ldr	x20, [x0]
	add	w24, w8, #1
Lloh5:
	adrp	x25, _VSE_CVP_TX_CREDITS@GOTPAGE
Lloh6:
	ldr	x25, [x25, _VSE_CVP_TX_CREDITS@GOTPAGEOFF]
Lloh7:
	adrp	x26, _ALTERA_CVP_V2_SIZE@GOTPAGE
Lloh8:
	ldr	x26, [x26, _ALTERA_CVP_V2_SIZE@GOTPAGEOFF]
LBB0_1:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w1, [x25]
	add	x2, sp, #24
	mov	x0, x20
	bl	_altera_read_config_byte
	cbnz	w0, LBB0_6
; %bb.2:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	x8, [sp, #24]
	ldr	x9, [x20, #8]
	cmp	x8, x9
	b.ne	LBB0_7
; %bb.3:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w8, [x26]
	mul	w1, w8, w19
	mov	x0, x21
	bl	_altera_cvp_chk_error
	cbnz	w0, LBB0_8
; %bb.4:                                ;   in Loop: Header=BB0_1 Depth=1
	ldr	w0, [x23]
	add	w1, w0, #1
	bl	_usleep_range
	subs	w24, w24, #1
	b.ne	LBB0_1
; %bb.5:
	ldr	x0, [x20]
Lloh9:
	adrp	x1, l_.str.2@PAGE
Lloh10:
	add	x1, x1, l_.str.2@PAGEOFF
	bl	_dev_err
Lloh11:
	adrp	x8, _ETIMEDOUT@GOTPAGE
Lloh12:
	ldr	x8, [x8, _ETIMEDOUT@GOTPAGEOFF]
	b	LBB0_9
LBB0_6:
	mov	x22, x0
	ldr	x0, [x20]
Lloh13:
	adrp	x1, l_.str@PAGE
Lloh14:
	add	x1, x1, l_.str@PAGEOFF
	bl	_dev_err
	b	LBB0_10
LBB0_7:
	mov	w22, #0
	b	LBB0_10
LBB0_8:
	ldr	x8, [sp, #24]
	ldp	x0, x9, [x20]
	stp	x8, x9, [sp]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	bl	_dev_err
Lloh17:
	adrp	x8, _EAGAIN@GOTPAGE
Lloh18:
	ldr	x8, [x8, _EAGAIN@GOTPAGEOFF]
LBB0_9:
	ldr	w8, [x8]
	neg	w22, w8
LBB0_10:
	mov	x0, x22
	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
	add	sp, sp, #112
	ret
	.loh AdrpLdrGot	Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh5, Lloh6
	.loh AdrpLdrGot	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGot	Lloh11, Lloh12
	.loh AdrpAdd	Lloh9, Lloh10
	.loh AdrpAdd	Lloh13, Lloh14
	.loh AdrpLdrGot	Lloh17, Lloh18
	.loh AdrpAdd	Lloh15, Lloh16
	.cfi_endproc
                                        ; -- End function
	.comm	_V2_CREDIT_TIMEOUT_US,4,2       ; @V2_CREDIT_TIMEOUT_US
	.comm	_V2_CHECK_CREDIT_US,4,2         ; @V2_CHECK_CREDIT_US
	.comm	_VSE_CVP_TX_CREDITS,4,2         ; @VSE_CVP_TX_CREDITS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Error reading CVP Credit Register\n"

	.comm	_ALTERA_CVP_V2_SIZE,4,2         ; @ALTERA_CVP_V2_SIZE
l_.str.1:                               ; @.str.1
	.asciz	"CE Bit error credit reg[0x%x]:sent[0x%x]\n"

	.comm	_EAGAIN,4,2                     ; @EAGAIN
l_.str.2:                               ; @.str.2
	.asciz	"Timeout waiting for credit\n"

	.comm	_ETIMEDOUT,4,2                  ; @ETIMEDOUT
	.no_dead_strip	_altera_cvp_v2_wait_for_credit
.subsections_via_symbols
