// File: 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:
subq $0x278, %rsp            # imm = 0x278
movq %rdi, 0x50(%rsp)
movq %rdi, %rax
movq %rax, 0x58(%rsp)
movq %rdi, 0x270(%rsp)
movq %rsi, 0x268(%rsp)
movl %edx, 0x264(%rsp)
movq 0x268(%rsp), %rsi
leaq 0xe0(%rsp), %rdi
movl $0x8, %edx
callq 0xcc40
movw $0x0, 0xde(%rsp)
movw $0x0, 0xdc(%rsp)
movw $0x0, 0xda(%rsp)
movb $0x0, 0xd9(%rsp)
movb $0x0, 0xd8(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xca10
movl 0x264(%rsp), %eax
movl %eax, 0x60(%rsp)
testl %eax, %eax
je 0xb6033
jmp 0xb6021
movl 0x60(%rsp), %eax
subl $0x1, %eax
je 0xb60d9
jmp 0xb6252
leaq 0xe0(%rsp), %rdi
leaq 0xde(%rsp), %rsi
callq 0xc0e0
movq %rax, 0x48(%rsp)
jmp 0xb604f
movq 0x48(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xc950
jmp 0xb6063
leaq 0xb8(%rsp), %rdi
callq 0xcc10
testb $0x1, %al
jne 0xb6076
jmp 0xb60d4
movswl 0xde(%rsp), %edi
callq 0xbfbe0
movb %al, 0x47(%rsp)
jmp 0xb6089
movb 0x47(%rsp), %al
testb $0x1, %al
jne 0xb6093
jmp 0xb60d4
movq 0x50(%rsp), %rdi
movswl 0xde(%rsp), %esi
xorl %ecx, %ecx
movl %ecx, %edx
callq 0xbfc20
jmp 0xb60ab
movl $0x1, 0xa8(%rsp)
jmp 0xb6376
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0xb639d
jmp 0xb6350
leaq 0xe0(%rsp), %rdi
leaq 0xde(%rsp), %rsi
callq 0xc0e0
movq %rax, 0x38(%rsp)
jmp 0xb60f5
movq 0x38(%rsp), %rdi
leaq 0xd9(%rsp), %rsi
callq 0xc9b0
movq %rax, 0x30(%rsp)
jmp 0xb610e
movq 0x30(%rsp), %rdi
leaq 0xdc(%rsp), %rsi
callq 0xc0e0
movq %rax, 0x28(%rsp)
jmp 0xb6127
movq 0x28(%rsp), %rdi
leaq 0xd8(%rsp), %rsi
callq 0xc9b0
movq %rax, 0x20(%rsp)
jmp 0xb6140
movq 0x20(%rsp), %rdi
leaq 0xda(%rsp), %rsi
callq 0xc0e0
movq %rax, 0x18(%rsp)
jmp 0xb6159
movq 0x18(%rsp), %rdi
leaq 0xb8(%rsp), %rsi
callq 0xc950
jmp 0xb616d
movw 0xdc(%rsp), %ax
addw $-0x1, %ax
movw %ax, 0xdc(%rsp)
movw 0xda(%rsp), %ax
addw $-0x1, %ax
movw %ax, 0xda(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xcc10
testb $0x1, %al
jne 0xb61ab
jmp 0xb624d
movswl 0xde(%rsp), %edi
callq 0xbfbe0
movb %al, 0x17(%rsp)
jmp 0xb61be
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xb61cb
jmp 0xb624d
movswl 0xdc(%rsp), %edi
callq 0xbfc80
movb %al, 0x16(%rsp)
jmp 0xb61de
movb 0x16(%rsp), %al
testb $0x1, %al
jne 0xb61e8
jmp 0xb624d
movswl 0xda(%rsp), %edi
callq 0xbfca0
movb %al, 0x15(%rsp)
jmp 0xb61fb
movb 0x15(%rsp), %al
testb $0x1, %al
jne 0xb6205
jmp 0xb624d
movsbl 0xd9(%rsp), %eax
movsbl 0xd8(%rsp), %ecx
cmpl %ecx, %eax
jne 0xb624d
movq 0x50(%rsp), %rdi
movswl 0xde(%rsp), %esi
movsbl 0xdc(%rsp), %edx
movsbl 0xda(%rsp), %ecx
callq 0xbfc20
jmp 0xb623d
movl $0x1, 0xa8(%rsp)
jmp 0xb6376
jmp 0xb6350
movb $0x1, 0x66(%rsp)
movl $0x10, %edi
callq 0xc3b0
movq %rax, (%rsp)
leaq 0x67(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0xcd00
movq 0x8(%rsp), %rdx
leaq 0x1b3f8(%rip), %rsi     # 0xd1678
leaq 0x68(%rsp), %rdi
callq 0x29fd0
jmp 0xb628c
leaq 0x1b420(%rip), %rdx     # 0xd16b3
leaq 0x88(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x2a2f0
jmp 0xb62a7
movq (%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0xcbb0
jmp 0xb62ba
movq (%rsp), %rdi
movb $0x0, 0x66(%rsp)
movq 0x4fd26(%rip), %rsi     # 0x105ff0
movq 0x4fc9f(%rip), %rdx     # 0x105f70
callq 0xcc80
jmp 0xb63c4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0xb6332
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
jmp 0xb6328
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0xb0(%rsp)
movl %eax, 0xac(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xce98
leaq 0x68(%rsp), %rdi
callq 0xce98
leaq 0x67(%rsp), %rdi
callq 0xc7a0
testb $0x1, 0x66(%rsp)
jne 0xb6345
jmp 0xb634e
movq (%rsp), %rdi
callq 0xc580
jmp 0xb639d
movq 0x50(%rsp), %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0xc410
movq 0x50(%rsp), %rdi
callq 0xbfcc0
movl $0x1, 0xa8(%rsp)
leaq 0xb8(%rsp), %rdi
callq 0xce98
leaq 0xe0(%rsp), %rdi
callq 0xc390
movq 0x58(%rsp), %rax
addq $0x278, %rsp            # imm = 0x278
retq
leaq 0xb8(%rsp), %rdi
callq 0xce98
leaq 0xe0(%rsp), %rdi
callq 0xc390
movq 0xb0(%rsp), %rdi
callq 0xccf0
nopw %cs:(%rax,%rax)