// File: /workspace/github_cpp_makefile_star2_O1/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 0x7e77c
testl %ebp, %ebp
jne 0x7e88e
leaq 0x68(%rsp), %rdi
leaq 0x2(%rsp), %rsi
callq 0xa0b0
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0xa720
cmpq $0x0, 0x10(%rsp)
jne 0x7e824
movzwl 0x2(%rsp), %ecx
leal -0x3e9(%rcx), %eax
movzwl %ax, %eax
cmpl $0x5db, %eax            # imm = 0x5DB
jae 0x7e824
jmp 0x7e82c
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), %edx
decl %edx
movw %dx, 0x4(%rsp)
cmpq $0x0, 0x10(%rsp)
jne 0x7e824
movzwl 0x2(%rsp), %ecx
leal -0x3e9(%rcx), %esi
movzwl %si, %esi
cmpl $0x5da, %esi            # imm = 0x5DA
ja 0x7e824
cmpw $0xc, %ax
setb %sil
cmpw $0x1f, %dx
setb %dil
andb %sil, %dil
cmpb $0x1, %dil
jne 0x7e824
movb 0x1(%rsp), %sil
cmpb (%rsp), %sil
je 0x7e830
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edx, %edx
leaq 0x31469(%rip), %rsi     # 0xafca0
movq %rsi, (%rbx)
movw %cx, 0x8(%rbx)
movb %al, 0xa(%rbx)
movb %dl, 0xb(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e85b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x316f6(%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 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x11cfc(%rip), %rsi     # 0x905a8
leaq 0x11d2f(%rip), %rdx     # 0x905e2
leaq 0x48(%rsp), %rdi
callq 0x2fdd8
leaq 0x11d1f(%rip), %rsi     # 0x905e3
leaq 0x48(%rsp), %rdi
callq 0xaac0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x7e8f0
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x7e8fd
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rdx
leaq 0x28(%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 0x316bb(%rip), %rsi     # 0xaffe8
movq 0x3162c(%rip), %rdx     # 0xaff60
movq %rbx, %rdi
callq 0xa9b0
movq %rax, %r14
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x7e95e
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x7e95e
movq %rax, %r14
movb $0x1, %bpl
movq 0x48(%rsp), %rdi
cmpq %r12, %rdi
je 0x7e97d
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x7e97d
movq %rax, %r14
movb $0x1, %bpl
testb %bpl, %bpl
je 0x7e98f
movq %rbx, %rdi
callq 0xa440
jmp 0x7e98f
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7e9a6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq 0x315ab(%rip), %rsi     # 0xaff58
leaq 0x68(%rsp), %rdi
callq 0xa7e0
leaq 0xe0(%rsp), %rdi
callq 0xa1c0
movq %r14, %rdi
callq 0xaa10