	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function h264_encode_frame
_h264_encode_frame:                     ## @h264_encode_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	%r12
	pushq	%rbx
	.cfi_offset %rbx, -48
	.cfi_offset %r12, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%rcx, %r14
	movq	%rdx, %r15
	movq	%rsi, %rbx
	movq	%rdi, %r12
	callq	_mtk_vcodec_debug_enter
	movq	_H264_BS_MODE_FRAME@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	movq	%rbx, %rdx
	movq	%r15, %rcx
	movq	%r14, %r8
	callq	_vpu_enc_encode
	testl	%eax, %eax
	jne	LBB0_7
## %bb.1:
	movq	(%r12), %rax
	movq	_VEN_IPI_MSG_ENC_STATE_SKIP@GOTPCREL(%rip), %rcx
	cmpq	(%rcx), %rax
	jne	LBB0_3
## %bb.2:
	movl	8(%r12), %edx
	movl	%edx, (%r14)
	movl	(%r15), %edi
	movq	24(%r12), %rax
	movq	_VENC_H264_VPU_WORK_BUF_SKIP_FRAME@GOTPCREL(%rip), %rcx
	movq	(%rcx), %rcx
	movl	(%rax,%rcx,4), %esi
	callq	_memcpy
	incl	16(%r12)
	jmp	LBB0_6
LBB0_3:
	movq	%r12, %rdi
	callq	_h264_enc_wait_venc_done
	movq	_MTK_VENC_IRQ_STATUS_FRM@GOTPCREL(%rip), %rcx
	cmpl	(%rcx), %eax
	jne	LBB0_4
## %bb.5:
	movq	_VENC_PIC_BITSTREAM_BYTE_CNT@GOTPCREL(%rip), %rax
	movl	(%rax), %esi
	movq	%r12, %rdi
	callq	_h264_read_reg
	movl	%eax, (%r14)
	movl	12(%r12), %r8d
	movl	16(%r12), %edx
	incl	%edx
	movl	%edx, 16(%r12)
	movl	(%r14), %ecx
	leaq	L_.str.1(%rip), %rsi
	movq	%r12, %rdi
	callq	_mtk_vcodec_debug
LBB0_6:
	xorl	%eax, %eax
	jmp	LBB0_7
LBB0_4:
	leaq	L_.str(%rip), %rsi
	movq	%r12, %rdi
	movl	%eax, %edx
	callq	_mtk_vcodec_err
	movq	_EIO@GOTPCREL(%rip), %rcx
	xorl	%eax, %eax
	subl	(%rcx), %eax
LBB0_7:
	popq	%rbx
	popq	%r12
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_H264_BS_MODE_FRAME,4,2         ## @H264_BS_MODE_FRAME
	.comm	_VEN_IPI_MSG_ENC_STATE_SKIP,8,3 ## @VEN_IPI_MSG_ENC_STATE_SKIP
	.comm	_VENC_H264_VPU_WORK_BUF_SKIP_FRAME,8,3 ## @VENC_H264_VPU_WORK_BUF_SKIP_FRAME
	.comm	_MTK_VENC_IRQ_STATUS_FRM,4,2    ## @MTK_VENC_IRQ_STATUS_FRM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"irq_status=%d failed"

	.comm	_EIO,4,2                        ## @EIO
	.comm	_VENC_PIC_BITSTREAM_BYTE_CNT,4,2 ## @VENC_PIC_BITSTREAM_BYTE_CNT
L_.str.1:                               ## @.str.1
	.asciz	"frm %d bs_size %d key_frm %d <-"

	.no_dead_strip	_h264_encode_frame
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function h264_encode_frame
_h264_encode_frame:                     ; @h264_encode_frame
	.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	x20, x3
	mov	x21, x2
	mov	x22, x1
	mov	x19, x0
	bl	_mtk_vcodec_debug_enter
Lloh0:
	adrp	x8, _H264_BS_MODE_FRAME@GOTPAGE
Lloh1:
	ldr	x8, [x8, _H264_BS_MODE_FRAME@GOTPAGEOFF]
Lloh2:
	ldr	w1, [x8]
	mov	x0, x19
	mov	x2, x22
	mov	x3, x21
	mov	x4, x20
	bl	_vpu_enc_encode
	cbnz	w0, LBB0_6
