	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function nvenc_upload_frame
_nvenc_upload_frame:                    ## @nvenc_upload_frame
	.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	$40, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r14
	movq	(%rdi), %rax
	movq	8(%rdi), %r13
	movq	_AV_PIX_FMT_CUDA@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.1:
	movq	_AV_PIX_FMT_D3D11@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	je	LBB0_2
## %bb.9:
	xorps	%xmm0, %xmm0
	movaps	%xmm0, -64(%rbp)
	movq	_NV_ENC_LOCK_INPUT_BUFFER_VER@GOTPCREL(%rip), %rax
	movl	(%rax), %eax
	movl	%eax, -56(%rbp)
	movl	4(%r15), %eax
	movl	%eax, -60(%rbp)
	movl	(%r13), %edi
	leaq	-64(%rbp), %rsi
	callq	*24(%r13)
	movq	_NV_ENC_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_10
## %bb.11:
	movl	-64(%rbp), %eax
	movl	%eax, 8(%r15)
	leaq	-64(%rbp), %rdx
	movq	%r14, %rdi
	movq	%r15, %rsi
	movq	%rbx, %rcx
	callq	_nvenc_copy_frame
	movl	%eax, %r12d
	movl	(%r13), %edi
	movl	4(%r15), %esi
	callq	*16(%r13)
	movq	_NV_ENC_SUCCESS@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	je	LBB0_15
## %bb.12:
	leaq	L_.str.3(%rip), %rdx
	jmp	LBB0_13
LBB0_2:
	movq	%r14, %rdi
	movq	%rbx, %rsi
	callq	_nvenc_register_frame
	movl	%eax, %r12d
	testl	%eax, %eax
	js	LBB0_3
## %bb.4:
	movl	16(%r15), %edi
	movq	%rbx, %rsi
	callq	_av_frame_ref
	testl	%eax, %eax
	js	LBB0_14
## %bb.5:
	movq	%r15, -72(%rbp)                 ## 8-byte Spill
	movq	8(%r13), %rax
	movl	%r12d, %r15d
	shlq	$5, %r15
	movq	16(%rax,%r15), %rcx
	testq	%rcx, %rcx
	jne	LBB0_8
## %bb.6:
	movq	_NV_ENC_MAP_INPUT_RESOURCE_VER@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	leaq	(%rax,%r15), %rsi
	movl	%ecx, 12(%rax,%r15)
	movl	24(%rax,%r15), %ecx
	movl	%ecx, 8(%rax,%r15)
	movl	(%r13), %edi
	callq	*32(%r13)
	movl	%eax, %ecx
	movq	_NV_ENC_SUCCESS@GOTPCREL(%rip), %rax
	cmpl	(%rax), %ecx
	jne	LBB0_16
## %bb.7:
	movq	8(%r13), %rax
	movq	16(%rax,%r15), %rcx
LBB0_8:
	incq	%rcx
	movq	%rcx, 16(%rax,%r15)
	movq	-72(%rbp), %rdx                 ## 8-byte Reload
	movl	%r12d, (%rdx)
	movl	4(%rax,%r15), %ecx
	movl	%ecx, 4(%rdx)
	movl	(%rax,%r15), %eax
	movl	%eax, 12(%rdx)
	movq	(%rbx), %rax
	movl	(%rax), %eax
	movl	%eax, 8(%rdx)
	xorl	%r12d, %r12d
	jmp	LBB0_15
LBB0_10:
	leaq	L_.str.2(%rip), %rdx
LBB0_13:
	movq	%r14, %rdi
	movl	%eax, %esi
	callq	_nvenc_print_error
LBB0_14:
	movl	%eax, %r12d
	jmp	LBB0_15
LBB0_3:
	movq	_AV_LOG_ERROR@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	leaq	L_.str(%rip), %rdx
	movq	%r14, %rdi
	callq	_av_log
