// File: /workspace/github_cpp_makefile_star2_O3/murry2018[P]mogazi/mog.cpp
// Function: main
int main(int argc, char **argv) {
  if (argc != 2) {
    string filename = argv[0];
    string::size_type loc=0, ploc;
    while ((ploc = filename.substr(loc).find('/')) != string::npos)
      loc = ploc+1;
    cout << "usage: " << string(filename.begin() + loc, filename.end())
         << " <Kakaotalk datafile>" << endl;
    return 0;
  }
  ifstream chats(argv[1]);
  kakaotalk::room myroom(chats);
  vector<string> mogazi;

  for (auto& each : myroom.enrolls) {
    auto& m_name = each.first;
    auto& m_info = each.second;

    cout << m_name << ", 한 말의 수: " << int(m_info) << endl;
    if (int(m_info) < 20) {
      mogazi.push_back(m_name);
    }
  }

  sort(mogazi.begin(), mogazi.end());
  cout << "안녕히 가세요 " << endl;
  for (auto& each : mogazi) {
    cout << each << " ";
  }
  cout << endl;

  cout << myroom.member_total() - myroom.enrolls.size()
       << " 명이 조사 결과에서 누락되었습니다." << endl;

  typedef std::pair<std::string, kakaotalk::mem_info> pairtype;
  myroom.enrolls.sort([](const pairtype& x, const pairtype& y)
                      { return x.first < y.first; });
  cout << "재적자 목록" << endl;
  int cnt = 0;
  for (auto& each : myroom.enrolls) {
    cout << '[' << each.first << "] ";
    if (cnt++ / 5 > 0) {
      cnt = 0;
      cout << endl;
    }
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8b8, %rsp            # imm = 0x8B8
cmpl $0x2, %edi
jne 0x4f3d
movq 0x8(%rsi), %rsi
leaq -0x2e0(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x44e0
leaq -0xd8(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x144e0
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0xd8(%rbp), %r14
cmpq %rbx, %r14
je 0x4b20
leaq 0x115c9(%rip), %r15     # 0x16022
movq 0x10(%r14), %rsi
movq 0x18(%r14), %rdx
movq 0x1a550(%rip), %rdi     # 0x1efb8
callq 0x4360
movq %rax, %r12
movl $0x12, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4360
leaq 0x30(%r14), %r13
movq %r13, %rdi
callq 0x6042
movq %r12, %rdi
movl %eax, %esi
callq 0x4490
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r12, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq %r13, %rdi
callq 0x6042
cmpl $0x13, %eax
jg 0x4ada
leaq 0x10(%r14), %rsi
leaq -0x40(%rbp), %rdi
callq 0x5210
movq (%r14), %r14
cmpq %rbx, %r14
jne 0x4a59
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r14
cmpq %r14, %rbx
je 0x4b20
movq %r14, %rax
subq %rbx, %rax
sarq $0x5, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x57d4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x58a8
movq 0x1a491(%rip), %rbx     # 0x1efb8
leaq 0x11507(%rip), %rsi     # 0x16035
movl $0x14, %edx
movq %rbx, %rdi
callq 0x4360
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq 0x1a45f(%rip), %rbx     # 0x1efb8
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r13
cmpq %r13, %r12
je 0x4bae
movq 0x1a43b(%rip), %r14     # 0x1efb8
leaq 0x11486(%rip), %r15     # 0x1600a
movq (%r12), %rsi
movq 0x8(%r12), %rdx
movq %r14, %rdi
callq 0x4360
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4360
addq $0x20, %r12
cmpq %r13, %r12
jne 0x4b84
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq 0x1a3ec(%rip), %rdi     # 0x1efb8
callq 0x4040
movq %rax, %rdi
callq 0x4230
leaq -0xd8(%rbp), %rdi
callq 0x14df6
subq -0xc8(%rbp), %rax
movq 0x1a3c5(%rip), %rdi     # 0x1efb8
movq %rax, %rsi
callq 0x4220
movq %rax, %r14
leaq 0x11445(%rip), %rsi     # 0x1604a
movl $0x32, %edx
movq %rax, %rdi
callq 0x4360
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq -0xd8(%rbp), %rsi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rsi
je 0x4e00
cmpq %rax, (%rsi)
je 0x4e00
leaq -0x60(%rbp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
movq $0x0, 0x10(%rax)
xorl %eax, %eax
leaq (%rax,%rbp), %rcx
addq $-0x8e0, %rcx           # imm = 0xF720
movq %rcx, 0x8(%rcx)
movq %rcx, (%rcx)
movq $0x0, 0x10(%rcx)
addq $0x18, %rax
cmpq $0x600, %rax            # imm = 0x600
jne 0x4c6e
xorl %ebx, %ebx
leaq -0x60(%rbp), %r14
movq %rbx, %r15
movq -0x60(%rbp), %rdi
movq (%rsi), %rdx
cmpq %rsi, %rdi
sete %al
cmpq %rdi, %rdx
sete %cl
orb %al, %cl
jne 0x4cc4
callq 0x4180
incq -0x50(%rbp)
decq -0xc8(%rbp)
leaq (%r15,%rbp), %r12
addq $-0x8e0, %r12           # imm = 0xF720
movl $0x18, %ebx
testq %r15, %r15
movq %r15, -0x68(%rbp)
je 0x4d2d
movq %r12, -0x48(%rbp)
movq %r15, %r12
leaq -0x8e0(%rbp), %r15
cmpq (%r15), %r15
setne %r13b
je 0x4d39
movq %r15, %rdi
movq %r14, %rsi
callq 0x511a
movq %r14, %rdi
movq %r15, %rsi
callq 0x44c0
movq 0x10(%r15), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%r15)
movq %rax, -0x50(%rbp)
addq $0x18, %r15
addq $-0x18, %r12
jne 0x4ceb
movq -0x48(%rbp), %r12
movq %r12, %r15
jmp 0x4d3f
movb $0x1, %r13b
leaq -0x8e0(%rbp), %r15
jmp 0x4d3f
xorl %ebx, %ebx
movq -0x48(%rbp), %r12
movq %r14, %rdi
movq %r15, %rsi
callq 0x44c0
movq 0x10(%r15), %rax
movq -0x50(%rbp), %rcx
movq %rcx, 0x10(%r15)
movq %rax, -0x50(%rbp)
addq -0x68(%rbp), %rbx
movq -0xd8(%rbp), %rsi
leaq -0xd8(%rbp), %rax
cmpq %rax, %rsi
jne 0x4c9a
cmpq $0x18, %rbx
je 0x4da1
addq %rbp, %rbx
addq $-0x8e0, %rbx           # imm = 0xF720
leaq -0x8c8(%rbp), %r14
leaq -0x18(%r14), %rsi
movq %r14, %rdi
callq 0x511a
addq $0x18, %r14
cmpq %rbx, %r14
jne 0x4d8c
leaq -0x18(%r12), %rsi
leaq -0x8(%r12), %rax
leaq 0x10(%r12), %rbx
testb %r13b, %r13b
cmovneq %r12, %rsi
cmoveq %rax, %rbx
leaq -0xd8(%rbp), %r14
movq %r14, %rdi
callq 0x44c0
movq (%rbx), %rax
movq 0x10(%r14), %rcx
movq %rcx, (%rbx)
movq %rax, 0x10(%r14)
movl $0x5e8, %ebx            # imm = 0x5E8
leaq (%rbx,%rbp), %rdi
addq $-0x8e0, %rdi           # imm = 0xF720
callq 0x53a0
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x4ddd
leaq -0x60(%rbp), %rdi
callq 0x53a0
movq 0x1a1b1(%rip), %r14     # 0x1efb8
leaq 0x1126f(%rip), %rsi     # 0x1607d
movl $0x10, %edx
movq %r14, %rdi
callq 0x4360
movq (%r14), %rax
addq -0x18(%rax), %r14
movq %r14, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq 0x1a17f(%rip), %r14     # 0x1efb8
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq -0xd8(%rbp), %r13
leaq -0xd8(%rbp), %rax
cmpq %rax, %r13
je 0x4ee9
xorl %ebx, %ebx
leaq -0x8e0(%rbp), %r15
leaq 0x1121e(%rip), %r12     # 0x1608e
movb $0x5b, -0x8e0(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x4360
movq 0x10(%r13), %rsi
movq 0x18(%r13), %rdx
movq %rax, %rdi
callq 0x4360
movl $0x2, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x4360
cmpl $0x5, %ebx
jl 0x4ed7
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x4040
xorl %ebx, %ebx
movq %rax, %rdi
callq 0x4230
jmp 0x4ed9
incl %ebx
movq (%r13), %r13
leaq -0xd8(%rbp), %rax
cmpq %rax, %r13
jne 0x4e70
leaq -0x40(%rbp), %rdi
callq 0x525c
leaq -0x98(%rbp), %rbx
movq %rbx, %rdi
callq 0x5302
movq -0x20(%rbx), %rdi
leaq -0xa8(%rbp), %rax
cmpq %rax, %rdi
je 0x4f20
movq -0xa8(%rbp), %rsi
incq %rsi
callq 0x42f0
leaq -0xd8(%rbp), %rdi
callq 0x53a0
leaq -0x2e0(%rbp), %rdi
callq 0x4090
jmp 0x5082
movq (%rsi), %rsi
leaq -0x8e0(%rbp), %rdi
leaq -0x2e0(%rbp), %rdx
callq 0x51d2
leaq -0x2d0(%rbp), %r13
xorl %r12d, %r12d
leaq -0x2e0(%rbp), %r14
leaq -0x8e0(%rbp), %r15
movq %r12, %rbx
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
movq $-0x1, %rcx
callq 0x4320
movq %r14, %rdi
movl $0x2f, %esi
xorl %edx, %edx
callq 0x43d0
movq %rax, %r12
movq -0x2e0(%rbp), %rdi
cmpq %r13, %rdi
je 0x4fb0
movq -0x2d0(%rbp), %rsi
incq %rsi
callq 0x42f0
incq %r12
jne 0x4f6b
movq 0x19ffc(%rip), %rdi     # 0x1efb8
leaq 0x11041(%rip), %rsi     # 0x16004
movl $0x7, %edx
callq 0x4360
movq -0x8e0(%rbp), %rdx
addq %rdx, %rbx
addq -0x8d8(%rbp), %rdx
leaq -0x2e0(%rbp), %rdi
movq %r13, (%rdi)
movq %rbx, %rsi
callq 0x548e
movq -0x2e0(%rbp), %rsi
movq -0x2d8(%rbp), %rdx
movq 0x19fb3(%rip), %rdi     # 0x1efb8
callq 0x4360
movq %rax, %rbx
leaq 0x10ff8(%rip), %rsi     # 0x1600c
movl $0x15, %edx
movq %rax, %rdi
callq 0x4360
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x42d0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq -0x2e0(%rbp), %rdi
cmpq %r13, %rdi
je 0x5063
movq -0x2d0(%rbp), %rsi
incq %rsi
callq 0x42f0
leaq -0x8d0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5082
movq -0x8d0(%rbp), %rsi
incq %rsi
callq 0x42f0
xorl %eax, %eax
addq $0x8b8, %rsp            # imm = 0x8B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x50c6
jmp 0x50c6
movq %rax, %rbx
jmp 0x5112
movq %rax, %rbx
jmp 0x5106
movq %rax, %rbx
movq -0x2e0(%rbp), %rdi
cmpq %r13, %rdi
je 0x50c9
movq -0x2d0(%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x50c9
jmp 0x50ee
movq %rax, %rbx
leaq -0x8d0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x5112
movq -0x8d0(%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x5112
jmp 0x50ee
jmp 0x50ee
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x525c
leaq -0xd8(%rbp), %rdi
callq 0x52ca
leaq -0x2e0(%rbp), %rdi
callq 0x4090
movq %rbx, %rdi
callq 0x44a0