// File: /workspace/github_cpp_makefile_star2_O2/AsherGlick[P]CommentHeader/source/main.cpp
// Function: headder(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, char)
string headder(string input, string extendedInput, char outputRightWallFlag) {

  bool fillRightWall = true;
  if (outputRightWallFlag == 'g') {
    fillRightWall = false;
  }


  vector<string> output;

  // Print Top Line
  int fillWidth = titleWidth - 2 - globalHeaderStyle._TOP_LEFT.size() - globalHeaderStyle._TOP_RIGHT.size() - input.size();
  int halfFillWidth = fillWidth/2;
  string topLine = globalHeaderStyle._TOP_LEFT;
  for (int i = 0; i < fillWidth - halfFillWidth; i++) {
    topLine+=globalHeaderStyle._TOP_FILL;
  }
  topLine += " " + input + " ";
  for (int i = 0; i < halfFillWidth; i ++) {
    topLine += globalHeaderStyle._TOP_FILL;
  }
  topLine += globalHeaderStyle._TOP_RIGHT;
  // output += "\n";
  output.push_back(topLine);

  // Print Text filled Rows
  int whitespaceLength = titleWidth - globalHeaderStyle._LEFT_COLUMN.size() - globalHeaderStyle._RIGHT_COLUMN.size();
  if (extendedInput != "") {
    vector<string> textLines = align(extendedInput, outputAlignmentFlag, whitespaceLength);
    for (unsigned int i = 0; i < textLines.size(); i++) {
      string middleLine = globalHeaderStyle._LEFT_COLUMN;
      middleLine += textLines[i];
      if (fillRightWall) {
        middleLine += globalHeaderStyle._RIGHT_COLUMN;
      }
      // output += "\n";
      output.push_back(middleLine);
    }
  }

  // Print blank rows
  if (titleLength == 0 && extendedInput == "") {
    output.push_back(globalHeaderStyle._LEFT_COLUMN);
  }
  else {
    for (unsigned int i = 0; i < titleLength; i++) {
      string blankLine = globalHeaderStyle._LEFT_COLUMN;
      for (int j = 0; j < whitespaceLength; j++) {
        blankLine += " ";
      }
      blankLine += globalHeaderStyle._RIGHT_COLUMN;
      output.push_back(blankLine);
    }
  }

  // Print Bottom Line
  string bottomLine = globalHeaderStyle._BOTTOM_LEFT;
  int bottomWidth = titleWidth - globalHeaderStyle._BOTTOM_LEFT.size() - globalHeaderStyle._BOTTOM_RIGHT.size();
  for (int i = 0; i < bottomWidth; i++) {
    bottomLine += globalHeaderStyle._BOTTOM_FILL;
  }
  bottomLine += globalHeaderStyle._BOTTOM_RIGHT;

  output.push_back(bottomLine);



  string textOutput = "";

  for (int i = 0; i < output.size(); i++) {
    textOutput += stripTrailingSpaces(output[i]) + "\n";
  }

  // Return the result
  return textOutput;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movl %ecx, %r15d
movq %rdx, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
andq $0x0, -0x50(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x60(%rbp)
movl 0x8ae2(%rip), %eax      # 0x12220
movl 0x8b3c(%rip), %ecx      # 0x12280
addl 0x8af6(%rip), %ecx      # 0x12240
movq %rsi, -0x30(%rbp)
addl 0x8(%rsi), %ecx
leaq 0x8ae0(%rip), %rsi      # 0x12238
negl %ecx
leal (%rax,%rcx), %ebx
addl $-0x2, %ebx
pushq $0x2
popq %rcx
movl %ebx, %eax
cltd
idivl %ecx
movl %eax, %r12d
leaq -0xc0(%rbp), %rdi
callq 0x3310
subl %r12d, %ebx
xorl %r13d, %r13d
testl %ebx, %ebx
cmovgl %ebx, %r13d
leaq 0x8ace(%rip), %rbx      # 0x12258
leaq -0xc0(%rbp), %r14
subl $0x1, %r13d
jb 0x97a4
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33e0
jmp 0x9791
leaq 0x2871(%rip), %rsi      # 0xc01c
leaq -0xa0(%rbp), %rdi
movq -0x30(%rbp), %rdx
callq 0xa25b
leaq 0x285a(%rip), %rdx      # 0xc01c
leaq -0x80(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0xa314
leaq -0xc0(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x33e0
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0xa0(%rbp), %rdi
callq 0x3120
xorl %r13d, %r13d
testl %r12d, %r12d
cmovgl %r12d, %r13d
leaq 0x8a50(%rip), %rbx      # 0x12258
leaq -0xc0(%rbp), %r14
subl $0x1, %r13d
jb 0x9822
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33e0
jmp 0x980f
leaq 0x8a4f(%rip), %rsi      # 0x12278
leaq -0xc0(%rbp), %rdi
callq 0x33e0
leaq -0x60(%rbp), %rdi
leaq -0xc0(%rbp), %rsi
callq 0xa39c
movl 0x89d5(%rip), %ecx      # 0x12220
movl 0x8a6f(%rip), %eax      # 0x122c0
addl 0x8a49(%rip), %eax      # 0x122a0
subl %eax, %ecx
movl %ecx, -0x30(%rbp)
leaq 0x334a(%rip), %rsi      # 0xcbad
movq -0x40(%rbp), %rdi
callq 0xa38f
testb %al, %al
je 0x9933
leaq -0xe0(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x3310
movsbl 0x8991(%rip), %edx      # 0x1221c
leaq -0xa0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
movl -0x30(%rbp), %ecx
callq 0x9e13
leaq -0xe0(%rbp), %rdi
callq 0x3120
xorl %r12d, %r12d
leaq 0x89e1(%rip), %r13      # 0x12298
leaq -0x80(%rbp), %r14
leaq -0x60(%rbp), %rbx
movl %r12d, %r12d
movq -0x98(%rbp), %rax
subq -0xa0(%rbp), %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0x9927
movq %r14, %rdi
movq %r13, %rsi
callq 0x3310
movq %r12, %rsi
shlq $0x5, %rsi
addq -0xa0(%rbp), %rsi
movq %r14, %rdi
callq 0x33e0
cmpb $0x67, %r15b
je 0x990f
movq %r14, %rdi
leaq 0x89ae(%rip), %rsi      # 0x122b8
callq 0x33e0
movq %rbx, %rdi
movq %r14, %rsi
callq 0xa39c
movq %r14, %rdi
callq 0x3120
incl %r12d
jmp 0x98bf
leaq -0xa0(%rbp), %rdi
callq 0x684a
cmpl $0x0, 0x8c46(%rip)      # 0x12580
jne 0x9a9e
leaq 0x3266(%rip), %rsi      # 0xcbad
movq -0x40(%rbp), %rdi
callq 0xa1a9
testb %al, %al
je 0x9a9e
leaq 0x8939(%rip), %rsi      # 0x12298
leaq -0x60(%rbp), %rdi
callq 0xa39c
leaq 0x8969(%rip), %rsi      # 0x122d8
leaq -0x80(%rbp), %rdi
callq 0x3310
movl 0x89a2(%rip), %eax      # 0x12320
addl 0x895c(%rip), %eax      # 0x122e0
movl 0x8896(%rip), %ecx      # 0x12220
subl %eax, %ecx
xorl %r15d, %r15d
testl %ecx, %ecx
cmovgl %ecx, %r15d
leaq 0x895c(%rip), %rbx      # 0x122f8
leaq -0x80(%rbp), %r14
subl $0x1, %r15d
jb 0x99b3
movq %r14, %rdi
movq %rbx, %rsi
callq 0x33e0
jmp 0x99a0
leaq 0x895e(%rip), %rsi      # 0x12318
leaq -0x80(%rbp), %rdi
callq 0x33e0
leaq -0x60(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0xa39c
leaq 0x31d6(%rip), %rsi      # 0xcbad
leaq -0xa0(%rbp), %rdx
movq -0x38(%rbp), %rdi
callq 0x30f0
xorl %ebx, %ebx
leaq -0x100(%rbp), %r14
leaq -0x120(%rbp), %r15
leaq -0xa0(%rbp), %r13
xorl %r12d, %r12d
movq -0x60(%rbp), %rsi
movq -0x58(%rbp), %rax
subq %rsi, %rax
sarq $0x5, %rax
cmpq %r12, %rax
jbe 0x9a6a
addq %rbx, %rsi
movq %r14, %rdi
callq 0x3310
movq %r15, %rdi
movq %r14, %rsi
callq 0x7c30
movq %r13, %rdi
movq %r15, %rsi
leaq 0x3174(%rip), %rdx      # 0xcbac
callq 0xa314
movq -0x38(%rbp), %rdi
movq %r13, %rsi
callq 0x33e0
movq %r13, %rdi
callq 0x3120
movq %r15, %rdi
callq 0x3120
movq %r14, %rdi
callq 0x3120
incq %r12
addq $0x20, %rbx
jmp 0x9a01
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0xc0(%rbp), %rdi
callq 0x3120
leaq -0x60(%rbp), %rdi
callq 0x684a
movq -0x38(%rbp), %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
movl -0x30(%rbp), %r13d
testl %r13d, %r13d
cmovlel %ebx, %r13d
leaq -0x80(%rbp), %r14
leaq 0x2566(%rip), %r12      # 0xc01c
cmpl 0x8ac4(%rip), %ebx      # 0x12580
jae 0x9968
movq %r14, %rdi
leaq 0x87cc(%rip), %rsi      # 0x12298
callq 0x3310
movl %r13d, %r15d
subl $0x1, %r15d
jb 0x9ae7
movq %r14, %rdi
movq %r12, %rsi
callq 0x33c0
jmp 0x9ad4
movq %r14, %rdi
leaq 0x87c7(%rip), %rsi      # 0x122b8
callq 0x33e0
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0xa39c
movq %r14, %rdi
callq 0x3120
incl %ebx
jmp 0x9ab6
jmp 0x9ba2
movq %rax, %r14
leaq -0xe0(%rbp), %rdi
jmp 0x9bca
jmp 0x9ba2
jmp 0x9bc3
jmp 0x9ba2
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x3120
jmp 0x9b3c
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
jmp 0x9bca
jmp 0x9ba2
movq %rax, %r14
jmp 0x9bdb
jmp 0x9bc3
jmp 0x9ba2
movq %rax, %r14
jmp 0x9bb3
jmp 0x9ba2
movq %rax, %r14
leaq -0xa0(%rbp), %rdi
callq 0x3120
jmp 0x9b71
movq %rax, %r14
leaq -0x120(%rbp), %rdi
callq 0x3120
jmp 0x9b82
movq %rax, %r14
leaq -0x100(%rbp), %rdi
callq 0x3120
jmp 0x9b93
movq %rax, %r14
movq -0x38(%rbp), %rdi
callq 0x3120
jmp 0x9bc6
jmp 0x9bc3
jmp 0x9ba2
movq %rax, %r14
jmp 0x9bcf
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0xa0(%rbp), %rdi
callq 0x684a
jmp 0x9bcf
jmp 0x9bc3
movq %rax, %r14
leaq -0x80(%rbp), %rdi
callq 0x3120
leaq -0xc0(%rbp), %rdi
callq 0x3120
leaq -0x60(%rbp), %rdi
callq 0x684a
movq %r14, %rdi
callq 0x3390