LBB0_15:
	movl	%r12d, %eax
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_16:
	movq	-72(%rbp), %rax                 ## 8-byte Reload
	movl	16(%rax), %edi
	movl	%ecx, %ebx
	callq	_av_frame_unref
	leaq	L_.str.1(%rip), %rdx
	movq	%r14, %rdi
	movl	%ebx, %esi
	addq	$40, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	jmp	_nvenc_print_error              ## TAILCALL
	.cfi_endproc
                                        ## -- End function
	.comm	_AV_PIX_FMT_CUDA,8,3            ## @AV_PIX_FMT_CUDA
	.comm	_AV_PIX_FMT_D3D11,8,3           ## @AV_PIX_FMT_D3D11
	.comm	_AV_LOG_ERROR,4,2               ## @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"Could not register an input HW frame\n"

	.comm	_NV_ENC_MAP_INPUT_RESOURCE_VER,4,2 ## @NV_ENC_MAP_INPUT_RESOURCE_VER
	.comm	_NV_ENC_SUCCESS,4,2             ## @NV_ENC_SUCCESS
L_.str.1:                               ## @.str.1
	.asciz	"Error mapping an input resource"

	.comm	_NV_ENC_LOCK_INPUT_BUFFER_VER,4,2 ## @NV_ENC_LOCK_INPUT_BUFFER_VER
L_.str.2:                               ## @.str.2
	.asciz	"Failed locking nvenc input buffer"

L_.str.3:                               ## @.str.3
	.asciz	"Failed unlocking input buffer!"

	.no_dead_strip	_nvenc_upload_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function nvenc_upload_frame
