// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x38, %rsp
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq 0xae2a(%rip), %rax      # 0xd2a0
movq %rax, 0x18(%rsp)
movq 0xae26(%rip), %rax      # 0xd2a8
movq %rax, 0x10(%rsp)
movq 0xae3a(%rip), %rdi      # 0xd2c8
callq 0x8040
movq 0xae2e(%rip), %rdi      # 0xd2c8
movq 0x28(%rsp), %rdx
xorl %esi, %esi
callq 0x8310
movq 0xae23(%rip), %rax      # 0xd2d0
movq %rax, 0x30(%rsp)
movq 0x20(%rsp), %rax
cmpq 0xad2a(%rip), %rax      # 0xd1e8
jne 0x24df
movq 0xae11(%rip), %rdi      # 0xd2d8
callq 0x8040
movb $0x0, 0xae19(%rip)      # 0xd2ec
movq 0xadfe(%rip), %rdi      # 0xd2d8
callq 0x8080
movq 0x30(%rsp), %rax
movq 0x10(%rax), %rdi
callq 0x2680
movq 0x30(%rsp), %rax
movq 0x20(%rax), %rax
movq %rax, 0xadd3(%rip)      # 0xd2d0
movq 0xadc4(%rip), %rax      # 0xd2c8
movq %rax, 0x8(%rsp)
cmpq $0x0, 0xadbf(%rip)      # 0xd2d0
jne 0x2520
movq $-0x1, %rax
movq %rax, (%rsp)
jmp 0x252e
movq 0xada9(%rip), %rax      # 0xd2d0
movq (%rax), %rax
movq %rax, (%rsp)
movq 0x8(%rsp), %rdi
movq (%rsp), %rdx
xorl %esi, %esi
callq 0x8280
movq 0x28(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x28(%rsp)
movq 0x30(%rsp), %rax
cmpl $0x0, 0x8(%rax)
jne 0x255c
jmp 0x25df
movq 0x30(%rsp), %rax
cmpq $0x0, 0x30(%rax)
jne 0x2577
movq 0x30(%rsp), %rdi
callq 0x2730
jmp 0x2487
movq 0x30(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x30(%rsp), %rax
movslq 0x38(%rax), %rdx
movq 0x18(%rsp), %rcx
movl $0x1, %esi
callq 0x22b0
cmpb $0x0, 0xac39(%rip)      # 0xd1d8
je 0x25c2
movq 0x30(%rsp), %rax
movq 0x40(%rax), %rdi
movq 0x30(%rsp), %rax
movslq 0x48(%rax), %rdx
movq 0x10(%rsp), %rcx
movl $0x1, %esi
callq 0x22b0
movq 0x30(%rsp), %rdi
callq 0x2730
movq 0x20(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x20(%rsp)
jmp 0x2487
movq 0x30(%rsp), %rdi
callq 0x2730
movq 0xad00(%rip), %rdi      # 0xd2f0
callq 0x8040
movq 0xacfc(%rip), %rax      # 0xd2f8
cmpl $0x0, 0x8(%rax)
je 0x2621
movq 0xa9ef(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7d4d(%rip), %rsi      # 0xa360
movb $0x0, %al
callq 0x2150
xorl %edi, %edi
callq 0x22a0
movq 0xacc8(%rip), %rdi      # 0xd2f0
callq 0x8080
movq 0xac94(%rip), %rdi      # 0xd2c8
callq 0x8040
cmpq $0x0, 0xac8f(%rip)      # 0xd2d0
je 0x2662
movq 0xa9ae(%rip), %rax      # 0xcff8
movq (%rax), %rdi
leaq 0x7d0c(%rip), %rsi      # 0xa360
movb $0x0, %al
callq 0x2150
xorl %edi, %edi
callq 0x22a0
movq 0xac5f(%rip), %rdi      # 0xd2c8
xorl %esi, %esi
movq $-0x1, %rdx
callq 0x8280
addq $0x38, %rsp
retq
nopl (%rax)