// File: chhylp123[P]hifiasm/Process_Read.cpp
// Function: append_All_reads(All_reads*, char*, unsigned int)
int append_All_reads(All_reads* r, char *idx, uint32_t id)
{
	char *gfa_name = NULL; MALLOC(gfa_name, (strlen(idx)+100));
	FILE *fp = NULL, *fpo = NULL;

	sprintf(gfa_name, "%s.ec%u.bin", idx, id);
    fp = fopen(gfa_name, "r");
	if (!fp) {free(gfa_name); return 0;}

	sprintf(gfa_name, "%s.ovlp%u.source.bin", idx, id);
	fpo = fopen(gfa_name, "r");
	if (!fpo) {free(gfa_name); fclose(fp); return 0;}
	free(gfa_name);

	int local_adapterLen, f_flag;
    f_flag = fread(&local_adapterLen, sizeof(local_adapterLen), 1, fp);
    if(local_adapterLen != asm_opt.adapterLen) {
        fprintf(stderr, "the adapterLen of index is: %d, but the adapterLen set by user is: %d\n", 
        local_adapterLen, asm_opt.adapterLen);
		exit(1);
    }
	uint64_t index_size0, name_index_size0, total_reads0, total_reads_bases0, total_name_length0;
	index_size0 = r->index_size; 
	total_reads0 = r->total_reads; 
	total_reads_bases0 = r->total_reads_bases;
	total_name_length0 = r->total_name_length;
	name_index_size0 = ((total_reads0)?(total_reads0+1):(0));///r->name_index_size;

    f_flag += fread(&r->index_size, sizeof(r->index_size), 1, fp);
	f_flag += fread(&r->name_index_size, sizeof(r->name_index_size), 1, fp);
	f_flag += fread(&r->total_reads, sizeof(r->total_reads), 1, fp);
	f_flag += fread(&r->total_reads_bases, sizeof(r->total_reads_bases), 1, fp);
	f_flag += fread(&r->total_name_length, sizeof(r->total_name_length), 1, fp);

	r->index_size += index_size0;
	r->name_index_size += name_index_size0; if(name_index_size0) r->name_index_size--;
	r->total_reads += total_reads0;
	r->total_reads_bases += total_reads_bases0;
	r->total_name_length += total_name_length0;


	uint64_t i = 0, zero = 0, k;
	REALLOC(r->N_site, r->total_reads);

	for (i = total_reads0; i < r->total_reads; i++) {
		f_flag += fread(&zero, sizeof(zero), 1, fp);

		if (zero) {
			r->N_site[i] = (uint64_t*)malloc(sizeof(uint64_t)*(zero + 1));
			r->N_site[i][0] = zero;
			if (r->N_site[i][0]) {
				f_flag += fread(r->N_site[i]+1, sizeof(r->N_site[i][0]), r->N_site[i][0], fp);
			}
		} else {
			r->N_site[i] = NULL;
		}
	}

	REALLOC(r->read_length, r->total_reads);
	f_flag += fread(r->read_length + total_reads0, sizeof(uint64_t), r->total_reads-total_reads0, fp);

	REALLOC(r->read_size, r->total_reads);
	memcpy (r->read_size + total_reads0, r->read_length + total_reads0, sizeof(uint64_t)*(r->total_reads-total_reads0));

	REALLOC(r->read_sperate, r->total_reads);
	for (i = total_reads0; i < r->total_reads; i++) {
		r->read_sperate[i] = (uint8_t*)malloc(sizeof(uint8_t)*(r->read_length[i]/4+1));
		f_flag += fread(r->read_sperate[i], sizeof(uint8_t), r->read_length[i]/4+1, fp);
	}


	REALLOC(r->name, r->total_name_length);
	f_flag += fread(r->name + total_name_length0, sizeof(char), r->total_name_length - total_name_length0, fp);

	REALLOC(r->name_index, r->name_index_size); uint64_t sft = 0;
	if(name_index_size0) sft = r->name_index[--name_index_size0];
	// fprintf(stderr, "name_index_size0::%lu, total_reads0::%lu, sft::%lu\n", name_index_size0, total_reads0, sft);
	f_flag += fread(r->name_index + name_index_size0, sizeof(uint64_t), r->name_index_size-name_index_size0, fp);
	if(sft) {
		for (i = name_index_size0; i < r->name_index_size; i++) r->name_index[i] += sft;
	}

	/****************************may have bugs********************************/
	REALLOC(r->trio_flag, r->total_reads);
	f_flag += fread(r->trio_flag + total_reads0, sizeof(uint8_t), r->total_reads - total_reads0, fp);

	int hom_cov0 = asm_opt.hom_cov, het_cov0 = asm_opt.het_cov;
	f_flag += fread(&(asm_opt.hom_cov), sizeof(asm_opt.hom_cov), 1, fp); asm_opt.hom_cov += hom_cov0;
    f_flag += fread(&(asm_opt.het_cov), sizeof(asm_opt.het_cov), 1, fp); asm_opt.het_cov += het_cov0;
	/****************************may have bugs********************************/

	REALLOC(r->cigars, r->total_reads);
	REALLOC(r->second_round_cigar, r->total_reads);
	for (i = total_reads0; i < r->total_reads; i++) {
		r->second_round_cigar[i].size = r->cigars[i].size = 0;
		r->second_round_cigar[i].length = r->cigars[i].length = 0;
		r->second_round_cigar[i].record = r->cigars[i].record = NULL;

		r->second_round_cigar[i].lost_base_size = r->cigars[i].lost_base_size = 0;
		r->second_round_cigar[i].lost_base_length = r->cigars[i].lost_base_length = 0;
		r->second_round_cigar[i].lost_base = r->cigars[i].lost_base = NULL;
	}
	///r->pb_regions = NULL;

	REALLOC(r->paf, r->total_reads);
	memset(r->paf+total_reads0, 0, sizeof((*(r->paf)))*(r->total_reads - total_reads0));
	long long n_read; f_flag = fread(&n_read, sizeof(n_read), 1, fpo); ma_hit_t t;
	for (i = total_reads0; i < r->total_reads; i++) {
		f_flag += fread(&(r->paf[i].is_fully_corrected), sizeof(r->paf[i].is_fully_corrected), 1, fpo);
        f_flag += fread(&(r->paf[i].is_abnormal), sizeof(r->paf[i].is_abnormal), 1, fpo);
        f_flag += fread(&(r->paf[i].length), sizeof(r->paf[i].length), 1, fpo);

        if(r->paf[i].length == 0) continue;
        for (k = 0; k < r->paf[i].length; k++) read_ma(&t, fpo);
		r->paf[i].length = 0;
	}

	REALLOC(r->reverse_paf, r->total_reads); 
	memset(r->reverse_paf+total_reads0, 0, sizeof((*(r->reverse_paf)))*(r->total_reads - total_reads0));

    fclose(fp); fclose(fpo);
    fprintf(stderr, "Reads has been loaded.\n");
	return 1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movq $0x0, -0x28(%rbp)
movq -0x18(%rbp), %rdi
callq 0x20a0
movq %rax, %rdi
addq $0x64, %rdi
shlq $0x0, %rdi
callq 0x2270
movq %rax, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq 0x37900c(%rip), %rsi    # 0x381499
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rdi
leaq 0x387f37(%rip), %rsi    # 0x3903d6
callq 0x2200
movq %rax, -0x30(%rbp)
cmpq $0x0, -0x30(%rbp)
jne 0x84c4
movq -0x28(%rbp), %rdi
callq 0x2210
movl $0x0, -0x4(%rbp)
jmp 0x8faa
movq -0x28(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq 0x378fcf(%rip), %rsi    # 0x3814a5
movb $0x0, %al
callq 0x2050
movq -0x28(%rbp), %rdi
leaq 0x387eee(%rip), %rsi    # 0x3903d6
callq 0x2200
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
jne 0x8516
movq -0x28(%rbp), %rdi
callq 0x2210
movq -0x30(%rbp), %rdi
callq 0x21a0
movl $0x0, -0x4(%rbp)
jmp 0x8faa
movq -0x28(%rbp), %rdi
callq 0x2210
movq -0x30(%rbp), %rcx
leaq -0x3c(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x40(%rbp)
movl -0x3c(%rbp), %eax
leaq 0x3bc2b5(%rip), %rcx    # 0x3c47f8
cmpl 0x100(%rcx), %eax
je 0x857d
movq 0x3bba8e(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
movl -0x3c(%rbp), %edx
leaq 0x3bc299(%rip), %rax    # 0x3c47f8
movl 0x100(%rax), %ecx
leaq 0x378ece(%rip), %rsi    # 0x38143a
movb $0x0, %al
callq 0x22a0
movl $0x1, %edi
callq 0x2240
movq -0x10(%rbp), %rax
movq 0x38(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
movq %rax, -0x58(%rbp)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rax
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x85c5
movq -0x58(%rbp), %rax
addq $0x1, %rax
movq %rax, -0xc8(%rbp)
jmp 0x85d0
xorl %eax, %eax
movq %rax, -0xc8(%rbp)
jmp 0x85d0
movq -0xc8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rdi
addq $0x38, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x48, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x50, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x58, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rdi
addq $0x60, %rdi
movq -0x30(%rbp), %rcx
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x48(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x38(%rax), %rcx
movq %rcx, 0x38(%rax)
movq -0x50(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x48(%rax), %rcx
movq %rcx, 0x48(%rax)
cmpq $0x0, -0x50(%rbp)
je 0x86da
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x48(%rax)
movq -0x58(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movq -0x60(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x58(%rax), %rcx
movq %rcx, 0x58(%rax)
movq -0x68(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x60(%rax), %rcx
movq %rcx, 0x60(%rax)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x883b
movq -0x30(%rbp), %rcx
leaq -0x78(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
cmpq $0x0, -0x78(%rbp)
je 0x8815
movq -0x78(%rbp), %rdi
addq $0x1, %rdi
shlq $0x3, %rdi
callq 0x2270
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x78(%rbp), %rcx
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rdx
movq (%rax,%rdx,8), %rax
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
cmpq $0x0, (%rax)
je 0x8813
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
addq $0x8, %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq (%rax), %rdx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
jmp 0x8828
movq -0x10(%rbp), %rax
movq (%rax), %rax
movq -0x70(%rbp), %rcx
movq $0x0, (%rax,%rcx,8)
jmp 0x882a
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x8744
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rdi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdx
subq -0x58(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x20(%rax)
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rdi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x58(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rsi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdx
subq -0x58(%rbp), %rdx
shlq $0x3, %rdx
callq 0x2180
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x89be
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
shrq $0x2, %rdi
addq $0x1, %rdi
shlq $0x0, %rdi
callq 0x2270
movq %rax, %rdx
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
shrq $0x2, %rdx
addq $0x1, %rdx
movq -0x30(%rbp), %rcx
movl $0x1, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x8924
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
addq -0x68(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rdx
subq -0x68(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x1, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rsi
shlq $0x3, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x40(%rax)
movq $0x0, -0x88(%rbp)
cmpq $0x0, -0x50(%rbp)
je 0x8a6e
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x50(%rbp), %rcx
movq %rcx, %rdx
addq $-0x1, %rdx
movq %rdx, -0x50(%rbp)
movq -0x8(%rax,%rcx,8), %rax
movq %rax, -0x88(%rbp)
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rdi
movq -0x50(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x48(%rax), %rdx
subq -0x50(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x8, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
cmpq $0x0, -0x88(%rbp)
je 0x8af3
movq -0x50(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x48(%rcx), %rax
jae 0x8af1
movq -0x88(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x70(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x8aba
jmp 0x8af3
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rsi
shlq $0x0, %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x28(%rax)
movq -0x10(%rbp), %rax
movq 0x28(%rax), %rdi
addq -0x58(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rdx
subq -0x58(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl $0x1, %esi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
leaq 0x3bbca7(%rip), %rax    # 0x3c47f8
movl 0xd0(%rax), %eax
movl %eax, -0x8c(%rbp)
leaq 0x3bbc94(%rip), %rax    # 0x3c47f8
movl 0xd4(%rax), %eax
movl %eax, -0x90(%rbp)
movq -0x30(%rbp), %rcx
leaq 0x3bbc7d(%rip), %rdi    # 0x3c47f8
addq $0xd0, %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movl -0x8c(%rbp), %ecx
leaq 0x3bbc4d(%rip), %rax    # 0x3c47f8
addl 0xd0(%rax), %ecx
leaq 0x3bbc40(%rip), %rax    # 0x3c47f8
movl %ecx, 0xd0(%rax)
movq -0x30(%rbp), %rcx
leaq 0x3bbc2f(%rip), %rdi    # 0x3c47f8
addq $0xd4, %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movl -0x90(%rbp), %ecx
leaq 0x3bbbff(%rip), %rax    # 0x3c47f8
addl 0xd4(%rax), %ecx
leaq 0x3bbbf2(%rip), %rax    # 0x3c47f8
movl %ecx, 0xd4(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rdi
movq -0x10(%rbp), %rax
imulq $0x28, 0x50(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x68(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rdi
movq -0x10(%rbp), %rax
imulq $0x28, 0x50(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x70(%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x8d8f
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x1c(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movq $0x0, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
imulq $0x28, -0x70(%rbp), %rcx
addq %rcx, %rax
movq $0x0, 0x10(%rax)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x8c56
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
movq -0x10(%rbp), %rax
imulq $0x18, 0x50(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x78(%rax)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
imulq $0x18, -0x58(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
subq -0x58(%rbp), %rax
imulq $0x18, %rax, %rdx
xorl %esi, %esi
callq 0x2100
movq -0x38(%rbp), %rcx
leaq -0x98(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x22e0
movl %eax, -0x40(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq -0x10(%rbp), %rcx
cmpq 0x50(%rcx), %rax
jae 0x8f28
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
imulq $0x18, -0x70(%rbp), %rax
addq %rax, %rdi
addq $0x10, %rdi
movq -0x38(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
imulq $0x18, -0x70(%rbp), %rax
addq %rax, %rdi
addq $0x11, %rdi
movq -0x38(%rbp), %rcx
movl $0x1, %edx
movq %rdx, %rsi
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rdi
imulq $0x18, -0x70(%rbp), %rax
addq %rax, %rdi
addq $0xc, %rdi
movq -0x38(%rbp), %rcx
movl $0x4, %esi
movl $0x1, %edx
callq 0x22e0
movq %rax, %rcx
movslq -0x40(%rbp), %rax
addq %rcx, %rax
movl %eax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
imulq $0x18, -0x70(%rbp), %rcx
addq %rcx, %rax
cmpl $0x0, 0xc(%rax)
jne 0x8ebe
jmp 0x8f17
movq $0x0, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq -0x10(%rbp), %rcx
movq 0x78(%rcx), %rcx
imulq $0x18, -0x70(%rbp), %rdx
addq %rdx, %rcx
movl 0xc(%rcx), %ecx
cmpq %rcx, %rax
jae 0x8f00
movq -0x38(%rbp), %rsi
leaq -0xc0(%rbp), %rdi
callq 0x81d0
movq -0x80(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x80(%rbp)
jmp 0x8ec6
movq -0x10(%rbp), %rax
movq 0x78(%rax), %rax
imulq $0x18, -0x70(%rbp), %rcx
addq %rcx, %rax
movl $0x0, 0xc(%rax)
movq -0x70(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x70(%rbp)
jmp 0x8dfc
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
movq -0x10(%rbp), %rax
imulq $0x18, 0x50(%rax), %rsi
callq 0x2360
movq %rax, %rcx
movq -0x10(%rbp), %rax
movq %rcx, 0x80(%rax)
movq -0x10(%rbp), %rax
movq 0x80(%rax), %rdi
imulq $0x18, -0x58(%rbp), %rax
addq %rax, %rdi
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rax
subq -0x58(%rbp), %rax
imulq $0x18, %rax, %rdx
xorl %esi, %esi
callq 0x2100
movq -0x30(%rbp), %rdi
callq 0x21a0
movq -0x38(%rbp), %rdi
callq 0x21a0
movq 0x3bb04e(%rip), %rax    # 0x3c3fe0
movq (%rax), %rdi
leaq 0x3784e5(%rip), %rsi    # 0x381481
movb $0x0, %al
callq 0x22a0
movl $0x1, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xd0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)