_nvenc_upload_frame:                    ; @nvenc_upload_frame
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #96
	.cfi_def_cfa_offset 96
	stp	x26, x25, [sp, #16]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #32]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #48]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #64]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #80]             ; 16-byte Folded Spill
	add	x29, sp, #80
	.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, x2
	mov	x21, x1
	mov	x20, x0
	ldp	x8, x24, [x0]
Lloh0:
	adrp	x9, _AV_PIX_FMT_CUDA@GOTPAGE
Lloh1:
	ldr	x9, [x9, _AV_PIX_FMT_CUDA@GOTPAGEOFF]
Lloh2:
	ldr	x9, [x9]
Lloh3:
	adrp	x10, _AV_PIX_FMT_D3D11@GOTPAGE
Lloh4:
	ldr	x10, [x10, _AV_PIX_FMT_D3D11@GOTPAGEOFF]
Lloh5:
	ldr	x10, [x10]
	cmp	x8, x9
	ccmp	x8, x10, #4, ne
	b.ne	LBB0_7
; %bb.1:
	mov	x0, x20
	mov	x1, x21
	bl	_nvenc_register_frame
	mov	x22, x0
	tbnz	w0, #31, LBB0_13
; %bb.2:
	ldr	w0, [x19, #16]
	mov	x1, x21
	bl	_av_frame_ref
	tbnz	w0, #31, LBB0_12
; %bb.3:
	ldr	x8, [x24, #8]
	mov	w25, w22
	add	x1, x8, x25, lsl #5
	ldr	x9, [x1, #16]
	cbnz	x9, LBB0_6
; %bb.4:
Lloh6:
	adrp	x8, _NV_ENC_MAP_INPUT_RESOURCE_VER@GOTPAGE
Lloh7:
	ldr	x8, [x8, _NV_ENC_MAP_INPUT_RESOURCE_VER@GOTPAGEOFF]
Lloh8:
	ldr	w8, [x8]
	ldr	w9, [x1, #24]
	stp	w9, w8, [x1, #8]
	ldr	x8, [x24, #32]
	ldr	w0, [x24]
	blr	x8
Lloh9:
	adrp	x8, _NV_ENC_SUCCESS@GOTPAGE
Lloh10:
	ldr	x8, [x8, _NV_ENC_SUCCESS@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_15
; %bb.5:
	ldr	x8, [x24, #8]
	add	x9, x8, x25, lsl #5
	ldr	x9, [x9, #16]
LBB0_6:
	add	x8, x8, x25, lsl #5
	add	x9, x9, #1
	str	x9, [x8, #16]
	str	w22, [x19]
	ldr	w9, [x8, #4]
	str	w9, [x19, #4]
	ldr	w8, [x8]
	str	w8, [x19, #12]
	ldr	x8, [x21]
	ldr	w8, [x8]
	str	w8, [x19, #8]
	mov	w22, #0
	b	LBB0_14
LBB0_7:
	stp	xzr, xzr, [sp]
Lloh12:
	adrp	x8, _NV_ENC_LOCK_INPUT_BUFFER_VER@GOTPAGE
Lloh13:
	ldr	x8, [x8, _NV_ENC_LOCK_INPUT_BUFFER_VER@GOTPAGEOFF]
Lloh14:
	ldr	w8, [x8]
	ldr	w9, [x19, #4]
	stp	w9, w8, [sp, #4]
	ldr	x8, [x24, #24]
	ldr	w0, [x24]
	mov	x1, sp
	blr	x8
Lloh15:
	adrp	x23, _NV_ENC_SUCCESS@GOTPAGE
Lloh16:
	ldr	x23, [x23, _NV_ENC_SUCCESS@GOTPAGEOFF]
	ldr	w8, [x23]
	cmp	w0, w8
	b.ne	LBB0_10
; %bb.8:
	ldr	w8, [sp]
	str	w8, [x19, #8]
	mov	x2, sp
	mov	x0, x20
	mov	x1, x19
	mov	x3, x21
	bl	_nvenc_copy_frame
	mov	x22, x0
	ldr	x8, [x24, #16]
	ldr	w0, [x24]
	ldr	w1, [x19, #4]
	blr	x8
	ldr	w8, [x23]
	cmp	w0, w8
	b.eq	LBB0_14
; %bb.9:
	mov	x1, x0
Lloh17:
	adrp	x2, l_.str.3@PAGE
Lloh18:
	add	x2, x2, l_.str.3@PAGEOFF
	b	LBB0_11
LBB0_10:
	mov	x1, x0
Lloh19:
	adrp	x2, l_.str.2@PAGE
Lloh20:
	add	x2, x2, l_.str.2@PAGEOFF
LBB0_11:
	mov	x0, x20
	bl	_nvenc_print_error
LBB0_12:
	mov	x22, x0
	b	LBB0_14
LBB0_13:
Lloh21:
	adrp	x8, _AV_LOG_ERROR@GOTPAGE
Lloh22:
	ldr	x8, [x8, _AV_LOG_ERROR@GOTPAGEOFF]
Lloh23:
	ldr	w1, [x8]
Lloh24:
	adrp	x2, l_.str@PAGE
Lloh25:
	add	x2, x2, l_.str@PAGEOFF
	mov	x0, x20
	bl	_av_log
LBB0_14:
	mov	x0, x22
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	ret
LBB0_15:
	mov	x23, x0
	ldr	w0, [x19, #16]
	bl	_av_frame_unref
Lloh26:
	adrp	x2, l_.str.1@PAGE
Lloh27:
	add	x2, x2, l_.str.1@PAGEOFF
	mov	x0, x20
	mov	x1, x23
	ldp	x29, x30, [sp, #80]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #64]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #48]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #32]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #16]             ; 16-byte Folded Reload
	add	sp, sp, #96
	b	_nvenc_print_error
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGot	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpAdd	Lloh17, Lloh18
	.loh AdrpAdd	Lloh19, Lloh20
	.loh AdrpAdd	Lloh24, Lloh25
	.loh AdrpLdrGotLdr	Lloh21, Lloh22, Lloh23
	.loh AdrpAdd	Lloh26, Lloh27
	.cfi_endproc
                                        ; -- End function
	.comm	_AV_PIX_FMT_CUDA,8,3            ; @AV_PIX_FMT_CUDA
	.comm	_AV_PIX_FMT_D3D11,8,3           ; @AV_PIX_FMT_D3D11
	.comm	_AV_LOG_ERROR,4,2               ; @AV_LOG_ERROR
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"Could not register an input HW frame\n"

	.comm	_NV_ENC_MAP_INPUT_RESOURCE_VER,4,2 ; @NV_ENC_MAP_INPUT_RESOURCE_VER
	.comm	_NV_ENC_SUCCESS,4,2             ; @NV_ENC_SUCCESS
l_.str.1:                               ; @.str.1
	.asciz	"Error mapping an input resource"

	.comm	_NV_ENC_LOCK_INPUT_BUFFER_VER,4,2 ; @NV_ENC_LOCK_INPUT_BUFFER_VER
l_.str.2:                               ; @.str.2
	.asciz	"Failed locking nvenc input buffer"

l_.str.3:                               ; @.str.3
	.asciz	"Failed unlocking input buffer!"

	.no_dead_strip	_nvenc_upload_frame
.subsections_via_symbols
