// File: /workspace/github_cpp_makefile_star2_O2/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 %r14
pushq %rbx
subq $0x1f0, %rsp            # imm = 0x1F0
movl %edx, %ebp
movq %rdi, %rbx
leaq 0x70(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0xb9a0
andw $0x0, 0x8(%rsp)
andw $0x0, 0xc(%rsp)
andw $0x0, 0xa(%rsp)
xorl %eax, %eax
leaq 0x20(%rsp), %rcx
movq %rcx, -0x10(%rcx)
andq $0x0, -0x8(%rcx)
movb %al, 0x7(%rsp)
movb %al, 0x6(%rsp)
movb %al, (%rcx)
cmpl $0x1, %ebp
je 0x509bc
testl %ebp, %ebp
jne 0x50ab4
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb0a0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0xb730
cmpq $0x0, 0x18(%rsp)
jne 0x50a7e
movzwl 0x8(%rsp), %eax
leal -0x3e9(%rax), %ecx
cmpw $0x5da, %cx             # imm = 0x5DA
ja 0x50a7e
leaq 0x33305(%rip), %rcx     # 0x83cb0
movq %rcx, (%rbx)
movw %ax, 0x8(%rbx)
andw $0x0, 0xa(%rbx)
jmp 0x50a91
leaq 0x70(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0xb0a0
leaq 0x7(%rsp), %rsi
movq %rax, %rdi
callq 0xb770
leaq 0xc(%rsp), %rsi
movq %rax, %rdi
callq 0xb0a0
leaq 0x6(%rsp), %rsi
movq %rax, %rdi
callq 0xb770
leaq 0xa(%rsp), %rsi
movq %rax, %rdi
callq 0xb0a0
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0xb730
movzwl 0xc(%rsp), %eax
decl %eax
movw %ax, 0xc(%rsp)
movzwl 0xa(%rsp), %ecx
decl %ecx
movw %cx, 0xa(%rsp)
cmpq $0x0, 0x18(%rsp)
jne 0x50a7e
movzwl 0x8(%rsp), %edx
leal -0x3e9(%rdx), %esi
cmpw $0x5db, %si             # imm = 0x5DB
setb %sil
cmpw $0xc, %ax
setb %dil
andb %sil, %dil
cmpw $0x1f, %cx
setb %sil
andb %dil, %sil
cmpb $0x1, %sil
jne 0x50a7e
movb 0x7(%rsp), %sil
cmpb 0x6(%rsp), %sil
jne 0x50a7e
leaq 0x33241(%rip), %rsi     # 0x83cb0
movq %rsi, (%rbx)
movw %dx, 0x8(%rbx)
movb %al, 0xa(%rbx)
movb %cl, 0xb(%rbx)
jmp 0x50a91
andq $0x0, 0x8(%rbx)
leaq 0x33226(%rip), %rax     # 0x83cb0
movq %rax, (%rbx)
movb $0x0, 0xa(%rbx)
leaq 0x10(%rsp), %rdi
callq 0xbb68
leaq 0x70(%rsp), %rdi
callq 0xb2d0
movq %rbx, %rax
addq $0x1f0, %rsp            # imm = 0x1F0
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x10
popq %rdi
callq 0xb300
movq %rax, %rbx
leaq 0xea92(%rip), %rsi      # 0x5f558
leaq 0x30(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x1b7b6
leaq 0xeab7(%rip), %rdx      # 0x5f593
leaq 0x50(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x1b92d
movb $0x1, %bpl
leaq 0x50(%rsp), %rsi
movq %rbx, %rdi
callq 0xb940
xorl %ebp, %ebp
movq 0x334e4(%rip), %rsi     # 0x83fe8
movq 0x33455(%rip), %rdx     # 0x83f60
movq %rbx, %rdi
callq 0xb9d0
movq %rax, %r14
leaq 0x50(%rsp), %rdi
callq 0xbb68
jmp 0x50b28
movq %rax, %r14
movb $0x1, %bpl
leaq 0x30(%rsp), %rdi
callq 0xbb68
testb %bpl, %bpl
jne 0x50b3c
jmp 0x50b49
movq %rax, %r14
movq %rbx, %rdi
callq 0xb470
jmp 0x50b49
movq %rax, %r14
leaq 0x10(%rsp), %rdi
callq 0xbb68
leaq 0x70(%rsp), %rdi
callq 0xb2d0
movq %r14, %rdi
callq 0xba30
nop