// File: Phidelux[P]terminal-table/src/table.cpp
// Function: bornageek::utils::termtab::Table::render[abi:cxx11]() const
const std::string Table::render() const {
        std::stringstream ss;

        std::vector<Row> rowsWithHeadings = this->rowsWithHeadings();
        
        std::string sep = this->renderSeparator(
          this->mStyle.borderLeftMid(), this->mStyle.borderMidMid(), 
          this->mStyle.borderRightMid(), this->mStyle.borderMid());

        if(this->mTitle.length() > 0) {
          std::uint16_t innerWidth = (this->numColumns() - 1) 
              * this->cellSpacing() + this->cellPadding();

          for(std::uint16_t c = 0; c < this->numColumns(); c++) {
            innerWidth += this->columnWidth(c);
          }

          std::uint16_t spaceLeft = innerWidth / 2 - mTitle.length() / 2;

          ss << this->mStyle.borderTopLeft() 
             << std::string(innerWidth, this->mStyle.borderTop())
             << this->mStyle.borderTopRight() << std::endl; 
          ss << this->mStyle.borderLeft() 
             << std::string(spaceLeft, ' ') << std::left 
             << std::setw(innerWidth - spaceLeft) << std::setfill(' ') 
             << this->mTitle; 
          ss << this->mStyle.borderRight() << std::endl << sep;
        } else {
          ss << this->renderSeparator(
            this->mStyle.borderTopLeft(), this->mStyle.borderTopMid(), 
            this->mStyle.borderTopRight(), this->mStyle.borderTop());
        }

        std::for_each(rowsWithHeadings.begin(), --rowsWithHeadings.end(),
          [&ss, sep, rowsWithHeadings](Row row){ 
            if(row.cells().size() > 0) {
              ss << row << sep; 
            }
          });

        if( rowsWithHeadings.size() > 0) {
          ss << rowsWithHeadings.back() << this->renderSeparator(
            this->mStyle.borderBottomLeft(), this->mStyle.borderBottomMid(), 
            this->mStyle.borderBottomRight(), this->mStyle.borderBottom());
        }

        return ss.str();
      }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x4f0, %rsp            # imm = 0x4F0
