// File: /workspace/github_cpp_makefile_star2_O2/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 $0x8a8, %rsp            # imm = 0x8A8
cmpl $0x2, %edi
jne 0x47bd
movq 0x8(%rsi), %rsi
leaq -0x2d0(%rbp), %rbx
pushq $0x8
popq %rdx
movq %rbx, %rdi
callq 0x44f0
leaq -0xc8(%rbp), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x126e0
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rax
andq $0x0, 0x10(%rax)
movaps %xmm0, (%rax)
movq %r15, %r12
movq (%r15), %r15
cmpq %r12, %r15
je 0x489d
leaq 0x10(%r15), %r13
movq 0x1a846(%rip), %rdi     # 0x1efb0
movq %r13, %rsi
callq 0x42b0
movq %rax, %rdi
leaq 0xf8a6(%rip), %rsi      # 0x14022
callq 0x42d0
movq %rax, %rbx
leaq 0x30(%r15), %r14
movq %r14, %rdi
callq 0x59e4
movq %rbx, %rdi
movl %eax, %esi
callq 0x4490
movq %rax, %rdi
callq 0x4160
movq %r14, %rdi
callq 0x59e4
cmpl $0x13, %eax
jg 0x4753
leaq -0x40(%rbp), %rdi
movq %r13, %rsi
callq 0x4c5e
jmp 0x4753
movq (%rsi), %rsi
leaq -0x8d0(%rbp), %rdi
leaq -0x2d0(%rbp), %rdx
callq 0x4c22
xorl %ebx, %ebx
leaq -0x2d0(%rbp), %r14
pushq $-0x1
popq %r12
pushq $0x2f
popq %r13
movq %rbx, %r15
movq %r14, %rdi
leaq -0x8d0(%rbp), %rsi
movq %rbx, %rdx
movq %r12, %rcx
callq 0x4320
movq %r14, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x43e0
movq %rax, %rbx
movq %r14, %rdi
callq 0x4538
incq %rbx
jne 0x47e4
movq 0x1a790(%rip), %rdi     # 0x1efb0
leaq 0xf7dd(%rip), %rsi      # 0x14004
callq 0x42d0
movq %rax, %r14
movq -0x8d0(%rbp), %rdx
addq %rdx, %r15
addq -0x8c8(%rbp), %rdx
leaq -0x2c0(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x2d0(%rbp), %rdi
movq %r15, %rsi
callq 0x4e58
leaq -0x2d0(%rbp), %rsi
movq %r14, %rdi
callq 0x42b0
leaq 0xf79c(%rip), %rsi      # 0x1400c
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4160
leaq -0x2d0(%rbp), %rdi
callq 0x4538
leaq -0x8d0(%rbp), %rdi
callq 0x4538
jmp 0x4b02
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x5136
movq 0x1a6ff(%rip), %rdi     # 0x1efb0
leaq 0xf77d(%rip), %rsi      # 0x14035
callq 0x42d0
movq %rax, %rdi
callq 0x4160
movq -0x40(%rbp), %rbx
movq -0x38(%rbp), %r12
movq 0x1a6dc(%rip), %r14     # 0x1efb0
leaq 0xf72f(%rip), %r15      # 0x1400a
cmpq %r12, %rbx
je 0x48fc
movq %r14, %rdi
movq %rbx, %rsi
callq 0x42b0
movq %rax, %rdi
movq %r15, %rsi
callq 0x42d0
addq $0x20, %rbx
jmp 0x48db
movq 0x1a6ad(%rip), %rdi     # 0x1efb0
callq 0x4160
leaq -0xc8(%rbp), %r13
movq %r13, %rdi
callq 0x12c7a
subq -0xb8(%rbp), %rax
movq 0x1a68b(%rip), %rdi     # 0x1efb0
movq %rax, %rsi
callq 0x4220
leaq 0xf716(%rip), %rsi      # 0x1404a
movq %rax, %rdi
callq 0x42d0
movq %rax, %rdi
callq 0x4160
movq -0xc8(%rbp), %rcx
cmpq %r13, %rcx
je 0x4a6a
cmpq %r13, (%rcx)
je 0x4a6a
leaq -0x58(%rbp), %rax
movq %rax, 0x8(%rax)
movq %rax, (%rax)
andq $0x0, 0x10(%rax)
xorl %eax, %eax
leaq (%rax,%rbp), %rdx
addq $-0x8d0, %rdx           # imm = 0xF730
movq %rdx, 0x8(%rdx)
movq %rdx, (%rdx)
andq $0x0, 0x10(%rdx)
addq $0x18, %rax
cmpq $0x600, %rax            # imm = 0x600
jne 0x496f
leaq -0x8d0(%rbp), %r13
leaq -0x58(%rbp), %r15
movq %r13, %rbx
leaq -0xc8(%rbp), %rdx
movq %rbx, %r12
movq -0x58(%rbp), %rsi
movq %r15, %rdi
callq 0x5922
movq %r13, %r14
cmpq %r12, %r14
je 0x49df
cmpq (%r14), %r14
je 0x49e7
movq %r14, %rdi
movq %r15, %rsi
callq 0x4b78
movq %r15, %rdi
movq %r14, %rsi
callq 0x58fa
addq $0x18, %r14
jmp 0x49b9
movq %r12, %rsi
pushq $0x18
popq %rbx
jmp 0x49ec
movq %r14, %rsi
xorl %ebx, %ebx
movq %r15, %rdi
callq 0x58fa
addq %r12, %rbx
movq -0xc8(%rbp), %rcx
leaq -0xc8(%rbp), %rdx
cmpq %rdx, %rcx
jne 0x49a7
leaq -0x8d0(%rbp), %rsi
movq %rdx, %r13
leaq 0x18(%rsi), %r15
cmpq %rbx, %r15
je 0x4a2a
movq %r15, %rdi
callq 0x4b78
movq %r15, %rsi
jmp 0x4a14
leaq -0x18(%r12), %rsi
cmpq %r12, %r14
cmoveq %r12, %rsi
leaq -0xc8(%rbp), %rdi
callq 0x58fa
movl $0x5e8, %ebx            # imm = 0x5E8
leaq (%rbx,%rbp), %rdi
addq $-0x8d0, %rdi           # imm = 0xF730
callq 0x4d7a
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x4a47
leaq -0x58(%rbp), %rdi
callq 0x4d7a
movq 0x1a53f(%rip), %rdi     # 0x1efb0
leaq 0xf605(%rip), %rsi      # 0x1407d
callq 0x42d0
movq %rax, %rdi
callq 0x4160
xorl %ebx, %ebx
movq 0x1a522(%rip), %r14     # 0x1efb0
pushq $0x5b
popq %r15
leaq 0xf5f5(%rip), %r12      # 0x1408e
movq (%r13), %r13
leaq -0xc8(%rbp), %rax
cmpq %rax, %r13
je 0x4ae1
movq %r14, %rdi
movl %r15d, %esi
callq 0x4380
leaq 0x10(%r13), %rsi
movq %rax, %rdi
callq 0x42b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x42d0
leal 0x1(%rbx), %eax
cmpl $0x5, %ebx
movl %eax, %ebx
jl 0x4a99
movq %r14, %rdi
callq 0x4160
xorl %ebx, %ebx
jmp 0x4a99
leaq -0x40(%rbp), %rdi
callq 0x4c9a
leaq -0xc8(%rbp), %rdi
callq 0x4cc6
leaq -0x2d0(%rbp), %rdi
callq 0x4090
xorl %eax, %eax
addq $0x8a8, %rsp            # imm = 0x8A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4b37
jmp 0x4b37
movq %rax, %rbx
jmp 0x4b70
movq %rax, %rbx
jmp 0x4b64
movq %rax, %rbx
leaq -0x2d0(%rbp), %rdi
callq 0x4538
jmp 0x4b3a
jmp 0x4b4c
movq %rax, %rbx
leaq -0x8d0(%rbp), %rdi
callq 0x4538
jmp 0x4b70
jmp 0x4b4c
jmp 0x4b4c
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x4c9a
leaq -0xc8(%rbp), %rdi
callq 0x4cc6
leaq -0x2d0(%rbp), %rdi
callq 0x4090
movq %rbx, %rdi
callq 0x44b0