// File: /workspace/github_c_makefile_star2_O3/tvlabs[P]edge264/./edge264_headers.c
// Function: alloc_frame
static int alloc_frame(Edge264Decoder *dec, int id) {
	dec->frame_buffers[id] = malloc(dec->frame_size);
	if (dec->frame_buffers[id] == NULL)
		return ENOMEM;
	Edge264Macroblock *m = (Edge264Macroblock *)(dec->frame_buffers[id] + dec->plane_size_Y + dec->plane_size_C);
	int mbs = (dec->sps.pic_width_in_mbs + 1) * dec->sps.pic_height_in_mbs - 1;
	for (int i = 0; i < mbs; i += dec->sps.pic_width_in_mbs + 1) {
		for (int j = i; j < i + dec->sps.pic_width_in_mbs; j++)
			m[j].recovery_bits = 0;
		if (i + dec->sps.pic_width_in_mbs < mbs)
			m[i + dec->sps.pic_width_in_mbs] = unavail_mb;
	}
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movslq 0x34(%rdi), %rdi
callq 0x10f0
movslq %ebp, %rcx
movq %rax, 0x188(%rbx,%rcx,8)
testq %rax, %rax
je 0xd4e5
movzwl 0x534(%rbx), %r9d
leal 0x1(%r9), %ecx
movswl 0x536(%rbx), %r8d
imull %ecx, %r8d
cmpl $0x2, %r8d
jl 0xd4e1
movslq 0x2c(%rbx), %rcx
movslq 0x30(%rbx), %rdx
addq %rcx, %rdx
leaq (%rax,%rdx), %rcx
movq %rcx, 0x8(%rsp)
decl %r8d
leaq 0x1(%r9), %rdi
movl %r8d, %r13d
movq %r9, %rcx
notq %rcx
movq %rcx, 0x10(%rsp)
leal 0x1f(%r9), %r15d
andl $-0x20, %r15d
leaq (%rax,%rdx), %r11
addq $0x24d1, %r11           # imm = 0x24D1
imulq $0x130, %r9, %rbp       # imm = 0x130
movl $0x130, %eax            # imm = 0x130
addq %rax, %rbp
xorl %r14d, %r14d
vpmovsxbq 0x2a213(%rip), %ymm3 # 0x3734c
vpmovsxbq 0x2a20e(%rip), %ymm4 # 0x37350
vpmovsxbq 0x2a209(%rip), %ymm5 # 0x37354
vpmovsxbq 0x2a204(%rip), %ymm6 # 0x37358
vpmovsxbq 0x2a1ff(%rip), %ymm7 # 0x3735c
vpmovsxbq 0x2a1fa(%rip), %ymm8 # 0x37360
vpmovsxbq 0x2a1f5(%rip), %ymm9 # 0x37364
vpmovsxbq 0x2a1f0(%rip), %ymm10 # 0x37368
xorl %r12d, %r12d
movq %rdi, (%rsp)
leaq (%r12,%r9), %rax
testq %r9, %r9
je 0xd434
movq %r14, %rcx
imulq 0x10(%rsp), %rcx
addq %rax, %rcx
decq %rcx
vpbroadcastq %rcx, %ymm0
movq %r11, %rcx
xorl %edx, %edx
vpbroadcastq %rdx, %ymm1
vpor %ymm1, %ymm10, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd1c8
movb $0x0, -0x24d0(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd1d9
movb $0x0, -0x23a0(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd1ea
movb $0x0, -0x2270(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd1fb
movb $0x0, -0x2140(%rcx)
vpor %ymm1, %ymm9, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd217
movb $0x0, -0x2010(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd228
movb $0x0, -0x1ee0(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd239
movb $0x0, -0x1db0(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd24a
movb $0x0, -0x1c80(%rcx)
vpor %ymm1, %ymm8, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd266
movb $0x0, -0x1b50(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd277
movb $0x0, -0x1a20(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd288
movb $0x0, -0x18f0(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd299
movb $0x0, -0x17c0(%rcx)
vpor %ymm7, %ymm1, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd2b5
movb $0x0, -0x1690(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd2c6
movb $0x0, -0x1560(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd2d7
movb $0x0, -0x1430(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd2e8
movb $0x0, -0x1300(%rcx)
vpor %ymm6, %ymm1, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd304
movb $0x0, -0x11d0(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd315
movb $0x0, -0x10a0(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd326
movb $0x0, -0xf70(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd337
movb $0x0, -0xe40(%rcx)
vpor %ymm5, %ymm1, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd353
movb $0x0, -0xd10(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd364
movb $0x0, -0xbe0(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd375
movb $0x0, -0xab0(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd386
movb $0x0, -0x980(%rcx)
vpor %ymm4, %ymm1, %ymm2
vpcmpleuq %ymm0, %ymm2, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd3a2
movb $0x0, -0x850(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd3b3
movb $0x0, -0x720(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd3c4
movb $0x0, -0x5f0(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd3d5
movb $0x0, -0x4c0(%rcx)
vpor %ymm3, %ymm1, %ymm1
vpcmpleuq %ymm0, %ymm1, %k0
kmovd %k0, %esi
testb $0x1, %sil
je 0xd3f1
movb $0x0, -0x390(%rcx)
kmovd %k0, %esi
testb $0x2, %sil
je 0xd402
movb $0x0, -0x260(%rcx)
kmovd %k0, %esi
testb $0x4, %sil
je 0xd413
movb $0x0, -0x130(%rcx)
kmovd %k0, %esi
testb $0x8, %sil
je 0xd420
movb $0x0, (%rcx)
addq $0x20, %rdx
addq $0x2600, %rcx           # imm = 0x2600
cmpq %rdx, %r15
jne 0xd1a6
cmpl %eax, %r8d
jle 0xd4cf
imulq $0x130, %rax, %rdi      # imm = 0x130
addq 0x8(%rsp), %rdi
movl $0x130, %edx            # imm = 0x130
leaq 0x31c7b(%rip), %rsi     # 0x3f0d0
movq %r14, 0x20(%rsp)
movl %r8d, %r14d
movq %r9, %rbx
movq %r12, 0x18(%rsp)
movq %r11, %r12
vzeroupper
callq 0x10c0
vpmovsxbq 0x29eef(%rip), %ymm10 # 0x37368
vpmovsxbq 0x29ee2(%rip), %ymm9 # 0x37364
vpmovsxbq 0x29ed5(%rip), %ymm8 # 0x37360
vpmovsxbq 0x29ec8(%rip), %ymm7 # 0x3735c
vpmovsxbq 0x29ebb(%rip), %ymm6 # 0x37358
vpmovsxbq 0x29eae(%rip), %ymm5 # 0x37354
vpmovsxbq 0x29ea1(%rip), %ymm4 # 0x37350
vpmovsxbq 0x29e94(%rip), %ymm3 # 0x3734c
movq %r12, %r11
movq 0x18(%rsp), %r12
movq %rbx, %r9
movl %r14d, %r8d
movq 0x20(%rsp), %r14
movq (%rsp), %rdi
addq %rdi, %r12
incq %r14
addq %rbp, %r11
cmpq %r13, %r12
jb 0xd17f
xorl %eax, %eax
jmp 0xd4ea
movl $0xc, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
vzeroupper
retq