// File: /workspace/github_c_makefile_star2_O2/luixmao[P]verilog/design.cpp
// Function: Design::addFindGate(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Gate* Design::addFindGate(int gtype, string n){
  Gate* ptr;
  map<string, Gate *>::iterator it_gate;
  it_gate=designGates.find(n);
  if(it_gate!= designGates.end() ){
    return it_gate->second;
  }
  else{
    if(gtype == AND){
      ptr = new And(n);
      designGates[n]=ptr;
    }
    else if(gtype == OR){
      ptr = new Or(n);
      designGates[n]=ptr;
    }
    else if(gtype == NAND){
      ptr = new Nand(n);
      designGates[n]=ptr;
    }
    else if(gtype == NOR){
      ptr = new Nor(n);
      designGates[n]=ptr;
    }
    else if(gtype == XOR){
      ptr = new Xor(n);
      designGates[n]=ptr;
    }
    else if(gtype == NOT){
      ptr = new Not(n);
      designGates[n]=ptr;
    }
    else{
      cout << " error in gate type " <<endl;
      return NULL;
    }
  }
return ptr; // return pointer to new gate
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xc0, %rsp
movq %rdx, %r14
movl %esi, %ebx
movq %rdi, %r12
leaq 0x50(%rdi), %r15
movq %r15, %rdi
movq %rdx, %rsi
callq 0x5c96
addq $0x58, %r12
cmpq %r12, %rax
je 0x5093
movq 0x40(%rax), %rbx
jmp 0x51d9
cmpl $0x5, %ebx
ja 0x51ec
movl %ebx, %eax
leaq 0x3063(%rip), %rcx      # 0x8108
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0xe0(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0x3dea
leaq -0xe0(%rbp), %rdi
jmp 0x51c6
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x43e2
leaq -0x60(%rbp), %rdi
jmp 0x51c6
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0x4264
leaq -0xa0(%rbp), %rdi
jmp 0x51c6
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0x80(%rbp), %rsi
movq %rbx, %rdi
callq 0x40e6
leaq -0x80(%rbp), %rdi
jmp 0x51c6
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0xc0(%rbp), %rsi
movq %rbx, %rdi
callq 0x3f68
leaq -0xc0(%rbp), %rdi
jmp 0x51c6
pushq $0x40
popq %rdi
callq 0x31a0
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
movq %r14, %rsi
callq 0x3240
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x456c
leaq -0x40(%rbp), %rdi
callq 0x30d0
movq %r15, %rdi
movq %r14, %rsi
callq 0x5488
movq %rbx, (%rax)
movq %rbx, %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x6ddd(%rip), %rdi      # 0xbfd0
leaq 0x2f50(%rip), %rsi      # 0x814a
callq 0x3190
movq %rax, %rdi
callq 0x30e0
xorl %ebx, %ebx
jmp 0x51d9
movq %rax, %r14
leaq -0x40(%rbp), %rdi
jmp 0x5248
movq %rax, %r14
leaq -0xc0(%rbp), %rdi
jmp 0x5248
movq %rax, %r14
leaq -0x80(%rbp), %rdi
jmp 0x5248
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
jmp 0x5248
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
jmp 0x5248
movq %rax, %r14
leaq -0x60(%rbp), %rdi
callq 0x30d0
jmp 0x525c
jmp 0x5259
jmp 0x5259
jmp 0x5259
jmp 0x5259
jmp 0x5259
movq %rax, %r14
pushq $0x40
popq %rsi
movq %rbx, %rdi
callq 0x31b0
movq %r14, %rdi
callq 0x32f0
nop