movq %rdi, -0x330(%rbp)
movq %rdi, %rax
movq %rax, -0x328(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x320(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x3170
movq -0x320(%rbp), %rsi
leaq -0x1b0(%rbp), %rdi
callq 0xa3b0
jmp 0xabd0
movq -0x320(%rbp), %rdi
callq 0x38f0
movq %rax, -0x338(%rbp)
jmp 0xabe5
movq -0x320(%rbp), %rdi
movq -0x338(%rbp), %rax
movb (%rax), %al
movb %al, -0x341(%rbp)
callq 0x3970
movq %rax, -0x340(%rbp)
jmp 0xac09
movq -0x320(%rbp), %rdi
movq -0x340(%rbp), %rax
movb (%rax), %al
movb %al, -0x351(%rbp)
callq 0x39f0
movq %rax, -0x350(%rbp)
jmp 0xac2d
movq -0x320(%rbp), %rdi
movq -0x350(%rbp), %rax
movb (%rax), %al
movb %al, -0x361(%rbp)
callq 0x3930
movq %rax, -0x360(%rbp)
jmp 0xac51
movq -0x320(%rbp), %rsi
movb -0x361(%rbp), %al
movb -0x351(%rbp), %cl
movb -0x341(%rbp), %dl
movq -0x360(%rbp), %rdi
movsbl (%rdi), %r9d
movsbl %dl, %edx
movsbl %cl, %ecx
movsbl %al, %r8d
leaq -0x1e0(%rbp), %rdi
callq 0xa8d0
jmp 0xac8d
movq -0x320(%rbp), %rdi
addq $0x20, %rdi
callq 0x3340
cmpq $0x0, %rax
jbe 0xb1c2
movq -0x320(%rbp), %rdi
callq 0x9be0
movw %ax, -0x364(%rbp)
jmp 0xacbc
movq -0x320(%rbp), %rdi
movw -0x364(%rbp), %ax
movzwl %ax, %eax
decl %eax
movl %eax, -0x36c(%rbp)
callq 0x9d50
movw %ax, -0x366(%rbp)
jmp 0xace3
movq -0x320(%rbp), %rdi
movl -0x36c(%rbp), %eax
movw -0x366(%rbp), %cx
movzwl %cx, %ecx
imull %ecx, %eax
movl %eax, -0x374(%rbp)
callq 0x9d80
movw %ax, -0x36e(%rbp)
jmp 0xad11
movl -0x374(%rbp), %eax
movw -0x36e(%rbp), %cx
movzwl %cx, %ecx
addl %ecx, %eax
movw %ax, -0x1e2(%rbp)
movw $0x0, -0x1e4(%rbp)
movq -0x320(%rbp), %rdi
movzwl -0x1e4(%rbp), %eax
movl %eax, -0x37c(%rbp)
callq 0x9be0
movw %ax, -0x376(%rbp)
jmp 0xad55
movl -0x37c(%rbp), %eax
movw -0x376(%rbp), %cx
movzwl %cx, %ecx
cmpl %ecx, %eax
jge 0xadff
movq -0x320(%rbp), %rdi
movzwl -0x1e4(%rbp), %esi
callq 0xa170
movw %ax, -0x37e(%rbp)
jmp 0xad89
movw -0x37e(%rbp), %ax
movzwl %ax, %ecx
movzwl -0x1e2(%rbp), %eax
addl %ecx, %eax
movw %ax, -0x1e2(%rbp)
movw -0x1e4(%rbp), %ax
addw $0x1, %ax
movw %ax, -0x1e4(%rbp)
jmp 0xad33
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0xb57c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0xb570
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0xb564
movq -0x320(%rbp), %rdi
movzwl -0x1e2(%rbp), %eax
shrl %eax
movl %eax, -0x394(%rbp)
addq $0x20, %rdi
callq 0x3340
movq -0x320(%rbp), %rdi
movq %rax, %rcx
movl -0x394(%rbp), %eax
shrl %ecx
subl %ecx, %eax
movw %ax, -0x1e6(%rbp)
leaq -0x188(%rbp), %rax
movq %rax, -0x390(%rbp)
callq 0x3730
movq %rax, -0x388(%rbp)
jmp 0xae55
movq -0x390(%rbp), %rdi
movq -0x388(%rbp), %rax
movsbl (%rax), %esi
callq 0x32d0
movq %rax, -0x3a0(%rbp)
jmp 0xae74
movq -0x320(%rbp), %rdi
movzwl -0x1e2(%rbp), %eax
movq %rax, -0x3b0(%rbp)
callq 0x36c0
movq %rax, -0x3a8(%rbp)
jmp 0xae97
movq -0x3a8(%rbp), %rax
movsbl (%rax), %eax
movl %eax, -0x3bc(%rbp)
leaq -0x209(%rbp), %rdi
movq %rdi, -0x3b8(%rbp)
callq 0x33d0
movq -0x3b0(%rbp), %rsi
movl -0x3bc(%rbp), %edx
movq -0x3b8(%rbp), %rcx
leaq -0x208(%rbp), %rdi
callq 0x8c40
jmp 0xaedc
movq -0x3a0(%rbp), %rdi
leaq -0x208(%rbp), %rsi
callq 0x3200
movq %rax, -0x3c8(%rbp)
jmp 0xaef8
movq -0x320(%rbp), %rdi
callq 0x3770
movq %rax, -0x3d0(%rbp)
jmp 0xaf0d
movq -0x3c8(%rbp), %rdi
movq -0x3d0(%rbp), %rax
movsbl (%rax), %esi
callq 0x32d0
movq %rax, -0x3d8(%rbp)
jmp 0xaf2c
movq -0x3d8(%rbp), %rdi
movq 0xe06e(%rip), %rsi      # 0x18fa8
callq 0x3260
jmp 0xaf41
leaq -0x208(%rbp), %rdi
callq 0x3140
leaq -0x209(%rbp), %rdi
callq 0x3280
movq -0x320(%rbp), %rdi
leaq -0x188(%rbp), %rax
movq %rax, -0x3e8(%rbp)
callq 0x38b0
movq %rax, -0x3e0(%rbp)
jmp 0xaf7c
movq -0x3e8(%rbp), %rdi
movq -0x3e0(%rbp), %rax
movsbl (%rax), %esi
callq 0x32d0
movq %rax, -0x3f0(%rbp)
jmp 0xaf9b
movzwl -0x1e6(%rbp), %eax
movq %rax, -0x400(%rbp)
leaq -0x231(%rbp), %rdi
movq %rdi, -0x3f8(%rbp)
callq 0x33d0
movq -0x400(%rbp), %rsi
movq -0x3f8(%rbp), %rcx
leaq -0x230(%rbp), %rdi
movl $0x20, %edx
callq 0x8c40
jmp 0xafdd
movq -0x3f0(%rbp), %rdi
leaq -0x230(%rbp), %rsi
callq 0x3200
movq %rax, -0x408(%rbp)
jmp 0xaff9
movq -0x408(%rbp), %rdi
leaq -0x2337(%rip), %rsi     # 0x8cd0
callq 0x3090
movq %rax, -0x410(%rbp)
jmp 0xb015
movzwl -0x1e2(%rbp), %edi
movzwl -0x1e6(%rbp), %eax
subl %eax, %edi
callq 0x8cb0
movl %eax, -0x414(%rbp)
jmp 0xb032
movq -0x410(%rbp), %rdi
movl -0x414(%rbp), %eax
movl %eax, -0x238(%rbp)
movl -0x238(%rbp), %esi
callq 0x32b0
movq %rax, -0x420(%rbp)
jmp 0xb059
movl $0x20, %edi
callq 0x8d00
movb %al, -0x421(%rbp)
jmp 0xb06b
movq -0x420(%rbp), %rdi
movb -0x421(%rbp), %al
movb %al, -0x239(%rbp)
movzbl -0x239(%rbp), %esi
callq 0x3370
movq %rax, -0x430(%rbp)
jmp 0xb093
movq -0x430(%rbp), %rdi
movq -0x320(%rbp), %rsi
addq $0x20, %rsi
callq 0x3200
jmp 0xb0ac
leaq -0x230(%rbp), %rdi
callq 0x3140
leaq -0x231(%rbp), %rdi
callq 0x3280
movq -0x320(%rbp), %rdi
leaq -0x188(%rbp), %rax
movq %rax, -0x440(%rbp)
callq 0x39b0
movq %rax, -0x438(%rbp)
jmp 0xb0e7
movq -0x440(%rbp), %rdi
movq -0x438(%rbp), %rax
movsbl (%rax), %esi
callq 0x32d0
movq %rax, -0x448(%rbp)
jmp 0xb106
movq -0x448(%rbp), %rdi
movq 0xde94(%rip), %rsi      # 0x18fa8
callq 0x3260
movq %rax, -0x450(%rbp)
jmp 0xb122
movq -0x450(%rbp), %rdi
leaq -0x1e0(%rbp), %rsi
callq 0x3200
jmp 0xb137
jmp 0xb2d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0xb16e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x208(%rbp), %rdi
callq 0x3140
leaq -0x209(%rbp), %rdi
callq 0x3280
jmp 0xb564
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
jmp 0xb1b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x230(%rbp), %rdi
callq 0x3140
leaq -0x231(%rbp), %rdi
callq 0x3280
jmp 0xb564
movq -0x320(%rbp), %rdi
leaq -0x188(%rbp), %rax
movq %rax, -0x460(%rbp)
callq 0x3730
movq %rax, -0x458(%rbp)
jmp 0xb1e5
movq -0x320(%rbp), %rdi
movq -0x458(%rbp), %rax
movb (%rax), %al
movb %al, -0x469(%rbp)
callq 0x36f0
movq %rax, -0x468(%rbp)
jmp 0xb209
movq -0x320(%rbp), %rdi
movq -0x468(%rbp), %rax
movb (%rax), %al
movb %al, -0x479(%rbp)
callq 0x3770
movq %rax, -0x478(%rbp)
jmp 0xb22d
movq -0x320(%rbp), %rdi
movq -0x478(%rbp), %rax
movb (%rax), %al
movb %al, -0x489(%rbp)
callq 0x36c0
movq %rax, -0x488(%rbp)
jmp 0xb251
movq -0x320(%rbp), %rsi
movb -0x489(%rbp), %al
movb -0x479(%rbp), %cl
movb -0x469(%rbp), %dl
movq -0x488(%rbp), %rdi
movsbl (%rdi), %r9d
movsbl %dl, %edx
movsbl %cl, %ecx
movsbl %al, %r8d
leaq -0x260(%rbp), %rdi
callq 0xa8d0
jmp 0xb28d
movq -0x460(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x3200
jmp 0xb2a2
leaq -0x260(%rbp), %rdi
callq 0x3140
jmp 0xb2d3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x3140
jmp 0xb564
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x4a0(%rbp)
callq 0xbb20
movq -0x4a0(%rbp), %rdi
movq %rax, -0x2a8(%rbp)
callq 0xbb50
movq %rax, -0x2b8(%rbp)
leaq -0x2b8(%rbp), %rdi
callq 0xc240
movq (%rax), %rax
movq %rax, -0x2b0(%rbp)
leaq -0x198(%rbp), %rax
movq %rax, -0x2f8(%rbp)
leaq -0x2f0(%rbp), %rdi
movq %rdi, -0x498(%rbp)
leaq -0x1e0(%rbp), %rsi
callq 0x30c0
jmp 0xb340
leaq -0x2d0(%rbp), %rdi
leaq -0x1b0(%rbp), %rsi
callq 0xbe70
jmp 0xb355
movq -0x2a8(%rbp), %rsi
movq -0x2b0(%rbp), %rdx
leaq -0x2a0(%rbp), %rdi
leaq -0x2f8(%rbp), %rcx
callq 0xb5a0
jmp 0xb378
leaq -0x2a0(%rbp), %rdi
callq 0xb650
leaq -0x2f8(%rbp), %rdi
callq 0xb650
leaq -0x1b0(%rbp), %rdi
callq 0xbbb0
cmpq $0x0, %rax
jbe 0xb51b
leaq -0x188(%rbp), %rax
movq %rax, -0x4b0(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0xc2d0
movq -0x4b0(%rbp), %rdi
movq %rax, %rsi
callq 0xc260
movq %rax, -0x4a8(%rbp)
jmp 0xb3d8
movq -0x320(%rbp), %rdi
callq 0x3830
movq %rax, -0x4b8(%rbp)
jmp 0xb3ed
movq -0x320(%rbp), %rdi
movq -0x4b8(%rbp), %rax
movb (%rax), %al
movb %al, -0x4c1(%rbp)
callq 0x37f0
movq %rax, -0x4c0(%rbp)
jmp 0xb411
movq -0x320(%rbp), %rdi
movq -0x4c0(%rbp), %rax
movb (%rax), %al
movb %al, -0x4d1(%rbp)
callq 0x3870
movq %rax, -0x4d0(%rbp)
jmp 0xb435
movq -0x320(%rbp), %rdi
movq -0x4d0(%rbp), %rax
movb (%rax), %al
movb %al, -0x4e1(%rbp)
callq 0x37b0
movq %rax, -0x4e0(%rbp)
jmp 0xb459
movq -0x320(%rbp), %rsi
movb -0x4e1(%rbp), %al
movb -0x4d1(%rbp), %cl
movb -0x4c1(%rbp), %dl
movq -0x4e0(%rbp), %rdi
movsbl (%rdi), %r9d
movsbl %dl, %edx
movsbl %cl, %ecx
movsbl %al, %r8d
leaq -0x318(%rbp), %rdi
callq 0xa8d0
jmp 0xb495
movq -0x4a8(%rbp), %rdi
leaq -0x318(%rbp), %rsi
callq 0x3200
jmp 0xb4aa
leaq -0x318(%rbp), %rdi
callq 0x3140
jmp 0xb51b
movq -0x498(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
callq 0x3140
jmp 0xb564
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x2f8(%rbp), %rdi
callq 0xb650
jmp 0xb564
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b8(%rbp)
movl %eax, -0x1bc(%rbp)
leaq -0x318(%rbp), %rdi
callq 0x3140
jmp 0xb564
movq -0x330(%rbp), %rdi
leaq -0x198(%rbp), %rsi
callq 0x3220
jmp 0xb530
leaq -0x1e0(%rbp), %rdi
callq 0x3140
leaq -0x1b0(%rbp), %rdi
callq 0x7660
leaq -0x198(%rbp), %rdi
callq 0x31a0
movq -0x328(%rbp), %rax
addq $0x4f0, %rsp            # imm = 0x4F0
popq %rbp
retq
leaq -0x1e0(%rbp), %rdi
callq 0x3140
leaq -0x1b0(%rbp), %rdi
callq 0x7660
leaq -0x198(%rbp), %rdi
callq 0x31a0
movq -0x1b8(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)