// File: Phidelux[P]terminal-table/src/cell.cpp
// Function: bornageek::utils::termtab::Cell::render[abi:cxx11](unsigned short, unsigned short) const
const std::string Cell::render(const std::uint16_t line, const std::uint16_t col) const {
        std::stringstream ss;

        std::uint16_t width = this->width(col);

        std::string left(this->mTable->style().paddingLeft(), ' ');
        std::string right(this->mTable->style().paddingRight(), ' ');

        switch(this->mAlign) {
          case Alignment::LEFT:
            ss << left << std::setw(width) 
              << std::left << std::setfill(' ') << this->line(line) << right;
            break;
          case Alignment::RIGHT:
            ss << left << std::setw(width) 
              << std::right << std::setfill(' ') << this->line(line) << right;
            break;
          case Alignment::CENTER:
            std::string val = this->line(line); 
            std::uint16_t innerWidth = width + this->mTable->cellPadding();
            std::uint16_t spaceLeft = innerWidth / 2 - val.length() / 2;
            
            ss << std::string(spaceLeft, ' ') << std::setw(innerWidth - spaceLeft)
               << std::left << std::setfill(' ') << this->line(line);
            break;
        }

        return ss.str();
      }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x420, %rsp            # imm = 0x420
movq %rdi, -0x320(%rbp)
movw %cx, %ax
movw %dx, %cx
movq %rdi, %rdx
movq %rdx, -0x318(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movw %cx, -0x12(%rbp)
movw %ax, -0x14(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x310(%rbp)
leaq -0x1a0(%rbp), %rdi
callq 0x3170
movq -0x310(%rbp), %rdi
movzwl -0x14(%rbp), %esi
callq 0x7d70
movw %ax, -0x302(%rbp)
jmp 0x8332
movq -0x310(%rbp), %rax
movw -0x302(%rbp), %cx
movw %cx, -0x1a2(%rbp)
movq (%rax), %rsi
leaq -0x1f4(%rbp), %rdi
callq 0xa580
jmp 0x8358
leaq -0x1f4(%rbp), %rdi
callq 0x3a70
movw %ax, -0x322(%rbp)
jmp 0x836d
movw -0x322(%rbp), %ax
movzwl %ax, %eax
movq %rax, -0x338(%rbp)
leaq -0x1f5(%rbp), %rdi
movq %rdi, -0x330(%rbp)
callq 0x33d0
movq -0x338(%rbp), %rsi
movq -0x330(%rbp), %rcx
leaq -0x1d8(%rbp), %rdi
movl $0x20, %edx
callq 0x8c40
jmp 0x83b2
leaq -0x1f5(%rbp), %rdi
callq 0x3280
movq -0x310(%rbp), %rax
movq (%rax), %rsi
leaq -0x234(%rbp), %rdi
callq 0xa580
jmp 0x83d6
leaq -0x234(%rbp), %rdi
callq 0x3ab0
movw %ax, -0x33a(%rbp)
jmp 0x83eb
movw -0x33a(%rbp), %ax
movzwl %ax, %eax
movq %rax, -0x350(%rbp)
leaq -0x235(%rbp), %rdi
movq %rdi, -0x348(%rbp)
callq 0x33d0
movq -0x350(%rbp), %rsi
movq -0x348(%rbp), %rcx
leaq -0x218(%rbp), %rdi
movl $0x20, %edx
callq 0x8c40
jmp 0x8430
leaq -0x235(%rbp), %rdi
callq 0x3280
movq -0x310(%rbp), %rax
movl 0x28(%rax), %eax
movl %eax, -0x354(%rbp)
testl %eax, %eax
je 0x84ef
jmp 0x8456
movl -0x354(%rbp), %eax
subl $0x1, %eax
je 0x8631
jmp 0x8467
movl -0x354(%rbp), %eax
subl $0x2, %eax
je 0x875c
jmp 0x89cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x8a2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x1f5(%rbp), %rdi
callq 0x3280
jmp 0x8a2c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x8a20
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x235(%rbp), %rdi
callq 0x3280
jmp 0x8a20
leaq -0x190(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x3200
movq %rax, -0x360(%rbp)
jmp 0x850b
movzwl -0x1a2(%rbp), %edi
callq 0x8cb0
movl %eax, -0x364(%rbp)
jmp 0x851f
movq -0x360(%rbp), %rdi
movl -0x364(%rbp), %eax
movl %eax, -0x23c(%rbp)
movl -0x23c(%rbp), %esi
callq 0x32b0
movq %rax, -0x370(%rbp)
jmp 0x8546
movq -0x370(%rbp), %rdi
leaq 0x77c(%rip), %rsi       # 0x8cd0
callq 0x3090
movq %rax, -0x378(%rbp)
jmp 0x8562
movl $0x20, %edi
callq 0x8d00
movb %al, -0x379(%rbp)
jmp 0x8574
movq -0x378(%rbp), %rdi
movb -0x379(%rbp), %al
movb %al, -0x23d(%rbp)
movzbl -0x23d(%rbp), %esi
callq 0x3370
movq %rax, -0x388(%rbp)
jmp 0x859c
movq -0x310(%rbp), %rsi
movzwl -0x12(%rbp), %edx
leaq -0x260(%rbp), %rdi
callq 0x7fa0
jmp 0x85b5
movq -0x388(%rbp), %rdi
leaq -0x260(%rbp), %rsi
callq 0x3200
movq %rax, -0x390(%rbp)
jmp 0x85d1
movq -0x390(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x3200
jmp 0x85e6
leaq -0x260(%rbp), %rdi
callq 0x3140
jmp 0x89cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x8a14
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x260(%rbp), %rdi
callq 0x3140
jmp 0x8a14
leaq -0x190(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x3200
movq %rax, -0x398(%rbp)
jmp 0x864d
movzwl -0x1a2(%rbp), %edi
callq 0x8cb0
movl %eax, -0x39c(%rbp)
jmp 0x8661
movq -0x398(%rbp), %rdi
movl -0x39c(%rbp), %eax
movl %eax, -0x264(%rbp)
movl -0x264(%rbp), %esi
callq 0x32b0
movq %rax, -0x3a8(%rbp)
jmp 0x8688
movq -0x3a8(%rbp), %rdi
leaq 0x68a(%rip), %rsi       # 0x8d20
callq 0x3090
movq %rax, -0x3b0(%rbp)
jmp 0x86a4
movl $0x20, %edi
callq 0x8d00
movb %al, -0x3b1(%rbp)
jmp 0x86b6
movq -0x3b0(%rbp), %rdi
movb -0x3b1(%rbp), %al
movb %al, -0x265(%rbp)
movzbl -0x265(%rbp), %esi
callq 0x3370
movq %rax, -0x3c0(%rbp)
jmp 0x86de
movq -0x310(%rbp), %rsi
movzwl -0x12(%rbp), %edx
leaq -0x288(%rbp), %rdi
callq 0x7fa0
jmp 0x86f7
movq -0x3c0(%rbp), %rdi
leaq -0x288(%rbp), %rsi
callq 0x3200
movq %rax, -0x3c8(%rbp)
jmp 0x8713
movq -0x3c8(%rbp), %rdi
leaq -0x218(%rbp), %rsi
callq 0x3200
jmp 0x8728
leaq -0x288(%rbp), %rdi
callq 0x3140
jmp 0x89cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x288(%rbp), %rdi
callq 0x3140
jmp 0x8a14
movq -0x310(%rbp), %rsi
movzwl -0x12(%rbp), %edx
leaq -0x2a8(%rbp), %rdi
callq 0x7fa0
jmp 0x8775
movq -0x310(%rbp), %rax
movzwl -0x1a2(%rbp), %ecx
movl %ecx, -0x3d0(%rbp)
movq (%rax), %rdi
callq 0x9d80
movw %ax, -0x3ca(%rbp)
jmp 0x879a
movl -0x3d0(%rbp), %eax
movw -0x3ca(%rbp), %dx
movw %dx, %cx
addl %ecx, %eax
movw %ax, -0x2aa(%rbp)
movzwl -0x2aa(%rbp), %eax
shrl %eax
movl %eax, -0x3ec(%rbp)
leaq -0x2a8(%rbp), %rdi
callq 0x3340
movq %rax, %rcx
movl -0x3ec(%rbp), %eax
shrl %ecx
subl %ecx, %eax
movw %ax, -0x2ac(%rbp)
leaq -0x190(%rbp), %rax
movq %rax, -0x3e8(%rbp)
movzwl -0x2ac(%rbp), %eax
movq %rax, -0x3e0(%rbp)
leaq -0x2d1(%rbp), %rdi
movq %rdi, -0x3d8(%rbp)
callq 0x33d0
movq -0x3e0(%rbp), %rsi
movq -0x3d8(%rbp), %rcx
leaq -0x2d0(%rbp), %rdi
movl $0x20, %edx
callq 0x8c40
jmp 0x8832
movq -0x3e8(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0x3200
movq %rax, -0x3f8(%rbp)
jmp 0x884e
movzwl -0x2aa(%rbp), %edi
movzwl -0x2ac(%rbp), %eax
subl %eax, %edi
callq 0x8cb0
movl %eax, -0x3fc(%rbp)
jmp 0x886b
movq -0x3f8(%rbp), %rdi
movl -0x3fc(%rbp), %eax
movl %eax, -0x2d8(%rbp)
movl -0x2d8(%rbp), %esi
callq 0x32b0
movq %rax, -0x408(%rbp)
jmp 0x8892
movq -0x408(%rbp), %rdi
leaq 0x430(%rip), %rsi       # 0x8cd0
callq 0x3090
movq %rax, -0x410(%rbp)
jmp 0x88ae
movl $0x20, %edi
callq 0x8d00
movb %al, -0x411(%rbp)
jmp 0x88c0
movq -0x410(%rbp), %rdi
movb -0x411(%rbp), %al
movb %al, -0x2d9(%rbp)
movzbl -0x2d9(%rbp), %esi
callq 0x3370
movq %rax, -0x420(%rbp)
jmp 0x88e8
movq -0x310(%rbp), %rsi
movzwl -0x12(%rbp), %edx
leaq -0x300(%rbp), %rdi
callq 0x7fa0
jmp 0x8901
movq -0x420(%rbp), %rdi
leaq -0x300(%rbp), %rsi
callq 0x3200
jmp 0x8916
leaq -0x300(%rbp), %rdi
callq 0x3140
leaq -0x2d0(%rbp), %rdi
callq 0x3140
leaq -0x2d1(%rbp), %rdi
callq 0x3280
leaq -0x2a8(%rbp), %rdi
callq 0x3140
jmp 0x89cb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x89bd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x89b1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
jmp 0x89a5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1b0(%rbp)
movl %eax, -0x1b4(%rbp)
leaq -0x300(%rbp), %rdi
callq 0x3140
leaq -0x2d0(%rbp), %rdi
callq 0x3140
leaq -0x2d1(%rbp), %rdi
callq 0x3280
leaq -0x2a8(%rbp), %rdi
callq 0x3140
jmp 0x8a14
movq -0x320(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x3220
jmp 0x89e0
leaq -0x218(%rbp), %rdi
callq 0x3140
leaq -0x1d8(%rbp), %rdi
callq 0x3140
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
movq -0x318(%rbp), %rax
addq $0x420, %rsp            # imm = 0x420
popq %rbp
retq
leaq -0x218(%rbp), %rdi
callq 0x3140
leaq -0x1d8(%rbp), %rdi
callq 0x3140
leaq -0x1a0(%rbp), %rdi
callq 0x31a0
movq -0x1b0(%rbp), %rdi
callq 0x33c0
nopw %cs:(%rax,%rax)
nop