// File: /workspace/github_cpp_makefile_star2_O3/marxn[P]pupp/src/pupp.cpp
// Function: main
int main(int argc, char * argv[])
{
        FILE * fp = NULL;

        if(argc==1)
        {
                fp = stdin;
        }
        else
        {
                fp = fopen(argv[1],"r");
                if(fp==NULL)
                {
                        fprintf(stderr, "Could not open file: '%s'\n", argv[1]);
                        return -1;
                }
        }

        yyin = fp;

        ContainerNode * bean = parse();

        if(bean == NULL)
        {
                return -1;
        }

        MapValue * para = new MapValue();

        for(int i = 0; i<argc; i++)
        {
                IntegerValue * key = new IntegerValue(i);
                StringValue * value = new StringValue(string(argv[i]));

                ValueBox * vb = new ValueBox(value);
                KVValue * kv = new KVValue(key, vb);
                para->AddKV(kv);

                delete kv;
                delete vb;
                delete value;
                delete key;
        }

        string   para_name = "args";
        VariableType para_type(Map, Null);

        VarDefinitionStatement * defstmt = new VarDefinitionStatement(&para_name, &para_type);
        defstmt->SetParentNode(bean);
        defstmt->SetInitExpr(new ConstValueExpression(para));

        bean->AddNode(defstmt);

        if(bean->Provision()==false || bean->Check()==false)
        {
                return -2;
        }

        NodeContext context;
        context.AddFrame(bean);

        bean->Execute(&context);

        fclose(fp);

        int ret = 0;

        ConstValue * retval = context.FunctionRet;

        if(retval!=NULL && retval->GetType()==Integer)
        {
                ret = static_cast<int>(static_cast<IntegerValue*>(retval)->GetValue());
        }

        return ret;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r15
movl %edi, %ebx
cmpl $0x1, %edi
jne 0x78f3
movq 0x3f6da(%rip), %rax     # 0x46fc8
movq (%rax), %r14
jmp 0x790f
movq 0x8(%r15), %rdi
leaq 0x2ef93(%rip), %rsi     # 0x36891
callq 0x6330
movq %rax, %r14
testq %rax, %rax
je 0x7b9d
leaq 0x3f9ca(%rip), %rax     # 0x472e0
movq %r14, (%rax)
callq 0x14cb7
testq %rax, %rax
je 0x7ba9
movq %rax, 0x10(%rsp)
movl $0x40, %edi
callq 0x6260
movq %rax, (%rsp)
movq %rax, %rdi
callq 0x8a52
movq %r14, 0x8(%rsp)
testl %ebx, %ebx
jle 0x7a46
movl %ebx, %eax
movq %rax, 0x20(%rsp)
xorl %r13d, %r13d
leaq 0x48(%rsp), %rbp
movq %r15, 0x18(%rsp)
movl $0x18, %edi
callq 0x6260
movq %rax, %rbx
movq %rax, %rdi
movq %r13, %rsi
callq 0x810c
movl $0x30, %edi
callq 0x6260
movq %rax, %r14
movq (%r15,%r13,8), %rsi
movq %rbp, %rdi
leaq 0x88(%rsp), %rdx
callq 0x7cae
movq %r14, %rdi
movq %rbp, %rsi
callq 0x7f4c
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x79c3
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6270
movl $0x10, %edi
callq 0x6260
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x7dba
movl $0x20, %edi
callq 0x6260
movq %rax, %r12
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x8826
movq (%rsp), %rdi
movq %r12, %rsi
callq 0x8bde
movq (%r12), %rax
movq %r12, %rdi
callq *0x8(%rax)
movq %r15, %rdi
callq 0x7de0
movl $0x10, %esi
movq %r15, %rdi
callq 0x6270
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
incq %r13
cmpq %r13, 0x20(%rsp)
movq 0x18(%rsp), %r15
jne 0x7963
leaq 0x38(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x2d5c9(%rip), %rsi     # 0x3501f
leaq 0x2d5c6(%rip), %rdx     # 0x35023
leaq 0x28(%rsp), %rdi
callq 0x7cec
leaq 0x68(%rsp), %rdi
movl $0x6, %esi
xorl %edx, %edx
callq 0x17374
movq 0x10(%rsp), %r12
movl $0x80, %edi
callq 0x6260
movq %rax, %rbx
leaq 0x28(%rsp), %rsi
leaq 0x68(%rsp), %rdx
movq %rax, %rdi
callq 0x173d6
movq %rbx, %rdi
movq %r12, %rsi
callq 0xc342
movl $0x20, %edi
callq 0x6260
movq %rax, %r14
movq %rax, %rdi
movq (%rsp), %rsi
callq 0x9fea
movq %rbx, %rdi
movq %r14, %rsi
callq 0x17758
movq %r12, %rdi
movq %rbx, %rsi
callq 0x9ee8
movq (%r12), %rax
movq %r12, %rdi
callq *0x10(%rax)
movl $0xfffffffe, %ebx       # imm = 0xFFFFFFFE
testb %al, %al
je 0x7b62
movq (%r12), %rax
movq %r12, %rdi
callq *0x18(%rax)
testb %al, %al
je 0x7b62
leaq 0x88(%rsp), %rdi
callq 0xc586
leaq 0x88(%rsp), %rdi
movq %r12, %rsi
callq 0xc6ae
leaq 0x88(%rsp), %rsi
movq %r12, %rdi
callq 0xc316
movq 0x8(%rsp), %rdi
callq 0x6250
movq 0xd8(%rsp), %r14
xorl %ebx, %ebx
testq %r14, %r14
je 0x7b55
movq %r14, %rdi
callq 0x7da6
cmpl $0x1, %eax
jne 0x7b55
movq %r14, %rdi
callq 0x8160
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0xc5e8
leaq 0x70(%rsp), %r14
movq (%r14), %rdi
cmpq %r14, %rdi
je 0x7b84
movq (%rdi), %r12
movl $0x18, %esi
callq 0x6270
movq %r12, %rdi
cmpq %r14, %r12
jne 0x7b6f
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x7bae
movq 0x38(%rsp), %rsi
incq %rsi
callq 0x6270
jmp 0x7bae
addq $0x8, %r15
movq %r15, %rdi
callq 0x6500
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x7bc6
jmp 0x7c15
movq %rax, %r13
leaq 0x88(%rsp), %rdi
callq 0xc5e8
jmp 0x7c18
movq %rax, %r13
movl $0x20, %esi
movq %r14, %rdi
jmp 0x7bf0
movq %rax, %r13
movl $0x80, %esi
movq %rbx, %rdi
callq 0x6270
jmp 0x7c18
movq %rax, %r13
jmp 0x7c3a
movq %rax, %r13
jmp 0x7ca6
movq %rax, %r13
movl $0x40, %esi
movq (%rsp), %rdi
jmp 0x7ca1
movq %rax, %r13
leaq 0x70(%rsp), %rbx
movq (%rbx), %rdi
cmpq %rbx, %rdi
je 0x7c3a
movq (%rdi), %r14
movl $0x18, %esi
callq 0x6270
movq %r14, %rdi
cmpq %rbx, %r14
jne 0x7c25
movq 0x28(%rsp), %rdi
cmpq %r15, %rdi
je 0x7ca6
movq 0x38(%rsp), %rsi
incq %rsi
jmp 0x7ca1
movq %rax, %r13
movl $0x18, %esi
movq %rbx, %rdi
jmp 0x7ca1
movq %rax, %r13
jmp 0x7c7f
movq %rax, %r13
movq 0x48(%rsp), %rdi
leaq 0x58(%rsp), %rax
cmpq %rax, %rdi
je 0x7c7f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0x6270
movl $0x30, %esi
movq %r14, %rdi
jmp 0x7ca1
movq %rax, %r13
movl $0x10, %esi
movq %r15, %rdi
jmp 0x7ca1
movq %rax, %r13
movl $0x20, %esi
movq %r12, %rdi
callq 0x6270
movq %r13, %rdi
callq 0x6460