// File: /workspace/github_cpp_makefile_star2_O3/ncbi[P]amr/tsv.cpp
// Function: Common_sp::Date::parse(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, Common_sp::Date::Format)
Date Date::parse (const string &s,
                  Format fmt)
{ 
  istringstream iss (s);
  short year = 0;
  short month = 0;
  short day = 0;
  char c1 = '\0';
  char c2 = '\0';
  string tmp;
  switch (fmt)
  {
    case fmt_Year:
      iss >> year >> tmp;
      if (   tmp. empty ()
          && isYear (year)
         )
        return Date (year);
      break;
    case fmt_YMD:
      iss >> year >> c1 >> month >> c2 >> day >> tmp;
      month--;
      day--;
      if (   tmp. empty ()
          && isYear  (year)
          && isMonth (month)
          && isDay   (day)
          && c1 == c2
         )
        return Date (year, (char) month, (char) day);
      break;
    default: throw runtime_error (FUNC "Unknown date format");
  }
  return Date ();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1e8, %rsp            # imm = 0x1E8
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x68(%rsp), %rdi
movl $0x8, %edx
callq 0xa980
xorl %eax, %eax
movw %ax, 0x2(%rsp)
movw %ax, 0x6(%rsp)
movw %ax, 0x4(%rsp)
movb %al, 0x1(%rsp)
movb %al, (%rsp)
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb %al, (%r15)
cmpl $0x1, %ebp
je 0x7e491
testl %ebp, %ebp
jne 0x7e5b4
leaq 0x68(%rsp), %rdi
leaq 0x2(%rsp), %rsi
callq 0xa0b0
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0xa720
cmpq $0x0, 0x10(%rsp)
jne 0x7e554
movzwl 0x2(%rsp), %eax
leal -0x3e9(%rax), %ecx
movzwl %cx, %ecx
cmpl $0x5da, %ecx            # imm = 0x5DA
ja 0x7e554
leaq 0x31821(%rip), %rcx     # 0xafca0
movq %rcx, (%rbx)
movw %ax, 0x8(%rbx)
movw $0x0, 0xa(%rbx)
jmp 0x7e56a
leaq 0x68(%rsp), %rdi
leaq 0x2(%rsp), %rsi
callq 0xa0b0
leaq 0x1(%rsp), %rsi
movq %rax, %rdi
callq 0xa750
leaq 0x6(%rsp), %rsi
movq %rax, %rdi
callq 0xa0b0
movq %rsp, %rsi
movq %rax, %rdi
callq 0xa750
leaq 0x4(%rsp), %rsi
movq %rax, %rdi
callq 0xa0b0
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0xa720
movzwl 0x6(%rsp), %eax
decl %eax
movw %ax, 0x6(%rsp)
movzwl 0x4(%rsp), %ecx
decl %ecx
movw %cx, 0x4(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x7e554
movzwl 0x2(%rsp), %edx
leal -0x3e9(%rdx), %esi
movzwl %si, %esi
cmpl $0x5db, %esi            # imm = 0x5DB
setb %sil
cmpw $0xc, %ax
setb %dil
cmpw $0x1f, %cx
setb %r8b
andb %dil, %r8b
andb %sil, %r8b
cmpb $0x1, %r8b
jne 0x7e554
movb 0x1(%rsp), %sil
cmpb (%rsp), %sil
jne 0x7e554
leaq 0x3175b(%rip), %rsi     # 0xafca0
movq %rsi, (%rbx)
movw %dx, 0x8(%rbx)
movb %al, 0xa(%rbx)
movb %cl, 0xb(%rbx)
jmp 0x7e56a
movq $0x0, 0x8(%rbx)
leaq 0x3173d(%rip), %rax     # 0xafca0
movq %rax, (%rbx)
movb $0x0, 0xa(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e581
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x319d0(%rip), %rsi     # 0xaff58
leaq 0x68(%rsp), %rdi
callq 0xa7e0
leaq 0xe0(%rsp), %rdi
callq 0xa1c0
movq %rbx, %rax
addq $0x1e8, %rsp            # imm = 0x1E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0xa2c0
movq %rax, %rbx
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x11fd6(%rip), %rsi     # 0x905a8
leaq 0x12009(%rip), %rdx     # 0x905e2
leaq 0x28(%rsp), %rdi
callq 0x2fa1a
leaq 0x11ff9(%rip), %rsi     # 0x905e3
leaq 0x28(%rsp), %rdi
callq 0xaac0
leaq 0x58(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7e616
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x7e623
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, 0x8(%rsi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
movb $0x1, %bpl
movq %rbx, %rdi
callq 0xa930
xorl %ebp, %ebp
movq 0x31995(%rip), %rsi     # 0xaffe8
movq 0x31906(%rip), %rdx     # 0xaff60
movq %rbx, %rdi
callq 0xa9b0
movq %rax, %r14
movq 0x48(%rsp), %rdi
cmpq %r13, %rdi
je 0x7e67c
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x7e693
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
testb %bpl, %bpl
jne 0x7e6b9
jmp 0x7e6c6
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x7e6b9
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x7e6b9
movq %rax, %r14
movq %rbx, %rdi
callq 0xa440
jmp 0x7e6c6
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e6dd
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x31874(%rip), %rsi     # 0xaff58
leaq 0x68(%rsp), %rdi
callq 0xa7e0
leaq 0xe0(%rsp), %rdi
callq 0xa1c0
movq %r14, %rdi
callq 0xaa10
nop