	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function h264_enc_encode
_h264_enc_encode:                       ## @h264_enc_encode
	.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	$72, %rsp
	.cfi_offset %rbx, -56
	.cfi_offset %r12, -48
	.cfi_offset %r13, -40
	.cfi_offset %r14, -32
	.cfi_offset %r15, -24
	movq	%r8, %r15
	movq	%rcx, -56(%rbp)                 ## 8-byte Spill
	movq	%rdx, %r12
	movl	%esi, %r14d
	movq	%rdi, %r13
	movq	8(%rdi), %rbx
	leaq	L_.str(%rip), %rsi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_mtk_vcodec_debug
	movq	%rbx, -48(%rbp)                 ## 8-byte Spill
	movq	(%rbx), %rax
	movl	(%rax), %edi
	callq	_enable_irq
	cmpl	$129, %r14d
	je	LBB0_4
## %bb.1:
	cmpl	$128, %r14d
	jne	LBB0_12
## %bb.2:
	movq	%r15, %rbx
	leaq	-72(%rbp), %rdx
	movq	%r13, %rdi
	movq	-56(%rbp), %rsi                 ## 8-byte Reload
	callq	_h264_encode_header
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_13
## %bb.3:
	movl	-72(%rbp), %eax
	movl	%eax, (%rbx)
	movl	$0, 4(%rbx)
	jmp	LBB0_13
LBB0_4:
	movq	%r12, -104(%rbp)                ## 8-byte Spill
	cmpl	$0, 4(%r13)
	movq	%r15, -96(%rbp)                 ## 8-byte Spill
	je	LBB0_5
## %bb.6:
	leaq	L_.str.1(%rip), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	callq	_mtk_vcodec_debug
	leaq	-80(%rbp), %rdx
	movq	%r13, %rdi
	movq	-56(%rbp), %r12                 ## 8-byte Reload
	movq	%r12, %rsi
	callq	_h264_encode_header
	movl	%eax, %r15d
	testl	%eax, %eax
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_14
## %bb.7:
	movl	-80(%rbp), %edx
	movl	%edx, %eax
	andl	$127, %eax
	movl	$0, %r15d
	movq	%rdx, -88(%rbp)                 ## 8-byte Spill
	je	LBB0_9
## %bb.8:
	movq	_H264_FILLER_MARKER_SIZE@GOTPCREL(%rip), %rcx
	movl	(%rcx), %ecx
	addl	%eax, %ecx
	xorl	%r15d, %r15d
	cmpl	$129, %ecx
	setge	%r15b
	shll	$7, %r15d
	subl	%eax, %r15d
	subl	$-128, %r15d
	movl	8(%r12), %esi
	addl	%edx, %esi
	movq	%r13, %rdi
	movl	%r15d, %edx
	callq	_h264_encode_filler
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
LBB0_9:
	leal	(%r15,%rdx), %ecx
	movl	8(%r12), %eax
	addl	%ecx, %eax
	movl	%eax, -64(%rbp)
	movl	4(%r12), %eax
	addl	%ecx, %eax
	movl	%eax, -68(%rbp)
	movl	(%r12), %eax
	movl	%ecx, %r12d
	subl	%ecx, %eax
	movl	%eax, -72(%rbp)
	leaq	-72(%rbp), %rdx
	leaq	-76(%rbp), %rcx
	movq	%r13, %rdi
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	callq	_h264_encode_frame
	movq	%r15, %rcx
	movl	%eax, %r15d
	testl	%eax, %eax
	jne	LBB0_14
## %bb.10:
	movl	-76(%rbp), %r8d
	addl	%r8d, %r12d
	movq	-96(%rbp), %rax                 ## 8-byte Reload
	movl	%r12d, (%rax)
	leaq	L_.str.2(%rip), %rsi
	movq	%r13, %rdi
	movq	-88(%rbp), %rdx                 ## 8-byte Reload
                                        ## kill: def $edx killed $edx killed $rdx
                                        ## kill: def $ecx killed $ecx killed $rcx
	movl	%r12d, %r9d
	xorl	%eax, %eax
	callq	_mtk_vcodec_debug
	movl	$0, 4(%r13)
	jmp	LBB0_11
