// File: /workspace/github_c_makefile_star2_O3/lh3[P]fermi2/seq.c
// Function: main_interleave
int main_interleave(int argc, char *argv[])
{
	gzFile fp1, fp2;
	kseq_t *seq[2];
	kstring_t str;

	if (argc < 3) {
		fprintf(stderr, "Usage: fermi interleave <in1.fq> <in2.fq>\n");
		return 1;
	}
	str.l = str.m = 0; str.s = 0;
	fp1 = strcmp(argv[1], "-")? gzopen(argv[1], "r") : gzdopen(fileno(stdin), "r");
	fp2 = strcmp(argv[2], "-")? gzopen(argv[2], "r") : gzdopen(fileno(stdin), "r");
	seq[0] = kseq_init(fp1);
	seq[1] = kseq_init(fp2);
	while (kseq_read(seq[0]) >= 0) {
		if (kseq_read(seq[1]) < 0) break; // one file ends
		str.l = 0;
		if (seq[0]->name.l > 2 && seq[0]->name.s[seq[0]->name.l-2] == '/' && isdigit(seq[0]->name.s[seq[0]->name.l-1]))
			seq[0]->name.s[(seq[0]->name.l -= 2)] = 0; // trim tailing "/[0-9]$"
		seq[1]->name.l = 0;
		kputsn(seq[0]->name.s, seq[0]->name.l, &seq[1]->name); // make sure two ends having the same name
		write_seq(seq[0], &str);
		write_seq(seq[1], &str);
		fputs(str.s, stdout);
	}
	kseq_destroy(seq[0]); gzclose(fp1);
	kseq_destroy(seq[1]); gzclose(fp2);
	free(str.s);
	return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
cmpl $0x2, %edi
jle 0xe57f
movq %rsi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0xe392
cmpb $0x0, 0x1(%rdi)
je 0xe53b
leaq 0xf023(%rip), %rsi      # 0x1d3bc
callq 0x22b0
movq %rax, %rbx
movq 0x10(%r14), %rdi
cmpb $0x2d, (%rdi)
jne 0xe3b4
cmpb $0x0, 0x1(%rdi)
je 0xe55d
leaq 0xf001(%rip), %rsi      # 0x1d3bc
callq 0x22b0
movq %rax, %r14
movq %rbx, %rdi
callq 0xde96
movq %rax, %r13
movq %r14, %rdi
callq 0xde96
movq %rax, %r12
movq %r13, %rdi
callq 0xdf28
testl %eax, %eax
movq %rbx, 0x20(%rsp)
movq %r14, 0x18(%rsp)
js 0xe4fb
movq %r12, %rdi
callq 0xdf28
testl %eax, %eax
js 0xe4fb
movq %rsp, %rbp
movl $0x0, (%rsp)
movl (%r13), %r14d
movq 0x8(%r13), %r15
cmpl $0x3, %r14d
jb 0xe44a
leal -0x2(%r14), %ebx
cmpb $0x2f, (%r15,%rbx)
jne 0xe44a
callq 0x2360
movq (%rax), %rax
leal -0x1(%r14), %ecx
movsbq (%r15,%rcx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0xe44a
movl %ebx, (%r13)
movb $0x0, (%r15,%rbx)
movl %ebx, %r14d
leal 0x1(%r14), %eax
cmpl 0x4(%r12), %eax
jae 0xe45c
movq 0x8(%r12), %rbx
jmp 0xe497
movl %eax, %ecx
shrl %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x2, %eax
orl %ecx, %eax
movl %eax, %ecx
shrl $0x4, %ecx
orl %eax, %ecx
movl %ecx, %eax
shrl $0x8, %eax
orl %ecx, %eax
movl %eax, %esi
shrl $0x10, %esi
orl %eax, %esi
incl %esi
movl %esi, 0x4(%r12)
movq 0x8(%r12), %rdi
callq 0x2260
movq %rax, %rbx
movq %rax, 0x8(%r12)
movslq %r14d, %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21f0
movl %r14d, (%r12)
movl %r14d, %eax
movb $0x0, (%rbx,%rax)
movq %r13, %rdi
movq %rbp, %rsi
callq 0xe58b
movq %r12, %rdi
movq %rbp, %rsi
callq 0xe58b
movq 0x8(%rsp), %r15
movq 0x16aee(%rip), %rax     # 0x24fc0
movq (%rax), %rsi
movq %r15, %rdi
callq 0x2130
movq %r13, %rdi
callq 0xdf28
testl %eax, %eax
js 0xe4fe
movq %r12, %rdi
callq 0xdf28
testl %eax, %eax
jns 0xe406
jmp 0xe4fe
xorl %r15d, %r15d
movq %r13, %rdi
callq 0xdee8
movq 0x20(%rsp), %rdi
callq 0x2030
movq %r12, %rdi
callq 0xdee8
movq 0x18(%rsp), %rdi
callq 0x2030
movq %r15, %rdi
callq 0x2040
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x16a86(%rip), %rax     # 0x24fc8
movq (%rax), %rdi
callq 0x2200
leaq 0xee6b(%rip), %rsi      # 0x1d3bc
movl %eax, %edi
callq 0x20c0
jmp 0xe39e
movq 0x16a64(%rip), %rax     # 0x24fc8
movq (%rax), %rdi
callq 0x2200
leaq 0xee49(%rip), %rsi      # 0x1d3bc
movl %eax, %edi
callq 0x20c0
jmp 0xe3c0
callq 0x2c91
movl $0x1, %eax
jmp 0xe52c