// File: /workspace/github_cpp_makefile_star2_O3/yuansliu[P]HiRGC/hirgc.cpp
// Function: saveOtherData(_IO_FILE*)
void saveOtherData(FILE *fp) { // write auxiliary information to file
	fprintf(fp, "%s\n", meta_data);//identifier
	//------------------------
	writeRunLengthCoding(fp, line_break_len, line_break_vec);//length of shor seuqences
	//------------------------
	fprintf(fp, "%d", pos_vec_len); //intervals of lower-case letters
	for (int i = 0; i < pos_vec_len; i++) {
		fprintf(fp, " %d %d", pos_vec[i].begin, pos_vec[i].length);
	}
	//------------------------
	fprintf(fp, "\n%d", n_vec_len); //intervals of the letter 'N'
	for (int i = 0; i < n_vec_len; i++) {
		fprintf(fp, " %d %d", n_vec[i].begin, n_vec[i].length);
	}
	//------------------------
	fprintf(fp, "\n%d", other_char_len); //other characters
	if (other_char_len > 0) {
		int flag[30];
		for (int i = 0; i < 26; i++) {
			flag[i] = -1;
		}
		vector<int> arr;
	
		for (int i = 0; i < other_char_len; i++) {
			fprintf(fp, " %d", other_char_vec[i].pos);

			int temp = other_char_vec[i].ch;
			if (flag[temp] == -1) {
				arr.push_back(temp);
				flag[temp] = arr.size()-1;
			}
		}

		//save other char information
		int size = arr.size();
		fprintf(fp, " %d", size);
		for (int i = 0; i < size; i++) {
			fprintf(fp, " %d", arr[i]);
		}

		if (size < 10) {
			fprintf(fp, " ");
			for (int i = 0; i < other_char_len; i++) {
				fprintf(fp, "%d", flag[other_char_vec[i].ch]);
			}
		} else {
			int bit_num = ceil(log(size)/log(2));
			int v_num = floor(32.0/bit_num);

			for (int i = 0; i < other_char_len; ) {
				// fprintf(fp, "%d ", flag[other_char_vec[i].ch]);
				unsigned int v = 0;
				for (int j = 0; j < v_num && i < other_char_len; j++, i++) {
					v <<= bit_num;
					v += flag[other_char_vec[i].ch];
				}
				fprintf(fp, " %u", v);
			}
		}
	}
	fprintf(fp, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xb8, %rsp
movq %rdi, %rbx
movq 0x5360(%rip), %rdx      # 0x8178
leaq 0x225d(%rip), %rsi      # 0x507c
xorl %eax, %eax
callq 0x21e0
movl 0x539c(%rip), %esi      # 0x81c8
movq 0x5365(%rip), %rdx      # 0x8198
movq %rbx, %rdi
callq 0x2c42
movl 0x537f(%rip), %edx      # 0x81c0
leaq 0x2212(%rip), %rsi      # 0x505a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21e0
cmpl $0x0, 0x5367(%rip)      # 0x81c0
jle 0x2e91
leaq 0x21f0(%rip), %r14      # 0x5052
xorl %r15d, %r15d
movq 0x5314(%rip), %rax      # 0x8180
movl (%rax,%r15,8), %edx
movl 0x4(%rax,%r15,8), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
incq %r15
movslq 0x5334(%rip), %rax      # 0x81c0
cmpq %rax, %r15
jl 0x2e65
movl 0x532d(%rip), %edx      # 0x81c4
leaq 0x21bb(%rip), %rsi      # 0x5059
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21e0
cmpl $0x0, 0x5315(%rip)      # 0x81c4
jle 0x2ee7
leaq 0x219a(%rip), %r14      # 0x5052
xorl %r15d, %r15d
movq 0x52c6(%rip), %rax      # 0x8188
movl (%rax,%r15,8), %edx
movl 0x4(%rax,%r15,8), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
incq %r15
movslq 0x52e2(%rip), %rax      # 0x81c4
cmpq %rax, %r15
jl 0x2ebb
movl 0x52c3(%rip), %edx      # 0x81b0
leaq 0x2165(%rip), %rsi      # 0x5059
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21e0
cmpl $0x0, 0x52ab(%rip)      # 0x81b0
jle 0x315b
pcmpeqd %xmm0, %xmm0
movdqa %xmm0, 0x90(%rsp)
movdqa %xmm0, 0x80(%rsp)
movdqa %xmm0, 0x70(%rsp)
movdqa %xmm0, 0x60(%rsp)
movdqa %xmm0, 0x50(%rsp)
movdqa %xmm0, 0x40(%rsp)
movq $-0x1, 0xa0(%rsp)
pxor %xmm0, %xmm0
leaq 0x10(%rsp), %r14
movdqa %xmm0, (%r14)
movq $0x0, 0x10(%r14)
leaq 0x20f3(%rip), %r15      # 0x5055
leaq 0xc(%rsp), %r12
xorl %r13d, %r13d
movq 0x521f(%rip), %rax      # 0x8190
movl (%rax,%r13,8), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21e0
movq 0x5207(%rip), %rax      # 0x8190
movslq 0x4(%rax,%r13,8), %rax
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0x40(%rsp,%rax,4)
jne 0x2fd6
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x2fb2
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x18(%rsp)
jmp 0x2fc2
movq %r14, %rdi
movq %r12, %rdx
callq 0x4368
movq 0x18(%rsp), %rsi
subq 0x10(%rsp), %rsi
shrq $0x2, %rsi
decl %esi
movslq 0xc(%rsp), %rax
movl %esi, 0x40(%rsp,%rax,4)
incq %r13
movslq 0x51d0(%rip), %rax      # 0x81b0
cmpq %rax, %r13
jl 0x2f6a
movq 0x18(%rsp), %r14
subq 0x10(%rsp), %r14
shrq $0x2, %r14
leaq 0x205b(%rip), %rsi      # 0x5055
movq %rbx, %rdi
movl %r14d, %edx
xorl %eax, %eax
callq 0x21e0
testl %r14d, %r14d
jle 0x3044
movl %r14d, %r12d
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
leaq 0x2038(%rip), %r15      # 0x5055
xorl %r13d, %r13d
movq 0x10(%rsp), %rax
movl (%rax,%r13,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21e0
incq %r13
cmpq %r13, %r12
jne 0x3020
cmpl $0xa, %r14d
jge 0x3099
movl $0x20, %edi
movq %rbx, %rsi
callq 0x21a0
cmpl $0x0, 0x5158(%rip)      # 0x81b0
jle 0x314c
leaq 0x1ff5(%rip), %r14      # 0x505a
xorl %r15d, %r15d
movq 0x5121(%rip), %rax      # 0x8190
movslq 0x4(%rax,%r15,8), %rax
movl 0x40(%rsp,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
incq %r15
movslq 0x5121(%rip), %rax      # 0x81b0
cmpq %rax, %r15
jl 0x3068
jmp 0x314c
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
callq 0x2110
divsd 0x1f5a(%rip), %xmm0     # 0x5008
callq 0x2050
movapd %xmm0, 0x30(%rsp)
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm1
movsd 0x1f47(%rip), %xmm0     # 0x5010
divsd %xmm1, %xmm0
callq 0x2250
movl 0x50d8(%rip), %ecx      # 0x81b0
testl %ecx, %ecx
jle 0x314c
cvttsd2si 0x30(%rsp), %ebp
cvttsd2si %xmm0, %r15d
leaq 0x1f6f(%rip), %r14      # 0x505d
xorl %r12d, %r12d
testl %r15d, %r15d
jle 0x3132
movq 0x5093(%rip), %rax      # 0x8190
movslq %r12d, %r8
movslq %ecx, %rsi
incq %r8
xorl %edx, %edx
movl $0x1, %edi
movl %ebp, %ecx
shll %cl, %edx
movslq -0x4(%rax,%r8,8), %rcx
addl 0x40(%rsp,%rcx,4), %edx
incl %r12d
cmpl %r15d, %edi
jge 0x3134
leaq 0x1(%r8), %rcx
incl %edi
cmpq %rsi, %r8
movq %rcx, %r8
jl 0x310d
jmp 0x3134
xorl %edx, %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21e0
movl 0x5069(%rip), %ecx      # 0x81b0
cmpl %ecx, %r12d
jl 0x30f1
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x315b
callq 0x2150
movl $0xa, %edi
movq %rbx, %rsi
callq 0x21a0
addq $0xb8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x318c
callq 0x2150
movq %rbx, %rdi
callq 0x2260