LBB0_12:
	leaq	L_.str.3(%rip), %rsi
	movq	%r13, %rdi
	movl	%r14d, %edx
	callq	_mtk_vcodec_err
	movq	_EINVAL@GOTPCREL(%rip), %rax
	xorl	%r15d, %r15d
	subl	(%rax), %r15d
LBB0_13:
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
LBB0_14:
	movq	(%rbx), %rax
	movl	(%rax), %edi
	callq	_disable_irq
	leaq	L_.str.4(%rip), %rsi
	movq	%r13, %rdi
	movl	%r14d, %edx
	xorl	%eax, %eax
	callq	_mtk_vcodec_debug
	movl	%r15d, %eax
	addq	$72, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
LBB0_5:
	movq	%r13, %rdi
	movq	-104(%rbp), %rsi                ## 8-byte Reload
	movq	-56(%rbp), %rdx                 ## 8-byte Reload
	movq	%r15, %rcx
	callq	_h264_encode_frame
	movl	%eax, %r15d
	testl	%eax, %eax
	movq	-48(%rbp), %rbx                 ## 8-byte Reload
	jne	LBB0_14
LBB0_11:
	movl	(%r13), %eax
	movq	-96(%rbp), %rcx                 ## 8-byte Reload
	movl	%eax, 4(%rcx)
	xorl	%r15d, %r15d
	jmp	LBB0_14
	.cfi_endproc
                                        ## -- End function
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"opt %d ->"

L_.str.1:                               ## @.str.1
	.asciz	"h264_encode_frame prepend SPS/PPS"

	.comm	_H264_FILLER_MARKER_SIZE,4,2    ## @H264_FILLER_MARKER_SIZE
L_.str.2:                               ## @.str.2
	.asciz	"hdr %d filler %d frame %d bs %d"

L_.str.3:                               ## @.str.3
	.asciz	"venc_start_opt %d not supported"

	.comm	_EINVAL,4,2                     ## @EINVAL
L_.str.4:                               ## @.str.4
	.asciz	"opt %d <-"

	.no_dead_strip	_h264_enc_encode
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function h264_enc_encode
_h264_enc_encode:                       ; @h264_enc_encode
	.cfi_startproc
