// File: /workspace/github_c_makefile_star2_O3/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 0x2e0a(%rip), %rsi      # 0x7220
movl $0x7, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x21d0
leaq 0x2d0f(%rip), %rsi      # 0x7148
movl $0x1, %edx
movq %rax, %rdi
callq 0x21d0
movq 0x80(%r14), %rax
cmpq %rax, 0x88(%r14)
je 0x44e0
movl $0x1, %r12d
xorl %r13d, %r13d
leaq 0x2ce0(%rip), %r15      # 0x714a
movq %r13, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, %rdi
callq 0x21d0
movq 0x80(%r14), %rax
movq 0x88(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
leaq -0x1(%rcx), %rdx
cmpq %r13, %rdx
jne 0x44b0
movq 0xa0(%r14), %rdx
cmpq 0x98(%r14), %rdx
je 0x44d5
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21d0
movq 0x80(%r14), %rax
movq 0x88(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movl %r12d, %r13d
incl %r12d
cmpq %r13, %rcx
jne 0x446a
movq 0x98(%r14), %rax
cmpq %rax, 0xa0(%r14)
je 0x4566
movl $0x1, %r12d
xorl %r13d, %r13d
leaq 0x2c4a(%rip), %r15      # 0x714a
movq %r13, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movq 0x8(%rax,%rcx), %rdx
movq %rbx, %rdi
callq 0x21d0
movq 0x98(%r14), %rax
movq 0xa0(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
leaq -0x1(%rcx), %rdx
cmpq %r13, %rdx
je 0x455b
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21d0
movq 0x98(%r14), %rax
movq 0xa0(%r14), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
movl %r12d, %r13d
incl %r12d
cmpq %r13, %rcx
jne 0x4500
leaq 0x2bdf(%rip), %rsi      # 0x714c
movl $0x3, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x88(%r14), %rax
cmpq 0x80(%r14), %rax
je 0x4651
movl $0x1, %r15d
xorl %r13d, %r13d
leaq 0x2b20(%rip), %r12      # 0x70e5
movl $0x7, %edx
movq %rbx, %rdi
leaq 0x2b7c(%rip), %rsi      # 0x7150
callq 0x21d0
movq 0x80(%r14), %rax
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21d0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x88(%r14), %rax
subq 0x80(%r14), %rax
movl %r15d, %r13d
sarq $0x5, %rax
incl %r15d
cmpq %r13, %rax
jne 0x45c5
movq 0xa0(%r14), %rax
cmpq 0x98(%r14), %rax
je 0x4701
movl $0x1, %r15d
xorl %r13d, %r13d
leaq 0x2a70(%rip), %r12      # 0x70e5
movl $0x8, %edx
movq %rbx, %rdi
leaq 0x2ad4(%rip), %rsi      # 0x7158
callq 0x21d0
movq 0x98(%r14), %rax
shlq $0x5, %r13
movq (%rax,%r13), %rsi
movq 0x8(%rax,%r13), %rdx
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x21d0
movq (%r13), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0xa0(%r14), %rax
subq 0x98(%r14), %rax
movl %r15d, %r13d
sarq $0x5, %rax
incl %r15d
cmpq %r13, %rax
jne 0x4675
movq 0xc0(%r14), %r12
movq 0x8(%r12), %rax
cmpq (%r12), %rax
je 0x47c9
movl $0x1, %r13d
xorl %r15d, %r15d
movl $0x6, %edx
movq %rbx, %rdi
leaq 0x2a32(%rip), %rsi      # 0x7161
callq 0x21d0
movq (%r12), %rax
movq (%rax,%r15,8), %rsi
leaq -0x50(%rbp), %rdi
callq 0x2686
movq -0x50(%rbp), %rsi
movq -0x48(%rbp), %rdx
movq %rbx, %rdi
callq 0x21d0
movb $0x3b, -0x29(%rbp)
movl $0x1, %edx
movq %rax, %rdi
leaq -0x29(%rbp), %rsi
callq 0x21d0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %r15, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x47ad
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2190
movq 0x8(%r12), %rax
subq (%r12), %rax
movl %r13d, %r15d
sarq $0x3, %rax
incl %r13d
cmpq %r15, %rax
jne 0x4720
movq 0x68(%r14), %r15
addq $0x58, %r14
cmpq %r14, %r15
je 0x47f3
movq 0x40(%r15), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
movq %r15, %rdi
callq 0x20f0
movq %rax, %r15
cmpq %r14, %rax
jne 0x47d6
leaq 0x296e(%rip), %rsi      # 0x7168
movl $0x9, %edx
movq %rbx, %rdi
callq 0x21d0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2170
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rax
cmpq %rax, %rdi
je 0x4859
movq -0x40(%rbp), %rsi
incq %rsi
callq 0x2190
movq %rbx, %rdi
callq 0x22b0
nop