// File: /workspace/github_cpp_makefile_star2_O2/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 $0xa8, %rsp
movq %rdi, %rbx
movq 0x54af(%rip), %rdx      # 0x8178
leaq 0x23ac(%rip), %rsi      # 0x507c
xorl %eax, %eax
callq 0x21f0
movl 0x54eb(%rip), %esi      # 0x81c8
movq 0x54b4(%rip), %rdx      # 0x8198
movq %rbx, %rdi
callq 0x2b6e
movl 0x54ce(%rip), %edx      # 0x81c0
leaq 0x2361(%rip), %rsi      # 0x505a
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21f0
leaq 0x2348(%rip), %r14      # 0x5052
xorl %r15d, %r15d
movslq 0x54ac(%rip), %rax      # 0x81c0
cmpq %rax, %r15
jge 0x2d3b
movq 0x5460(%rip), %rax      # 0x8180
movl (%rax,%r15,8), %edx
movl 0x4(%rax,%r15,8), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r15
jmp 0x2d0d
movl 0x5483(%rip), %edx      # 0x81c4
leaq 0x2311(%rip), %rsi      # 0x5059
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21f0
leaq 0x22f9(%rip), %r14      # 0x5052
xorl %r15d, %r15d
movslq 0x5461(%rip), %rax      # 0x81c4
cmpq %rax, %r15
jge 0x2d8a
movq 0x5419(%rip), %rax      # 0x8188
movl (%rax,%r15,8), %edx
movl 0x4(%rax,%r15,8), %ecx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r15
jmp 0x2d5c
movl 0x5420(%rip), %edx      # 0x81b0
leaq 0x22c2(%rip), %rsi      # 0x5059
movq %rbx, %rdi
xorl %eax, %eax
callq 0x21f0
movl 0x5409(%rip), %eax      # 0x81b0
testl %eax, %eax
jle 0x2f88
xorl %ecx, %ecx
cmpq $0x1a, %rcx
je 0x2dc1
orl $-0x1, 0x30(%rsp,%rcx,4)
incq %rcx
jmp 0x2db1
xorpd %xmm0, %xmm0
leaq 0x10(%rsp), %r14
andq $0x0, 0x10(%r14)
movapd %xmm0, (%r14)
leaq 0x227a(%rip), %r15      # 0x5055
leaq 0xc(%rsp), %r12
xorl %r13d, %r13d
cltq
cmpq %rax, %r13
jge 0x2e48
movq 0x539f(%rip), %rax      # 0x8190
movl (%rax,%r13,8), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21f0
movq 0x5387(%rip), %rax      # 0x8190
movslq 0x4(%rax,%r13,8), %rax
movl %eax, 0xc(%rsp)
cmpl $-0x1, 0x30(%rsp,%rax,4)
jne 0x2e3d
movq %r14, %rdi
movq %r12, %rsi
callq 0x3d26
movq 0x18(%rsp), %rax
subq 0x10(%rsp), %rax
shrq $0x2, %rax
decl %eax
movslq 0xc(%rsp), %rcx
movl %eax, 0x30(%rsp,%rcx,4)
incq %r13
movl 0x536a(%rip), %eax      # 0x81b0
jmp 0x2de3
movq 0x18(%rsp), %r14
subq 0x10(%rsp), %r14
shrq $0x2, %r14
leaq 0x21f8(%rip), %r15      # 0x5055
movq %rbx, %rdi
movq %r15, %rsi
movl %r14d, %edx
xorl %eax, %eax
callq 0x21f0
testl %r14d, %r14d
movl $0x0, %r12d
cmovgl %r14d, %r12d
xorl %r13d, %r13d
cmpq %r13, %r12
je 0x2e9d
movq 0x10(%rsp), %rax
movl (%rax,%r13,4), %edx
movq %rbx, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r13
jmp 0x2e7d
cmpl $0xa, %r14d
jge 0x2eea
pushq $0x20
popq %rdi
movq %rbx, %rsi
callq 0x2190
leaq 0x21a5(%rip), %r14      # 0x505a
xorl %r15d, %r15d
movslq 0x52f1(%rip), %rax      # 0x81b0
cmpq %rax, %r15
jge 0x2f7e
movq 0x52c1(%rip), %rax      # 0x8190
movslq 0x4(%rax,%r15,8), %rax
movl 0x30(%rsp,%rax,4), %edx
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
incq %r15
jmp 0x2eb8
movl %r14d, %edi
callq 0x3d44
divsd 0x210e(%rip), %xmm0     # 0x5008
callq 0x2050
cvttsd2si %xmm0, %ebp
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm1
movsd 0x20fd(%rip), %xmm0     # 0x5010
divsd %xmm1, %xmm0
callq 0x2260
cvttsd2si %xmm0, %r15d
leaq 0x2135(%rip), %r14      # 0x505d
xorl %r12d, %r12d
movslq 0x527e(%rip), %rax      # 0x81b0
cmpl %eax, %r12d
jge 0x2f7e
movq 0x5252(%rip), %rcx      # 0x8190
movslq %r12d, %rdi
leaq (%rcx,%rdi,8), %r8
addq $0x4, %r8
xorl %esi, %esi
xorl %edx, %edx
cmpl %r15d, %esi
jge 0x2f6c
leaq (%rdi,%rsi), %rcx
cmpq %rax, %rcx
jge 0x2f6c
movl %ebp, %ecx
shll %cl, %edx
movslq (%r8,%rsi,8), %rcx
addl 0x30(%rsp,%rcx,4), %edx
incq %rsi
jmp 0x2f4d
addl %esi, %r12d
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x21f0
jmp 0x2f2b
leaq 0x10(%rsp), %rdi
callq 0x3f6c
pushq $0xa
popq %rdi
movq %rbx, %rsi
callq 0x2190
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x3f6c
movq %rbx, %rdi
callq 0x2270