// File: /workspace/github_cpp_makefile_star2_O2/eniac[P]Mantis/src/ast/ast_nodes_p4.cpp
// Function: P4RegisterNode::P4RegisterNode(AstNode*, AstNode*)
P4RegisterNode::P4RegisterNode(AstNode* name, AstNode* body) {
    nodeType_ = typeid(*this).name();
    name_ = dynamic_cast<NameNode*>(name);
    if(body->nodeType_.find("EmptyNode")!=string::npos) {
        body_ = new BodyNode(NULL, NULL, new BodyWordNode(BodyWordNode::STRING, new StrNode(new string(""))));
        width_ = -1;
        instanceCount_ = -1;        
    } else {
        body_ = dynamic_cast<BodyNode*>(body);
        std::stringstream ss(body_->toString());
        std::string item;
        while (std::getline(ss, item, ';'))
        {
            std::stringstream ss_(item);
            std::string item_;
            while (std::getline(ss_, item_, ':')) {
                boost::algorithm::trim(item_);
                if(item_.compare("width")==0) {
                    std::getline(ss_, item_, ':');
                    boost::algorithm::trim(item_);
                    width_ = stoi(item_);
                } else if (item_.compare("instance_count")==0) {
                    std::getline(ss_, item_, ':');
                    boost::algorithm::trim(item_);
                    instanceCount_ = stoi(item_);
                }
            }
        }        
    }
    if (body_) body_->parent_ = this;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x368, %rsp            # imm = 0x368
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0x448c4
leaq 0x4d875(%rip), %rax     # 0x94b70
movq %rax, (%r15)
movq %r15, -0x30(%rbp)
leaq 0x10(%r15), %rdi
leaq 0x31bb2(%rip), %rsi     # 0x78ebf
callq 0x41850
testq %r14, %r14
je 0x47331
leaq 0x4d372(%rip), %rsi     # 0x94690
leaq 0x4d71b(%rip), %rdx     # 0x94a40
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x41480
jmp 0x47333
xorl %eax, %eax
movq -0x30(%rbp), %r14
movq %rax, 0x40(%r14)
leaq 0x10(%rbx), %rdi
leaq 0x31a11(%rip), %rsi     # 0x78d57
xorl %edx, %edx
callq 0x41880
cmpq $-0x1, %rax
je 0x473cf
pushq $0x60
popq %rdi
callq 0x413f0
movq %rax, %rbx
pushq $0x50
popq %rdi
callq 0x413f0
movq %rax, %r15
pushq $0x48
popq %rdi
callq 0x413f0
movq %rax, %r12
pushq $0x20
popq %rdi
callq 0x413f0
movq %rax, %r13
leaq 0x33535(%rip), %rsi     # 0x7a8bb
leaq -0x388(%rbp), %rdx
movq %rax, %rdi
callq 0x411c0
movq %r12, %rdi
movq %r13, %rsi
callq 0x44730
pushq $0x3
popq %rsi
movq %r15, %rdi
movq %r12, %rdx
callq 0x46ba0
movq %rbx, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x46fa6
movq -0x30(%rbp), %rax
movq %rbx, 0x48(%rax)
orq $-0x1, 0x50(%rax)
jmp 0x4759f
leaq 0x4d2ba(%rip), %rsi     # 0x94690
leaq 0x4d79b(%rip), %rdx     # 0x94b78
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x41480
movq %rax, 0x48(%r14)
movq (%rax), %rcx
leaq -0x200(%rbp), %rdi
movq %rax, %rsi
callq *(%rcx)
leaq -0x388(%rbp), %rdi
leaq -0x200(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x416c0
leaq -0x200(%rbp), %r14
movq %r14, %rdi
callq 0x418c8
leaq -0x68(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x58(%rbp), %r15
pushq $0x3a
popq %r13
leaq -0x38(%rbp), %r12
leaq 0x3038b(%rip), %rbx     # 0x777cd
leaq -0x388(%rbp), %rdi
leaq -0x78(%rbp), %rsi
pushq $0x3b
popq %rdx
callq 0x417f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4757d
movq %r14, %rdi
leaq -0x78(%rbp), %rsi
pushq $0x18
popq %rdx
callq 0x416c0
leaq -0x48(%rbp), %rax
movq %rax, -0x58(%rbp)
andq $0x0, -0x50(%rbp)
movb $0x0, -0x48(%rbp)
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x417f0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x47568
movq %r12, %rdi
callq 0x418a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x49aca
movq %r12, %rdi
callq 0x415e0
movq %r15, %rdi
movq %rbx, %rsi
callq 0x41130
testl %eax, %eax
je 0x47526
movq %r15, %rdi
leaq 0x31886(%rip), %rsi     # 0x78d61
callq 0x41130
testl %eax, %eax
jne 0x47487
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x417f0
movq %r12, %rdi
callq 0x418a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x49aca
movq %r12, %rdi
callq 0x415e0
movq %r15, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x49b15
movq -0x30(%rbp), %rcx
movl %eax, 0x54(%rcx)
jmp 0x47487
movq %r14, %rdi
movq %r15, %rsi
movl %r13d, %edx
callq 0x417f0
movq %r12, %rdi
callq 0x418a0
movq %r15, %rdi
movq %r12, %rsi
callq 0x49aca
movq %r12, %rdi
callq 0x415e0
movq %r15, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x49b15
movq -0x30(%rbp), %rcx
movl %eax, 0x50(%rcx)
jmp 0x47487
movq %r15, %rdi
callq 0x418c8
movq %r14, %rdi
callq 0x41330
jmp 0x47442
leaq -0x78(%rbp), %rdi
callq 0x418c8
leaq -0x388(%rbp), %rdi
callq 0x41330
movq -0x30(%rbp), %rax
movq 0x48(%rax), %rbx
testq %rbx, %rbx
je 0x475a3
movq %rax, 0x30(%rbx)
addq $0x368, %rsp            # imm = 0x368
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq -0x200(%rbp), %rdi
callq 0x418c8
jmp 0x47650
jmp 0x47605
jmp 0x475f8
jmp 0x475eb
jmp 0x475de
movq %rax, %r14
movq %r13, %rdi
callq 0x413a0
jmp 0x475e1
movq %rax, %r14
movq %r12, %rdi
callq 0x413a0
jmp 0x475ee
movq %rax, %r14
movq %r15, %rdi
callq 0x413a0
jmp 0x475fb
movq %rax, %r14
movq %rbx, %rdi
callq 0x413a0
jmp 0x47650
movq %rax, %r14
jmp 0x47650
jmp 0x4760c
movq %rax, %r14
jmp 0x4763b
jmp 0x47615
jmp 0x47615
movq %rax, %r14
leaq -0x38(%rbp), %rdi
callq 0x415e0
jmp 0x47626
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x418c8
leaq -0x200(%rbp), %rdi
callq 0x41330
leaq -0x78(%rbp), %rdi
callq 0x418c8
leaq -0x388(%rbp), %rdi
callq 0x41330
movq -0x30(%rbp), %rdi
callq 0x44900
movq %r14, %rdi
callq 0x41790
nop