// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/decodeEncode.cpp
// Function: encode[abi:cxx11](int)
string encode(int code){
  string takeString = "";

  //Special Case: CASTLING
  if (code == 69) {
    return "O-O";
  }
  if (code == 70) {
    return "O-O-O";
  }

  //If the move took a piece
  if (code>199 && code <264) {
    takeString = "x";
    code -= 200;
  }

  int row = code%8; //gets an integer for the row
  int column = (code-row)/8; //gets an integer for the column
  string rowString = to_string(row+1); //Converts to a string for concatenation
  string columnString;

  //Assigns a letter based on the row
  switch (column) {
    case 0:
      columnString = "a";
    break;
    case 1:
      columnString = "b";
    break;
    case 2:
      columnString = "c";
    break;
    case 3:
      columnString = "d";
    break;
    case 4:
      columnString = "e";
    break;
    case 5:
      columnString = "f";
    break;
    case 6:
      columnString = "g";
    break;
    case 7:
      columnString = "h";
    break;
    default:
      return "Undefined";
  }
  //Concatenates the column and row
  string output = takeString + columnString + rowString;
  return output;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %r14d
movq %rdi, %rbx
leaq -0x58(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x2a6e(%rip), %rdx      # 0x600e
leaq -0x68(%rbp), %rdi
movq %rdx, %rsi
callq 0x38de
cmpl $0x46, %r14d
je 0x35da
cmpl $0x45, %r14d
jne 0x35fc
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x2ce5(%rip), %rsi      # 0x62ab
leaq 0x2ce1(%rip), %rdx      # 0x62ae
movq %rbx, %rdi
callq 0x38de
jmp 0x3786
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x2cc1(%rip), %rsi      # 0x62a9
leaq 0x2cbf(%rip), %rdx      # 0x62ae
movq %rbx, %rdi
callq 0x38de
jmp 0x3786
leal -0xc8(%r14), %r12d
cmpl $0x3f, %r12d
ja 0x3628
leaq -0x68(%rbp), %rdi
movq 0x8(%rdi), %rdx
leaq 0x2cd4(%rip), %rcx      # 0x62ec
movl $0x1, %r8d
xorl %esi, %esi
callq 0x2180
movl %r12d, %r14d
leal 0x7(%r14), %r13d
testl %r14d, %r14d
cmovnsl %r14d, %r13d
movl %r13d, %eax
andl $-0x8, %eax
negl %eax
leal (%r14,%rax), %r12d
incl %r12d
movl %r12d, %r14d
shrl $0x1f, %r14d
leal 0x1(%r14), %esi
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
leaq -0x48(%rbp), %rdi
movl $0x2d, %edx
callq 0x2130
sarl $0x3, %r13d
movl %r12d, %edx
negl %edx
cmovsl %r12d, %edx
movl %r14d, %edi
addq -0x48(%rbp), %rdi
movl $0x1, %esi
callq 0x386c
leaq -0x78(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
cmpl $0x8, %r13d
jae 0x3712
movl %r13d, %eax
leaq 0x2bb8(%rip), %rdx      # 0x6260
movslq (%rdx,%rax,4), %rcx
addq %rdx, %rcx
leaq -0x88(%rbp), %rdi
movl $0x1, %r8d
xorl %esi, %esi
xorl %edx, %edx
callq 0x2180
leaq -0xa8(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x88(%rbp), %rdx
callq 0x380e
movq -0x48(%rbp), %rsi
movq -0x40(%rbp), %rdx
leaq -0xa8(%rbp), %rdi
callq 0x2060
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%rax), %rsi
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rsi
je 0x3731
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x3737
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0x2bce(%rip), %rsi      # 0x62ee
leaq 0x2bd0(%rip), %rdx      # 0x62f7
movq %rbx, %rdi
callq 0x38de
jmp 0x3763
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rbx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3763
callq 0x20f0
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x3774
callq 0x20f0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x3786
callq 0x20f0
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x3794
callq 0x20f0
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x98(%rbp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x37ca
callq 0x20f0
jmp 0x37ca
jmp 0x37c7
jmp 0x37c7
movq %rax, %rbx
movq -0x88(%rbp), %rdi
cmpq %r12, %rdi
je 0x37db
callq 0x20f0
movq -0x48(%rbp), %rdi
leaq -0x38(%rbp), %rax
cmpq %rax, %rdi
je 0x37f8
callq 0x20f0
jmp 0x37f8
jmp 0x37f5
jmp 0x37f5
jmp 0x37f5
movq %rax, %rbx
movq -0x68(%rbp), %rdi
cmpq %r15, %rdi
je 0x3806
callq 0x20f0
movq %rbx, %rdi
callq 0x21c0