// File: chhylp123[P]hifiasm/Process_Read.cpp
// Function: produce_u_seq(char*, ma_utg_t*, UC_Read*)
void produce_u_seq(char* r, ma_utg_t *u, UC_Read *buf)
{
	if(u->m == 0 || u->n == 0) return;
	uint32_t j, k, l = 0;
    uint32_t rId, ori, start, eLen, readLen;
	char *readS = NULL;
	memset(r, 'N', u->len);
	for (j = 0; j < u->n; ++j) {
		rId = u->a[j]>>33;
		///uId = i;
		ori = u->a[j]>>32&1;
		start = l;
		eLen = (uint32_t)u->a[j];
		l += eLen;

		if(eLen == 0) continue;
		recover_UC_Read(buf, &R_INF, rId);

		readS = buf->seq;
		readLen = Get_READ_LENGTH(R_INF, rId);
		
		if (!ori) // forward strand
		{
			for (k = 0; k < eLen; k++)
			{
				r[start + k] = readS[k];
			}
		}
		else
		{
			for (k = 0; k < eLen; k++)
			{
				uint8_t c = (uint8_t)readS[readLen - 1 - k];
				r[start + k] = c >= 128? 'N' : RC_CHAR(c);
			}
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x10(%rbp), %rax
cmpl $0x0, 0xc(%rax)
je 0x121e8
movq -0x10(%rbp), %rax
cmpl $0x0, 0x10(%rax)
jne 0x121ed
jmp 0x12381
movl $0x0, -0x24(%rbp)
movq $0x0, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl (%rax), %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
movl %eax, %eax
movl %eax, %edx
movl $0x4e, %esi
callq 0x2100
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jae 0x12381
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x21, %rax
movl %eax, -0x28(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
shrq $0x20, %rax
andq $0x1, %rax
movl %eax, -0x2c(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq 0x18(%rax), %rax
movl -0x1c(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x34(%rbp)
movl -0x34(%rbp), %eax
addl -0x24(%rbp), %eax
movl %eax, -0x24(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x1228c
jmp 0x12373
movq -0x18(%rbp), %rdi
movl -0x28(%rbp), %eax
movl %eax, %edx
leaq 0x3b3034(%rip), %rsi    # 0x3c52d0
callq 0xa380
movq -0x18(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
leaq 0x3b301d(%rip), %rax    # 0x3c52d0
movq 0x18(%rax), %rax
movl -0x28(%rbp), %ecx
movq (%rax,%rcx,8), %rax
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x2c(%rbp)
jne 0x122fc
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x122fa
movq -0x40(%rbp), %rax
movl -0x20(%rbp), %ecx
movb (%rax,%rcx), %dl
movq -0x8(%rbp), %rax
movl -0x30(%rbp), %ecx
addl -0x20(%rbp), %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x122ce
jmp 0x12371
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
cmpl -0x34(%rbp), %eax
jae 0x1236f
movq -0x40(%rbp), %rax
movl -0x38(%rbp), %ecx
subl $0x1, %ecx
subl -0x20(%rbp), %ecx
movl %ecx, %ecx
movb (%rax,%rcx), %al
movb %al, -0x41(%rbp)
movzbl -0x41(%rbp), %eax
cmpl $0x80, %eax
jl 0x12332
movb $0x4e, %al
movb %al, -0x42(%rbp)
jmp 0x12352
movzbl -0x41(%rbp), %eax
movl %eax, %ecx
leaq 0x3b2311(%rip), %rax    # 0x3c4650
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x3b2409(%rip), %rax    # 0x3c4755
movb (%rax,%rcx), %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %dl
movq -0x8(%rbp), %rax
movl -0x30(%rbp), %ecx
addl -0x20(%rbp), %ecx
movl %ecx, %ecx
movb %dl, (%rax,%rcx)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x12303
jmp 0x12371
jmp 0x12373
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x12220
addq $0x50, %rsp
popq %rbp
retq
nopw (%rax,%rax)