// File: /workspace/github_cpp_makefile_star2_O1/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 $0x398, %rsp            # imm = 0x398
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %rcx
movb $0x1, 0x8(%rdi)
addq $0x10, %rdi
leaq 0x20(%rcx), %rax
movq %rax, -0x88(%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 0x56ee0(%rip), %rax     # 0x8cb10
movq %rcx, -0x40(%rbp)
movq %rax, (%rcx)
leaq 0x402a1(%rip), %rcx     # 0x75edf
movl $0x4, %edx
movl $0x10, %r8d
xorl %esi, %esi
callq 0x2e640
testq %r14, %r14
je 0x35c6f
leaq 0x569d4(%rip), %rsi     # 0x8c630
leaq 0x56d7d(%rip), %rdx     # 0x8c9e0
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x2e430
jmp 0x35c71
xorl %eax, %eax
movq -0x40(%rbp), %r14
movq %rax, 0x40(%r14)
leaq 0x10(%rbx), %rdi
leaq 0x400f3(%rip), %rsi     # 0x75d77
movl $0x9, %ecx
xorl %edx, %edx
callq 0x2e710
cmpq $-0x1, %rax
je 0x35d4f
movl $0x60, %edi
callq 0x2e3a0
movq %rax, -0x60(%rbp)
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)
movb $0x1, %al
movq %rax, -0x58(%rbp)
leaq 0x41bf7(%rip), %rdx     # 0x778db
movb $0x1, %r14b
movb $0x1, %bl
movq %r13, %rdi
movq %rdx, %rsi
callq 0x33112
xorl %r14d, %r14d
movb $0x1, %bl
movq %r12, %rdi
movq %r13, %rsi
callq 0x32b5a
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, %rdi
movl $0x3, %esi
movq %r12, %rdx
callq 0x3526c
xorl %r14d, %r14d
xorl %ebx, %ebx
movq $0x0, -0x58(%rbp)
movq -0x60(%rbp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r15, %rcx
callq 0x3578c
movq -0x40(%rbp), %rcx
movq -0x60(%rbp), %rax
movq %rax, 0x48(%rcx)
movq $-0x1, 0x50(%rcx)
jmp 0x360b3
leaq 0x568da(%rip), %rsi     # 0x8c630
leaq 0x56dbb(%rip), %rdx     # 0x8cb18
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0x2e430
movq %rax, 0x48(%r14)
movq (%rax), %rcx
leaq -0x230(%rbp), %rdi
movq %rax, %rsi
callq *(%rcx)
leaq -0x3b8(%rbp), %rdi
leaq -0x230(%rbp), %rsi
movl $0x18, %edx
callq 0x2e670
leaq -0x220(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x35da7
callq 0x2e360
leaq -0x98(%rbp), %rax
movq %rax, -0x10(%rax)
movq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x30(%rbp), %r14
leaq -0x30(%rbp), %r12
leaq -0x30(%rbp), %r13
leaq -0x80(%rbp), %rbx
leaq -0x48(%rbp), %r15
leaq -0x3b8(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
movl $0x3b, %edx
callq 0x2e790
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x36078
leaq -0x230(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
movl $0x18, %edx
callq 0x2e670
leaq -0x70(%rbp), %rax
movq %rax, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
movb $0x0, -0x70(%rbp)
leaq -0x230(%rbp), %rdi
movq %rbx, %rsi
movl $0x3a, %edx
callq 0x2e790
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x36042
movq %r15, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r14, %rdi
movq %r15, %rsi
callq 0x2e270
movq %rbx, %rdi
leaq -0x38(%rbp), %rsi
callq 0x39c99
movq %r14, %rdi
callq 0x2e580
movq %r15, %rdi
callq 0x2e580
movq %rbx, %rdi
leaq 0x3e941(%rip), %rsi     # 0x747cd
callq 0x2e0f0
testl %eax, %eax
je 0x35f79
movq %rbx, %rdi
leaq 0x3fede(%rip), %rsi     # 0x75d81
callq 0x2e0f0
testl %eax, %eax
jne 0x35e27
leaq -0x230(%rbp), %rdi
movq %rbx, %rsi
movl $0x3a, %edx
callq 0x2e790
movq %r15, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r12, %rdi
movq %r15, %rsi
callq 0x2e270
movq %rbx, %rdi
movq %r15, %r14
leaq -0x38(%rbp), %r15
movq %r15, %rsi
callq 0x39c99
movq %r12, %rdi
callq 0x2e580
movq %r14, %rdi
callq 0x2e580
movq -0x80(%rbp), %r14
callq 0x2e060
movq %rax, %r13
movl (%rax), %r12d
movl $0x0, (%rax)
movq %r14, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x2e570
cmpq %r14, -0x38(%rbp)
je 0x360ea
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x360f6
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x360f6
testl %ecx, %ecx
leaq -0x30(%rbp), %r14
leaq -0x48(%rbp), %r15
jne 0x35f65
movl %r12d, (%r13)
movq -0x40(%rbp), %rcx
movl %eax, 0x54(%rcx)
leaq -0x30(%rbp), %r12
leaq -0x30(%rbp), %r13
jmp 0x35e27
leaq -0x230(%rbp), %rdi
movq %rbx, %rsi
movl $0x3a, %edx
callq 0x2e790
movq %r15, %rdi
callq 0x2e800
movw $0x2000, -0x38(%rbp)    # imm = 0x2000
movq %r13, %rdi
movq %r15, %rsi
callq 0x2e270
movq %rbx, %rdi
movq %r15, %r14
leaq -0x38(%rbp), %r15
movq %r15, %rsi
callq 0x39c99
movq %r13, %rdi
callq 0x2e580
movq %r14, %rdi
callq 0x2e580
movq -0x80(%rbp), %r14
callq 0x2e060
movq %rax, %r13
movl (%rax), %r12d
movl $0x0, (%rax)
movq %r14, %rdi
movq %r15, %rsi
movl $0xa, %edx
callq 0x2e570
cmpq %r14, -0x38(%rbp)
je 0x360d2
leaq -0x80000000(%rax), %rcx
movabsq $-0x100000000, %rdx     # imm = 0xFFFFFFFF00000000
cmpq %rdx, %rcx
jb 0x360de
movl (%r13), %ecx
cmpl $0x22, %ecx
je 0x360de
testl %ecx, %ecx
jne 0x36026
movl %r12d, (%r13)
movq -0x40(%rbp), %rcx
movl %eax, 0x50(%rcx)
leaq -0x30(%rbp), %r14
leaq -0x30(%rbp), %r12
leaq -0x30(%rbp), %r13
leaq -0x48(%rbp), %r15
jmp 0x35e27
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x36054
callq 0x2e360
leaq -0x230(%rbp), %rdi
movq 0x57ef6(%rip), %rsi     # 0x8df58
callq 0x2e2f0
leaq -0x1b0(%rbp), %rdi
callq 0x2e150
jmp 0x35dd1
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x36090
callq 0x2e360
movq 0x57ec1(%rip), %rsi     # 0x8df58
leaq -0x3b8(%rbp), %rdi
callq 0x2e2f0
leaq -0x338(%rbp), %rdi
callq 0x2e150
movq -0x40(%rbp), %rcx
movq 0x48(%rcx), %rax
testq %rax, %rax
je 0x360c0
movq %rcx, 0x30(%rax)
addq $0x398, %rsp            # imm = 0x398
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3fd5f(%rip), %rdi     # 0x75e38
callq 0x2e260
leaq 0x3fd53(%rip), %rdi     # 0x75e38
callq 0x2e5c0
leaq 0x3fd47(%rip), %rdi     # 0x75e38
callq 0x2e260
leaq 0x3fd3b(%rip), %rdi     # 0x75e38
callq 0x2e5c0
movq %rax, %rbx
leaq -0x220(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x36234
callq 0x2e360
jmp 0x36234
jmp 0x36145
movq %rax, -0x50(%rbp)
movb $0x1, %bl
movb $0x1, %al
movq %rax, -0x58(%rbp)
jmp 0x3615e
movq %rax, -0x50(%rbp)
movb $0x1, %al
movq %rax, -0x58(%rbp)
jmp 0x3616a
movq %rax, -0x50(%rbp)
jmp 0x36178
movq %rax, %rbx
jmp 0x36234
movq %rax, -0x50(%rbp)
testb %r14b, %r14b
je 0x3615e
movq %r13, %rdi
callq 0x2e360
testb %bl, %bl
je 0x3616a
movq %r12, %rdi
callq 0x2e360
cmpb $0x0, -0x58(%rbp)
je 0x36178
movq %r15, %rdi
callq 0x2e360
movq -0x60(%rbp), %rdi
callq 0x2e360
movq -0x50(%rbp), %rbx
jmp 0x36234
jmp 0x3618c
movq %rax, %rbx
jmp 0x361fd
movq %rax, %rbx
movq %r12, %rdi
jmp 0x361b9
movq %rax, %rbx
movq %r13, %rdi
jmp 0x361b9
jmp 0x361a3
movq %rax, %rbx
cmpl $0x0, (%r13)
jne 0x361cc
movl %r12d, (%r13)
jmp 0x361cc
movq %rax, %rbx
movq %r14, %rdi
callq 0x2e580
leaq -0x48(%rbp), %rdi
callq 0x2e580
jmp 0x361cc
movq %rax, %rbx
movq -0x80(%rbp), %rdi
leaq -0x70(%rbp), %rax
cmpq %rax, %rdi
je 0x361de
callq 0x2e360
movq 0x57d73(%rip), %rsi     # 0x8df58
leaq -0x230(%rbp), %rdi
callq 0x2e2f0
leaq -0x1b0(%rbp), %rdi
callq 0x2e150
movq -0xa8(%rbp), %rdi
leaq -0x98(%rbp), %rax
cmpq %rax, %rdi
je 0x36215
callq 0x2e360
movq 0x57d3c(%rip), %rsi     # 0x8df58
leaq -0x3b8(%rbp), %rdi
callq 0x2e2f0
leaq -0x338(%rbp), %rdi
callq 0x2e150
leaq 0x56755(%rip), %rax     # 0x8c990
movq -0x40(%rbp), %rcx
movq %rax, (%rcx)
movq 0x10(%rcx), %rdi
cmpq -0x88(%rbp), %rdi
je 0x36254
callq 0x2e360
movq %rbx, %rdi
callq 0x2e730