// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpl $0x3, -0x8(%rbp)
jge 0x144f9
movq 0x1eb1c(%rip), %rax     # 0x32ff8
movq (%rax), %rdi
leaq 0x189e2(%rip), %rsi     # 0x2cec8
movb $0x0, %al
callq 0x21d0
movl $0x1, -0x4(%rbp)
jmp 0x14702
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movq $0x0, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x18617(%rip), %rsi     # 0x2cb35
callq 0x21b0
cmpl $0x0, %eax
je 0x14542
movq -0x10(%rbp), %rax
movq 0x8(%rax), %rdi
leaq 0x18964(%rip), %rsi     # 0x2ce9b
callq 0x22c0
movq %rax, -0x48(%rbp)
jmp 0x14563
movq 0x1ea7f(%rip), %rax     # 0x32fc8
movq (%rax), %rdi
callq 0x2210
movl %eax, %edi
leaq 0x18941(%rip), %rsi     # 0x2ce9b
callq 0x20d0
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x185bb(%rip), %rsi     # 0x2cb35
callq 0x21b0
cmpl $0x0, %eax
je 0x1459e
movq -0x10(%rbp), %rax
movq 0x10(%rax), %rdi
leaq 0x18908(%rip), %rsi     # 0x2ce9b
callq 0x22c0
movq %rax, -0x50(%rbp)
jmp 0x145bf
movq 0x1ea23(%rip), %rax     # 0x32fc8
movq (%rax), %rdi
callq 0x2210
movl %eax, %edi
leaq 0x188e5(%rip), %rsi     # 0x2ce9b
callq 0x20d0
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x13c80
movq %rax, -0x30(%rbp)
movq -0x20(%rbp), %rdi
callq 0x13c80
movq %rax, -0x28(%rbp)
movq -0x30(%rbp), %rdi
callq 0x13d30
cmpl $0x0, %eax
jl 0x146ce
movq -0x28(%rbp), %rdi
callq 0x13d30
cmpl $0x0, %eax
jge 0x14606
jmp 0x146ce
movl $0x0, -0x40(%rbp)
movq -0x30(%rbp), %rax
cmpl $0x2, (%rax)
jbe 0x1467b
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rcx
movl (%rcx), %ecx
subl $0x2, %ecx
movl %ecx, %ecx
movsbl (%rax,%rcx), %eax
cmpl $0x2f, %eax
jne 0x1467b
callq 0x2370
movq (%rax), %rax
movq -0x30(%rbp), %rcx
movq 0x8(%rcx), %rcx
movq -0x30(%rbp), %rdx
movl (%rdx), %edx
subl $0x1, %edx
movl %edx, %edx
movsbl (%rcx,%rdx), %ecx
movslq %ecx, %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x800, %eax            # imm = 0x800
cmpl $0x0, %eax
je 0x1467b
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq -0x30(%rbp), %rdx
movl (%rdx), %ecx
subl $0x2, %ecx
movl %ecx, (%rdx)
movl %ecx, %ecx
movb $0x0, (%rax,%rcx)
movq -0x28(%rbp), %rax
movl $0x0, (%rax)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rdi
movq -0x30(%rbp), %rax
movl (%rax), %esi
movq -0x28(%rbp), %rdx
callq 0x14710
movq -0x30(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x14840
movq -0x28(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x14840
movq -0x38(%rbp), %rdi
movq 0x1e8ff(%rip), %rax     # 0x32fc0
movq (%rax), %rsi
callq 0x2150
jmp 0x145e1
movq -0x30(%rbp), %rdi
callq 0x13cc0
movq -0x18(%rbp), %rdi
callq 0x2030
movq -0x28(%rbp), %rdi
callq 0x13cc0
movq -0x20(%rbp), %rdi
callq 0x2030
movq -0x38(%rbp), %rdi
callq 0x2040
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)