; %bb.1:
	ldr	x8, [x19]
Lloh3:
	adrp	x9, _VEN_IPI_MSG_ENC_STATE_SKIP@GOTPAGE
Lloh4:
	ldr	x9, [x9, _VEN_IPI_MSG_ENC_STATE_SKIP@GOTPAGEOFF]
Lloh5:
	ldr	x9, [x9]
	cmp	x8, x9
	b.ne	LBB0_3
; %bb.2:
	ldr	w2, [x19, #8]
	str	w2, [x20]
	ldr	w0, [x21]
	ldr	x8, [x19, #24]
Lloh6:
	adrp	x9, _VENC_H264_VPU_WORK_BUF_SKIP_FRAME@GOTPAGE
Lloh7:
	ldr	x9, [x9, _VENC_H264_VPU_WORK_BUF_SKIP_FRAME@GOTPAGEOFF]
Lloh8:
	ldr	x9, [x9]
	ldr	w1, [x8, x9, lsl #2]
	bl	_memcpy
	mov	w0, #0
	ldr	w8, [x19, #16]
	add	w8, w8, #1
	str	w8, [x19, #16]
	b	LBB0_6
LBB0_3:
	mov	x0, x19
	bl	_h264_enc_wait_venc_done
Lloh9:
	adrp	x8, _MTK_VENC_IRQ_STATUS_FRM@GOTPAGE
Lloh10:
	ldr	x8, [x8, _MTK_VENC_IRQ_STATUS_FRM@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	cmp	w0, w8
	b.ne	LBB0_5
; %bb.4:
Lloh12:
	adrp	x8, _VENC_PIC_BITSTREAM_BYTE_CNT@GOTPAGE
Lloh13:
	ldr	x8, [x8, _VENC_PIC_BITSTREAM_BYTE_CNT@GOTPAGEOFF]
Lloh14:
	ldr	w1, [x8]
	mov	x0, x19
	bl	_h264_read_reg
	str	w0, [x20]
	ldp	w4, w8, [x19, #12]
	add	w2, w8, #1
	str	w2, [x19, #16]
	ldr	w3, [x20]
Lloh15:
	adrp	x1, l_.str.1@PAGE
Lloh16:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_debug
	mov	w0, #0
	b	LBB0_6
LBB0_5:
	mov	x2, x0
Lloh17:
	adrp	x1, l_.str@PAGE
Lloh18:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_err
Lloh19:
	adrp	x8, _EIO@GOTPAGE
Lloh20:
	ldr	x8, [x8, _EIO@GOTPAGEOFF]
Lloh21:
	ldr	w8, [x8]
	neg	w0, w8
LBB0_6:
	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
	.loh AdrpLdrGotLdr	Lloh0, Lloh1, Lloh2
	.loh AdrpLdrGotLdr	Lloh3, Lloh4, Lloh5
	.loh AdrpLdrGotLdr	Lloh6, Lloh7, Lloh8
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh15, Lloh16
	.loh AdrpLdrGotLdr	Lloh12, Lloh13, Lloh14
	.loh AdrpLdrGotLdr	Lloh19, Lloh20, Lloh21
	.loh AdrpAdd	Lloh17, Lloh18
	.cfi_endproc
                                        ; -- End function
	.comm	_H264_BS_MODE_FRAME,4,2         ; @H264_BS_MODE_FRAME
	.comm	_VEN_IPI_MSG_ENC_STATE_SKIP,8,3 ; @VEN_IPI_MSG_ENC_STATE_SKIP
	.comm	_VENC_H264_VPU_WORK_BUF_SKIP_FRAME,8,3 ; @VENC_H264_VPU_WORK_BUF_SKIP_FRAME
	.comm	_MTK_VENC_IRQ_STATUS_FRM,4,2    ; @MTK_VENC_IRQ_STATUS_FRM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"irq_status=%d failed"

	.comm	_EIO,4,2                        ; @EIO
	.comm	_VENC_PIC_BITSTREAM_BYTE_CNT,4,2 ; @VENC_PIC_BITSTREAM_BYTE_CNT
l_.str.1:                               ; @.str.1
	.asciz	"frm %d bs_size %d key_frm %d <-"

	.no_dead_strip	_h264_encode_frame
.subsections_via_symbols
