// File: /workspace/github_c_makefile_star2_O3/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 0x565e
addq $0x58, %r12
cmpq %r12, %rax
je 0x48ab
movq 0x40(%rax), %rbx
jmp 0x4abb
cmpl $0x5, %ebx
ja 0x4ace
movl %ebx, %eax
leaq 0x2873(%rip), %rcx      # 0x7130
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0xd0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xe0(%rbp), %rdi
callq 0x28b4
leaq -0xe0(%rbp), %rsi
movq %rbx, %rdi
callq 0x311a
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0xd0(%rbp), %rsi
jmp 0x4aa5
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x50(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x60(%rbp), %rdi
callq 0x28b4
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x38e2
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0x50(%rbp), %rsi
jmp 0x4aa5
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x90(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xa0(%rbp), %rdi
callq 0x28b4
leaq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0x36f0
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0x90(%rbp), %rsi
jmp 0x4aa5
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x70(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x80(%rbp), %rdi
callq 0x28b4
leaq -0x80(%rbp), %rsi
movq %rbx, %rdi
callq 0x34fe
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0x70(%rbp), %rsi
jmp 0x4aa5
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0xb0(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0xc0(%rbp), %rdi
callq 0x28b4
leaq -0xc0(%rbp), %rsi
movq %rbx, %rdi
callq 0x330c
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0xb0(%rbp), %rsi
jmp 0x4aa5
movl $0x40, %edi
callq 0x2180
movq %rax, %rbx
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq -0x40(%rbp), %rdi
callq 0x28b4
leaq -0x40(%rbp), %rsi
movq %rbx, %rdi
callq 0x3adc
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x4aad
movq -0x30(%rbp), %rsi
incq %rsi
callq 0x2190
movq %r15, %rdi
movq %r14, %rsi
callq 0x4ecc
movq %rbx, (%rax)
movq %rbx, %rax
addq $0xc0, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq 0x64fb(%rip), %rbx      # 0xafd0
leaq 0x2696(%rip), %rsi      # 0x7172
movl $0x14, %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
xorl %ebx, %ebx
jmp 0x4abb
movq %rax, %r14
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0x30(%rbp), %rsi
jmp 0x4b94
movq %rax, %r14
movq -0xc0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0xb0(%rbp), %rsi
jmp 0x4b94
movq %rax, %r14
movq -0x80(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0x70(%rbp), %rsi
jmp 0x4b94
movq %rax, %r14
movq -0xa0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0x90(%rbp), %rsi
jmp 0x4b94
movq %rax, %r14
movq -0xe0(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0xd0(%rbp), %rsi
jmp 0x4b94
movq %rax, %r14
movq -0x60(%rbp), %rdi
cmpq %r12, %rdi
je 0x4bab
movq -0x50(%rbp), %rsi
incq %rsi
callq 0x2190
jmp 0x4bab
jmp 0x4ba8
jmp 0x4ba8
jmp 0x4ba8
jmp 0x4ba8
jmp 0x4ba8
movq %rax, %r14
movl $0x40, %esi
movq %rbx, %rdi
callq 0x2190
movq %r14, %rdi
callq 0x22b0