// File: rcolomina[P]the_charmed_house/src/item_creator.cpp
// Function: ItemGameCreator::createById(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Entidad* ItemGameCreator::createById(std::string itemId){

    // getting element item
    pElem elem_Items=this->searchForGame(string("items"));
    assert(elem_Items!=NULL);
	  
    pElem elem_Item=this->searchForId(elem_Items,itemId);
    assert(elem_Item!=NULL);
	  
    // handler
    TiXmlHandle itemHandle(elem_Item);
	  
    pElem elem_names=itemHandle.FirstChild("names").ToElement();
    assert(elem_names!=NULL);
    vector<std::string> names=getInfoList(elem_names,Name);
	  			 
    pElem elem_descriptions=itemHandle.FirstChild("descriptions").ToElement();
    assert(elem_descriptions!=NULL);
    vector<string> descrip=getInfoList(elem_descriptions,Text);	  

    pElem elem_properties=itemHandle.FirstChild("properties").ToElement();
    assert(elem_properties!=NULL);
	  
    vector<string> prop=getInfoList(elem_properties,Text);	  
    vector<string> propN=getInfoList(elem_properties,Name);

    vector<pair<string,string> > props;
	  
    vector<string>::iterator it1;
    vector<string>::iterator it2;
    for(it1 = propN.begin(),it2 = prop.begin();
        it1 < propN.end() && it2 < prop.end();
        it1++,it2++)
    {
/*			 cout<<"it1:"<<*it1<<" it2:"<<*it2<<endl;		 
			 bool boolvalue=false;
			 if(*it2==string("true"))
                         boolvalue=true;
*/					
//			 pair<string,bool> pa(*it1,boolvalue);
//			 props.push_back(pa);
        pair<string,string> pa(*it1,*it2);
        props.push_back(pa);			 
    }

    const Entidad& ent=Entidad(itemId,names[0],descrip[0]);

    string pathFileText; //TODO: connect with XML
    pItem item=new Item(ent,names,descrip,props,pathFileText);
	
    return item;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x390, %rsp            # imm = 0x390
