// File: /workspace/github_cpp_makefile_star2_O2/ahupowerdns[P]spamidea/getsender.cc
// Function: processLine(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, MailTreeNode*&)
void processLine(std::string& l, MailTreeNode*& start)
{
  //std::regex received_regex(R"(Received: from ([\S.]+) \(([^)]*)\) by ([\S.]+) \(([^)]*)\).*for <(.*@.*)>.*)");



  if(boost::starts_with(l, "Received: ")) {
    auto pos = l.find(';');
    if(pos != string::npos)
      l.resize(pos);
    // Received: from server.ds9a.nl ([127.0.0.1]) by localhost (server.ds9a.nl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id CedExUADWeuK for <ahu@ds9a.nl>

    //             their chosen name       what we think of that                       ourname    sometimes address                            destination
    // Received: from mail.ietf.org (mail.ietf.org [IPv6:2001:1900:3001:11::2c]) by server.ds9a.nl (Postfix) with ESMTPS id 30A4DAC011D for <bert@hubertnet.nl>



    std::smatch received_match;
    cout<<l<<endl;
    string fromServer, fromAddress, ourName, ourAddress, forAddress;
    
    if(std::regex_search(l, received_match, received_regex)) {
      static std::vector<pair<string*, int>> l({
        {&fromServer, 1},
            {&ourName, 2}
        });

          
      for(auto& p : l)
        *p.first = received_match[p.second];

      if(ourName != "localhost") {
        start=start->add(ourName);
      }

      cout << "\t"<<received_match[1] << " | " << received_match[2] << " | " << received_match[3]<< " | " << received_match[4] << endl;
    }
    else if(std::regex_search(l, received_match, received_regex2)) {
      ourName = received_match[1];
      start=start->add(ourName);
      cout << "\t"<<received_match[1] << " | " << received_match[2] << " | " << received_match[3]<< " | " << received_match[4] << endl;
    }
    else
      cout << "\tNo match"<<endl;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf0, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xd92d(%rip), %rsi      # 0x12137
callq 0xfcbc
testb %al, %al
je 0x4c69
pushq $0x3b
popq %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x43f0
cmpq $-0x1, %rax
je 0x4835
movq %r14, %rdi
movq %rax, %rsi
callq 0x4420
xorps %xmm0, %xmm0
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movq 0x18767(%rip), %rdi     # 0x1cfb0
movq %r14, %rsi
callq 0x42a0
movq %rax, %rdi
callq 0x4160
leaq 0x80(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
leaq 0xe0(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0xc0(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
leaq 0xa0(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x18e8a(%rip), %rdx     # 0x1d748
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x51ee
pushq $0x18
popq %r12
testb %al, %al
je 0x4954
movb 0x18ec5(%rip), %al      # 0x1d7a0
testb %al, %al
je 0x4c7a
movq 0x18e9e(%rip), %r15     # 0x1d788
movq 0x18e9f(%rip), %r13     # 0x1d790
leaq 0x50(%rsp), %r14
cmpq %r13, %r15
je 0x49a4
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x492c
movslq 0x8(%r15), %rdi
movq %rcx, %rax
cqto
idivq %r12
addq $-0x3, %rax
cmpq %rdi, %rax
jbe 0x492c
imulq $0x18, %rdi, %rax
addq %rax, %rsi
jmp 0x4933
addq %rcx, %rsi
addq $-0x48, %rsi
movq %r14, %rdi
callq 0x11e18
movq (%r15), %rdi
movq %r14, %rsi
callq 0x43b0
movq %r14, %rdi
callq 0x4140
addq $0x10, %r15
jmp 0x48f6
leaq 0x18e0d(%rip), %rdx     # 0x1d768
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %ecx, %ecx
callq 0x51ee
testb %al, %al
je 0x4ab0
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4ac8
movq %rcx, %rax
cqto
idivq %r12
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x4ac8
addq $0x18, %rsi
jmp 0x4acf
leaq 0xd797(%rip), %rsi      # 0x12142
leaq 0x30(%rsp), %rdi
callq 0x5249
testb %al, %al
je 0x49c9
movq (%rbx), %rdi
leaq 0x30(%rsp), %rsi
callq 0x5254
movq %rax, (%rbx)
movq 0x185e0(%rip), %rdi     # 0x1cfb0
leaq 0xd775(%rip), %rsi      # 0x1214c
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4a06
movq %rcx, %rax
cqto
idivq %r12
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x4a06
addq $0x18, %rsi
jmp 0x4a0d
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd735(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4a4b
movq %rcx, %rax
cqto
idivq %r12
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0x4a4b
addq $0x30, %rsi
jmp 0x4a52
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd6f0(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4a90
movq %rcx, %rax
cqto
idivq %r12
addq $-0x7, %rax
cmpq $-0x5, %rax
ja 0x4a90
addq $0x48, %rsi
jmp 0x4a97
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd6ab(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
jmp 0x4be6
movq 0x184f9(%rip), %rdi     # 0x1cfb0
leaq 0xd694(%rip), %rsi      # 0x12152
callq 0x42c0
jmp 0x4c1c
addq %rcx, %rsi
addq $-0x48, %rsi
leaq 0x50(%rsp), %rdi
callq 0x11e18
leaq 0x30(%rsp), %r14
leaq 0x50(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x43b0
movq %r15, %rdi
callq 0x4140
movq (%rbx), %rdi
movq %r14, %rsi
callq 0x5254
movq %rax, (%rbx)
movq 0x184a5(%rip), %rdi     # 0x1cfb0
leaq 0xd63a(%rip), %rsi      # 0x1214c
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4b41
movq %rcx, %rax
cqto
idivq %r12
addq $-0x5, %rax
cmpq $-0x3, %rax
ja 0x4b41
addq $0x18, %rsi
jmp 0x4b48
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd5fa(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4b86
movq %rcx, %rax
cqto
idivq %r12
addq $-0x6, %rax
cmpq $-0x4, %rax
ja 0x4b86
addq $0x30, %rsi
jmp 0x4b8d
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd5b5(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4bcb
movq %rcx, %rax
cqto
idivq %r12
addq $-0x7, %rax
cmpq $-0x5, %rax
ja 0x4bcb
addq $0x48, %rsi
jmp 0x4bd2
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
leaq 0xd570(%rip), %rsi      # 0x1214e
movq %rax, %rdi
callq 0x42c0
movq %rax, %rdi
movq 0x10(%rsp), %rsi
movq 0x18(%rsp), %rcx
subq %rsi, %rcx
je 0x4c10
movq %rcx, %rax
cqto
idivq %r12
addq $-0x8, %rax
cmpq $-0x6, %rax
ja 0x4c10
addq $0x60, %rsi
jmp 0x4c17
addq %rcx, %rsi
addq $-0x48, %rsi
callq 0x5417
movq %rax, %rdi
callq 0x4160
leaq 0x90(%rsp), %rdi
callq 0x4140
leaq 0xb0(%rsp), %rdi
callq 0x4140
leaq 0x30(%rsp), %rdi
callq 0x4140
leaq 0xd0(%rsp), %rdi
callq 0x4140
leaq 0x70(%rsp), %rdi
callq 0x4140
leaq 0x10(%rsp), %rdi
callq 0x5dde
addq $0xf0, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x18b1f(%rip), %rdi     # 0x1d7a0
callq 0x4520
testl %eax, %eax
je 0x48e3
leaq 0x70(%rsp), %rax
leaq 0x50(%rsp), %rsi
movq %rax, (%rsi)
movl $0x1, 0x8(%rsi)
leaq 0x30(%rsp), %rax
movq %rax, 0x10(%rsi)
movl $0x2, 0x18(%rsi)
leaq 0x18acf(%rip), %rdi     # 0x1d788
pushq $0x2
popq %rdx
leaq 0xf(%rsp), %rcx
callq 0x520a
leaq 0x577(%rip), %rdi       # 0x5244
leaq 0x18ab4(%rip), %rsi     # 0x1d788
leaq 0x1860d(%rip), %rdx     # 0x1d2e8
callq 0x4290
leaq 0x18ab9(%rip), %rdi     # 0x1d7a0
callq 0x41e0
jmp 0x48e3
movq %rax, %rbx
leaq 0x18aa5(%rip), %rdi     # 0x1d7a0
callq 0x41d0
jmp 0x4d0e
jmp 0x4d0b
movq %rax, %rbx
jmp 0x4d49
jmp 0x4d0b
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x4140
leaq 0xb0(%rsp), %rdi
callq 0x4140
leaq 0x30(%rsp), %rdi
callq 0x4140
leaq 0xd0(%rsp), %rdi
callq 0x4140
leaq 0x70(%rsp), %rdi
callq 0x4140
leaq 0x10(%rsp), %rdi
callq 0x5dde
movq %rbx, %rdi
callq 0x4500