// File: ys1998[P]spsim/src/writer.cpp
// Function: Writer::flush(int)
void Writer::flush(int id){
	if(in1->valid()){
		auto inp = in1->read();
		auto iRead = std::get<0>(inp);
		auto inp1 = std::get<1>(inp);
		if(iRead.get_id() < id){
			in1->write(std::make_tuple(iRead, inp1));
		}
	}
	if(in3->valid()){
		auto inp = in3->read();
		auto iRead = std::get<0>(inp);
		auto inp1 = std::get<1>(inp);
		if(iRead.get_id() < id){
			in3->write(std::make_tuple(iRead, inp1));
		}
	}
	if(in2->valid()){
		auto inp = in2->read();
		auto iRead = std::get<0>(inp);
		auto inp1 = std::get<1>(inp);
		auto inp2 = std::get<2>(inp);
		if(iRead.get_id() < id){
			in2->write(std::make_tuple(iRead, inp1, inp2 ));
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x8(%rbp)
movl %esi, -0xc(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x4a0(%rbp)
movq 0x188(%rax), %rdi
callq 0x6420
testb $0x1, %al
jne 0x20f62
jmp 0x210aa
movq -0x4a0(%rbp), %rax
movq 0x188(%rax), %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x4a8(%rbp)
callq 0x12500
movq -0x4a8(%rbp), %rdi
callq 0x12590
movq %rax, %rsi
leaq -0x108(%rbp), %rdi
callq 0x6c70
jmp 0x20fa0
leaq -0x90(%rbp), %rdi
callq 0x12540
movl (%rax), %eax
movl %eax, -0x118(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x6270
movl %eax, -0x4ac(%rbp)
jmp 0x20fc8
movl -0x4ac(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x21073
movq -0x4a0(%rbp), %rax
movq 0x188(%rax), %rax
movq %rax, -0x4b8(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x108(%rbp), %rsi
leaq -0x118(%rbp), %rdx
callq 0x6470
jmp 0x21008
movq -0x4b8(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x6440
jmp 0x2101d
leaq -0x198(%rbp), %rdi
callq 0x64b0
jmp 0x21073
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x21099
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x2108d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x64b0
jmp 0x2108d
leaq -0x108(%rbp), %rdi
callq 0x61d0
leaq -0x90(%rbp), %rdi
callq 0x64b0
jmp 0x210aa
leaq -0x108(%rbp), %rdi
callq 0x61d0
leaq -0x90(%rbp), %rdi
callq 0x64b0
jmp 0x2139a
movq -0x4a0(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x6420
testb $0x1, %al
jne 0x210c6
jmp 0x2120e
movq -0x4a0(%rbp), %rax
movq 0x190(%rax), %rsi
leaq -0x218(%rbp), %rdi
movq %rdi, -0x4c0(%rbp)
callq 0x12500
movq -0x4c0(%rbp), %rdi
callq 0x12590
movq %rax, %rsi
leaq -0x290(%rbp), %rdi
callq 0x6c70
jmp 0x21104
leaq -0x218(%rbp), %rdi
callq 0x12540
movl (%rax), %eax
movl %eax, -0x294(%rbp)
leaq -0x290(%rbp), %rdi
callq 0x6270
movl %eax, -0x4c4(%rbp)
jmp 0x2112c
movl -0x4c4(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x211d7
movq -0x4a0(%rbp), %rax
movq 0x190(%rax), %rax
movq %rax, -0x4d0(%rbp)
leaq -0x318(%rbp), %rdi
leaq -0x290(%rbp), %rsi
leaq -0x294(%rbp), %rdx
callq 0x6470
jmp 0x2116c
movq -0x4d0(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x6440
jmp 0x21181
leaq -0x318(%rbp), %rdi
callq 0x64b0
jmp 0x211d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x211fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x211f1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x64b0
jmp 0x211f1
leaq -0x290(%rbp), %rdi
callq 0x61d0
leaq -0x218(%rbp), %rdi
callq 0x64b0
jmp 0x2120e
leaq -0x290(%rbp), %rdi
callq 0x61d0
leaq -0x218(%rbp), %rdi
callq 0x64b0
jmp 0x2139a
movq -0x4a0(%rbp), %rax
movq 0x198(%rax), %rdi
callq 0x6310
testb $0x1, %al
jne 0x2122a
jmp 0x21391
movq -0x4a0(%rbp), %rax
movq 0x198(%rax), %rsi
leaq -0x398(%rbp), %rdi
movq %rdi, -0x4d8(%rbp)
callq 0x62b0
movq -0x4d8(%rbp), %rdi
callq 0x6360
movq %rax, %rsi
leaq -0x410(%rbp), %rdi
callq 0x6c70
jmp 0x21268
leaq -0x398(%rbp), %rdi
movq %rdi, -0x4e8(%rbp)
callq 0x63e0
movq -0x4e8(%rbp), %rdi
movl (%rax), %eax
movl %eax, -0x414(%rbp)
callq 0x6400
movl (%rax), %eax
movl %eax, -0x418(%rbp)
leaq -0x410(%rbp), %rdi
callq 0x6270
movl %eax, -0x4dc(%rbp)
jmp 0x212ab
movl -0x4dc(%rbp), %eax
cmpl -0xc(%rbp), %eax
jge 0x2135d
movq -0x4a0(%rbp), %rax
movq 0x198(%rax), %rax
movq %rax, -0x4f0(%rbp)
leaq -0x498(%rbp), %rdi
leaq -0x410(%rbp), %rsi
leaq -0x414(%rbp), %rdx
leaq -0x418(%rbp), %rcx
callq 0x6500
jmp 0x212f2
movq -0x4f0(%rbp), %rdi
leaq -0x498(%rbp), %rsi
callq 0x6330
jmp 0x21307
leaq -0x498(%rbp), %rdi
callq 0x62f0
jmp 0x2135d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x21383
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
jmp 0x21377
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x110(%rbp)
movl %eax, -0x114(%rbp)
leaq -0x498(%rbp), %rdi
callq 0x62f0
jmp 0x21377
leaq -0x410(%rbp), %rdi
callq 0x61d0
leaq -0x398(%rbp), %rdi
callq 0x62f0
jmp 0x21391
leaq -0x410(%rbp), %rdi
callq 0x61d0
leaq -0x398(%rbp), %rdi
callq 0x62f0
jmp 0x2139a
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
movq -0x110(%rbp), %rdi
callq 0x3480
nopw %cs:(%rax,%rax)