// File: /workspace/github_cpp_makefile_star2_O3/chhylp123[P]hifiasm/Process_Read.cpp
// Function: malloc_All_reads(All_reads*)
void malloc_All_reads(All_reads* r)
{
	r->read_size = (uint64_t*)malloc(sizeof(uint64_t)*r->total_reads);
	memcpy(r->read_size, r->read_length, sizeof(uint64_t)*r->total_reads);

	r->read_sperate = (uint8_t**)malloc(sizeof(uint8_t*)*r->total_reads);
	if(asm_opt.is_sc) MALLOC(r->rsc, r->total_reads);

	long long i = 0;
	for (i = 0; i < (long long)r->total_reads; i++)
	{
		r->read_sperate[i] = (uint8_t*)malloc(sizeof(uint8_t)*(r->read_length[i]/4+1));
		if(r->rsc) MALLOC(r->rsc[i], (r->read_length[i]/sc_bn) + ((r->read_length[i]%sc_bn)?1:0));
	}

	r->cigars = (Compressed_Cigar_record*)malloc(sizeof(Compressed_Cigar_record)*r->total_reads);
	r->second_round_cigar = (Compressed_Cigar_record*)malloc(sizeof(Compressed_Cigar_record)*r->total_reads);
	r->paf = (ma_hit_t_alloc*)malloc(sizeof(ma_hit_t_alloc)*r->total_reads);
	r->reverse_paf = (ma_hit_t_alloc*)malloc(sizeof(ma_hit_t_alloc)*r->total_reads);
	///r->pb_regions = (kvec_t_u64_warp*)malloc(r->total_reads*sizeof(kvec_t_u64_warp));

	for (i = 0; i < (long long)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;
		init_ma_hit_t_alloc(&(r->paf[i]));
		init_ma_hit_t_alloc(&(r->reverse_paf[i]));
		///kv_init(r->pb_regions[i].a);
	}

	r->name = (char*)malloc(sizeof(char)*r->total_name_length);
	r->N_site = (uint64_t**)calloc(r->total_reads, sizeof(uint64_t*));
	r->trio_flag = (uint8_t*)malloc(r->total_reads*sizeof(uint8_t));
	memset(r->trio_flag, AMBIGU, r->total_reads*sizeof(uint8_t));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x50(%rdi), %r14
leaq (,%r14,8), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x20(%rbx)
movq 0x18(%rbx), %rsi
movq %rax, %rdi
movq %r15, %rdx
callq 0x2160
movq %r15, %rdi
callq 0x2280
movq %rax, 0x10(%rbx)
leaq 0x262b55(%rip), %rax    # 0x295758
cmpq $0x0, 0x2b0(%rax)
je 0x32c19
movq %r15, %rdi
callq 0x2280
movq %rax, 0x30(%rbx)
testq %r14, %r14
jle 0x32c6c
xorl %r12d, %r12d
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
shrq $0x2, %rdi
incq %rdi
callq 0x2280
movq 0x10(%rbx), %rcx
movq %rax, (%rcx,%r12,8)
movq 0x30(%rbx), %r13
testq %r13, %r13
je 0x32c64
movq 0x18(%rbx), %rax
movq (%rax,%r12,8), %rdi
movq %rdi, %rax
shrq %rax
andl $0x1, %edi
addq %rax, %rdi
callq 0x2280
movq %rax, (%r13,%r12,8)
incq %r12
cmpq %r12, %r14
jne 0x32c21
leaq (%r15,%r15,4), %r12
movq %r12, %rdi
callq 0x2280
movq %rax, 0x68(%rbx)
movq %r12, %rdi
callq 0x2280
movq %rax, 0x70(%rbx)
leaq (%r15,%r15,2), %r15
movq %r15, %rdi
callq 0x2280
movq %rax, 0x78(%rbx)
movq %r15, %rdi
callq 0x2280
movq %rax, 0x80(%rbx)
testq %r14, %r14
jle 0x32d2b
movl $0x1c, %r15d
xorl %r12d, %r12d
xorl %r13d, %r13d
xorl %ebp, %ebp
movq 0x68(%rbx), %rax
movl %r12d, -0x10(%rax,%r15)
movq 0x70(%rbx), %rcx
movl %r12d, -0x10(%rcx,%r15)
movl %r12d, -0x14(%rax,%r15)
movl %r12d, -0x14(%rcx,%r15)
movq %r12, -0x1c(%rax,%r15)
movq %r12, -0x1c(%rcx,%r15)
movl %r12d, (%rax,%r15)
movl %r12d, (%rcx,%r15)
movl %r12d, -0x4(%rax,%r15)
movl %r12d, -0x4(%rcx,%r15)
movq %r12, -0xc(%rax,%r15)
movq %r12, -0xc(%rcx,%r15)
movq 0x78(%rbx), %rdi
addq %r13, %rdi
callq 0xa0c35
movq 0x80(%rbx), %rdi
addq %r13, %rdi
callq 0xa0c35
incq %rbp
movq 0x50(%rbx), %r14
addq $0x18, %r13
addq $0x28, %r15
cmpq %r14, %rbp
jl 0x32cba
movq 0x60(%rbx), %rdi
callq 0x2280
movq %rax, 0x8(%rbx)
movl $0x8, %esi
movq %r14, %rdi
callq 0x2120
movq %rax, (%rbx)
movl $0x1, %edi
movq %r14, %rsi
callq 0x2120
movq %rax, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq