// File: /workspace/github_cpp_makefile_star2_O2/sile[P]unf/src/unf/unf-time.cc
// Function: main
int main(int argc, char** argv) {
  UNF::Normalizer norm;

  std::cerr << "= read: " << std::endl;
  std::vector<std::string> lines;
  std::string line;
  unsigned total_length=0;
  while(std::getline(std::cin,line)) {
    lines.push_back(line);
    total_length += line.size();
  }
  std::cerr << "  == " << lines.size() << " lines" << std::endl;
  std::cerr << "  == " << "average(line length): " << total_length/lines.size() << " byte" << std::endl;

  UNF::Normalizer::Form forms[] = {UNF::Normalizer::FORM_NFD, UNF::Normalizer::FORM_NFC,
				   UNF::Normalizer::FORM_NFKD,UNF::Normalizer::FORM_NFKC};
  const char* form_names[5] = {"NFD ","NFC ","NFKD","NFKC"};
  
  std::cerr << "= time: " << std::endl;
  int n=0;
  for(unsigned formid=0; formid < 4; formid++) {
    std::cerr << "  == " << form_names[formid] << ":  ";
    double beg_t = gettime();
    for(unsigned i=0; i < lines.size(); i++) 
      n += strlen(norm.normalize(lines[i].c_str(), forms[formid]));
    std::cerr << gettime()-beg_t << " sec" << std::endl;    
  }

  std::cerr << "DONE" << std::endl;
  return n;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x148, %rsp            # imm = 0x148
leaq 0x1ddc(%rip), %rax      # 0x40e0
leaq 0xe0(%rsp), %rcx
movq %rax, -0xa0(%rcx)
movl $0x102, -0x98(%rcx)     # imm = 0x102
leaq 0x3fe7c(%rip), %rdx     # 0x421a0
movq %rdx, -0x90(%rcx)
movq %rax, -0x88(%rcx)
movl $0x103, -0x80(%rcx)     # imm = 0x103
movq %rdx, -0x78(%rcx)
movq %rax, -0x70(%rcx)
movl $0x101, -0x68(%rcx)     # imm = 0x101
movq %rdx, -0x60(%rcx)
movq %rax, -0x58(%rcx)
movl $0x105, -0x50(%rcx)     # imm = 0x105
andq $0x0, -0x48(%rcx)
movq %rax, -0x40(%rcx)
movl $0x106, -0x38(%rcx)     # imm = 0x106
andq $0x0, -0x30(%rcx)
movq %rax, -0x28(%rcx)
movl $0x104, -0x20(%rcx)     # imm = 0x104
andq $0x0, -0x18(%rcx)
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
xorl %eax, %eax
movb %al, (%rcx)
leaq 0x100(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
leaq 0x120(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, (%rcx)
xorpd %xmm0, %xmm0
movupd %xmm0, 0x10(%rcx)
andq $0x0, 0x20(%rcx)
movq 0x65c24(%rip), %rdi     # 0x67fe8
leaq 0x1c55(%rip), %rsi      # 0x4020
callq 0x2110
movq %rax, %rdi
callq 0x2090
xorpd %xmm0, %xmm0
movq %rsp, %rbx
movapd %xmm0, (%rbx)
andq $0x0, 0x10(%rbx)
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
xorl %ebp, %ebp
movq 0x65bce(%rip), %r14     # 0x67fd0
leaq 0x20(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x2040
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2431
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2644
addl 0x28(%rsp), %ebp
jmp 0x2407
movq 0x65bb0(%rip), %rdi     # 0x67fe8
leaq 0x1bea(%rip), %rsi      # 0x4029
callq 0x2110
movq 0x8(%rsp), %rsi
subq (%rsp), %rsi
sarq $0x5, %rsi
movq %rax, %rdi
callq 0x20d0
leaq 0x1bcf(%rip), %rsi      # 0x402f
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
callq 0x2090
movq 0x65b71(%rip), %rdi     # 0x67fe8
leaq 0x1bab(%rip), %rsi      # 0x4029
callq 0x2110
leaq 0x1bac(%rip), %rsi      # 0x4036
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
movl %ebp, %eax
movq 0x8(%rsp), %rcx
subq (%rsp), %rcx
sarq $0x5, %rcx
xorl %edx, %edx
divq %rcx
movq %rax, %rsi
callq 0x20d0
leaq 0x1b95(%rip), %rsi      # 0x404d
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
callq 0x2090
movq 0x65b19(%rip), %rdi     # 0x67fe8
leaq 0x1b91(%rip), %rsi      # 0x4067
callq 0x2110
movq %rax, %rdi
callq 0x2090
xorl %r15d, %r15d
movq 0x65afb(%rip), %r14     # 0x67fe8
leaq 0x1bdc(%rip), %r12      # 0x40d0
leaq 0x40(%rsp), %r13
xorl %ebx, %ebx
cmpq $0x4, %r15
je 0x25b1
movq %r14, %rdi
leaq 0x1b1a(%rip), %rsi      # 0x4029
callq 0x2110
leaq 0x65865(%rip), %rcx     # 0x67d80
movq (%rcx,%r15,8), %rsi
movq %rax, %rdi
callq 0x2110
movq %rax, %rdi
leaq 0x1b3f(%rip), %rsi      # 0x4070
callq 0x2110
xorl %ebp, %ebp
callq 0x2670
movsd %xmm0, 0x18(%rsp)
movl %ebp, %ebp
movq (%rsp), %rax
movq 0x8(%rsp), %rcx
subq %rax, %rcx
sarq $0x5, %rcx
cmpq %rbp, %rcx
jbe 0x257f
movq %rbp, %rcx
shlq $0x5, %rcx
movq (%rax,%rcx), %rsi
movl (%r12,%r15,4), %edx
movq %r13, %rdi
callq 0x26a0
movq %rax, %rdi
callq 0x2080
addl %eax, %ebx
incl %ebp
jmp 0x2543
callq 0x2670
subsd 0x18(%rsp), %xmm0
movq %r14, %rdi
callq 0x2170
movq %rax, %rdi
leaq 0x1ad8(%rip), %rsi      # 0x4074
callq 0x2110
movq %rax, %rdi
callq 0x2090
incq %r15
jmp 0x24fb
movq 0x65a30(%rip), %rdi     # 0x67fe8
leaq 0x1aba(%rip), %rsi      # 0x4079
callq 0x2110
movq %rax, %rdi
callq 0x2090
leaq 0x20(%rsp), %rdi
callq 0x2130
movq %rsp, %rdi
callq 0x26da
leaq 0x40(%rsp), %rdi
callq 0x2718
movl %ebx, %eax
addq $0x148, %rsp            # imm = 0x148
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2607
movq %rax, %rbx
jmp 0x2621
jmp 0x2614
jmp 0x2614
movq %rax, %rbx
jmp 0x2629
jmp 0x2614
jmp 0x2614
jmp 0x2614
jmp 0x2614
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x2130
movq %rsp, %rdi
callq 0x26da
leaq 0x40(%rsp), %rdi
callq 0x2718
movq %rbx, %rdi
callq 0x21b0
movq %rax, %rdi
callq 0x26cf
nop