// File: /workspace/github_c_makefile_star2_O0/lh3[P]minimap2/format.c
// Function: mm_write_sam3
void mm_write_sam3(kstring_t *s, const mm_idx_t *mi, const mm_bseq1_t *t, int seg_idx, int reg_idx, int n_seg, const int *n_regss, const mm_reg1_t *const* regss, void *km, int64_t opt_flag, int rep_len)
{
	const int max_bam_cigar_op = 65535;
	int flag, n_regs = n_regss[seg_idx], cigar_in_tag = 0;
	int this_rid = -1, this_pos = -1;
	const mm_reg1_t *regs = regss[seg_idx], *r_prev = NULL, *r_next;
	const mm_reg1_t *r = n_regs > 0 && reg_idx < n_regs && reg_idx >= 0? &regs[reg_idx] : NULL;

	// find the primary of the previous and the next segments, if they are mapped
	if (n_seg > 1) {
		int i, next_sid = (seg_idx + 1) % n_seg;
		r_next = get_sam_pri(n_regss[next_sid], regss[next_sid]);
		if (n_seg > 2) {
			for (i = 1; i <= n_seg - 1; ++i) {
				int prev_sid = (seg_idx + n_seg - i) % n_seg;
				if (n_regss[prev_sid] > 0) {
					r_prev = get_sam_pri(n_regss[prev_sid], regss[prev_sid]);
					break;
				}
			}
		} else r_prev = r_next;
	} else r_prev = r_next = NULL;

	// write QNAME
	s->l = 0;
	mm_sprintf_lite(s, "%s", t->name);
	if (n_seg > 1) s->l = mm_qname_len(t->name); // trim the suffix like /1 or /2

	// write flag
	flag = n_seg > 1? 0x1 : 0x0;
	if (r == 0) {
		flag |= 0x4;
	} else {
		if (r->rev) flag |= 0x10;
		if (r->parent != r->id) flag |= 0x100;
		else if (!r->sam_pri) flag |= 0x800;
	}
	if (n_seg > 1) {
		if (r && r->proper_frag) flag |= 0x2; // TODO: this doesn't work when there are more than 2 segments
		if (seg_idx == 0) flag |= 0x40;
		else if (seg_idx == n_seg - 1) flag |= 0x80;
		if (r_next == NULL) flag |= 0x8;
		else if (r_next->rev) flag |= 0x20;
	}
	mm_sprintf_lite(s, "\t%d", flag);

	// write coordinate, MAPQ and CIGAR
	if (r == 0) {
		if (r_prev) {
			this_rid = r_prev->rid, this_pos = r_prev->rs;
			mm_sprintf_lite(s, "\t%s\t%d\t0\t*", mi->seq[this_rid].name, this_pos+1);
		} else mm_sprintf_lite(s, "\t*\t0\t0\t*");
	} else {
		this_rid = r->rid, this_pos = r->rs;
		mm_sprintf_lite(s, "\t%s\t%d\t%d\t", mi->seq[r->rid].name, r->rs+1, r->mapq);
		if ((opt_flag & MM_F_LONG_CIGAR) && r->p && r->p->n_cigar > max_bam_cigar_op - 2) {
			int n_cigar = r->p->n_cigar;
			if (r->qs != 0) ++n_cigar;
			if (r->qe != t->l_seq) ++n_cigar;
			if (n_cigar > max_bam_cigar_op)
				cigar_in_tag = 1;
		}
		if (cigar_in_tag) {
			int slen;
			if ((flag & 0x900) == 0 || (opt_flag & MM_F_SOFTCLIP)) slen = t->l_seq;
			else if ((flag & 0x100) && !(opt_flag & MM_F_SECONDARY_SEQ)) slen = 0;
			else slen = r->qe - r->qs;
			mm_sprintf_lite(s, "%dS%dN", slen, r->re - r->rs);
		} else write_sam_cigar(s, flag, 0, t->l_seq, r, opt_flag);
	}

	// write mate positions
	if (n_seg > 1) {
		int tlen = 0;
		if (this_rid >= 0 && r_next) {
			if (this_rid == r_next->rid) {
				if (r) {
					int this_pos5 = r->rev? r->re - 1 : this_pos;
					int next_pos5 = r_next->rev? r_next->re - 1 : r_next->rs;
					tlen = next_pos5 - this_pos5;
				}
				mm_sprintf_lite(s, "\t=\t");
			} else mm_sprintf_lite(s, "\t%s\t", mi->seq[r_next->rid].name);
			mm_sprintf_lite(s, "%d\t", r_next->rs + 1);
		} else if (r_next) { // && this_rid < 0
			mm_sprintf_lite(s, "\t%s\t%d\t", mi->seq[r_next->rid].name, r_next->rs + 1);
		} else if (this_rid >= 0) { // && r_next == NULL
			mm_sprintf_lite(s, "\t=\t%d\t", this_pos + 1); // next segment will take r's coordinate
		} else mm_sprintf_lite(s, "\t*\t0\t"); // neither has coordinates
		if (tlen > 0) ++tlen;
		else if (tlen < 0) --tlen;
		mm_sprintf_lite(s, "%d\t", tlen);
	} else mm_sprintf_lite(s, "\t*\t0\t0\t");

	// write SEQ and QUAL
	if (r == 0) {
		sam_write_sq(s, t->seq, t->l_seq, 0, 0);
		mm_sprintf_lite(s, "\t");
		if (t->qual) sam_write_sq(s, t->qual, t->l_seq, 0, 0);
		else mm_sprintf_lite(s, "*");
	} else {
		if ((flag & 0x900) == 0 || (opt_flag & MM_F_SOFTCLIP)) {
			sam_write_sq(s, t->seq, t->l_seq, r->rev, r->rev);
			mm_sprintf_lite(s, "\t");
			if (t->qual) sam_write_sq(s, t->qual, t->l_seq, r->rev, 0);
			else mm_sprintf_lite(s, "*");
		} else if ((flag & 0x100) && !(opt_flag & MM_F_SECONDARY_SEQ)){
			mm_sprintf_lite(s, "*\t*");
		} else {
			sam_write_sq(s, t->seq + r->qs, r->qe - r->qs, r->rev, r->rev);
			mm_sprintf_lite(s, "\t");
			if (t->qual) sam_write_sq(s, t->qual + r->qs, r->qe - r->qs, r->rev, 0);
			else mm_sprintf_lite(s, "*");
		}
	}

	// write tags
	if (mm_rg_id[0]) mm_sprintf_lite(s, "\tRG:Z:%s", mm_rg_id);
	if (n_seg > 2) mm_sprintf_lite(s, "\tFI:i:%d", seg_idx);
	if (r) {
		write_tags(s, r);
		if (r->parent == r->id && r->p && n_regs > 1 && regs && r >= regs && r - regs < n_regs) { // supplementary aln may exist
			int i, n_sa = 0; // n_sa: number of SA fields
			for (i = 0; i < n_regs; ++i)
				if (i != r - regs && regs[i].parent == regs[i].id && regs[i].p)
					++n_sa;
			if (n_sa > 0) {
				mm_sprintf_lite(s, "\tSA:Z:");
				for (i = 0; i < n_regs; ++i) {
					const mm_reg1_t *q = &regs[i];
					int l_M, l_I = 0, l_D = 0, clip5 = 0, clip3 = 0;
					if (r == q || q->parent != q->id || q->p == 0) continue;
					if (q->qe - q->qs < q->re - q->rs) l_M = q->qe - q->qs, l_D = (q->re - q->rs) - l_M;
					else l_M = q->re - q->rs, l_I = (q->qe - q->qs) - l_M;
					clip5 = q->rev? t->l_seq - q->qe : q->qs;
					clip3 = q->rev? q->qs : t->l_seq - q->qe;
					mm_sprintf_lite(s, "%s,%d,%c,", mi->seq[q->rid].name, q->rs+1, "+-"[q->rev]);
					if (clip5) mm_sprintf_lite(s, "%dS", clip5);
					if (l_M) mm_sprintf_lite(s, "%dM", l_M);
					if (l_I) mm_sprintf_lite(s, "%dI", l_I);
					if (l_D) mm_sprintf_lite(s, "%dD", l_D);
					if (clip3) mm_sprintf_lite(s, "%dS", clip3);
					mm_sprintf_lite(s, ",%d,%d;", q->mapq, q->blen - q->mlen + q->p->n_ambi);
				}
			}
		}
		if (r->p && (opt_flag & (MM_F_OUT_CS|MM_F_OUT_DS|MM_F_OUT_MD)))
			write_cs_ds_or_MD(km, s, mi, t, r, !(opt_flag&MM_F_OUT_CS_LONG), opt_flag&MM_F_OUT_MD, !!(opt_flag&MM_F_OUT_DS), 1, 0);
		if (cigar_in_tag)
			write_sam_cigar(s, flag, 1, t->l_seq, r, opt_flag);
	}
	if (rep_len >= 0) mm_sprintf_lite(s, "\trl:i:%d", rep_len);

	if ((opt_flag & MM_F_COPY_COMMENT) && t->comment)
		mm_sprintf_lite(s, "\t%s", t->comment);

	s->s[s->l] = 0; // we always have room for an extra byte (see str_enlarge)
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movl 0x30(%rbp), %eax
movq 0x28(%rbp), %rax
movq 0x20(%rbp), %rax
movq 0x18(%rbp), %rax
movq 0x10(%rbp), %rax
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl %r8d, -0x20(%rbp)
movl %r9d, -0x24(%rbp)
movl $0xffff, -0x28(%rbp)    # imm = 0xFFFF
movq 0x10(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movl (%rax,%rcx,4), %eax
movl %eax, -0x30(%rbp)
movl $0x0, -0x34(%rbp)
movl $0xffffffff, -0x38(%rbp) # imm = 0xFFFFFFFF
movl $0xffffffff, -0x3c(%rbp) # imm = 0xFFFFFFFF
movq 0x18(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movq %rax, -0x48(%rbp)
movq $0x0, -0x50(%rbp)
cmpl $0x0, -0x30(%rbp)
jle 0x15d03
movl -0x20(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x15d03
cmpl $0x0, -0x20(%rbp)
jl 0x15d03
movq -0x48(%rbp), %rax
movslq -0x20(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
jmp 0x15d0e
xorl %eax, %eax
movq %rax, -0xb0(%rbp)
jmp 0x15d0e
movq -0xb0(%rbp), %rax
movq %rax, -0x60(%rbp)
cmpl $0x1, -0x24(%rbp)
jle 0x15dc3
movl -0x1c(%rbp), %eax
addl $0x1, %eax
cltd
idivl -0x24(%rbp)
movl %edx, -0x68(%rbp)
movq 0x10(%rbp), %rax
movslq -0x68(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq 0x18(%rbp), %rax
movslq -0x68(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x16b00
movq %rax, -0x58(%rbp)
cmpl $0x2, -0x24(%rbp)
jle 0x15db9
movl $0x1, -0x64(%rbp)
movl -0x64(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jg 0x15db7
movl -0x1c(%rbp), %eax
addl -0x24(%rbp), %eax
subl -0x64(%rbp), %eax
cltd
idivl -0x24(%rbp)
movl %edx, -0x6c(%rbp)
movq 0x10(%rbp), %rax
movslq -0x6c(%rbp), %rcx
cmpl $0x0, (%rax,%rcx,4)
jle 0x15daa
movq 0x10(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movl (%rax,%rcx,4), %edi
movq 0x18(%rbp), %rax
movslq -0x6c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
callq 0x16b00
movq %rax, -0x50(%rbp)
jmp 0x15db7
jmp 0x15dac
movl -0x64(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x64(%rbp)
jmp 0x15d5d
jmp 0x15dc1
movq -0x58(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x15dd3
movq $0x0, -0x58(%rbp)
movq $0x0, -0x50(%rbp)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdx
leaq 0x418f0(%rip), %rsi     # 0x576e1
movb $0x0, %al
callq 0x144f0
cmpl $0x1, -0x24(%rbp)
jle 0x15e15
movq -0x18(%rbp), %rax
movq 0x8(%rax), %rdi
callq 0x16ba0
movslq %eax, %rcx
movq -0x8(%rbp), %rax
movq %rcx, (%rax)
movl -0x24(%rbp), %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x1, %edx
cmovgl %ecx, %eax
movl %eax, -0x2c(%rbp)
cmpq $0x0, -0x60(%rbp)
jne 0x15e3a
movl -0x2c(%rbp), %eax
orl $0x4, %eax
movl %eax, -0x2c(%rbp)
jmp 0x15e92
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15e55
movl -0x2c(%rbp), %eax
orl $0x10, %eax
movl %eax, -0x2c(%rbp)
movq -0x60(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl (%rcx), %eax
je 0x15e71
movl -0x2c(%rbp), %eax
orl $0x100, %eax            # imm = 0x100
movl %eax, -0x2c(%rbp)
jmp 0x15e90
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xc, %eax
andl $0x1, %eax
cmpl $0x0, %eax
jne 0x15e8e
movl -0x2c(%rbp), %eax
orl $0x800, %eax            # imm = 0x800
movl %eax, -0x2c(%rbp)
jmp 0x15e90
jmp 0x15e92
cmpl $0x1, -0x24(%rbp)
jle 0x15f16
cmpq $0x0, -0x60(%rbp)
je 0x15eba
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xd, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15eba
movl -0x2c(%rbp), %eax
orl $0x2, %eax
movl %eax, -0x2c(%rbp)
cmpl $0x0, -0x1c(%rbp)
jne 0x15ecb
movl -0x2c(%rbp), %eax
orl $0x40, %eax
movl %eax, -0x2c(%rbp)
jmp 0x15ee5
movl -0x1c(%rbp), %eax
movl -0x24(%rbp), %ecx
subl $0x1, %ecx
cmpl %ecx, %eax
jne 0x15ee3
movl -0x2c(%rbp), %eax
orl $0x80, %eax
movl %eax, -0x2c(%rbp)
jmp 0x15ee5
cmpq $0x0, -0x58(%rbp)
jne 0x15ef7
movl -0x2c(%rbp), %eax
orl $0x8, %eax
movl %eax, -0x2c(%rbp)
jmp 0x15f14
movq -0x58(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x15f12
movl -0x2c(%rbp), %eax
orl $0x20, %eax
movl %eax, -0x2c(%rbp)
jmp 0x15f14
jmp 0x15f16
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %edx
leaq 0x417a1(%rip), %rsi     # 0x576c5
movb $0x0, %al
callq 0x144f0
cmpq $0x0, -0x60(%rbp)
jne 0x15f94
cmpq $0x0, -0x50(%rbp)
je 0x15f7d
movq -0x50(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x50(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movslq -0x38(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movl -0x3c(%rbp), %ecx
addl $0x1, %ecx
leaq 0x41770(%rip), %rsi     # 0x576e4
movb $0x0, %al
callq 0x144f0
jmp 0x15f8f
movq -0x8(%rbp), %rdi
leaq 0x41767(%rip), %rsi     # 0x576ef
movb $0x0, %al
callq 0x144f0
jmp 0x16116
movq -0x60(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x38(%rbp)
movq -0x60(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x3c(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x60(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x60(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %r8d
andl $0xff, %r8d
leaq 0x41712(%rip), %rsi     # 0x576f8
movb $0x0, %al
callq 0x144f0
movq 0x28(%rbp), %rax
andq $0x10000, %rax          # imm = 0x10000
cmpq $0x0, %rax
je 0x16064
movq -0x60(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x16064
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
cmpl $0xfffd, 0x18(%rax)     # imm = 0xFFFD
jbe 0x16064
movq -0x60(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x18(%rax), %eax
movl %eax, -0x70(%rbp)
movq -0x60(%rbp), %rax
cmpl $0x0, 0x10(%rax)
je 0x1603a
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
movq -0x60(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x18(%rbp), %rcx
cmpl (%rcx), %eax
je 0x16052
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
cmpl $0xffff, -0x70(%rbp)    # imm = 0xFFFF
jle 0x16062
movl $0x1, -0x34(%rbp)
jmp 0x16064
cmpl $0x0, -0x34(%rbp)
je 0x160f8
movl -0x2c(%rbp), %eax
andl $0x900, %eax            # imm = 0x900
cmpl $0x0, %eax
je 0x1608b
movq 0x28(%rbp), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
je 0x16096
movq -0x18(%rbp), %rax
movl (%rax), %eax
movl %eax, -0x74(%rbp)
jmp 0x160d3
movl -0x2c(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x160c0
movabsq $0x1000000000, %rax     # imm = 0x1000000000
andq 0x28(%rbp), %rax
cmpq $0x0, %rax
jne 0x160c0
movl $0x0, -0x74(%rbp)
jmp 0x160d1
movq -0x60(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x60(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x74(%rbp)
jmp 0x160d3
movq -0x8(%rbp), %rdi
movl -0x74(%rbp), %edx
movq -0x60(%rbp), %rax
movl 0x1c(%rax), %ecx
movq -0x60(%rbp), %rax
subl 0x18(%rax), %ecx
leaq 0x41614(%rip), %rsi     # 0x57703
movb $0x0, %al
callq 0x144f0
jmp 0x16114
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x60(%rbp), %r8
movq 0x28(%rbp), %r9
xorl %edx, %edx
callq 0x16c20
jmp 0x16116
cmpl $0x1, -0x24(%rbp)
jle 0x162d8
movl $0x0, -0x78(%rbp)
cmpl $0x0, -0x38(%rbp)
jl 0x1622a
cmpq $0x0, -0x58(%rbp)
je 0x1622a
movl -0x38(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jne 0x161e0
cmpq $0x0, -0x60(%rbp)
je 0x161cc
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x16177
movq -0x60(%rbp), %rax
movl 0x1c(%rax), %eax
subl $0x1, %eax
movl %eax, -0xb4(%rbp)
jmp 0x16180
movl -0x3c(%rbp), %eax
movl %eax, -0xb4(%rbp)
movl -0xb4(%rbp), %eax
movl %eax, -0x7c(%rbp)
movq -0x58(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x161ad
movq -0x58(%rbp), %rax
movl 0x1c(%rax), %eax
subl $0x1, %eax
movl %eax, -0xb8(%rbp)
jmp 0x161ba
movq -0x58(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0xb8(%rbp)
movl -0xb8(%rbp), %eax
movl %eax, -0x80(%rbp)
movl -0x80(%rbp), %eax
subl -0x7c(%rbp), %eax
movl %eax, -0x78(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x41533(%rip), %rsi     # 0x5770a
movb $0x0, %al
callq 0x144f0
jmp 0x1620c
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
leaq 0x41509(%rip), %rsi     # 0x5770e
movb $0x0, %al
callq 0x144f0
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movl 0x18(%rax), %edx
addl $0x1, %edx
leaq 0x414fd(%rip), %rsi     # 0x5771e
movb $0x0, %al
callq 0x144f0
jmp 0x1629f
cmpq $0x0, -0x58(%rbp)
je 0x16269
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x58(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x58(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
leaq 0x414b3(%rip), %rsi     # 0x57713
movb $0x0, %al
callq 0x144f0
jmp 0x1629d
cmpl $0x0, -0x38(%rbp)
jl 0x16289
movq -0x8(%rbp), %rdi
movl -0x3c(%rbp), %edx
addl $0x1, %edx
leaq 0x4149b(%rip), %rsi     # 0x5771b
movb $0x0, %al
callq 0x144f0
jmp 0x1629b
movq -0x8(%rbp), %rdi
leaq 0x4148e(%rip), %rsi     # 0x57722
movb $0x0, %al
callq 0x144f0
jmp 0x1629d
jmp 0x1629f
cmpl $0x0, -0x78(%rbp)
jle 0x162b0
movl -0x78(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x162c1
cmpl $0x0, -0x78(%rbp)
jge 0x162bf
movl -0x78(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x78(%rbp)
jmp 0x162c1
movq -0x8(%rbp), %rdi
movl -0x78(%rbp), %edx
leaq 0x4144f(%rip), %rsi     # 0x5771e
movb $0x0, %al
callq 0x144f0
jmp 0x162ea
movq -0x8(%rbp), %rdi
leaq 0x41445(%rip), %rsi     # 0x57728
movb $0x0, %al
callq 0x144f0
cmpq $0x0, -0x60(%rbp)
jne 0x16361
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x16f10
movq -0x8(%rbp), %rdi
leaq 0x4140d(%rip), %rsi     # 0x57726
movb $0x0, %al
callq 0x144f0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1634a
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
xorl %r8d, %r8d
movl %r8d, %ecx
callq 0x16f10
jmp 0x1635c
movq -0x8(%rbp), %rdi
leaq 0x413dd(%rip), %rsi     # 0x57732
movb $0x0, %al
callq 0x144f0
jmp 0x16503
movl -0x2c(%rbp), %eax
andl $0x900, %eax            # imm = 0x900
cmpl $0x0, %eax
je 0x16382
movq 0x28(%rbp), %rax
andq $0x80000, %rax          # imm = 0x80000
cmpq $0x0, %rax
je 0x16413
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %ecx
shrl $0xa, %ecx
andl $0x1, %ecx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %r8d
shrl $0xa, %r8d
andl $0x1, %r8d
callq 0x16f10
movq -0x8(%rbp), %rdi
leaq 0x41365(%rip), %rsi     # 0x57726
movb $0x0, %al
callq 0x144f0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x163fc
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x18(%rbp), %rax
movl (%rax), %edx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %ecx
shrl $0xa, %ecx
andl $0x1, %ecx
xorl %r8d, %r8d
callq 0x16f10
jmp 0x1640e
movq -0x8(%rbp), %rdi
leaq 0x4132b(%rip), %rsi     # 0x57732
movb $0x0, %al
callq 0x144f0
jmp 0x16501
movl -0x2c(%rbp), %eax
andl $0x100, %eax            # imm = 0x100
cmpl $0x0, %eax
je 0x1644b
movabsq $0x1000000000, %rax     # imm = 0x1000000000
andq 0x28(%rbp), %rax
cmpq $0x0, %rax
jne 0x1644b
movq -0x8(%rbp), %rdi
leaq 0x412f1(%rip), %rsi     # 0x57730
movb $0x0, %al
callq 0x144f0
jmp 0x164ff
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x60(%rbp), %rax
movslq 0x10(%rax), %rax
addq %rax, %rsi
movq -0x60(%rbp), %rax
movl 0x14(%rax), %edx
movq -0x60(%rbp), %rax
subl 0x10(%rax), %edx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %ecx
shrl $0xa, %ecx
andl $0x1, %ecx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %r8d
shrl $0xa, %r8d
andl $0x1, %r8d
callq 0x16f10
movq -0x8(%rbp), %rdi
leaq 0x41289(%rip), %rsi     # 0x57726
movb $0x0, %al
callq 0x144f0
movq -0x18(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0x164eb
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x18(%rax), %rsi
movq -0x60(%rbp), %rax
movslq 0x10(%rax), %rax
addq %rax, %rsi
movq -0x60(%rbp), %rax
movl 0x14(%rax), %edx
movq -0x60(%rbp), %rax
subl 0x10(%rax), %edx
movq -0x60(%rbp), %rax
movl 0x3c(%rax), %ecx
shrl $0xa, %ecx
andl $0x1, %ecx
xorl %r8d, %r8d
callq 0x16f10
jmp 0x164fd
movq -0x8(%rbp), %rdi
leaq 0x4123c(%rip), %rsi     # 0x57732
movb $0x0, %al
callq 0x144f0
jmp 0x164ff
jmp 0x16501
jmp 0x16503
cmpb $0x0, 0x48446(%rip)     # 0x5e950
je 0x16525
movq -0x8(%rbp), %rdi
leaq 0x4121d(%rip), %rsi     # 0x57734
leaq 0x48432(%rip), %rdx     # 0x5e950
movb $0x0, %al
callq 0x144f0
cmpl $0x2, -0x24(%rbp)
jle 0x16540
movq -0x8(%rbp), %rdi
movl -0x1c(%rbp), %edx
leaq 0x41204(%rip), %rsi     # 0x5773d
movb $0x0, %al
callq 0x144f0
cmpq $0x0, -0x60(%rbp)
je 0x16a85
movq -0x8(%rbp), %rdi
movq -0x60(%rbp), %rsi
callq 0x158f0
movq -0x60(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x60(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x169c3
movq -0x60(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x169c3
cmpl $0x1, -0x30(%rbp)
jle 0x169c3
cmpq $0x0, -0x48(%rbp)
je 0x169c3
movq -0x60(%rbp), %rax
cmpq -0x48(%rbp), %rax
jb 0x169c3
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl $0x50, %ecx
cqto
idivq %rcx
movslq -0x30(%rbp), %rcx
cmpq %rcx, %rax
jge 0x169c3
movl $0x0, -0x88(%rbp)
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x1667d
movslq -0x84(%rbp), %rax
movq %rax, -0xc0(%rbp)
movq -0x60(%rbp), %rax
movq -0x48(%rbp), %rcx
subq %rcx, %rax
movl $0x50, %ecx
cqto
idivq %rcx
movq %rax, %rcx
movq -0xc0(%rbp), %rax
cmpq %rcx, %rax
je 0x16667
movq -0x48(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movl 0x20(%rax), %eax
movq -0x48(%rbp), %rcx
movslq -0x84(%rbp), %rdx
imulq $0x50, %rdx, %rdx
addq %rdx, %rcx
cmpl (%rcx), %eax
jne 0x16667
movq -0x48(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
cmpq $0x0, 0x48(%rax)
je 0x16667
movl -0x88(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x88(%rbp)
jmp 0x16669
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x165d3
cmpl $0x0, -0x88(%rbp)
jle 0x169c1
movq -0x8(%rbp), %rdi
leaq 0x410b1(%rip), %rsi     # 0x57746
movb $0x0, %al
callq 0x144f0
movl $0x0, -0x84(%rbp)
movl -0x84(%rbp), %eax
cmpl -0x30(%rbp), %eax
jge 0x169bf
movq -0x48(%rbp), %rax
movslq -0x84(%rbp), %rcx
imulq $0x50, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movl $0x0, -0x98(%rbp)
movl $0x0, -0x9c(%rbp)
movl $0x0, -0xa0(%rbp)
movl $0x0, -0xa4(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x90(%rbp), %rax
je 0x16726
movq -0x90(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x90(%rbp), %rcx
cmpl (%rcx), %eax
jne 0x16726
movq -0x90(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0x1672b
jmp 0x169ab
movq -0x90(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x10(%rcx), %eax
movq -0x90(%rbp), %rcx
movl 0x1c(%rcx), %ecx
movq -0x90(%rbp), %rdx
subl 0x18(%rdx), %ecx
cmpl %ecx, %eax
jge 0x16793
movq -0x90(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x10(%rcx), %eax
movl %eax, -0x94(%rbp)
movq -0x90(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x18(%rcx), %eax
subl -0x94(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0x167cd
movq -0x90(%rbp), %rax
movl 0x1c(%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x18(%rcx), %eax
movl %eax, -0x94(%rbp)
movq -0x90(%rbp), %rax
movl 0x14(%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x10(%rcx), %eax
subl -0x94(%rbp), %eax
movl %eax, -0x98(%rbp)
movq -0x90(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x167fa
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0xc4(%rbp)
jmp 0x1680a
movq -0x90(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xc4(%rbp)
movl -0xc4(%rbp), %eax
movl %eax, -0xa0(%rbp)
movq -0x90(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
cmpl $0x0, %eax
je 0x1683d
movq -0x90(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0xc8(%rbp)
jmp 0x16853
movq -0x18(%rbp), %rax
movl (%rax), %eax
movq -0x90(%rbp), %rcx
subl 0x14(%rcx), %eax
movl %eax, -0xc8(%rbp)
movl -0xc8(%rbp), %eax
movl %eax, -0xa4(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movq 0x20(%rax), %rax
movq -0x90(%rbp), %rcx
movslq 0x8(%rcx), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdx
movq -0x90(%rbp), %rax
movl 0x18(%rax), %ecx
addl $0x1, %ecx
movq -0x90(%rbp), %rax
movl 0x3c(%rax), %eax
shrl $0xa, %eax
andl $0x1, %eax
movl %eax, %eax
movl %eax, %esi
leaq 0x40ae9(%rip), %rax     # 0x57391
movsbl (%rax,%rsi), %r8d
leaq 0x40e99(%rip), %rsi     # 0x5774d
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0xa0(%rbp)
je 0x168dc
movq -0x8(%rbp), %rdi
movl -0xa0(%rbp), %edx
leaq 0x40e82(%rip), %rsi     # 0x57757
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0x94(%rbp)
je 0x168fd
movq -0x8(%rbp), %rdi
movl -0x94(%rbp), %edx
leaq 0x40e65(%rip), %rsi     # 0x5775b
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0x98(%rbp)
je 0x1691e
movq -0x8(%rbp), %rdi
movl -0x98(%rbp), %edx
leaq 0x40e48(%rip), %rsi     # 0x5775f
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0x9c(%rbp)
je 0x1693f
movq -0x8(%rbp), %rdi
movl -0x9c(%rbp), %edx
leaq 0x40e2b(%rip), %rsi     # 0x57763
movb $0x0, %al
callq 0x144f0
cmpl $0x0, -0xa4(%rbp)
je 0x16960
movq -0x8(%rbp), %rdi
movl -0xa4(%rbp), %edx
leaq 0x40dfe(%rip), %rsi     # 0x57757
movb $0x0, %al
callq 0x144f0
movq -0x8(%rbp), %rdi
movq -0x90(%rbp), %rax
movl 0x3c(%rax), %edx
andl $0xff, %edx
movq -0x90(%rbp), %rax
movl 0x30(%rax), %ecx
movq -0x90(%rbp), %rax
subl 0x2c(%rax), %ecx
movq -0x90(%rbp), %rax
movq 0x48(%rax), %rax
movl 0x14(%rax), %eax
andl $0x3fffffff, %eax       # imm = 0x3FFFFFFF
addl %eax, %ecx
leaq 0x40dc3(%rip), %rsi     # 0x57767
movb $0x0, %al
callq 0x144f0
movl -0x84(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x84(%rbp)
jmp 0x166a6
jmp 0x169c1
jmp 0x169c3
movq -0x60(%rbp), %rax
cmpq $0x0, 0x48(%rax)
je 0x16a5e
movabsq $0x2001000040, %rax     # imm = 0x2001000040
andq 0x28(%rbp), %rax
cmpq $0x0, %rax
je 0x16a5e
movq 0x20(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x10(%rbp), %rdx
movq -0x18(%rbp), %rcx
movq -0x60(%rbp), %r8
movq 0x28(%rbp), %rax
andq $0x800, %rax            # imm = 0x800
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %r9d
movq 0x28(%rbp), %rax
andq $0x1000000, %rax        # imm = 0x1000000
movl %eax, %r10d
movabsq $0x2000000000, %rax     # imm = 0x2000000000
andq 0x28(%rbp), %rax
cmpq $0x0, %rax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
xorl %r11d, %r11d
movl %r10d, (%rsp)
movl %eax, 0x8(%rsp)
movl $0x1, 0x10(%rsp)
movl $0x0, 0x18(%rsp)
callq 0x150f0
cmpl $0x0, -0x34(%rbp)
je 0x16a83
movq -0x8(%rbp), %rdi
movl -0x2c(%rbp), %esi
movq -0x18(%rbp), %rax
movl (%rax), %ecx
movq -0x60(%rbp), %r8
movq 0x28(%rbp), %r9
movl $0x1, %edx
callq 0x16c20
jmp 0x16a85
cmpl $0x0, 0x30(%rbp)
jl 0x16aa0
movq -0x8(%rbp), %rdi
movl 0x30(%rbp), %edx
leaq 0x40c12(%rip), %rsi     # 0x576ab
movb $0x0, %al
callq 0x144f0
movq 0x28(%rbp), %rax
andq $0x2000000, %rax        # imm = 0x2000000
cmpq $0x0, %rax
je 0x16ad5
movq -0x18(%rbp), %rax
cmpq $0x0, 0x20(%rax)
je 0x16ad5
movq -0x8(%rbp), %rdi
movq -0x18(%rbp), %rax
movq 0x20(%rax), %rdx
leaq 0x40c12(%rip), %rsi     # 0x576e0
movb $0x0, %al
callq 0x144f0
movq -0x8(%rbp), %rax
movq 0x10(%rax), %rax
movq -0x8(%rbp), %rcx
movq (%rcx), %rcx
movb $0x0, (%rax,%rcx)
addq $0xf0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)