// File: /workspace/github_c_makefile_star2_O2/luixmao[P]verilog/design.cpp
// Function: Design::dump(std::ostream&)
void Design::dump(ostream &os){
  //module
  os<< "module "<< desname <<"(";
  for(unsigned int i=0; i!=pis.size(); i++){
    os << pis[i] ; 
    if(i!=pis.size()-1 || pos.size()!=0 ){
      os<<",";
    }
  }
  for(unsigned int i=0; i!=pos.size(); i++){
    os << pos[i] ;   
    if(i!=pos.size()-1){
      os<<",";
    }
  }
  os <<"); "<<endl;


  // dump inputs
  for(unsigned int i=0; i!=pis.size(); i++){
    os<< " input " << pis[i] <<";" <<endl; 
  }

  //dump outputs
  for(unsigned int i=0; i!=pos.size(); i++){
    os<< " output " << pos[i] <<";" <<endl; 
  }


  //dump nets
  vector<Net *>* ptr_nets= getWireNets();  
  for(unsigned i =0 ; i!=ptr_nets->size(); i++){
    os << " wire " << ((*ptr_nets)[i])->name() << ';'<<endl;
  }

  //dump gates
  map<string, Gate *>::iterator it_gate;
  for(it_gate=designGates.begin() ; it_gate!=designGates.end(); it_gate++){
    (it_gate->second)->dump(os);
  }

  //dump endmodule
  os<< "endmodule"<<endl;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x3533(%rip), %rsi      # 0x82c9
movq %rbx, %rdi
callq 0x3190
movq %rax, %rdi
movq %r14, %rsi
callq 0x3180
leaq 0x3370(%rip), %rsi      # 0x8120
movq %rax, %rdi
callq 0x3190
xorl %r12d, %r12d
leaq 0x3360(%rip), %r15      # 0x8122
movl %r12d, %r12d
movq 0x80(%r14), %rsi
movq 0x88(%r14), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
je 0x4e2b
movq %r12, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0x3180
movq 0x88(%r14), %rax
subq 0x80(%r14), %rax
sarq $0x5, %rax
decq %rax
cmpq %r12, %rax
jne 0x4e1b
movq 0xa0(%r14), %rax
cmpq 0x98(%r14), %rax
je 0x4e26
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3190
incl %r12d
jmp 0x4dc2
xorl %r12d, %r12d
leaq 0x32ed(%rip), %r15      # 0x8122
movl %r12d, %r12d
movq 0x98(%r14), %rsi
movq 0xa0(%r14), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
je 0x4e8e
movq %r12, %rax
shlq $0x5, %rax
addq %rax, %rsi
movq %rbx, %rdi
callq 0x3180
movq 0xa0(%r14), %rax
subq 0x98(%r14), %rax
sarq $0x5, %rax
decq %rax
cmpq %r12, %rax
je 0x4e89
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3190
incl %r12d
jmp 0x4e35
leaq 0x328f(%rip), %rsi      # 0x8124
movq %rbx, %rdi
callq 0x3190
movq %rax, %rdi
callq 0x30e0
xorl %eax, %eax
leaq 0x327a(%rip), %r15      # 0x8128
leaq 0x3206(%rip), %r12      # 0x80bb
movl %eax, %r13d
movq 0x88(%r14), %rax
subq 0x80(%r14), %rax
sarq $0x5, %rax
cmpq %r13, %rax
je 0x4f09
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3190
movq %r13, %rsi
shlq $0x5, %rsi
addq 0x80(%r14), %rsi
movq %rax, %rdi
callq 0x3180
movq %rax, %rdi
movq %r12, %rsi
callq 0x3190
movq %rax, %rdi
callq 0x30e0
leal 0x1(%r13), %eax
jmp 0x4eb5
xorl %eax, %eax
leaq 0x321e(%rip), %r15      # 0x8130
leaq 0x31a2(%rip), %r12      # 0x80bb
movl %eax, %r13d
movq 0xa0(%r14), %rax
subq 0x98(%r14), %rax
sarq $0x5, %rax
cmpq %r13, %rax
je 0x4f6d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3190
movq %r13, %rsi
shlq $0x5, %rsi
addq 0x98(%r14), %rsi
movq %rax, %rdi
callq 0x3180
movq %rax, %rdi
movq %r12, %rsi
callq 0x3190
movq %rax, %rdi
callq 0x30e0
leal 0x1(%r13), %eax
jmp 0x4f19
movq %r14, -0x30(%rbp)
movq 0xc0(%r14), %r14
xorl %r12d, %r12d
movl %r12d, %r12d
movq 0x8(%r14), %rax
subq (%r14), %rax
sarq $0x3, %rax
cmpq %r12, %rax
je 0x4fe5
movq %rbx, %r13
movq %rbx, %rdi
leaq 0x319e(%rip), %rsi      # 0x8139
callq 0x3190
movq %rax, %r15
movq (%r14), %rax
movq (%rax,%r12,8), %rsi
leaq -0x50(%rbp), %rbx
movq %rbx, %rdi
callq 0x3616
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3180
movq %rax, %rdi
pushq $0x3b
popq %rsi
callq 0x31f0
movq %rax, %rdi
callq 0x30e0
leaq -0x50(%rbp), %rdi
callq 0x30d0
incl %r12d
movq %r13, %rbx
jmp 0x4f7b
movq -0x30(%rbp), %r14
movq 0x68(%r14), %r15
addq $0x58, %r14
cmpq %r14, %r15
je 0x5010
movq 0x40(%r15), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
movq %r15, %rdi
callq 0x3110
movq %rax, %r15
jmp 0x4ff1
leaq 0x3129(%rip), %rsi      # 0x8140
movq %rbx, %rdi
callq 0x3190
movq %rax, %rdi
callq 0x30e0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x32f0