// File: /workspace/github_cpp_makefile_star2_O1/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 0x4f48
movq 0x8(%rsi), %rsi
leaq -0x2d8(%rbp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x44e0
leaq -0xd0(%rbp), %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14488
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movq $0x0, -0x30(%rbp)
movq -0xd0(%rbp), %r14
cmpq %rbx, %r14
je 0x4ae6
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 0x60aa
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 0x60aa
cmpl $0x13, %eax
jg 0x4ada
leaq 0x10(%r14), %rsi
leaq -0x40(%rbp), %rdi
callq 0x521c
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 0x57f8
movq %rbx, %rdi
movq %r14, %rsi
callq 0x58e9
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 -0xd0(%rbp), %rdi
callq 0x14dd8
subq -0xc0(%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 -0xd0(%rbp), %rax
leaq -0xd0(%rbp), %rcx
cmpq %rcx, %rax
je 0x4e0b
cmpq %rcx, (%rax)
je 0x4e0b
leaq -0x58(%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 -0x8e0(%rbp), %r15
leaq -0x58(%rbp), %r14
movq -0x58(%rbp), %rdi
movq -0xd0(%rbp), %rsi
movq (%rsi), %rdx
cmpq %rsi, %rdi
sete %al
cmpq %rdi, %rdx
sete %cl
orb %al, %cl
jne 0x4ccf
callq 0x4180
incq -0x48(%rbp)
decq -0xc0(%rbp)
leaq (%rbx,%rbp), %r12
addq $-0x8e0, %r12           # imm = 0xF720
testq %rbx, %rbx
sete %r13b
movq %rbx, -0x60(%rbp)
je 0x4d32
cmpq %r15, -0x8e0(%rbp)
je 0x4d39
movq %r15, %rax
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x5126
movq %r14, %rdi
movq %r15, %rsi
callq 0x44c0
movq 0x10(%r15), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x10(%r15)
movq %rax, -0x48(%rbp)
leaq 0x18(%r15), %rax
cmpq %r12, %rax
sete %r13b
je 0x4d3d
cmpq %rax, (%rax)
jne 0x4cf3
xorl %ebx, %ebx
jmp 0x4d42
movl $0x18, %ebx
jmp 0x4d46
xorl %ebx, %ebx
jmp 0x4d46
movl $0x18, %ebx
addq $0x18, %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x44c0
movq 0x10(%r15), %rax
movq -0x48(%rbp), %rcx
movq %rcx, 0x10(%r15)
movq %rax, -0x48(%rbp)
addq -0x60(%rbp), %rbx
leaq -0xd0(%rbp), %rax
cmpq %rax, -0xd0(%rbp)
leaq -0x8e0(%rbp), %r15
jne 0x4ca1
cmpq $0x18, %rbx
je 0x4dac
addq %rbp, %rbx
addq $-0x8e0, %rbx           # imm = 0xF720
leaq -0x8c8(%rbp), %r14
leaq -0x18(%r14), %rsi
movq %r14, %rdi
callq 0x5126
addq $0x18, %r14
cmpq %rbx, %r14
jne 0x4d97
leaq -0x18(%r12), %rsi
leaq -0x8(%r12), %rax
leaq 0x10(%r12), %rbx
testb %r13b, %r13b
cmovneq %r12, %rsi
cmoveq %rax, %rbx
leaq -0xd0(%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 0x53a8
addq $-0x18, %rbx
cmpq $-0x18, %rbx
jne 0x4de8
leaq -0x58(%rbp), %rdi
callq 0x53a8
movq 0x1a1a6(%rip), %r14     # 0x1efb8
leaq 0x11264(%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 0x1a174(%rip), %r14     # 0x1efb8
movq %r14, %rdi
callq 0x4040
movq %rax, %rdi
callq 0x4230
movq -0xd0(%rbp), %r13
leaq -0xd0(%rbp), %rax
cmpq %rax, %r13
je 0x4ef4
xorl %ebx, %ebx
leaq -0x8e0(%rbp), %r15
leaq 0x11213(%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 0x4ee2
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 0x4ee4
incl %ebx
movq (%r13), %r13
leaq -0xd0(%rbp), %rax
cmpq %rax, %r13
jne 0x4e7b
leaq -0x40(%rbp), %rdi
callq 0x5268
leaq -0x90(%rbp), %rbx
movq %rbx, %rdi
callq 0x530a
movq -0x20(%rbx), %rdi
leaq -0xa0(%rbp), %rax
cmpq %rax, %rdi
je 0x4f2b
movq -0xa0(%rbp), %rsi
incq %rsi
callq 0x42f0
leaq -0xd0(%rbp), %rdi
callq 0x53a8
leaq -0x2d8(%rbp), %rdi
callq 0x4090
jmp 0x508d
movq (%rsi), %rsi
leaq -0x8e0(%rbp), %rdi
leaq -0x2d8(%rbp), %rdx
callq 0x51de
leaq -0x2c8(%rbp), %r13
xorl %r12d, %r12d
leaq -0x2d8(%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 -0x2d8(%rbp), %rdi
cmpq %r13, %rdi
je 0x4fbb
movq -0x2c8(%rbp), %rsi
incq %rsi
callq 0x42f0
incq %r12
jne 0x4f76
movq 0x19ff1(%rip), %rdi     # 0x1efb8
leaq 0x11036(%rip), %rsi     # 0x16004
movl $0x7, %edx
callq 0x4360
movq -0x8e0(%rbp), %rdx
addq %rdx, %rbx
addq -0x8d8(%rbp), %rdx
leaq -0x2d8(%rbp), %rdi
movq %r13, (%rdi)
movq %rbx, %rsi
callq 0x5492
movq -0x2d8(%rbp), %rsi
movq -0x2d0(%rbp), %rdx
movq 0x19fa8(%rip), %rdi     # 0x1efb8
callq 0x4360
movq %rax, %rbx
leaq 0x10fed(%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 -0x2d8(%rbp), %rdi
cmpq %r13, %rdi
je 0x506e
movq -0x2c8(%rbp), %rsi
incq %rsi
callq 0x42f0
leaq -0x8d0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x508d
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 0x50d1
jmp 0x50d1
movq %rax, %rbx
jmp 0x511d
movq %rax, %rbx
jmp 0x5111
movq %rax, %rbx
movq -0x2d8(%rbp), %rdi
cmpq %r13, %rdi
je 0x50d4
movq -0x2c8(%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x50d4
jmp 0x50f9
movq %rax, %rbx
leaq -0x8d0(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x511d
movq -0x8d0(%rbp), %rsi
incq %rsi
callq 0x42f0
jmp 0x511d
jmp 0x50f9
jmp 0x50f9
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x5268
leaq -0xd0(%rbp), %rdi
callq 0x52d2
leaq -0x2d8(%rbp), %rdi
callq 0x4090
movq %rbx, %rdi
callq 0x44a0
nop