// File: BohangZhang[P]Sorcery-C-Project/ascii_graphics.cc
// Function: replace_text_right(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>&, char, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
static void replace_text_right(card_template_t &text,char flag,std::string new_text) {
  std::string::reverse_iterator sit = new_text.rbegin();
  bool start_replace = false;
  bool end_replace = false;
  for (card_template_t::reverse_iterator vit = text.rbegin(); vit != text.rend(); ++vit) {
    for (std::string::reverse_iterator lit = vit->rbegin(); lit != vit->rend(); ++lit) {
      if (*lit == DELIMITER && *(lit+1) == flag) {
        start_replace = true;
      } else if (*lit == DELIMITER) {
        end_replace = true;
      }
      if (start_replace && (*lit == flag || *lit == DELIMITER)) {
        if (sit != new_text.rend()) {
          *lit = *sit;
          ++sit;
        } else {
          *lit = ' ';
        }
      }
      if (end_replace) {
        end_replace = false;
        start_replace = false;
      }
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdx, -0x60(%rbp)
movl %esi, %eax
movq -0x60(%rbp), %rsi
movq %rdi, -0x8(%rbp)
movb %al, -0x9(%rbp)
movq %rsi, -0x18(%rbp)
leaq -0x20(%rbp), %rdi
callq 0x6450
movb $0x0, -0x21(%rbp)
movb $0x0, -0x22(%rbp)
movq -0x8(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x18d10
movq -0x8(%rbp), %rsi
leaq -0x38(%rbp), %rdi
callq 0x18d90
leaq -0x30(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x18d60
testb $0x1, %al
jne 0x178be
jmp 0x17a12
leaq -0x30(%rbp), %rdi
callq 0x18de0
movq %rax, %rsi
leaq -0x40(%rbp), %rdi
callq 0x6450
leaq -0x30(%rbp), %rdi
callq 0x18de0
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
callq 0x6360
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x18e20
testb $0x1, %al
jne 0x178fe
jmp 0x17a02
leaq -0x40(%rbp), %rdi
callq 0x18e50
movsbl (%rax), %ecx
xorl %eax, %eax
cmpl $0xb, %ecx
movb %al, -0x61(%rbp)
jne 0x1793e
leaq -0x50(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x1, %edx
callq 0x18e80
leaq -0x50(%rbp), %rdi
callq 0x18e50
movsbl (%rax), %eax
movsbl -0x9(%rbp), %ecx
cmpl %ecx, %eax
sete %al
movb %al, -0x61(%rbp)
movb -0x61(%rbp), %al
testb $0x1, %al
jne 0x17947
jmp 0x1794d
movb $0x1, -0x21(%rbp)
jmp 0x17964
leaq -0x40(%rbp), %rdi
callq 0x18e50
movsbl (%rax), %eax
cmpl $0xb, %eax
jne 0x17962
movb $0x1, -0x22(%rbp)
jmp 0x17964
testb $0x1, -0x21(%rbp)
je 0x179e4
leaq -0x40(%rbp), %rdi
callq 0x18e50
movsbl (%rax), %eax
movsbl -0x9(%rbp), %ecx
cmpl %ecx, %eax
je 0x1798f
leaq -0x40(%rbp), %rdi
callq 0x18e50
movsbl (%rax), %eax
cmpl $0xb, %eax
jne 0x179e4
movq -0x60(%rbp), %rsi
leaq -0x58(%rbp), %rdi
callq 0x6360
leaq -0x20(%rbp), %rdi
leaq -0x58(%rbp), %rsi
callq 0x18e20
testb $0x1, %al
jne 0x179af
jmp 0x179d6
leaq -0x20(%rbp), %rdi
callq 0x18e50
movb (%rax), %al
movb %al, -0x62(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x18e50
movb -0x62(%rbp), %cl
movb %cl, (%rax)
leaq -0x20(%rbp), %rdi
callq 0x18ed0
jmp 0x179e2
leaq -0x40(%rbp), %rdi
callq 0x18e50
movb $0x20, (%rax)
jmp 0x179e4
testb $0x1, -0x22(%rbp)
je 0x179f2
movb $0x0, -0x22(%rbp)
movb $0x0, -0x21(%rbp)
jmp 0x179f4
leaq -0x40(%rbp), %rdi
callq 0x18ed0
jmp 0x178d3
jmp 0x17a04
leaq -0x30(%rbp), %rdi
callq 0x18f00
jmp 0x1789b
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)