	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	4, 0x90                         ## -- Begin function alloc_mv_buf
_alloc_mv_buf:                          ## @alloc_mv_buf
	.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
	movq	%rdi, %r15
	movl	(%rsi), %eax
	movl	4(%rsi), %edi
	movl	%eax, %esi
	callq	_get_mv_buf_size
	movl	%eax, -44(%rbp)                 ## 4-byte Spill
	movq	_H264_MAX_FB_NUM@GOTPCREL(%rip), %rax
	cmpl	$0, (%rax)
	jle	LBB0_7
## %bb.1:
	xorl	%ebx, %ebx
	xorl	%r12d, %r12d
	.p2align	4, 0x90
LBB0_2:                                 ## =>This Inner Loop Header: Depth=1
	movq	16(%r15), %r14
	leaq	(%r14,%rbx), %r13
	cmpq	$0, 8(%r14,%rbx)
	je	LBB0_4
## %bb.3:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	8(%r15), %edi
	movq	%r13, %rsi
	callq	_mtk_vcodec_mem_free
LBB0_4:                                 ##   in Loop: Header=BB0_2 Depth=1
	movl	-44(%rbp), %eax                 ## 4-byte Reload
	movl	%eax, (%r14,%rbx)
	movl	8(%r15), %edi
	movq	%r13, %rsi
	callq	_mtk_vcodec_mem_alloc
	testl	%eax, %eax
	jne	LBB0_5
## %bb.6:                               ##   in Loop: Header=BB0_2 Depth=1
	movl	4(%r14,%rbx), %eax
	movq	(%r15), %rcx
	movq	(%rcx), %rcx
	movl	%eax, (%rcx,%r12,4)
	incq	%r12
	movq	_H264_MAX_FB_NUM@GOTPCREL(%rip), %rax
	movslq	(%rax), %rax
	addq	$16, %rbx
	cmpq	%rax, %r12
	jl	LBB0_2
LBB0_7:
	xorl	%r13d, %r13d
	jmp	LBB0_8
LBB0_5:
	movl	%eax, %r13d
	leaq	L_.str(%rip), %rsi
	movq	%r15, %rdi
	callq	_mtk_vcodec_err
LBB0_8:
	movl	%r13d, %eax
	addq	$8, %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	retq
	.cfi_endproc
                                        ## -- End function
	.comm	_H264_MAX_FB_NUM,4,2            ## @H264_MAX_FB_NUM
	.section	__TEXT,__cstring,cstring_literals
L_.str:                                 ## @.str
	.asciz	"failed to allocate mv buf"

	.no_dead_strip	_alloc_mv_buf
.subsections_via_symbols

	.section	__TEXT,__text,regular,pure_instructions
	.build_version macos, 13, 0	sdk_version 13, 3
	.p2align	2                               ; -- Begin function alloc_mv_buf
_alloc_mv_buf:                          ; @alloc_mv_buf
	.cfi_startproc
; %bb.0:
	stp	x26, x25, [sp, #-80]!           ; 16-byte Folded Spill
	.cfi_def_cfa_offset 80
	stp	x24, x23, [sp, #16]             ; 16-byte Folded Spill
	stp	x22, x21, [sp, #32]             ; 16-byte Folded Spill
	stp	x20, x19, [sp, #48]             ; 16-byte Folded Spill
	stp	x29, x30, [sp, #64]             ; 16-byte Folded Spill
	add	x29, sp, #64
	.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, x0
	ldp	w1, w0, [x1]
	bl	_get_mv_buf_size
Lloh0:
	adrp	x22, _H264_MAX_FB_NUM@GOTPAGE
Lloh1:
	ldr	x22, [x22, _H264_MAX_FB_NUM@GOTPAGEOFF]
	ldr	w8, [x22]
	cmp	w8, #1
	b.lt	LBB0_6
; %bb.1:
	mov	x20, x0
	mov	x23, #0
	mov	x24, #0
LBB0_2:                                 ; =>This Inner Loop Header: Depth=1
	ldr	x25, [x19, #16]
	add	x21, x25, x23
	ldr	x8, [x21, #8]
	cbz	x8, LBB0_4
; %bb.3:                                ;   in Loop: Header=BB0_2 Depth=1
	ldr	w0, [x19, #8]
	mov	x1, x21
	bl	_mtk_vcodec_mem_free
LBB0_4:                                 ;   in Loop: Header=BB0_2 Depth=1
	str	w20, [x25, x23]
	ldr	w0, [x19, #8]
	mov	x1, x21
	bl	_mtk_vcodec_mem_alloc
	cbnz	w0, LBB0_7
; %bb.5:                                ;   in Loop: Header=BB0_2 Depth=1
	add	x8, x25, x23
	ldr	w8, [x8, #4]
	ldr	x9, [x19]
	ldr	x9, [x9]
	str	w8, [x9, x24, lsl #2]
	add	x24, x24, #1
	ldrsw	x8, [x22]
	add	x23, x23, #16
	cmp	x24, x8
	b.lt	LBB0_2
LBB0_6:
	mov	w21, #0
	b	LBB0_8
LBB0_7:
	mov	x21, x0
Lloh2:
	adrp	x1, l_.str@PAGE
Lloh3:
	add	x1, x1, l_.str@PAGEOFF
	mov	x0, x19
	bl	_mtk_vcodec_err
LBB0_8:
	mov	x0, x21
	ldp	x29, x30, [sp, #64]             ; 16-byte Folded Reload
	ldp	x20, x19, [sp, #48]             ; 16-byte Folded Reload
	ldp	x22, x21, [sp, #32]             ; 16-byte Folded Reload
	ldp	x24, x23, [sp, #16]             ; 16-byte Folded Reload
	ldp	x26, x25, [sp], #80             ; 16-byte Folded Reload
	ret
	.loh AdrpLdrGot	Lloh0, Lloh1
	.loh AdrpAdd	Lloh2, Lloh3
	.cfi_endproc
                                        ; -- End function
	.comm	_H264_MAX_FB_NUM,4,2            ; @H264_MAX_FB_NUM
	.section	__TEXT,__cstring,cstring_literals
l_.str:                                 ; @.str
	.asciz	"failed to allocate mv buf"

	.no_dead_strip	_alloc_mv_buf
.subsections_via_symbols