; %bb.0:
	sub	sp, sp, #160
	.cfi_def_cfa_offset 160
	stp	x28, x27, [sp, #64]             ; 16-byte Folded Spill
	stp	x26, x25, [sp, #80]             ; 16-byte Folded Spill
	stp	x24, x23, [sp, #96]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #112]            ; 16-byte Folded Spill
	stp	x20, x19, [sp, #128]            ; 16-byte Folded Spill
	stp	x29, x30, [sp, #144]            ; 16-byte Folded Spill
	add	x29, sp, #144
	.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	x21, x4
	mov	x22, x3
	mov	x23, x2
	mov	x20, x1
	mov	x19, x0
	ldr	x26, [x0, #8]
	mov	x8, x1
	str	x8, [sp]
Lloh0:
	adrp	x1, l_.str@PAGE
Lloh1:
	add	x1, x1, l_.str@PAGEOFF
	bl	_mtk_vcodec_debug
	ldr	x8, [x26]
	ldr	w0, [x8]
	bl	_enable_irq
	cmp	w20, #129
	b.eq	LBB0_4
; %bb.1:
	cmp	w20, #128
	b.ne	LBB0_8
; %bb.2:
	add	x2, sp, #48
	mov	x0, x19
	mov	x1, x22
	bl	_h264_encode_header
	mov	x24, x0
	cbnz	w0, LBB0_9
; %bb.3:
	ldr	w8, [sp, #48]
	stp	w8, wzr, [x21]
	b	LBB0_9
LBB0_4:
	ldr	w8, [x19, #4]
	cbz	w8, LBB0_10
; %bb.5:
Lloh2:
	adrp	x1, l_.str.1@PAGE
Lloh3:
	add	x1, x1, l_.str.1@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_debug
	add	x2, sp, #44
	mov	x0, x19
	mov	x1, x22
	bl	_h264_encode_header
	mov	x24, x0
	cbnz	w0, LBB0_9
; %bb.6:
	ldr	w27, [sp, #44]
	ands	w8, w27, #0x7f
	b.eq	LBB0_11
; %bb.7:
Lloh4:
	adrp	x9, _H264_FILLER_MARKER_SIZE@GOTPAGE
Lloh5:
	ldr	x9, [x9, _H264_FILLER_MARKER_SIZE@GOTPAGEOFF]
Lloh6:
	ldr	w9, [x9]
	add	w9, w9, w8
	mov	w10, #128
	mov	w11, #256
	cmp	w9, #128
	csel	w9, w11, w10, gt
	sub	w25, w9, w8
	ldr	w8, [x22, #8]
	add	w1, w8, w27
	mov	x0, x19
	mov	x2, x25
	bl	_h264_encode_filler
	b	LBB0_12
LBB0_8:
Lloh7:
	adrp	x1, l_.str.3@PAGE
Lloh8:
	add	x1, x1, l_.str.3@PAGEOFF
	mov	x0, x19
	mov	x2, x20
	bl	_mtk_vcodec_err
Lloh9:
	adrp	x8, _EINVAL@GOTPAGE
Lloh10:
	ldr	x8, [x8, _EINVAL@GOTPAGEOFF]
Lloh11:
	ldr	w8, [x8]
	neg	w24, w8
LBB0_9:
	ldr	x8, [x26]
	ldr	w0, [x8]
	bl	_disable_irq
	str	x20, [sp]
Lloh12:
	adrp	x1, l_.str.4@PAGE
Lloh13:
	add	x1, x1, l_.str.4@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_debug
	mov	x0, x24
	ldp	x29, x30, [sp, #144]            ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #128]            ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #112]            ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #96]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp, #80]             ; 16-byte Folded Reload
	ldp	x28, x27, [sp, #64]             ; 16-byte Folded Reload
	add	sp, sp, #160
	ret
LBB0_10:
	mov	x0, x19
	mov	x1, x23
	mov	x2, x22
	mov	x3, x21
	bl	_h264_encode_frame
	mov	x24, x0
	cbnz	w0, LBB0_9
	b	LBB0_14
LBB0_11:
	mov	w25, #0
LBB0_12:
	ldur	d0, [x22, #4]
	ldr	w8, [x22]
	add	w22, w25, w27
	sub	w8, w8, w22
	dup.2s	v1, w22
	add.2s	v0, v1, v0
	stur	d0, [sp, #52]
	str	w8, [sp, #48]
	add	x2, sp, #48
	add	x3, sp, #40
	mov	x0, x19
	mov	x1, x23
	bl	_h264_encode_frame
	mov	x24, x0
	cbnz	w0, LBB0_9
; %bb.13:
	ldr	w8, [sp, #40]
	add	w9, w8, w22
	str	w9, [x21]
	stp	x8, x9, [sp, #16]
	stp	x27, x25, [sp]
Lloh14:
	adrp	x1, l_.str.2@PAGE
Lloh15:
	add	x1, x1, l_.str.2@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_debug
	str	wzr, [x19, #4]
LBB0_14:
	mov	w24, #0
	ldr	w8, [x19]
	str	w8, [x21, #4]
	b	LBB0_9
	.loh AdrpAdd	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.loh AdrpLdrGotLdr	Lloh4, Lloh5, Lloh6
	.loh AdrpLdrGotLdr	Lloh9, Lloh10, Lloh11
	.loh AdrpAdd	Lloh7, Lloh8
	.loh AdrpAdd	Lloh12, Lloh13
	.loh AdrpAdd	Lloh14, Lloh15
	.cfi_endproc
                                        ; -- End function
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"opt %d ->"

l_.str.1:                               ; @.str.1
	.asciz	"h264_encode_frame prepend SPS/PPS"

	.comm	_H264_FILLER_MARKER_SIZE,4,2    ; @H264_FILLER_MARKER_SIZE
l_.str.2:                               ; @.str.2
	.asciz	"hdr %d filler %d frame %d bs %d"

l_.str.3:                               ; @.str.3
	.asciz	"venc_start_opt %d not supported"

	.comm	_EINVAL,4,2                     ; @EINVAL
l_.str.4:                               ; @.str.4
	.asciz	"opt %d <-"

	.no_dead_strip	_h264_enc_encode
.subsections_via_symbols
