// File: /workspace/github_cpp_makefile_star2_O3/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 $0x378, %rsp            # imm = 0x378
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rcx
movb $0x1, 0x8(%rdi)
addq $0x10, %rdi
leaq 0x20(%rcx), %rax
movq %rax, -0x70(%rbp)
movq %rax, 0x10(%rcx)
movl $0x65736162, 0x20(%rcx) # imm = 0x65736162
movq $0x4, 0x18(%rcx)
xorl %eax, %eax
movb %al, 0x24(%rcx)
movq $0x0, 0x30(%rcx)
movb %al, 0x38(%rcx)
leaq 0x572ab(%rip), %rax     # 0x8cb90
movq %rcx, -0x40(%rbp)
movq %rax, (%rcx)
leaq 0x405ec(%rip), %rcx     # 0x75edf
movl $0x4, %edx
movl $0x10, %r8d
xorl %esi, %esi
callq 0x2e640
testq %r14, %r14
je 0x35924
leaq 0x56d9f(%rip), %rsi     # 0x8c6b0
leaq 0x57148(%rip), %rdx     # 0x8ca60
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x2e430
jmp 0x35926
xorl %eax, %eax
movq -0x40(%rbp), %r14
movq %rax, 0x40(%r14)
leaq 0x10(%rbx), %rdi
leaq 0x4043e(%rip), %rsi     # 0x75d77
movl $0x9, %ecx
xorl %edx, %edx
callq 0x2e710
cmpq $-0x1, %rax
je 0x359dc
movl $0x60, %edi
callq 0x2e3a0
movq %rax, %r14
movl $0x50, %edi
callq 0x2e3a0
movq %rax, %r15
movl $0x48, %edi
callq 0x2e3a0
movq %rax, %r12
movl $0x20, %edi
callq 0x2e3a0
movq %rax, %r13
addq $0x10, %rax
movq %rax, (%r13)
leaq 0x41f49(%rip), %rdx     # 0x778db
movq %r13, %rdi
movq %rdx, %rsi
callq 0x32e40
movq %r12, %rdi
movq %r13, %rsi
callq 0x32870
movq %r15, %rdi
movl $0x3, %esi
movq %r12, %rdx
callq 0x34f1c
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x35432
movq -0x40(%rbp), %rax
movq %r14, 0x48(%rax)
movq $-0x1, 0x50(%rax)
jmp 0x35d3f
leaq 0x56ccd(%rip), %rsi     # 0x8c6b0
leaq 0x571ae(%rip), %rdx     # 0x8cb98
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x2e430
movq %rax, 0x48(%r14)
movq (%rax), %rcx
leaq -0x218(%rbp), %rdi
movq %rax, %rsi
callq *(%rcx)
leaq -0x3a0(%rbp), %rdi
leaq -0x218(%rbp), %rsi
movl $0x18, %edx
callq 0x2e670
leaq -0x208(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35a34
callq 0x2e360
leaq -0x80(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x30(%rbp), %r14
leaq -0x30(%rbp), %r15
leaq -0x30(%rbp), %r13
leaq -0x68(%rbp), %r12
leaq -0x48(%rbp), %rbx
leaq -0x3a0(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x3b, %edx
callq 0x2e790
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x35cfe
leaq -0x218(%rbp), %rdi
leaq -0x90(%rbp), %rsi
movl $0x18, %edx
callq 0x2e670
leaq -0x58(%rbp), %rax
movq %rax, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movb $0x0, -0x58(%rbp)
leaq -0x218(%rbp), %rdi
movq %r12, %rsi
movl $0x3a, %edx
callq 0x2e790
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x35cc8
movq %rbx, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2e270
movq %r12, %rdi
leaq -0x38(%rbp), %rsi
callq 0x398b9
movq %r14, %rdi
callq 0x2e580
movq %rbx, %rdi
callq 0x2e580
movq %r12, %rdi
leaq 0x3ecb7(%rip), %rsi     # 0x747cd
callq 0x2e0f0
testl %eax, %eax
je 0x35c01
movq %r12, %rdi
leaq 0x40254(%rip), %rsi     # 0x75d81
callq 0x2e0f0
testl %eax, %eax
jne 0x35ab1
leaq -0x218(%rbp), %rdi
movq %r12, %rsi
movl $0x3a, %edx
callq 0x2e790
movq %rbx, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r15, %rdi
movq %rbx, %rsi
callq 0x2e270
movq %r12, %rdi
movq %rbx, %r14
leaq -0x38(%rbp), %rbx
movq %rbx, %rsi
callq 0x398b9
movq %r15, %rdi
callq 0x2e580
movq %r14, %rdi
callq 0x2e580
movq -0x68(%rbp), %r15
callq 0x2e060
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x2e570
cmpq %r15, -0x38(%rbp)
je 0x35d6d
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x35d79
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x35d79
testl %ecx, %ecx
leaq -0x30(%rbp), %r15
leaq -0x48(%rbp), %rbx
jne 0x35bed
movl %r13d, (%r14)
movq -0x40(%rbp), %rcx
movl %eax, 0x54(%rcx)
leaq -0x30(%rbp), %r14
leaq -0x30(%rbp), %r13
jmp 0x35ab1
leaq -0x218(%rbp), %rdi
movq %r12, %rsi
movl $0x3a, %edx
callq 0x2e790
movq %rbx, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r13, %rdi
movq %rbx, %rsi
callq 0x2e270
movq %r12, %rdi
movq %rbx, %r14
leaq -0x38(%rbp), %rbx
movq %rbx, %rsi
callq 0x398b9
movq %r13, %rdi
callq 0x2e580
movq %r14, %rdi
callq 0x2e580
movq -0x68(%rbp), %r15
callq 0x2e060
movq %rax, %r14
movl (%rax), %r13d
movl $0x0, (%rax)
movq %r15, %rdi
movq %rbx, %rsi
movl $0xa, %edx
callq 0x2e570
cmpq %r15, -0x38(%rbp)
je 0x35d55
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x35d61
movl (%r14), %ecx
cmpl $0x22, %ecx
je 0x35d61
testl %ecx, %ecx
jne 0x35cac
movl %r13d, (%r14)
movq -0x40(%rbp), %rcx
movl %eax, 0x50(%rcx)
leaq -0x30(%rbp), %r14
leaq -0x30(%rbp), %r15
leaq -0x30(%rbp), %r13
leaq -0x48(%rbp), %rbx
jmp 0x35ab1
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x35cda
callq 0x2e360
leaq -0x218(%rbp), %rdi
movq 0x58270(%rip), %rsi     # 0x8df58
callq 0x2e2f0
leaq -0x198(%rbp), %rdi
callq 0x2e150
jmp 0x35a5b
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x35d13
callq 0x2e360
movq 0x5823e(%rip), %rsi     # 0x8df58
leaq -0x3a0(%rbp), %rdi
callq 0x2e2f0
leaq -0x320(%rbp), %rdi
callq 0x2e150
movq -0x40(%rbp), %rax
movq 0x48(%rax), %r14
testq %r14, %r14
je 0x35d43
movq %rax, 0x30(%r14)
addq $0x378, %rsp            # imm = 0x378
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x400dc(%rip), %rdi     # 0x75e38
callq 0x2e260
leaq 0x400d0(%rip), %rdi     # 0x75e38
callq 0x2e5c0
leaq 0x400c4(%rip), %rdi     # 0x75e38
callq 0x2e260
leaq 0x400b8(%rip), %rdi     # 0x75e38
callq 0x2e5c0
movq %rax, %rbx
leaq -0x208(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
jne 0x35dd2
jmp 0x35e89
jmp 0x35ddc
jmp 0x35dcc
jmp 0x35dbf
jmp 0x35db2
movq %rax, %rbx
movq %r13, %rdi
callq 0x2e360
jmp 0x35db5
movq %rax, %rbx
movq %r12, %rdi
callq 0x2e360
jmp 0x35dc2
movq %rax, %rbx
movq %r15, %rdi
callq 0x2e360
jmp 0x35dcf
movq %rax, %rbx
movq %r14, %rdi
callq 0x2e360
jmp 0x35e89
movq %rax, %rbx
jmp 0x35e89
jmp 0x35de6
movq %rax, %rbx
jmp 0x35e55
movq %rax, %rbx
movq %r15, %rdi
jmp 0x35e11
movq %rax, %rbx
movq %r13, %rdi
jmp 0x35e11
jmp 0x35dfd
movq %rax, %rbx
cmpl $0x0, (%r14)
jne 0x35e24
movl %r13d, (%r14)
jmp 0x35e24
movq %rax, %rbx
movq %r14, %rdi
callq 0x2e580
leaq -0x48(%rbp), %rdi
callq 0x2e580
jmp 0x35e24
movq %rax, %rbx
movq -0x68(%rbp), %rdi
leaq -0x58(%rbp), %rax
cmpq %rax, %rdi
je 0x35e36
callq 0x2e360
movq 0x5811b(%rip), %rsi     # 0x8df58
leaq -0x218(%rbp), %rdi
callq 0x2e2f0
leaq -0x198(%rbp), %rdi
callq 0x2e150
movq -0x90(%rbp), %rdi
leaq -0x80(%rbp), %rax
cmpq %rax, %rdi
je 0x35e6a
callq 0x2e360
movq 0x580e7(%rip), %rsi     # 0x8df58
leaq -0x3a0(%rbp), %rdi
callq 0x2e2f0
leaq -0x320(%rbp), %rdi
callq 0x2e150
leaq 0x56b80(%rip), %rax     # 0x8ca10
movq -0x40(%rbp), %rcx
movq %rax, (%rcx)
movq 0x10(%rcx), %rdi
cmpq -0x70(%rbp), %rdi
je 0x35ea6
callq 0x2e360
movq %rbx, %rdi
callq 0x2e730