// File: ncbi[P]amr/tsv.cpp
// Function: Common_sp::TextTable::setHeader()
void TextTable::setHeader ()
{
  RowNum row_num = 0;
  for (const StringVector& row : rows)
  {
    row_num++;
    if (row. size () != header. size ())
      throw Error (*this, "Row " + to_string (row_num) + " contains " + to_string (row. size ()) + " columns whereas header has " + to_string (header. size ()) + " columns");
    FFOR (RowNum, i, row. size ())
    {
      string field (row [i]);
      trim (field);
      Header& h = header [i];
      if (field. empty ())
      {
        h. null = true;
        continue;
      }
      maximize (h. len_max, field. size ());
      if (h. choices. size () <= Header::choices_max)
        h. choices << field;
      if (strNull (field))
        continue;
      if (! h. numeric)
        continue;
      {
        char* endptr = nullptr;
        strtod (field. c_str (), & endptr);
        if (endptr != field. c_str () + field. size ())
        {
          h. numeric = false;
          h. scientific = false;
          h. decimals = 0;
        }
      }
      if (h. numeric)
      {
        bool hasPoint = false;
        streamsize decimals = 0;
        if (getScientific (field, hasPoint, decimals))
          h. scientific = true;
        maximize<streamsize> (h. decimals, decimals);
      }
    }
  }

  // Header::len_max for numeric
  for (const StringVector& row : rows)
    FFOR (RowNum, i, row. size ())
    {
      Header& h = header [i];
      string field (row [i]);
      trim (field);
      if (strNull (field))
        continue;
      if (! h. numeric)
        continue;
      bool hasPoint = false;
      streamsize decimals = 0;
      getScientific (field, hasPoint, decimals);
      maximize (h. len_max, field. size () + (size_t) (h. decimals - decimals) + (! hasPoint));
    }
}

