// File: jianxinzhou[P]Smart/./src/MyTask.cpp
// Function: MyTask::excute(MyCache&)
void MyTask::excute(MyCache& cache) // cache_通过工作线程传入
{
    peerfd_ = socket(AF_INET, SOCK_DGRAM, 0);
    std::cout << "Task excute" << std::endl ;
    std::unordered_map<std::string, std::string>::iterator iter;
    iter =  cache.isMapped(queryWord_);
	if(iter != cache.hashmap_.end())
	{
        std::cout << " cached "  << std::endl;
        int iret = sendto(peerfd_, (iter -> second).c_str(), 
                  (iter -> second).size(), 0, 
                  (struct sockaddr*)&addr_, sizeof(addr_));
        std::cout <<"send: " << iret << std::endl ;
    }
    else 
	{
		std::cout << " no cached " << std::endl ;
        get_result();
        //std::cout << inet_ntoa(m_addr.sin_addr) << std::endl ;
        if(result_.empty())
        {
            std::string res = "no anwser !" ;
            int iret = sendto(peerfd_, res.c_str(), 
                       res.size(), 0, 
                       (struct sockaddr*)&addr_, sizeof(addr_));
            std::cout <<"send: " << iret << std::endl;
        }
        else 
        {
            MyResult res = result_.top();
            int iret = sendto(peerfd_, res.word_.c_str(), 
                              res.word_.size(), 0, 
                              (struct sockaddr*)&addr_, sizeof(addr_));
            std::cout <<"send:" << iret << std::endl ;
            cache.map_to_cache(queryWord_, res.word_);
        }
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0xa0(%rbp)
movl $0x2, %esi
xorl %edx, %edx
movl %esi, %edi
callq 0x30e0
movl %eax, %ecx
movq -0xa0(%rbp), %rax
movl %ecx, 0x30(%rax)
movq 0xd201(%rip), %rdi      # 0x1cfd0
leaq 0x343c(%rip), %rsi      # 0x13212
callq 0x32c0
movq %rax, %rdi
movq 0xd1d3(%rip), %rsi      # 0x1cfb8
callq 0x3310
leaq -0x18(%rbp), %rdi
callq 0x109f0
movq -0xa0(%rbp), %rsi
movq -0x10(%rbp), %rdi
callq 0x10a10
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x10a70
movq %rax, -0x28(%rbp)
leaq -0x18(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x10a40
testb $0x1, %al
jne 0xfe32
jmp 0xfef2
movq 0xd197(%rip), %rdi      # 0x1cfd0
leaq 0x33e8(%rip), %rsi      # 0x13228
callq 0x32c0
movq %rax, %rdi
movq 0xd169(%rip), %rsi      # 0x1cfb8
callq 0x3310
movq -0xa0(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0xac(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x3150
movq %rax, -0xa8(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x10aa0
movq %rax, %rdi
addq $0x20, %rdi
callq 0x3220
movq -0xa0(%rbp), %r8
movl -0xac(%rbp), %edi
movq -0xa8(%rbp), %rsi
movq %rax, %rdx
addq $0x20, %r8
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x3070
movl %eax, -0x2c(%rbp)
movq 0xd109(%rip), %rdi      # 0x1cfd0
leaq 0x3350(%rip), %rsi      # 0x1321e
callq 0x32c0
movq %rax, %rdi
movl -0x2c(%rbp), %esi
callq 0x3520
movq %rax, %rdi
movq 0xd0d0(%rip), %rsi      # 0x1cfb8
callq 0x3310
jmp 0x10186
movq 0xd0d7(%rip), %rdi      # 0x1cfd0
leaq 0x3325(%rip), %rsi      # 0x13225
callq 0x32c0
movq %rax, %rdi
movq 0xd0a9(%rip), %rsi      # 0x1cfb8
callq 0x3310
movq -0xa0(%rbp), %rdi
callq 0x101a0
movq -0xa0(%rbp), %rdi
addq $0x48, %rdi
callq 0x10ad0
testb $0x1, %al
jne 0xff39
jmp 0x10064
leaq -0x51(%rbp), %rdi
movq %rdi, -0xb8(%rbp)
callq 0x3540
movq -0xb8(%rbp), %rdx
leaq 0x32da(%rip), %rsi      # 0x13231
leaq -0x50(%rbp), %rdi
callq 0x3410
jmp 0xff62
leaq -0x51(%rbp), %rdi
callq 0x3320
movq -0xa0(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0xcc(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0xd8(%rbp)
callq 0x3150
movq -0xd8(%rbp), %rdi
movq %rax, -0xc8(%rbp)
callq 0x3220
movq -0xa0(%rbp), %r8
movl -0xcc(%rbp), %edi
movq -0xc8(%rbp), %rsi
movq %rax, %rdx
addq $0x20, %r8
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x3070
movq %rax, -0xc0(%rbp)
jmp 0xffcf
movq -0xc0(%rbp), %rax
movl %eax, -0x68(%rbp)
movq 0xcff0(%rip), %rdi      # 0x1cfd0
leaq 0x3237(%rip), %rsi      # 0x1321e
callq 0x32c0
movq %rax, -0xe0(%rbp)
jmp 0xfff5
movq -0xe0(%rbp), %rdi
movl -0x68(%rbp), %esi
callq 0x3520
movq %rax, -0xe8(%rbp)
jmp 0x1000d
movq -0xe8(%rbp), %rdi
movq 0xcf9d(%rip), %rsi      # 0x1cfb8
callq 0x3310
jmp 0x10022
leaq -0x50(%rbp), %rdi
callq 0x31f0
jmp 0x10184
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x51(%rbp), %rdi
callq 0x3320
jmp 0x1018f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x31f0
jmp 0x1018f
movq -0xa0(%rbp), %rdi
addq $0x48, %rdi
callq 0x10af0
movq %rax, %rsi
leaq -0x90(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0xcd90
movq -0x108(%rbp), %rdi
movq -0xa0(%rbp), %rax
movl 0x30(%rax), %eax
movl %eax, -0xfc(%rbp)
callq 0x3150
movq -0x108(%rbp), %rdi
movq %rax, -0xf8(%rbp)
callq 0x3220
movq -0xa0(%rbp), %r8
movl -0xfc(%rbp), %edi
movq -0xf8(%rbp), %rsi
movq %rax, %rdx
addq $0x20, %r8
xorl %ecx, %ecx
movl $0x10, %r9d
callq 0x3070
movq %rax, -0xf0(%rbp)
jmp 0x100ea
movq -0xf0(%rbp), %rax
movl %eax, -0x94(%rbp)
movq 0xced2(%rip), %rdi      # 0x1cfd0
leaq 0x3138(%rip), %rsi      # 0x1323d
callq 0x32c0
movq %rax, -0x110(%rbp)
jmp 0x10113
movq -0x110(%rbp), %rdi
movl -0x94(%rbp), %esi
callq 0x3520
movq %rax, -0x118(%rbp)
jmp 0x1012e
movq -0x118(%rbp), %rdi
movq 0xce7c(%rip), %rsi      # 0x1cfb8
callq 0x3310
jmp 0x10143
movq -0xa0(%rbp), %rsi
movq -0x10(%rbp), %rdi
leaq -0x90(%rbp), %rdx
callq 0x10b10
jmp 0x1015c
leaq -0x90(%rbp), %rdi
callq 0xce30
jmp 0x10184
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x60(%rbp)
movl %eax, -0x64(%rbp)
leaq -0x90(%rbp), %rdi
callq 0xce30
jmp 0x1018f
jmp 0x10186
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0x60(%rbp), %rdi
callq 0x3530
nopl (%rax,%rax)