// File: /workspace/github_c_makefile_star2_O2/annoroad[P]fqtools_plus/fqtools.c
// Function: writen
void writen(void){
	struct job* job = NULL;
	long seq = 0;
	long clean_seq = 0;
	FILE* fpout1 = g.fpout1;
	FILE* fpout2 = g.fpout2;
	for(;;){
		possess(write_first);
		wait_for(write_first,TO_BE,seq);
		job = write_head;
		if (clean_seq == g.QUOTA) {
			possess(in_pool.have);
			in_pool.term = 0;
			release(in_pool.have);
		}
		drop_space(job->in);
		write_head = job->next;
		twist(write_first,TO,write_head == NULL? -1:write_head->seq);
		
		seq++;
		if (!job->more) break;
		if (job->buffer1 == NULL){
			free_job(job);
			continue;
		}

		fwrite(job->buffer1,sizeof(char),job->l1,fpout1);
		if (g.single_or_pair) fwrite(job->buffer2,sizeof(char),job->l2,fpout2);
		free_job(job);
		clean_seq++;
	}

	free_job(job);

	possess(compress_have);
	if (compress_head->more != 0)
		fail();
	release(compress_have);
	possess(write_first);
	if (write_head != NULL)
		fail();
	twist(write_first,TO,-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x7e1f(%rip), %rax      # 0xa290
movq %rax, 0x10(%rsp)
movq 0x7e1b(%rip), %rax      # 0xa298
movq %rax, 0x8(%rsp)
xorl %ebp, %ebp
pushq $-0x1
popq %r15
pushq $0x1
popq %r13
xorl %r12d, %r12d
movq 0x7e22(%rip), %rdi      # 0xa2b8
callq 0x5ccb
movq 0x7e16(%rip), %rdi      # 0xa2b8
xorl %esi, %esi
movq %r12, %rbx
movq %r12, %rdx
callq 0x5ea2
movq 0x7e0a(%rip), %r14      # 0xa2c0
cmpq 0x7d1b(%rip), %rbp      # 0xa1d8
jne 0x24de
movq 0x7e02(%rip), %rdi      # 0xa2c8
callq 0x5ccb
movb $0x0, 0x7e0a(%rip)      # 0xa2dc
movq 0x7def(%rip), %rdi      # 0xa2c8
callq 0x5cfa
movq 0x10(%r14), %r12
testq %r12, %r12
je 0x2541
movq (%r12), %rdi
callq 0x5ccb
movq (%r12), %rdi
callq 0x6099
cmpl $0x1, %eax
jne 0x2532
movq %rbp, %r13
movq 0x18(%r12), %rbp
movq (%rbp), %rdi
callq 0x5ccb
movq 0x8(%rbp), %rax
movq %rax, 0x10(%r12)
movq %r12, 0x8(%rbp)
movq (%rbp), %rdi
pushq $0x1
popq %rdx
movq %r13, %rbp
pushq $0x1
popq %r13
movl %r13d, %esi
callq 0x5e4d
movq (%r12), %rdi
movl %r13d, %esi
movq %r15, %rdx
callq 0x5e4d
movq 0x20(%r14), %rax
movq %rax, 0x7d74(%rip)      # 0xa2c0
movq 0x7d65(%rip), %rdi      # 0xa2b8
movq %r15, %rdx
testq %rax, %rax
je 0x255e
movq (%rax), %rdx
xorl %esi, %esi
callq 0x5e4d
cmpl $0x0, 0x8(%r14)
je 0x25ca
movq %rbx, %r12
movq 0x30(%r14), %rdi
testq %rdi, %rdi
jne 0x2588
movq %r14, %rdi
callq 0x264f
incq %r12
jmp 0x248f
movslq 0x38(%r14), %rdx
pushq $0x1
popq %rsi
movq 0x10(%rsp), %rcx
callq 0x22c0
cmpb $0x0, 0x7c28(%rip)      # 0xa1c8
je 0x25b7
movq 0x40(%r14), %rdi
movslq 0x48(%r14), %rdx
pushq $0x1
popq %rsi
movq 0x8(%rsp), %rcx
callq 0x22c0
incq %r12
movq %r14, %rdi
callq 0x264f
incq %rbp
jmp 0x248f
movq %r14, %rdi
callq 0x264f
movq 0x7d07(%rip), %rdi      # 0xa2e0
callq 0x5ccb
movq 0x7d03(%rip), %rax      # 0xa2e8
cmpl $0x0, 0x8(%rax)
jne 0x262c
movq 0x7cee(%rip), %rdi      # 0xa2e0
callq 0x5cfa
movq 0x7cba(%rip), %rdi      # 0xa2b8
callq 0x5ccb
cmpq $0x0, 0x7cb5(%rip)      # 0xa2c0
jne 0x262c
movq 0x7ca4(%rip), %rdi      # 0xa2b8
pushq $-0x1
popq %rdx
xorl %esi, %esi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5e4d
movq 0x79c5(%rip), %rax      # 0x9ff8
movq (%rax), %rcx
leaq 0x4a13(%rip), %rdi      # 0x7050
pushq $0x6
popq %rsi
pushq $0x1
popq %rdx
callq 0x22c0
xorl %edi, %edi
callq 0x22b0