// Assembly:
subq $0x2d8, %rsp            # imm = 0x2D8
movq %rdi, 0x2d0(%rsp)
movq 0x2d0(%rsp), %rax
movq %rax, 0x68(%rsp)
movq $0x0, 0x2c8(%rsp)
addq $0x50, %rax
movq %rax, 0x2c0(%rsp)
movq 0x2c0(%rsp), %rdi
callq 0x304e0
movq %rax, 0x2b8(%rsp)
movq 0x2c0(%rsp), %rdi
callq 0x30510
movq %rax, 0x2b0(%rsp)
leaq 0x2b8(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x30540
testb $0x1, %al
jne 0xb7ccc
jmp 0xb834d
leaq 0x2b8(%rsp), %rdi
callq 0x30580
movq %rax, 0x2a8(%rsp)
movq 0x2c8(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x2c8(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x2f390
movq 0x68(%rsp), %rdi
movq %rax, 0x60(%rsp)
addq $0x30, %rdi
callq 0xbfec0
movq %rax, %rcx
movq 0x60(%rsp), %rax
cmpq %rcx, %rax
je 0xb8003
movb $0x1, 0x177(%rsp)
movl $0x10, %edi
callq 0xc3b0
movq %rax, 0x58(%rsp)
movq 0x2c8(%rsp), %rsi
leaq 0x1c8(%rsp), %rdi
callq 0x2bf10
jmp 0xb7d54
leaq 0x19a60(%rip), %rsi     # 0xd17bb
leaq 0x1e8(%rsp), %rdi
leaq 0x1c8(%rsp), %rdx
callq 0x2a340
jmp 0xb7d72
leaq 0x19d99(%rip), %rdx     # 0xd1b12
leaq 0x208(%rsp), %rdi
leaq 0x1e8(%rsp), %rsi
callq 0x2a2f0
jmp 0xb7d90
movq 0x2a8(%rsp), %rdi
callq 0x2f390
movq %rax, %rsi
leaq 0x198(%rsp), %rdi
callq 0x2bf10
jmp 0xb7daf
leaq 0x228(%rsp), %rdi
leaq 0x208(%rsp), %rsi
leaq 0x198(%rsp), %rdx
callq 0x2dde0
jmp 0xb7dce
leaq 0x199eb(%rip), %rdx     # 0xd17c0
leaq 0x248(%rsp), %rdi
leaq 0x228(%rsp), %rsi
callq 0x2a2f0
jmp 0xb7dec
movq 0x68(%rsp), %rdi
addq $0x30, %rdi
callq 0xbfec0
movq %rax, %rsi
leaq 0x178(%rsp), %rdi
callq 0x2bf10
jmp 0xb7e0c
leaq 0x268(%rsp), %rdi
leaq 0x248(%rsp), %rsi
leaq 0x178(%rsp), %rdx
callq 0x2dde0
jmp 0xb7e2b
leaq 0x199ab(%rip), %rdx     # 0xd17dd
leaq 0x288(%rsp), %rdi
leaq 0x268(%rsp), %rsi
callq 0x2a2f0
jmp 0xb7e49
movq 0x68(%rsp), %rsi
movq 0x58(%rsp), %rdi
leaq 0x288(%rsp), %rdx
callq 0x3a690
jmp 0xb7e62
movq 0x58(%rsp), %rdi
movb $0x0, 0x177(%rsp)
leaq 0x4ca8a(%rip), %rsi     # 0x104900
leaq -0x7d71d(%rip), %rdx    # 0x3a760
callq 0xcc80
jmp 0xb85e9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fe8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fdb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fc1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fb4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7fa7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7f9a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7f8d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb7f80
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x288(%rsp), %rdi
callq 0xce98
leaq 0x268(%rsp), %rdi
callq 0xce98
leaq 0x178(%rsp), %rdi
callq 0xce98
leaq 0x248(%rsp), %rdi
callq 0xce98
leaq 0x228(%rsp), %rdi
callq 0xce98
leaq 0x198(%rsp), %rdi
callq 0xce98
leaq 0x208(%rsp), %rdi
callq 0xce98
leaq 0x1e8(%rsp), %rdi
callq 0xce98
leaq 0x1c8(%rsp), %rdi
callq 0xce98
testb $0x1, 0x177(%rsp)
jne 0xb7ff4
jmp 0xb7ffe
movq 0x58(%rsp), %rdi
callq 0xc580
jmp 0xb85dc
movq $0x0, 0x168(%rsp)
movq 0x2a8(%rsp), %rdi
callq 0x2f390
movq %rax, 0x160(%rsp)
movq 0x168(%rsp), %rax
cmpq 0x160(%rsp), %rax
jae 0xb8339
movq 0x2a8(%rsp), %rdi
movq 0x168(%rsp), %rsi
callq 0x2f4e0
movq %rax, %rsi
leaq 0x140(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0xc320
movq 0x50(%rsp), %rdi
callq 0x73800
jmp 0xb8070
movq 0x68(%rsp), %rdi
addq $0x30, %rdi
movq 0x168(%rsp), %rsi
callq 0xbfee0
movq %rax, 0x48(%rsp)
jmp 0xb808d
movq 0x48(%rsp), %rax
movq %rax, 0x138(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xcc10
testb $0x1, %al
jne 0xb80ad
jmp 0xb80e2
movq 0x138(%rsp), %rax
movb $0x1, 0x40(%rax)
movl $0x6, 0x134(%rsp)
jmp 0xb82f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb8327
movq 0x138(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x40(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xc530
movq 0x40(%rsp), %rdi
movq %rax, %rsi
callq 0xc0010
jmp 0xb810f
movq 0x138(%rsp), %rdi
addq $0x48, %rdi
callq 0xc0050
cmpq $0x7, %rax
ja 0xb8143
movq 0x138(%rsp), %rdi
addq $0x48, %rdi
leaq 0x140(%rsp), %rsi
callq 0xc0060
jmp 0xb8141
jmp 0xb8143
leaq 0x140(%rsp), %rdi
callq 0xc00a0
movb %al, 0x3f(%rsp)
jmp 0xb8156
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xb8160
jmp 0xb8170
movl $0x6, 0x134(%rsp)
jmp 0xb82f0
movq 0x138(%rsp), %rax
testb $0x1, 0x30(%rax)
jne 0xb818e
movl $0x6, 0x134(%rsp)
jmp 0xb82f0
movq $0x0, 0x128(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xc300
movq %rax, %rdi
leaq 0x128(%rsp), %rsi
callq 0xcea0
movq 0x128(%rsp), %rax
movq %rax, 0x30(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xc300
movq %rax, 0x28(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xc530
movq 0x28(%rsp), %rcx
movq %rax, %rdx
movq 0x30(%rsp), %rax
addq %rdx, %rcx
cmpq %rcx, %rax
je 0xb8220
movq 0x138(%rsp), %rax
movb $0x0, 0x30(%rax)
movq 0x138(%rsp), %rax
movb $0x0, 0x31(%rax)
movq 0x138(%rsp), %rax
movq $0x0, 0x38(%rax)
movq 0x138(%rsp), %rax
testb $0x1, 0x30(%rax)
je 0xb82e5
movb $0x0, 0x127(%rsp)
movq $0x0, 0x118(%rsp)
leaq 0xf8(%rsp), %rdi
leaq 0x140(%rsp), %rsi
callq 0xc320
jmp 0xb825d
leaq 0xf8(%rsp), %rdi
leaq 0x127(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0x41670
movb %al, 0x27(%rsp)
jmp 0xb8280
leaq 0xf8(%rsp), %rdi
callq 0xce98
movb 0x27(%rsp), %al
testb $0x1, %al
jne 0xb8297
jmp 0xb82c8
movq 0x138(%rsp), %rax
movb $0x1, 0x31(%rax)
jmp 0xb82c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0xf8(%rsp), %rdi
callq 0xce98
jmp 0xb8327
movq 0x138(%rsp), %rdi
addq $0x38, %rdi
movq 0x118(%rsp), %rsi
callq 0xc01b0
jmp 0xb82e3
jmp 0xb82e5
movl $0x0, 0x134(%rsp)
leaq 0x140(%rsp), %rdi
callq 0xce98
movl 0x134(%rsp), %eax
testl %eax, %eax
je 0xb830c
jmp 0xb830a
jmp 0xb830e
jmp 0xb830e
movq 0x168(%rsp), %rax
addq $0x1, %rax
movq %rax, 0x168(%rsp)
jmp 0xb8024
leaq 0x140(%rsp), %rdi
callq 0xce98
jmp 0xb85dc
jmp 0xb833b
leaq 0x2b8(%rsp), %rdi
callq 0x30590
jmp 0xb7cae
movq 0x68(%rsp), %rax
addq $0x50, %rax
movq %rax, 0xf0(%rsp)
movq 0xf0(%rsp), %rdi
callq 0x304e0
movq %rax, 0xe8(%rsp)
movq 0xf0(%rsp), %rdi
callq 0x30510
movq %rax, 0xe0(%rsp)
leaq 0xe8(%rsp), %rdi
leaq 0xe0(%rsp), %rsi
callq 0x30540
testb $0x1, %al
jne 0xb83a6
jmp 0xb85d4
leaq 0xe8(%rsp), %rdi
callq 0x30580
movq %rax, 0xd8(%rsp)
movq $0x0, 0xd0(%rsp)
movq 0xd8(%rsp), %rdi
callq 0x2f390
movq %rax, 0xc8(%rsp)
movq 0xd0(%rsp), %rax
cmpq 0xc8(%rsp), %rax
jae 0xb85c0
movq 0x68(%rsp), %rdi
addq $0x30, %rdi
movq 0xd0(%rsp), %rsi
callq 0xbfee0
movq %rax, 0xc0(%rsp)
movq 0xd8(%rsp), %rdi
movq 0xd0(%rsp), %rsi
callq 0x2f4e0
movq %rax, %rsi
leaq 0xa0(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xc320
movq 0x18(%rsp), %rdi
callq 0x73800
jmp 0xb8446
leaq 0xa0(%rsp), %rdi
callq 0xc00a0
movb %al, 0x17(%rsp)
jmp 0xb8459
movb 0x17(%rsp), %al
testb $0x1, %al
jne 0xb8463
jmp 0xb848c
movl $0xb, 0x134(%rsp)
jmp 0xb855c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
jmp 0xb85b1
movq 0xc0(%rsp), %rax
testb $0x1, 0x30(%rax)
jne 0xb84aa
movl $0xb, 0x134(%rsp)
jmp 0xb855c
movb $0x0, 0x9f(%rsp)
movq $0x0, 0x90(%rsp)
leaq 0x70(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
callq 0xc320
jmp 0xb84d2
leaq 0x70(%rsp), %rdi
leaq 0x9f(%rsp), %rsi
leaq 0x90(%rsp), %rdx
callq 0x41670
jmp 0xb84ee
leaq 0x70(%rsp), %rdi
callq 0xce98
movq 0xc0(%rsp), %rax
addq $0x28, %rax
movq %rax, 0x8(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0xc530
movq 0x8(%rsp), %rdi
movq %rax, %rsi
movq 0xc0(%rsp), %rax
movq 0x38(%rax), %rax
movq 0x90(%rsp), %rcx
subq %rcx, %rax
addq %rax, %rsi
movb 0x9f(%rsp), %al
notb %al
movzbl %al, %eax
andl $0x1, %eax
addq %rax, %rsi
callq 0xc0010
jmp 0xb8551
movl $0x0, 0x134(%rsp)
leaq 0xa0(%rsp), %rdi
callq 0xce98
movl 0x134(%rsp), %eax
testl %eax, %eax
je 0xb8578
jmp 0xb8576
jmp 0xb857a
jmp 0xb857a
movq 0xd0(%rsp), %rax
addq $0x1, %rax
movq %rax, 0xd0(%rsp)
jmp 0xb83dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1c0(%rsp)
movl %eax, 0x1bc(%rsp)
leaq 0x70(%rsp), %rdi
callq 0xce98
leaq 0xa0(%rsp), %rdi
callq 0xce98
jmp 0xb85dc
jmp 0xb85c2
leaq 0xe8(%rsp), %rdi
callq 0x30590
jmp 0xb8388
addq $0x2d8, %rsp            # imm = 0x2D8
retq
movq 0x1c0(%rsp), %rdi
callq 0xccf0
nopl (%rax)