movq %rsi, -0x348(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x340(%rbp)
leaq -0x39(%rbp), %rdi
movq %rdi, -0x338(%rbp)
callq 0x56d0
movq -0x338(%rbp), %rdx
leaq 0x1678e(%rip), %rsi     # 0x50931
leaq -0x38(%rbp), %rdi
callq 0x299c0
jmp 0x3a1ae
movq -0x340(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x295f0
movq %rax, -0x350(%rbp)
jmp 0x3a1c7
leaq -0x38(%rbp), %rdi
callq 0x5748
leaq -0x39(%rbp), %rdi
callq 0x5420
movq -0x350(%rbp), %rax
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x3a1ed
jmp 0x3a23d
leaq 0x16743(%rip), %rdi     # 0x50937
leaq 0x168fb(%rip), %rsi     # 0x50af6
movl $0x12, %edx
leaq 0x16904(%rip), %rcx     # 0x50b0b
callq 0x5250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a22f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x5748
leaq -0x39(%rbp), %rdi
callq 0x5420
jmp 0x3a9af
movq -0x348(%rbp), %rdx
movq -0x340(%rbp), %rdi
leaq -0x18(%rbp), %rsi
callq 0x296a0
movq %rax, -0x58(%rbp)
cmpq $0x0, -0x58(%rbp)
je 0x3a261
jmp 0x3a280
leaq 0x16709(%rip), %rdi     # 0x50971
leaq 0x16887(%rip), %rsi     # 0x50af6
movl $0x15, %edx
leaq 0x16890(%rip), %rcx     # 0x50b0b
callq 0x5250
movq -0x58(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x29940
leaq -0x70(%rbp), %rdi
leaq -0x60(%rbp), %rsi
leaq 0x166e5(%rip), %rdx     # 0x50981
callq 0x4a8e0
leaq -0x70(%rbp), %rdi
callq 0x29960
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
je 0x3a2b7
jmp 0x3a2d6
leaq 0x166c9(%rip), %rdi     # 0x50987
leaq 0x16831(%rip), %rsi     # 0x50af6
movl $0x1b, %edx
leaq 0x1683a(%rip), %rcx     # 0x50b0b
callq 0x5250
movq -0x340(%rbp), %rsi
movq -0x68(%rbp), %rax
movq %rax, -0x90(%rbp)
movl $0x0, -0x94(%rbp)
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rdx
leaq -0x94(%rbp), %rcx
callq 0x29480
leaq 0x16685(%rip), %rdx     # 0x50998
leaq -0xa8(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4a8e0
jmp 0x3a325
leaq -0xa8(%rbp), %rdi
callq 0x29960
movq %rax, -0x358(%rbp)
jmp 0x3a33a
movq -0x358(%rbp), %rax
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x3a354
jmp 0x3a384
leaq 0x1664a(%rip), %rdi     # 0x509a5
leaq 0x16794(%rip), %rsi     # 0x50af6
movl $0x1f, %edx
leaq 0x1679d(%rip), %rcx     # 0x50b0b
callq 0x5250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a9a3
movq -0x340(%rbp), %rsi
movq -0xa0(%rbp), %rax
movq %rax, -0xc8(%rbp)
movl $0x1, -0xcc(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0xc8(%rbp), %rdx
leaq -0xcc(%rbp), %rcx
callq 0x29480
jmp 0x3a3bf
leaq 0x165f7(%rip), %rdx     # 0x509bd
leaq -0xe0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x4a8e0
jmp 0x3a3d8
leaq -0xe0(%rbp), %rdi
callq 0x29960
movq %rax, -0x360(%rbp)
jmp 0x3a3ed
movq -0x360(%rbp), %rax
movq %rax, -0xd8(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x3a407
jmp 0x3a437
leaq 0x165ba(%rip), %rdi     # 0x509c8
leaq 0x166e1(%rip), %rsi     # 0x50af6
movl $0x23, %edx
leaq 0x166ea(%rip), %rcx     # 0x50b0b
callq 0x5250
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a997
movq -0x340(%rbp), %rsi
movq -0xd8(%rbp), %rax
movq %rax, -0x100(%rbp)
movl $0x1, -0x104(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x100(%rbp), %rdx
leaq -0x104(%rbp), %rcx
callq 0x29480
jmp 0x3a472
movq -0x340(%rbp), %rsi
movq -0xd8(%rbp), %rax
movq %rax, -0x128(%rbp)
movl $0x0, -0x12c(%rbp)
leaq -0x120(%rbp), %rdi
leaq -0x128(%rbp), %rdx
leaq -0x12c(%rbp), %rcx
callq 0x29480
jmp 0x3a4ad
leaq -0x148(%rbp), %rdi
callq 0x36950
leaq -0x150(%rbp), %rdi
callq 0x36970
leaq -0x158(%rbp), %rdi
callq 0x36970
leaq -0x120(%rbp), %rdi
callq 0x2a3d0
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rax
movq %rax, -0x150(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x2a3d0
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x2a250
movq %rax, -0x170(%rbp)
leaq -0x150(%rbp), %rdi
leaq -0x170(%rbp), %rsi
callq 0x36990
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x361(%rbp)
jne 0x3a54a
jmp 0x3a576
leaq -0xf8(%rbp), %rdi
callq 0x2a250
movq %rax, -0x178(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x178(%rbp), %rsi
callq 0x36990
movb %al, -0x361(%rbp)
movb -0x361(%rbp), %al
testb $0x1, %al
jne 0x3a585
jmp 0x3a64b
leaq -0x150(%rbp), %rdi
callq 0x369d0
movq %rax, -0x370(%rbp)
leaq -0x158(%rbp), %rdi
callq 0x369d0
movq -0x370(%rbp), %rsi
movq %rax, %rdx
leaq -0x1b8(%rbp), %rdi
callq 0x369f0
jmp 0x3a5bc
leaq -0x148(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x36a50
jmp 0x3a5d1
leaq -0x1b8(%rbp), %rdi
callq 0x36ac0
leaq -0x150(%rbp), %rdi
xorl %esi, %esi
callq 0x36af0
movq %rax, -0x1c0(%rbp)
leaq -0x158(%rbp), %rdi
xorl %esi, %esi
callq 0x36af0
movq %rax, -0x1c8(%rbp)
jmp 0x3a513
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a98b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a973
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0x36ac0
jmp 0x3a973
movq -0x348(%rbp), %rsi
leaq -0x258(%rbp), %rdi
callq 0x5180
jmp 0x3a660
xorl %eax, %eax
movl %eax, %esi
leaq -0x88(%rbp), %rdi
callq 0x36b30
movq %rax, %rsi
leaq -0x278(%rbp), %rdi
callq 0x5180
jmp 0x3a681
xorl %eax, %eax
movl %eax, %esi
leaq -0xc0(%rbp), %rdi
callq 0x36b30
movq %rax, %rsi
leaq -0x298(%rbp), %rdi
callq 0x5180
jmp 0x3a6a2
leaq -0x238(%rbp), %rdi
leaq -0x258(%rbp), %rsi
leaq -0x278(%rbp), %rdx
leaq -0x298(%rbp), %rcx
callq 0x36b50
jmp 0x3a6c5
leaq -0x298(%rbp), %rdi
callq 0x5748
leaq -0x278(%rbp), %rdi
callq 0x5748
leaq -0x258(%rbp), %rdi
callq 0x5748
leaq -0x238(%rbp), %rax
movq %rax, -0x1d0(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x5540
movl $0x270, %edi            # imm = 0x270
callq 0x53c0
movq %rax, -0x378(%rbp)
jmp 0x3a716
movb $0x1, -0x329(%rbp)
movq -0x1d0(%rbp), %rax
movq %rax, -0x380(%rbp)
leaq -0x2d8(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x36bf0
jmp 0x3a740
leaq -0x2f0(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0x36bf0
jmp 0x3a755
leaq -0x308(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x36ce0
jmp 0x3a76a
leaq -0x328(%rbp), %rdi
leaq -0x2b8(%rbp), %rsi
callq 0x5180
jmp 0x3a77f
movq -0x380(%rbp), %rsi
movq -0x378(%rbp), %rdi
leaq -0x2d8(%rbp), %rdx
leaq -0x2f0(%rbp), %rcx
leaq -0x308(%rbp), %r8
leaq -0x328(%rbp), %r9
callq 0x402a0
jmp 0x3a7b0
movb $0x0, -0x329(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x5748
leaq -0x308(%rbp), %rdi
callq 0x36dd0
leaq -0x2f0(%rbp), %rdi
callq 0x298b0
leaq -0x2d8(%rbp), %rdi
callq 0x298b0
movq -0x378(%rbp), %rax
movq %rax, -0x2c0(%rbp)
movq -0x2c0(%rbp), %rax
movq %rax, -0x388(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0x5748
leaq -0x238(%rbp), %rdi
callq 0x2d510
leaq -0x148(%rbp), %rdi
callq 0x36dd0
leaq -0x120(%rbp), %rdi
callq 0x298b0
leaq -0xf8(%rbp), %rdi
callq 0x298b0
leaq -0xc0(%rbp), %rdi
callq 0x298b0
leaq -0x88(%rbp), %rdi
callq 0x298b0
movq -0x388(%rbp), %rax
addq $0x390, %rsp            # imm = 0x390
popq %rbp
retq
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a8a7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a89b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x298(%rbp), %rdi
callq 0x5748
leaq -0x278(%rbp), %rdi
callq 0x5748
leaq -0x258(%rbp), %rdi
callq 0x5748
jmp 0x3a973
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a95b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a93d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a931
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a925
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0x3a919
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x328(%rbp), %rdi
callq 0x5748
leaq -0x308(%rbp), %rdi
callq 0x36dd0
leaq -0x2f0(%rbp), %rdi
callq 0x298b0
leaq -0x2d8(%rbp), %rdi
callq 0x298b0
testb $0x1, -0x329(%rbp)
jne 0x3a948
jmp 0x3a959
movq -0x378(%rbp), %rdi
movl $0x270, %esi            # imm = 0x270
callq 0x53d0
jmp 0x3a95b
leaq -0x2b8(%rbp), %rdi
callq 0x5748
leaq -0x238(%rbp), %rdi
callq 0x2d510
leaq -0x148(%rbp), %rdi
callq 0x36dd0
leaq -0x120(%rbp), %rdi
callq 0x298b0
leaq -0xf8(%rbp), %rdi
callq 0x298b0
leaq -0xc0(%rbp), %rdi
callq 0x298b0
leaq -0x88(%rbp), %rdi
callq 0x298b0
movq -0x48(%rbp), %rdi
callq 0x56c0
nopl (%rax,%rax)