// File: /workspace/github_c_makefile_star2_O2/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 0xc7c4
movq %rsi, %r14
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x8(%rsi), %rdi
cmpb $0x2d, (%rdi)
jne 0xc647
cmpb $0x0, 0x1(%rdi)
je 0xc780
leaq 0xcd56(%rip), %rsi      # 0x193a4
callq 0x22b0
movq %rax, %rbx
movq 0x10(%r14), %rdi
cmpb $0x2d, (%rdi)
jne 0xc669
cmpb $0x0, 0x1(%rdi)
je 0xc7a2
leaq 0xcd34(%rip), %rsi      # 0x193a4
callq 0x22b0
movq %rax, %r14
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
callq 0xc26c
movq %rax, %r12
movq %r14, 0x18(%rsp)
movq %r14, %rdi
callq 0xc26c
movq %rax, %r15
xorl %ebp, %ebp
movq %rsp, %r13
movq %r12, %rdi
callq 0xc2d8
testl %eax, %eax
js 0xc743
movq %r15, %rdi
callq 0xc2d8
testl %eax, %eax
js 0xc743
andl $0x0, (%rsp)
movl (%r12), %ebx
movq 0x8(%r12), %rbp
cmpl $0x3, %ebx
jb 0xc700
leal -0x2(%rbx), %r14d
cmpb $0x2f, (%rbp,%r14)
jne 0xc700
callq 0x2360
movq (%rax), %rax
leal -0x1(%rbx), %ecx
movsbq (%rbp,%rcx), %rcx
testb $0x8, 0x1(%rax,%rcx,2)
je 0xc700
movl %r14d, (%r12)
movb $0x0, (%rbp,%r14)
movl %r14d, %ebx
andl $0x0, (%r15)
movq %rbp, %rdi
movl %ebx, %esi
movq %r15, %rdx
callq 0xc7e5
movq %r12, %rdi
movq %r13, %rsi
callq 0xc864
movq %r15, %rdi
movq %r13, %rsi
callq 0xc864
movq 0x8(%rsp), %rbp
movq 0x1588d(%rip), %rax     # 0x21fc0
movq (%rax), %rsi
movq %rbp, %rdi
callq 0x2130
jmp 0xc69d
movq %r12, %rdi
callq 0xc298
movq 0x20(%rsp), %rdi
callq 0x2030
movq %r15, %rdi
callq 0xc298
movq 0x18(%rsp), %rdi
callq 0x2030
movq %rbp, %rdi
callq 0x2040
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x15841(%rip), %rax     # 0x21fc8
movq (%rax), %rdi
callq 0x2200
leaq 0xcc0e(%rip), %rsi      # 0x193a4
movl %eax, %edi
callq 0x20c0
jmp 0xc653
movq 0x1581f(%rip), %rax     # 0x21fc8
movq (%rax), %rdi
callq 0x2200
leaq 0xcbec(%rip), %rsi      # 0x193a4
movl %eax, %edi
callq 0x20c0
jmp 0xc675
movq 0x1582d(%rip), %rax     # 0x21ff8
movq (%rax), %rcx
leaq 0xd7df(%rip), %rdi      # 0x19fb4
pushq $0x2a
popq %rsi
pushq $0x1
popq %rdx
callq 0x2310
pushq $0x1
popq %rax
jmp 0xc771