// File: karel-brinda[P]ococo/ext/htslib/cram/cram_encode.c
// Function: cram_encode_slice_read
static int cram_encode_slice_read(cram_fd *fd,
				  cram_container *c,
				  cram_block_compression_hdr *h,
				  cram_slice *s,
				  cram_record *cr,
				  int *last_pos) {
    int r = 0;
    int32_t i32;
    unsigned char uc;

    //fprintf(stderr, "Encode seq %d, %d/%d FN=%d, %s\n", rec, core->byte, core->bit, cr->nfeature, s->name_ds->str + cr->name);

    //printf("BF=0x%x\n", cr->flags);
    //	    bf = cram_flag_swap[cr->flags];
    i32 = fd->cram_flag_swap[cr->flags & 0xfff];
    r |= h->codecs[DS_BF]->encode(s, h->codecs[DS_BF], (char *)&i32, 1);

    i32 = cr->cram_flags & CRAM_FLAG_MASK;
    r |= h->codecs[DS_CF]->encode(s, h->codecs[DS_CF], (char *)&i32, 1);

    if (CRAM_MAJOR_VERS(fd->version) != 1 && s->hdr->ref_seq_id == -2)
	r |= h->codecs[DS_RI]->encode(s, h->codecs[DS_RI], (char *)&cr->ref_id, 1);

    r |= h->codecs[DS_RL]->encode(s, h->codecs[DS_RL], (char *)&cr->len, 1);

    if (c->pos_sorted) {
	i32 = cr->apos - *last_pos;
	r |= h->codecs[DS_AP]->encode(s, h->codecs[DS_AP], (char *)&i32, 1);
	*last_pos = cr->apos;
    } else {
	i32 = cr->apos;
	r |= h->codecs[DS_AP]->encode(s, h->codecs[DS_AP], (char *)&i32, 1);
    }

    r |= h->codecs[DS_RG]->encode(s, h->codecs[DS_RG], (char *)&cr->rg, 1);

    if (cr->cram_flags & CRAM_FLAG_DETACHED) {
	i32 = cr->mate_flags;
	r |= h->codecs[DS_MF]->encode(s, h->codecs[DS_MF], (char *)&i32, 1);

	r |= h->codecs[DS_NS]->encode(s, h->codecs[DS_NS],
				      (char *)&cr->mate_ref_id, 1);

	r |= h->codecs[DS_NP]->encode(s, h->codecs[DS_NP],
				      (char *)&cr->mate_pos, 1);

	r |= h->codecs[DS_TS]->encode(s, h->codecs[DS_TS],
				      (char *)&cr->tlen, 1);
    } else if (cr->cram_flags & CRAM_FLAG_MATE_DOWNSTREAM) {
	r |= h->codecs[DS_NF]->encode(s, h->codecs[DS_NF],
				      (char *)&cr->mate_line, 1);
    }

    /* Aux tags */
    if (CRAM_MAJOR_VERS(fd->version) == 1) {
	int j;
	uc = cr->ntags;
	r |= h->codecs[DS_TC]->encode(s, h->codecs[DS_TC], (char *)&uc, 1);

	for (j = 0; j < cr->ntags; j++) {
	    uint32_t i32 = s->TN[cr->TN_idx + j]; // id
	    r |= h->codecs[DS_TN]->encode(s, h->codecs[DS_TN], (char *)&i32, 1);
	}
    } else {
	r |= h->codecs[DS_TL]->encode(s, h->codecs[DS_TL], (char *)&cr->TL, 1);
    }

    // qual
    // QS codec : Already stored in block[2].

    // features (diffs)
    if (!(cr->flags & BAM_FUNMAP)) {
	int prev_pos = 0, j;

	r |= h->codecs[DS_FN]->encode(s, h->codecs[DS_FN],
				      (char *)&cr->nfeature, 1);
	for (j = 0; j < cr->nfeature; j++) {
	    cram_feature *f = &s->features[cr->feature + j];

	    uc = f->X.code;
	    r |= h->codecs[DS_FC]->encode(s, h->codecs[DS_FC], (char *)&uc, 1);
	    i32 = f->X.pos - prev_pos;
	    r |= h->codecs[DS_FP]->encode(s, h->codecs[DS_FP], (char *)&i32, 1);
	    prev_pos = f->X.pos;

	    switch(f->X.code) {
		//char *seq;

	    case 'X':
		//fprintf(stderr, "    FC=%c FP=%d base=%d\n", f->X.code, i32, f->X.base);
		
		uc = f->X.base;
		r |= h->codecs[DS_BS]->encode(s, h->codecs[DS_BS],
					      (char *)&uc, 1);
		break;
	    case 'S':
		// Already done
//		r |= h->codecs[DS_SC]->encode(s, h->codecs[DS_SC],
//					      BLOCK_DATA(s->soft_blk) + f->S.seq_idx,
//					      f->S.len);

//		if (IS_CRAM_3_VERS(fd)) {
//		    r |= h->codecs[DS_BB]->encode(s, h->codecs[DS_BB], 
//						  BLOCK_DATA(s->seqs_blk) + f->S.seq_idx,
//						  f->S.len);
//		}
		break;
	    case 'I':
		//seq = DSTRING_STR(s->seqs_ds) + f->S.seq_idx;
		//r |= h->codecs[DS_IN]->encode(s, h->codecs[DS_IN],
		//			     seq, f->S.len);
//		if (IS_CRAM_3_VERS(fd)) {
//		    r |= h->codecs[DS_BB]->encode(s, h->codecs[DS_BB], 
//						  BLOCK_DATA(s->seqs_blk) + f->I.seq_idx,
//						  f->I.len);
//		}
		break;
	    case 'i':
		uc = f->i.base;
		r |= h->codecs[DS_BA]->encode(s, h->codecs[DS_BA],
					      (char *)&uc, 1);
		//seq = DSTRING_STR(s->seqs_ds) + f->S.seq_idx;
		//r |= h->codecs[DS_IN]->encode(s, h->codecs[DS_IN], 
		//			     seq, 1);
		break;
	    case 'D':
		i32 = f->D.len;
		r |= h->codecs[DS_DL]->encode(s, h->codecs[DS_DL],
					      (char *)&i32, 1);
		break;

	    case 'B':
		//		    // Used when we try to store a non ACGTN base or an N
		//		    // that aligns against a non ACGTN reference

		uc  = f->B.base;
		r |= h->codecs[DS_BA]->encode(s, h->codecs[DS_BA],
					      (char *)&uc, 1);

		//                  Already added
		//		    uc  = f->B.qual;
		//		    r |= h->codecs[DS_QS]->encode(s, h->codecs[DS_QS], 
		//					     (char *)&uc, 1);
		break;

	    case 'b':
		// string of bases
		r |= h->codecs[DS_BB]->encode(s, h->codecs[DS_BB], 
					      (char *)BLOCK_DATA(s->seqs_blk)
					              + f->b.seq_idx,
					      f->b.len);
		break;

	    case 'Q':
		//                  Already added
		//		    uc  = f->B.qual;
		//		    r |= h->codecs[DS_QS]->encode(s, h->codecs[DS_QS], 
		//					     (char *)&uc, 1);
		break;

	    case 'N':
		i32 = f->N.len;
		r |= h->codecs[DS_RS]->encode(s, h->codecs[DS_RS],
					      (char *)&i32, 1);
		break;
		    
	    case 'P':
		i32 = f->P.len;
		r |= h->codecs[DS_PD]->encode(s, h->codecs[DS_PD],
					      (char *)&i32, 1);
		break;
		    
	    case 'H':
		i32 = f->H.len;
		r |= h->codecs[DS_HC]->encode(s, h->codecs[DS_HC],
					      (char *)&i32, 1);
		break;
		    

	    default:
		fprintf(stderr, "unhandled feature code %c\n",
			f->X.code);
		return -1;
	    }
	}

	r |= h->codecs[DS_MQ]->encode(s, h->codecs[DS_MQ],
				      (char *)&cr->mqual, 1);
    } else {
	char *seq = (char *)BLOCK_DATA(s->seqs_blk) + cr->seq;
	if (cr->len)
	    r |= h->codecs[DS_BA]->encode(s, h->codecs[DS_BA], seq, cr->len);
    }

    return r ? -1 : 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movq -0x30(%rbp), %rcx
movl 0xc(%rcx), %ecx
andl $0xfff, %ecx            # imm = 0xFFF
movslq %ecx, %rcx
movl 0x4234(%rax,%rcx,4), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x2f8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x2f8(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
andl $0xf, %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x300(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x300(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
je 0x3b482
movq -0x28(%rbp), %rax
movq (%rax), %rax
cmpl $-0x2, 0x4(%rax)
jne 0x3b482
movq -0x20(%rbp), %rax
movq 0x388(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x388(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x8, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x348(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x348(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x14, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x18(%rbp), %rax
cmpl $0x0, 0x88(%rax)
je 0x3b510
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movq -0x38(%rbp), %rcx
subl (%rcx), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x308(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x308(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0x18(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, (%rax)
jmp 0x3b549
movq -0x30(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x308(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x308(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x310(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x310(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x1c, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x2, %eax
cmpl $0x0, %eax
je 0x3b663
movq -0x30(%rbp), %rax
movl 0x6c(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x328(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x328(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x320(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x320(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x2c, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x338(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x338(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x30, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x20(%rbp), %rax
movq 0x330(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x330(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x34, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3b6a7
movq -0x30(%rbp), %rax
movl 0x10(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
je 0x3b6a5
movq -0x20(%rbp), %rax
movq 0x340(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x340(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x28, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3b6a7
movq -0x10(%rbp), %rax
movl 0xc(%rax), %eax
sarl $0x8, %eax
cmpl $0x1, %eax
jne 0x3b75d
movq -0x30(%rbp), %rax
movl 0x38(%rax), %eax
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rax
movq 0x3e0(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x3e0(%rcx), %rsi
leaq -0x41(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x38(%rcx), %eax
jge 0x3b75b
movq -0x28(%rbp), %rax
movq 0x50(%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x44(%rcx), %ecx
addl -0x48(%rbp), %ecx
movslq %ecx, %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x4c(%rbp)
movq -0x20(%rbp), %rax
movq 0x3b8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x3b8(%rcx), %rsi
leaq -0x4c(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3b6fa
jmp 0x3b790
movq -0x20(%rbp), %rax
movq 0x380(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x380(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x48, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movq -0x30(%rbp), %rax
movl 0xc(%rax), %eax
andl $0x4, %eax
cmpl $0x0, %eax
jne 0x3bb29
movl $0x0, -0x50(%rbp)
movq -0x20(%rbp), %rax
movq 0x350(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x350(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x68, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
movl $0x0, -0x54(%rbp)
movl -0x54(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x68(%rcx), %eax
jge 0x3baf4
movq -0x28(%rbp), %rax
movq 0x40(%rax), %rax
movq -0x30(%rbp), %rcx
movl 0x64(%rcx), %ecx
movl -0x54(%rbp), %edx
addl %edx, %ecx
movslq %ecx, %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movb 0x4(%rax), %al
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rax
movq 0x358(%rax), %rsi
movq 0x20(%rsi), %rax
movq -0x28(%rbp), %rdi
leaq -0x41(%rbp), %rdx
movl $0x1, %ecx
movl %ecx, -0x74(%rbp)
callq *%rax
movl -0x74(%rbp), %ecx
movl %eax, %edx
movl -0x3c(%rbp), %eax
orl %edx, %eax
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl (%rax), %eax
movl -0x50(%rbp), %edx
subl %edx, %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x360(%rax), %rsi
movq 0x20(%rsi), %rax
movq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rdx
callq *%rax
movl %eax, %ecx
movl -0x3c(%rbp), %eax
orl %ecx, %eax
movl %eax, -0x3c(%rbp)
movq -0x60(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x50(%rbp)
movq -0x60(%rbp), %rax
movl 0x4(%rax), %eax
addl $-0x42, %eax
movl %eax, %ecx
movq %rcx, -0x70(%rbp)
subl $0x27, %eax
ja 0x3bab9
movq -0x70(%rbp), %rax
leaq 0x406e4(%rip), %rcx     # 0x7bf90
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rax
movq 0x378(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x378(%rcx), %rsi
leaq -0x41(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
jmp 0x3bae4
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rax
movq 0x370(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x370(%rcx), %rsi
leaq -0x41(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x368(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x368(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movb %al, -0x41(%rbp)
movq -0x20(%rbp), %rax
movq 0x370(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x370(%rcx), %rsi
leaq -0x41(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq -0x20(%rbp), %rax
movq 0x3a8(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x3a8(%rcx), %rsi
movq -0x28(%rbp), %rcx
movq 0x68(%rcx), %rcx
movq 0x20(%rcx), %rdx
movq -0x60(%rbp), %rcx
movslq 0x8(%rcx), %rcx
addq %rcx, %rdx
movq -0x60(%rbp), %rcx
movl 0xc(%rcx), %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x390(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x390(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x398(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x398(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x40(%rbp)
movq -0x20(%rbp), %rax
movq 0x3a0(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x3a0(%rcx), %rsi
leaq -0x40(%rbp), %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bae4
movq 0x4e510(%rip), %rax     # 0x89fd0
movq (%rax), %rdi
movq -0x60(%rbp), %rax
movl 0x4(%rax), %edx
leaq 0x40b9a(%rip), %rsi     # 0x7c66b
movb $0x0, %al
callq 0x4830
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
jmp 0x3bb94
jmp 0x3bae6
movl -0x54(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x54(%rbp)
jmp 0x3b7e4
movq -0x20(%rbp), %rax
movq 0x318(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x318(%rcx), %rsi
movq -0x30(%rbp), %rdx
addq $0x60, %rdx
movl $0x1, %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bb81
movq -0x28(%rbp), %rax
movq 0x68(%rax), %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movslq 0x4c(%rcx), %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x0, 0x14(%rax)
je 0x3bb7f
movq -0x20(%rbp), %rax
movq 0x370(%rax), %rax
movq 0x20(%rax), %rax
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rcx
movq 0x370(%rcx), %rsi
movq -0x68(%rbp), %rdx
movq -0x30(%rbp), %rcx
movl 0x14(%rcx), %ecx
callq *%rax
orl -0x3c(%rbp), %eax
movl %eax, -0x3c(%rbp)
jmp 0x3bb81
movl -0x3c(%rbp), %edx
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq