	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvenc_find_free_reg_resource
_nvenc_find_free_reg_resource:          ## @nvenc_find_free_reg_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdi, %r14
	movq	(%rdi), %r15
	movl	(%r15), %ebx
	movq	8(%r15), %rdi
	callq	_FF_ARRAY_ELEMS
	movl	%eax, %ecx
	movl	(%r15), %eax
	cmpl	%ecx, %ebx
	jne	LBB0_14
## %bb.1:
	testl	%eax, %eax
	jle	LBB0_13
## %bb.2:
	movq	8(%r15), %rcx
	addq	$16, %rcx
	xorl	%ebx, %ebx
	jmp	LBB0_3
	.p2align	4, 0x90
LBB0_5:                                 ##   in Loop: Header=BB0_3 Depth=1
	incq	%rbx
	addq	$24, %rcx
	cmpq	%rbx, %rax
	je	LBB0_6
LBB0_3:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$0, (%rcx)
	jne	LBB0_5
## %bb.4:                               ##   in Loop: Header=BB0_3 Depth=1
	cmpq	$0, -16(%rcx)
	jne	LBB0_5
	jmp	LBB0_11
LBB0_14:
	leal	1(%rax), %ecx
	movl	%ecx, (%r15)
	jmp	LBB0_15
LBB0_6:
	movq	8(%r15), %rcx
	movl	$16, %r12d
	xorl	%ebx, %ebx
	.p2align	4, 0x90
LBB0_7:                                 ## =>This Inner Loop Header: Depth=1
	cmpl	$0, (%rcx,%r12)
	je	LBB0_8
## %bb.12:                              ##   in Loop: Header=BB0_7 Depth=1
	incq	%rbx
	addq	$24, %r12
	cmpq	%rbx, %rax
	jne	LBB0_7
LBB0_13:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str.1(%rip), %rdx
	movq	%r14, %rdi
	callq	_av_log
	movq	_ENOMEM@GOTPCREL(%rip), %rax
	movl	(%rax), %edi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_AVERROR                        ## TAILCALL
LBB0_8:
	movq	-16(%rcx,%r12), %rsi
	testq	%rsi, %rsi
	je	LBB0_11
## %bb.9:
	movl	16(%r15), %edi
	callq	*24(%r15)
	movq	_NV_ENC_SUCCESS@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_16
## %bb.10:
	movq	8(%r15), %rax
	xorps	%xmm0, %xmm0
	movups	%xmm0, -16(%rax,%r12)
LBB0_11:
	movl	%ebx, %eax
LBB0_15:
                                        ## kill: def $eax killed $eax killed $rax
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	movq	%rax, %rsi
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nvenc_print_error              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_NV_ENC_SUCCESS,8,3             ## @NV_ENC_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Failed unregistering unused input resource"

	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
L_.str.1:                               ## @.str.1
	.asciz	"Too many registered CUDA frames\n"

	.comm	_ENOMEM,4,2                     ## @ENOMEM
	.no_dead_strip	_nvenc_find_free_reg_resource
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvenc_find_free_reg_resource
_nvenc_find_free_reg_resource:          ; @nvenc_find_free_reg_resource
	.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, x0
	ldr	x21, [x0]
	ldr	w20, [x21]
	ldr	x0, [x21, #8]
	bl	_FF_ARRAY_ELEMS
	ldr	w8, [x21]
	cmp	w20, w0
	b.ne	LBB0_6
; %bb.1:
	cmp	w8, #1
	b.lt	LBB0_11
; %bb.2:
	mov	x20, #0
	ldr	x9, [x21, #8]
	add	x9, x9, #16
	b	LBB0_4
LBB0_3:                                 ;   in Loop: Header=BB0_4 Depth=1
	add	x20, x20, #1
	add	x9, x9, #24
	cmp	x8, x20
	b.eq	LBB0_8
LBB0_4:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9]
	cbnz	w10, LBB0_3
; %bb.5:                                ;   in Loop: Header=BB0_4 Depth=1
	ldur	x10, [x9, #-16]
	cbnz	x10, LBB0_3
	b	LBB0_7
LBB0_6:
	add	w9, w8, #1
	str	w9, [x21]
	mov	x20, x8
LBB0_7:
	mov	x0, x20
	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_8:
	mov	x20, #0
	ldr	x9, [x21, #8]
	mov	w22, #16
LBB0_9:                                 ; =>This Inner Loop Header: Depth=1
	ldr	w10, [x9, x22]
	cbz	w10, LBB0_12
; %bb.10:                               ;   in Loop: Header=BB0_9 Depth=1
	add	x20, x20, #1
	add	x22, x22, #24
	cmp	x8, x20
	b.ne	LBB0_9
LBB0_11:
Lloh0:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh1:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
Lloh3:
	adrp	x2, l_.str.1@PAGE
Lloh4:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_av_log
Lloh5:
	adrp	x8, _ENOMEM@GOTPAGE
Lloh6:
	ldr	x8, [x8, _ENOMEM@GOTPAGEOFF]
Lloh7:
	ldr	w0, [x8]
	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
	b	_AVERROR
LBB0_12:
	add	x8, x9, x22
	ldur	x1, [x8, #-16]
	cbz	x1, LBB0_7
; %bb.13:
	ldr	x8, [x21, #24]
	ldr	w0, [x21, #16]
	blr	x8
Lloh8:
	adrp	x8, _NV_ENC_SUCCESS@GOTPAGE
Lloh9:
	ldr	x8, [x8, _NV_ENC_SUCCESS@GOTPAGEOFF]
Lloh10:
	ldr	x8, [x8]
	cmp	x0, x8
	b.ne	LBB0_15
; %bb.14:
	ldr	x8, [x21, #8]
	add	x8, x8, x22
	stp	xzr, xzr, [x8, #-16]
	b	LBB0_7
LBB0_15:
	mov	x1, x0
Lloh11:
	adrp	x2, l_.str@PAGE
Lloh12:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x19
	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
	b	_nvenc_print_error
	.loh AdrpLdrGotLdr	Lloh5, Lloh6, Lloh7
	.loh AdrpAdd	Lloh3, Lloh4
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh8, Lloh9, Lloh10
	.loh AdrpAdd	Lloh11, Lloh12
	.cfi_endproc
                                        ; -- End function
	.comm	_NV_ENC_SUCCESS,8,3             ; @NV_ENC_SUCCESS
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Failed unregistering unused input resource"

	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
l_.str.1:                               ; @.str.1
	.asciz	"Too many registered CUDA frames\n"

	.comm	_ENOMEM,4,2                     ; @ENOMEM
	.no_dead_strip	_nvenc_find_free_reg_resource
.subsections_via_symbols
