// File: /workspace/github_c_makefile_star2_O0/tvlabs[P]edge264/edge264_headers.c
// Function: parse_ref_pic_list_modification
static void parse_ref_pic_list_modification(Edge264Decoder *dec, Edge264SeqParameterSet *sps, Edge264Task *t)
{
	// For P we sort on FrameNum, for B we sort on PicOrderCnt.
	const int32_t *values = (t->slice_type == 0) ? dec->FrameNums : dec->FieldOrderCnt[0];
	int pic_value = (t->slice_type == 0) ? dec->FrameNum : dec->TopFieldOrderCnt;
	int count[3] = {0, 0, 0}; // number of refs before/after/long
	int size = 0;
	
	// sort all short and long term references for RefPicListL0
	if (!dec->IdrPicFlag) {
		for (unsigned refs = dec->pic_reference_flags, next = 0; refs; refs ^= 1 << next) {
			int best = INT_MAX;
			for (unsigned r = refs; r; r &= r - 1) {
				int i = __builtin_ctz(r);
				int diff = values[i] - pic_value;
				int ShortTermNum = (diff <= 0) ? -diff : 0x10000 + diff;
				int LongTermNum = dec->LongTermFrameIdx[i] + 0x20000;
				int v = (dec->pic_long_term_flags & 1 << i) ? LongTermNum : ShortTermNum;
				if (v < best)
					best = v, next = i;
			}
			t->RefPicList[0][size++] = next;
			count[best >> 16]++;
		}
	}
	if (dec->nal_unit_type == 20) // if we're second view
		t->RefPicList[0][size++] = dec->prevPic; // add inter-view ref for MVC
	
	// fill RefPicListL1 by swapping before/after references
	for (int src = 0; src < size; src++) {
		int dst = (src < count[0]) ? src + count[1] :
			(src < count[0] + count[1]) ? src - count[0] : src;
		t->RefPicList[1][dst] = t->RefPicList[0][src];
	}
	
	// When decoding a field, extract a list of fields from each list of frames.
	/*union { int8_t q[32]; i8x16 v[2]; } RefFrameList;
	for (int l = 0; t->field_pic_flag && l <= t->slice_type; l++) {
		i8x16 v = t->RefPicList_v[l * 2];
		RefFrameList.v[0] = v;
		RefFrameList.v[1] = v + (i8x16){16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16};
		size = 0;
		int i = t->bottom_field_flag << 4; // first parity to check
		int j = i ^ 16; // other parity to alternate
		int lim_i = i + count[0] + count[1]; // set a first limit to short term frames
		int lim_j = j + count[0] + count[1]; // don't init with XOR as there can be 16 refs!
		int tot = count[0] + count[1] + count[2]; // ... then long term
		
		// probably not the most readable portion, yet otherwise needs a lot of code
		for (int k;;) {
			if (i >= lim_i) {
				if (j < lim_j) { // i reached limit but not j, swap them
					k = i, i = j, j = k;
					k = lim_i, lim_i = lim_j, lim_j = k;
				} else if (min(lim_i, lim_j) < tot) { // end of short term refs, go for long
					int parity = t->bottom_field_flag << 4;
					i = (t->bottom_field_flag << 4) + count[0] + count[1];
					j = i ^ 16;
					lim_i = i + count[2];
					lim_j = j + count[2];
				} else break; // end of long term refs, break
			}
			int pic = RefFrameList.q[i++];
			if (dec->reference_flags & 1 << pic) {
				t->RefPicList[l][size++] = pic;
				if (j < lim_j) { // swap parity if we have not emptied other parity yet
					k = i, i = j, j = k;
					k = lim_i, lim_i = lim_j, lim_j = k;
				}
			}
		}
	}*/
	
	// Swap the two first slots of RefPicListL1 if it the same as RefPicListL0.
	if (t->RefPicList[0][1] >= 0 && t->RefPicList[0][0] == t->RefPicList[1][0]) {
		t->RefPicList[1][0] = t->RefPicList[0][1];
		t->RefPicList[1][1] = t->RefPicList[0][0];
	}
	
	// parse the ref_pic_list_modification() header
	for (int l = 0; l <= t->slice_type; l++) {
		unsigned picNumLX = (t->field_pic_flag) ? dec->FrameNum * 2 + 1 : dec->FrameNum;
		if (get_u1(&dec->_gb)) { // ref_pic_list_modification_flag
			log_dec(dec, "  ref_pic_list_modifications_l%u: [", l);
			for (int refIdx = 0, modification_of_pic_nums_idc; (modification_of_pic_nums_idc = get_ue16(&dec->_gb, 5)) != 3 && refIdx < 32; refIdx++) {
				int num = get_ue32(&dec->_gb, 4294967294);
				log_dec(dec, "[\"%s\",%+d],",
					modification_of_pic_nums_idc < 2 ? "sref" : modification_of_pic_nums_idc == 2 ? "lref" : "view",
					modification_of_pic_nums_idc % 4 == 0 ? -num - 1 : num + (modification_of_pic_nums_idc != 2));
				int pic = dec->prevPic; // for modification_of_pic_nums_idc == 4 and 5
				if (modification_of_pic_nums_idc < 2) {
					picNumLX = (modification_of_pic_nums_idc == 0) ? picNumLX - (num + 1) : picNumLX + (num + 1);
					unsigned MaskFrameNum = (1 << sps->log2_max_frame_num) - 1;
					for (unsigned r = dec->pic_reference_flags & ~dec->pic_long_term_flags; r; r &= r - 1) {
						pic = __builtin_ctz(r);
						if (!((dec->FrameNums[pic] ^ picNumLX) & MaskFrameNum))
							break;
					}
				} else if (modification_of_pic_nums_idc == 2) {
					for (unsigned r = dec->pic_reference_flags & dec->pic_long_term_flags; r; r &= r - 1) {
						pic = __builtin_ctz(r);
						if (dec->LongTermFrameIdx[pic] == num)
							break;
					}
				}
				int buf = pic;
				int cIdx = refIdx;
				do {
					int swap = t->RefPicList[l][cIdx];
					t->RefPicList[l][cIdx] = buf;
					buf = swap;
				} while (++cIdx < t->pps.num_ref_idx_active[l] && buf != pic);
			}
			log_dec(dec, "]\n");
		}
	}
	
	#ifdef LOGS
		for (int lx = 0; lx <= t->slice_type; lx++) {
			log_dec(dec, "  RefPicList%u: [", lx);
			for (int i = 0; i < t->pps.num_ref_idx_active[lx]; i++) {
				int pic = t->RefPicList[lx][i];
				log_dec(dec, i < t->pps.num_ref_idx_active[lx] - 1 ? "%d," : "%d]\n", dec->FrameIds[pic]);
			}
		}
	#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x20(%rax), %eax
cmpl $0x0, %eax
jne 0x77265
movq -0x8(%rbp), %rax
addq $0x6c, %rax
movq %rax, -0xa8(%rbp)
jmp 0x77276
movq -0x8(%rbp), %rax
addq $0x3c0, %rax            # imm = 0x3C0
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rax
movsbl 0x20(%rax), %eax
cmpl $0x0, %eax
jne 0x7729d
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0xac(%rbp)
jmp 0x772aa
movq -0x8(%rbp), %rax
movl 0x3c(%rax), %eax
movl %eax, -0xac(%rbp)
movl -0xac(%rbp), %eax
movl %eax, -0x24(%rbp)
leaq -0x30(%rbp), %rdi
xorl %esi, %esi
movl $0xc, %edx
callq 0x7090
movl $0x0, -0x34(%rbp)
movq -0x8(%rbp), %rax
cmpb $0x0, 0x23(%rax)
jne 0x7740d
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
movl %eax, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
cmpl $0x0, -0x38(%rbp)
je 0x7740b
movl $0x7fffffff, -0x40(%rbp) # imm = 0x7FFFFFFF
movl -0x38(%rbp), %eax
movl %eax, -0x44(%rbp)
cmpl $0x0, -0x44(%rbp)
je 0x773c5
movl -0x44(%rbp), %eax
tzcntl %eax, %eax
movl %eax, -0x48(%rbp)
movq -0x20(%rbp), %rax
movslq -0x48(%rbp), %rcx
movl (%rax,%rcx,4), %eax
subl -0x24(%rbp), %eax
movl %eax, -0x4c(%rbp)
cmpl $0x0, -0x4c(%rbp)
jg 0x77338
xorl %eax, %eax
subl -0x4c(%rbp), %eax
movl %eax, -0xb0(%rbp)
jmp 0x77346
movl -0x4c(%rbp), %eax
addl $0x10000, %eax          # imm = 0x10000
movl %eax, -0xb0(%rbp)
movl -0xb0(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x8(%rbp), %rax
movslq -0x48(%rbp), %rcx
movsbl 0x380(%rax,%rcx), %eax
addl $0x20000, %eax          # imm = 0x20000
movl %eax, -0x54(%rbp)
movq -0x8(%rbp), %rax
movl 0x64(%rax), %eax
movl -0x48(%rbp), %ecx
movl $0x1, %edx
shll %cl, %edx
movl %edx, %ecx
andl %ecx, %eax
cmpl $0x0, %eax
je 0x7738c
movl -0x54(%rbp), %eax
movl %eax, -0xb4(%rbp)
jmp 0x77395
movl -0x50(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x58(%rbp)
movl -0x58(%rbp), %eax
cmpl -0x40(%rbp), %eax
jge 0x773b2
movl -0x58(%rbp), %eax
movl %eax, -0x40(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x773b4
movl -0x44(%rbp), %eax
subl $0x1, %eax
andl -0x44(%rbp), %eax
movl %eax, -0x44(%rbp)
jmp 0x77300
movl -0x3c(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movb %dl, 0x1a0(%rax,%rcx)
movl -0x40(%rbp), %eax
sarl $0x10, %eax
cltq
movl -0x30(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x30(%rbp,%rax,4)
movl -0x3c(%rbp), %ecx
movl $0x1, %eax
shll %cl, %eax
xorl -0x38(%rbp), %eax
movl %eax, -0x38(%rbp)
jmp 0x772e9
jmp 0x7740d
movq -0x8(%rbp), %rax
movsbl 0x22(%rax), %eax
cmpl $0x14, %eax
jne 0x7743a
movq -0x8(%rbp), %rax
movb 0x25(%rax), %dl
movq -0x18(%rbp), %rax
movl -0x34(%rbp), %ecx
movl %ecx, %esi
addl $0x1, %esi
movl %esi, -0x34(%rbp)
movslq %ecx, %rcx
movb %dl, 0x1a0(%rax,%rcx)
movl $0x0, -0x5c(%rbp)
movl -0x5c(%rbp), %eax
cmpl -0x34(%rbp), %eax
jge 0x774c1
movl -0x5c(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x7745f
movl -0x5c(%rbp), %eax
addl -0x2c(%rbp), %eax
movl %eax, -0xb8(%rbp)
jmp 0x7748f
movl -0x5c(%rbp), %eax
movl -0x30(%rbp), %ecx
addl -0x2c(%rbp), %ecx
cmpl %ecx, %eax
jge 0x7747a
movl -0x5c(%rbp), %eax
subl -0x30(%rbp), %eax
movl %eax, -0xbc(%rbp)
jmp 0x77483
movl -0x5c(%rbp), %eax
movl %eax, -0xbc(%rbp)
movl -0xbc(%rbp), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x18(%rbp), %rax
movslq -0x5c(%rbp), %rcx
movb 0x1a0(%rax,%rcx), %dl
movq -0x18(%rbp), %rax
movslq -0x60(%rbp), %rcx
movb %dl, 0x1c0(%rax,%rcx)
movl -0x5c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x5c(%rbp)
jmp 0x77441
movq -0x18(%rbp), %rax
movsbl 0x1a1(%rax), %eax
cmpl $0x0, %eax
jl 0x77513
movq -0x18(%rbp), %rax
movsbl 0x1a0(%rax), %eax
movq -0x18(%rbp), %rcx
movsbl 0x1c0(%rcx), %ecx
cmpl %ecx, %eax
jne 0x77513
movq -0x18(%rbp), %rax
movb 0x1a1(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1c0(%rax)
movq -0x18(%rbp), %rax
movb 0x1a0(%rax), %cl
movq -0x18(%rbp), %rax
movb %cl, 0x1c1(%rax)
movl $0x0, -0x64(%rbp)
movl -0x64(%rbp), %eax
movq -0x18(%rbp), %rcx
movsbl 0x20(%rcx), %ecx
cmpl %ecx, %eax
jg 0x77995
movq -0x18(%rbp), %rax
movsbl 0x21(%rax), %eax
cmpl $0x0, %eax
je 0x7754e
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
shll %eax
addl $0x1, %eax
movl %eax, -0xc0(%rbp)
jmp 0x7755b
movq -0x8(%rbp), %rax
movl 0x38(%rax), %eax
movl %eax, -0xc0(%rbp)
movl -0xc0(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x8(%rbp), %rdi
callq 0x77060
cmpl $0x0, %eax
je 0x77985
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x775e0
movq -0x8(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movl -0x64(%rbp), %ecx
leaq 0x5964c(%rip), %rdx     # 0xd0c0f
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
movl $0x0, -0x6c(%rbp)
movq -0x8(%rbp), %rdi
movl $0x5, %esi
callq 0x76d10
movl %eax, %ecx
movl %ecx, -0x70(%rbp)
xorl %eax, %eax
cmpl $0x3, %ecx
movb %al, -0xc1(%rbp)
je 0x77614
cmpl $0x20, -0x6c(%rbp)
setl %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
testb $0x1, %al
jne 0x77623
jmp 0x7791c
movq -0x8(%rbp), %rdi
movl $0xfffffffe, %esi       # imm = 0xFFFFFFFE
callq 0x76d10
movl %eax, -0x74(%rbp)
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x77744
movq -0x8(%rbp), %rax
addq $0x7ca2, %rax           # imm = 0x7CA2
movq -0x8(%rbp), %rcx
movswl 0x7ca0(%rcx), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rcx
movl $0x2542, %eax           # imm = 0x2542
subq %rcx, %rax
movq %rax, -0xd0(%rbp)
cmpl $0x2, -0x70(%rbp)
jge 0x7769f
leaq 0x595a9(%rip), %rax     # 0xd0c3f
movq %rax, -0xe0(%rbp)
jmp 0x776be
movl -0x70(%rbp), %edx
leaq 0x595a0(%rip), %rax     # 0xd0c49
leaq 0x59594(%rip), %rcx     # 0xd0c44
cmpl $0x2, %edx
cmoveq %rcx, %rax
movq %rax, -0xe0(%rbp)
movq -0xe0(%rbp), %rax
movq %rax, -0xe8(%rbp)
movl -0x70(%rbp), %eax
movl $0x4, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
jne 0x776ec
xorl %eax, %eax
subl -0x74(%rbp), %eax
subl $0x1, %eax
movl %eax, -0xec(%rbp)
jmp 0x77704
movl -0x74(%rbp), %eax
cmpl $0x2, -0x70(%rbp)
setne %cl
andb $0x1, %cl
movzbl %cl, %ecx
addl %ecx, %eax
movl %eax, -0xec(%rbp)
movq -0xe8(%rbp), %rcx
movq -0xd0(%rbp), %rsi
movq -0xd8(%rbp), %rdi
movl -0xec(%rbp), %r8d
leaq 0x5950c(%rip), %rdx     # 0xd0c33
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
movq -0x8(%rbp), %rax
movsbl 0x25(%rax), %eax
movl %eax, -0x78(%rbp)
cmpl $0x2, -0x70(%rbp)
jge 0x777f2
cmpl $0x0, -0x70(%rbp)
jne 0x77772
movl -0x68(%rbp), %eax
movl -0x74(%rbp), %ecx
addl $0x1, %ecx
subl %ecx, %eax
movl %eax, -0xf0(%rbp)
jmp 0x77783
movl -0x68(%rbp), %eax
movl -0x74(%rbp), %ecx
addl $0x1, %ecx
addl %ecx, %eax
movl %eax, -0xf0(%rbp)
movl -0xf0(%rbp), %eax
movl %eax, -0x68(%rbp)
movq -0x10(%rbp), %rax
movsbl 0xa(%rax), %ecx
movl $0x1, %eax
shll %cl, %eax
subl $0x1, %eax
movl %eax, -0x7c(%rbp)
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
movq -0x8(%rbp), %rcx
movl 0x64(%rcx), %ecx
xorl $-0x1, %ecx
andl %ecx, %eax
movl %eax, -0x80(%rbp)
cmpl $0x0, -0x80(%rbp)
je 0x777f0
movl -0x80(%rbp), %eax
tzcntl %eax, %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movslq -0x78(%rbp), %rcx
movl 0x6c(%rax,%rcx,4), %eax
xorl -0x68(%rbp), %eax
andl -0x7c(%rbp), %eax
cmpl $0x0, %eax
jne 0x777e0
jmp 0x777f0
jmp 0x777e2
movl -0x80(%rbp), %eax
subl $0x1, %eax
andl -0x80(%rbp), %eax
movl %eax, -0x80(%rbp)
jmp 0x777b7
jmp 0x77856
cmpl $0x2, -0x70(%rbp)
jne 0x77854
movq -0x8(%rbp), %rax
movl 0x60(%rax), %eax
movq -0x8(%rbp), %rcx
andl 0x64(%rcx), %eax
movl %eax, -0x84(%rbp)
cmpl $0x0, -0x84(%rbp)
je 0x77852
movl -0x84(%rbp), %eax
tzcntl %eax, %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rax
movslq -0x78(%rbp), %rcx
movsbl 0x380(%rax,%rcx), %eax
cmpl -0x74(%rbp), %eax
jne 0x77839
jmp 0x77852
jmp 0x7783b
movl -0x84(%rbp), %eax
subl $0x1, %eax
andl -0x84(%rbp), %eax
movl %eax, -0x84(%rbp)
jmp 0x7780c
jmp 0x77854
jmp 0x77856
movl -0x78(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x8c(%rbp)
movq -0x18(%rbp), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x8c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x90(%rbp)
movl -0x88(%rbp), %eax
movb %al, %dl
movq -0x18(%rbp), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x64(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x8c(%rbp), %rcx
movb %dl, (%rax,%rcx)
movl -0x90(%rbp), %eax
movl %eax, -0x88(%rbp)
movl -0x8c(%rbp), %ecx
addl $0x1, %ecx
movl %ecx, -0x8c(%rbp)
movq -0x18(%rbp), %rax
movslq -0x64(%rbp), %rdx
movsbl 0x222(%rax,%rdx), %edx
xorl %eax, %eax
cmpl %edx, %ecx
movb %al, -0xf1(%rbp)
jge 0x778fe
movl -0x88(%rbp), %eax
cmpl -0x78(%rbp), %eax
setne %al
movb %al, -0xf1(%rbp)
movb -0xf1(%rbp), %al
testb $0x1, %al
jne 0x77868
jmp 0x7790e
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x775e7
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x77983
movq -0x8(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
leaq 0x59252(%rip), %rdx     # 0xd0bb8
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
jmp 0x77985
jmp 0x77987
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x7751a
movl $0x0, -0x94(%rbp)
movl -0x94(%rbp), %eax
movq -0x18(%rbp), %rcx
movsbl 0x20(%rcx), %ecx
cmpl %ecx, %eax
jg 0x77b4b
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x77a22
movq -0x8(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movl -0x94(%rbp), %ecx
leaq 0x59249(%rip), %rdx     # 0xd0c4e
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
movl $0x0, -0x98(%rbp)
movl -0x98(%rbp), %eax
movq -0x18(%rbp), %rcx
movslq -0x94(%rbp), %rdx
movsbl 0x222(%rcx,%rdx), %ecx
cmpl %ecx, %eax
jge 0x77b35
movq -0x18(%rbp), %rax
addq $0x1a0, %rax            # imm = 0x1A0
movslq -0x94(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movslq -0x98(%rbp), %rcx
movsbl (%rax,%rcx), %eax
movl %eax, -0x9c(%rbp)
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
cmpq $0x2542, %rax           # imm = 0x2542
jae 0x77b1f
movq -0x8(%rbp), %rdi
addq $0x7ca2, %rdi           # imm = 0x7CA2
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %eax
cltq
addq %rax, %rdi
movq -0x8(%rbp), %rax
movswq 0x7ca0(%rax), %rax
movl $0x2542, %esi           # imm = 0x2542
subq %rax, %rsi
movl -0x98(%rbp), %ecx
movq -0x18(%rbp), %rax
movslq -0x94(%rbp), %rdx
movsbl 0x222(%rax,%rdx), %r8d
subl $0x1, %r8d
leaq 0x590cd(%rip), %rdx     # 0xd0baf
leaq 0x589e5(%rip), %rax     # 0xd04ce
cmpl %r8d, %ecx
cmovlq %rax, %rdx
movq -0x8(%rbp), %rax
movslq -0x9c(%rbp), %rcx
movl 0xec(%rax,%rcx,4), %ecx
movb $0x0, %al
callq 0x7070
movl %eax, %edx
movq -0x8(%rbp), %rax
movswl 0x7ca0(%rax), %ecx
addl %edx, %ecx
movw %cx, 0x7ca0(%rax)
jmp 0x77b21
movl -0x98(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x98(%rbp)
jmp 0x77a2c
jmp 0x77b37
movl -0x94(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x7799f
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
nopw %cs:(%rax,%rax)