LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/setup.cpp
// Function: setup(Board*)
int setup(Board* gameBoard) {

  //Pawns
  for (int i = 1; i<64; i+=8) {
    gameBoard->addPiece('p', i, 1);
    gameBoard->addPiece('p', i+5 , 0);
  }

  //Rooks
  gameBoard->addPiece('r', 0, 1);
  gameBoard->addPiece('r', 56, 1);
  gameBoard->addPiece('r', 7, 0);
  gameBoard->addPiece('r', 63, 0);

  //Bishops
  gameBoard->addPiece('b', 16, 1);
  gameBoard->addPiece('b', 40, 1);
  gameBoard->addPiece('b', 23, 0);
  gameBoard->addPiece('b', 47, 0);

  //Knights - note 'n' as type
  gameBoard->addPiece('n', 8, 1);
  gameBoard->addPiece('n', 48, 1);
  gameBoard->addPiece('n', 15, 0);
  gameBoard->addPiece('n', 55, 0);

  //Kings - note 'k' as type
  gameBoard->addPiece('k', 32, 1);
  gameBoard->addPiece('k', 39, 0);

  //Queens
  gameBoard->addPiece('q', 24, 1);
  gameBoard->addPiece('q', 31, 0);

return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movl $0x1, %r14d
movq %rbx, %rdi
movl $0x70, %esi
movl %r14d, %edx
movl $0x1, %ecx
callq 0x3c2c
leal 0x5(%r14), %edx
movq %rbx, %rdi
movl $0x70, %esi
xorl %ecx, %ecx
callq 0x3c2c
leal 0x8(%r14), %eax
cmpl $0x38, %r14d
movl %eax, %r14d
jb 0x3164
movq %rbx, %rdi
movl $0x72, %esi
xorl %edx, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x72, %esi
movl $0x38, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x72, %esi
movl $0x7, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x72, %esi
movl $0x3f, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x62, %esi
movl $0x10, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x62, %esi
movl $0x28, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x62, %esi
movl $0x17, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x62, %esi
movl $0x2f, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6e, %esi
movl $0x8, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6e, %esi
movl $0x30, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6e, %esi
movl $0xf, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6e, %esi
movl $0x37, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6b, %esi
movl $0x20, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x6b, %esi
movl $0x27, %edx
xorl %ecx, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x71, %esi
movl $0x18, %edx
movl $0x1, %ecx
callq 0x3c2c
movq %rbx, %rdi
movl $0x71, %esi
movl $0x1f, %edx
xorl %ecx, %ecx
callq 0x3c2c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Board.cpp
// Function: Board::Board(Piece**, bool*, std::vector<char, std::allocator<char>>, std::vector<int, std::allocator<int>>)
Board::Board (Piece** pieceArr, bool activeArr[64], std::vector<char> pstPcs, std::vector<int> pstMvs){
	for (int i = 0; i < 64; i++) {
		activeArray[i] = 0;
		if (activeArr[i]) {
			addPiece(pieceArr[i]->getType(), i, pieceArr[i]->getIsWhite());
		}
	}
	for (unsigned i = 0; i < pstPcs.size(); i++) {
		pastPieces.push_back(pstPcs.at(i));
	}
	for (unsigned i = 0; i < pstMvs.size(); i++) {
		pastMoves.push_back(pstMvs.at(i));
	}
	moveNumber = 0;
  movesSince = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, -0x48(%rbp)
movq %rcx, -0x40(%rbp)
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r12
leaq 0x50b3(%rip), %rax      # 0x8b68
movq %rax, (%rdi)
leaq 0x248(%rdi), %rax
movq %rax, -0x38(%rbp)
leaq 0x260(%rdi), %rax
movq %rax, -0x30(%rbp)
xorps %xmm0, %xmm0
movups %xmm0, 0x248(%rdi)
movups %xmm0, 0x258(%rdi)
movups %xmm0, 0x268(%rdi)
xorl %r15d, %r15d
movb $0x0, 0x208(%r12,%r15)
cmpb $0x1, (%rbx,%r15)
jne 0x3b20
movq (%r14,%r15,8), %rdi
callq 0x5c00
movl %eax, %r13d
movq (%r14,%r15,8), %rdi
callq 0x5c0a
movzbl %al, %ecx
movsbl %r13b, %esi
movq %r12, %rdi
movl %r15d, %edx
callq 0x3c2c
incq %r15
cmpq $0x40, %r15
jne 0x3ae9
movq -0x40(%rbp), %r13
movq (%r13), %rdx
cmpq %rdx, 0x8(%r13)
movq -0x38(%rbp), %r14
movq -0x48(%rbp), %r15
je 0x3b85
movl $0x1, %ebx
xorl %eax, %eax
addq %rax, %rdx
movq 0x250(%r12), %rsi
cmpq 0x258(%r12), %rsi
je 0x3b69
movb (%rdx), %al
movb %al, (%rsi)
incq 0x250(%r12)
jmp 0x3b71
movq %r14, %rdi
callq 0x5076
movl %ebx, %eax
movq (%r13), %rdx
movq 0x8(%r13), %rcx
subq %rdx, %rcx
incl %ebx
cmpq %rax, %rcx
ja 0x3b46
movq (%r15), %rax
cmpq %rax, 0x8(%r15)
movq -0x30(%rbp), %r14
je 0x3be0
movl $0x1, %ebx
xorl %ecx, %ecx
leaq (%rax,%rcx,4), %rdx
movq 0x268(%r12), %rsi
cmpq 0x270(%r12), %rsi
je 0x3bc1
movl (%rdx), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x268(%r12)
jmp 0x3bc9
movq %r14, %rdi
callq 0x5168
movl %ebx, %ecx
movq (%r15), %rax
movq 0x8(%r15), %rdx
subq %rax, %rdx
sarq $0x2, %rdx
incl %ebx
cmpq %rcx, %rdx
ja 0x3b99
movq $0x0, 0x278(%r12)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3bff
jmp 0x3bff
movq %rax, %rbx
movq -0x30(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3c13
callq 0x20f0
movq -0x38(%rbp), %rax
movq (%rax), %rdi
testq %rdi, %rdi
je 0x3c24
callq 0x20f0
movq %rbx, %rdi
callq 0x21c0
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Board.cpp
// Function: Board::addPiece(char, int, int)
int Board::addPiece(char type, int startSpace, int isWhite){
  if (activeArray[startSpace] == 1) { //If the space is taken
    return -1;
  }
  activeArray[startSpace] = 1; //Activates the space before placing the piece
  switch (type){
    case 'b':
      pieceArray[startSpace] = new Bishop(startSpace, isWhite);
      break;
    case 'n':
      pieceArray[startSpace] = new Knight(startSpace, isWhite);
      break;
    case 'p':
      pieceArray[startSpace] = new Pawn(startSpace, isWhite);
      break;
    case 'k':
      pieceArray[startSpace] = new King(startSpace, isWhite);
      break;
    case 'q':
      pieceArray[startSpace] = new Queen(startSpace, isWhite);
      break;
    case 'r':
      pieceArray[startSpace] = new Rook(startSpace, isWhite);
      break;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movslq %edx, %r15
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpb $0x0, 0x208(%rdi,%r15)
jne 0x3d48
movl %ecx, %r12d
movl %edx, %r13d
movq %rdi, %r14
movb $0x1, 0x208(%rdi,%r15)
movsbl %sil, %eax
xorl %ebx, %ebx
leal -0x6b(%rax), %ecx
cmpl $0x7, %ecx
ja 0x3ca2
leaq 0x2784(%rip), %rax      # 0x63fc
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x559c
jmp 0x3d3f
cmpl $0x62, %eax
jne 0x3d48
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x54a0
jmp 0x3d3f
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x5db8
jmp 0x3d3f
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x57bc
jmp 0x3d3f
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x569c
jmp 0x3d3f
movl $0x18, %edi
callq 0x2110
movq %rax, -0x30(%rbp)
movq %rax, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x5c40
movq -0x30(%rbp), %rax
movq %rax, 0x8(%r14,%r15,8)
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3d63
jmp 0x3d63
jmp 0x3d63
jmp 0x3d63
jmp 0x3d63
movq %rax, %rbx
movq -0x30(%rbp), %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x21c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Board.cpp
// Function: Board::getPiece(int)
const char* Board::getPiece(int space){
  char type = pieceArray[space]->getType();
  bool isWhite = pieceArray[space]->getIsWhite();

  if (isWhite == 1) {
    //White Pieces
    switch (type) {
      case 'p':
      return u8"\u2659";
      case 'r':
      return u8"\u2656";
      case 'b':
      return u8"\u2657";
      case 'n':
      return u8"\u2658";
      case 'k':
      return u8"♔";
      case 'q':
      return u8"\u2655";
    }
  } else {
    //Black Pieces
    switch (type) {
      case 'p':
      return u8"\u265F";
      case 'r':
      return u8"\u265C";
      case 'b':
      return u8"\u265D";
      case 'n':
      return u8"\u265E";
      case 'k':
      return u8"\u265A";
      case 'q':
      return u8"\u265B";
    }
  }

  return u8"\uFFFD";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movslq %esi, %r15
movq 0x8(%rdi,%r15,8), %rdi
callq 0x5c00
movl %eax, %ebx
movq 0x8(%r14,%r15,8), %rdi
callq 0x5c0a
movzbl %bl, %ecx
testb %al, %al
je 0x40e1
leal -0x6b(%rcx), %eax
cmpl $0x7, %eax
ja 0x4102
leaq 0x2370(%rip), %rcx      # 0x643c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x23d7(%rip), %rax      # 0x64b3
jmp 0x416d
leal -0x6b(%rcx), %eax
cmpl $0x7, %eax
ja 0x4110
leaq 0x232c(%rip), %rcx      # 0x641c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x23cb(%rip), %rax      # 0x64cb
jmp 0x416d
cmpl $0x62, %ecx
jne 0x411e
leaq 0x239d(%rip), %rax      # 0x64ab
jmp 0x416d
cmpl $0x62, %ecx
jne 0x411e
leaq 0x23a7(%rip), %rax      # 0x64c3
jmp 0x416d
leaq 0x23ae(%rip), %rax      # 0x64d3
jmp 0x416d
leaq 0x2379(%rip), %rax      # 0x64a7
jmp 0x416d
leaq 0x2388(%rip), %rax      # 0x64bf
jmp 0x416d
leaq 0x2363(%rip), %rax      # 0x64a3
jmp 0x416d
leaq 0x2372(%rip), %rax      # 0x64bb
jmp 0x416d
leaq 0x235d(%rip), %rax      # 0x64af
jmp 0x416d
leaq 0x236c(%rip), %rax      # 0x64c7
jmp 0x416d
leaq 0x2353(%rip), %rax      # 0x64b7
jmp 0x416d
leaq 0x2362(%rip), %rax      # 0x64cf
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Board.cpp
// Function: Board::getPastPiece(int)
const char* Board::getPastPiece(int number) {

  //Special Cases
  if (pastPieces[number] == 'x') {
    return u8"\u200A";
  }


  int isWhite = ((number + 1) % 2);

  if (isWhite == 1) {
    //White Pieces
    switch (pastPieces[number]) {
      case 'p':
      return u8"\u2659";
      case 'r':
      return u8"\u2656";
      case 'b':
      return u8"\u2657";
      case 'n':
      return u8"\u2658";
      case 'k':
      return u8"♔";
      case 'q':
      return u8"\u2655";
    }
  } else {
    //Black Pieces
    switch (pastPieces[number]) {
      case 'p':
      return u8"\u265F";
      case 'r':
      return u8"\u265C";
      case 'b':
      return u8"\u265D";
      case 'n':
      return u8"\u265E";
      case 'k':
      return u8"\u265A";
      case 'q':
      return u8"\u265B";
    }
  }

  //Error character
  return u8"\uFFFD";
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movslq %esi, %rax
movq 0x248(%rdi), %rcx
movzbl (%rcx,%rax), %eax
cmpl $0x78, %eax
jne 0x4198
leaq 0x2341(%rip), %rax      # 0x64d7
popq %rbp
retq
incl %esi
andl $0x80000001, %esi       # imm = 0x80000001
leal -0x6b(%rax), %ecx
cmpl $0x1, %esi
jne 0x41c6
cmpl $0x7, %ecx
ja 0x41e4
leaq 0x22c8(%rip), %rax      # 0x647c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x22ef(%rip), %rax      # 0x64b3
jmp 0x4196
cmpl $0x7, %ecx
ja 0x41f2
leaq 0x228a(%rip), %rax      # 0x645c
movslq (%rax,%rcx,4), %rcx
addq %rax, %rcx
jmpq *%rcx
leaq 0x22e9(%rip), %rax      # 0x64cb
jmp 0x4196
cmpl $0x62, %eax
jne 0x4200
leaq 0x22bb(%rip), %rax      # 0x64ab
jmp 0x4196
cmpl $0x62, %eax
jne 0x4200
leaq 0x22c5(%rip), %rax      # 0x64c3
jmp 0x4196
leaq 0x22cc(%rip), %rax      # 0x64d3
jmp 0x4196
leaq 0x2297(%rip), %rax      # 0x64a7
jmp 0x4196
leaq 0x22a6(%rip), %rax      # 0x64bf
jmp 0x4196
leaq 0x227e(%rip), %rax      # 0x64a3
jmp 0x4196
leaq 0x228a(%rip), %rax      # 0x64bb
jmp 0x4196
leaq 0x2272(%rip), %rax      # 0x64af
jmp 0x4196
leaq 0x227e(%rip), %rax      # 0x64c7
jmp 0x4196
leaq 0x2262(%rip), %rax      # 0x64b7
jmp 0x4196
leaq 0x226e(%rip), %rax      # 0x64cf
jmp 0x4196
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Bishop.cpp
// Function: Bishop::Bishop(int, int)
Bishop::Bishop(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'b';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x36da(%rip), %rax      # 0x8b98
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x62, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Bishop.cpp
// Function: Bishop::move(int, bool*)
bool Bishop::move(int square, bool activeArray[64]){
  // Decoding square numbers:
  int fromRow = row(location);
  int fromCol = col(location);
  int toRow = row(square);
  int toCol = col(square);

  // Pieces can't move to the square they are already on.
  if (square == location) {
    return 0;
  }
  // Checks that the move is strictly diagonal, and uses 'checkDiagonal' to
  // ensure that no other pieces are in the way.
  if ((abs(toRow-fromRow) == abs(toCol-fromCol)) && checkDiagonal(square, activeArray) == -1) {
		location = square;
    hasMoved = 1;
		return 1;
  } else {
    return 0;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, -0x30(%rbp)
movl %esi, %r14d
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x3a14
movl %eax, %r12d
movl 0xc(%rbx), %edi
callq 0x3a29
movl %eax, %r13d
movl %r14d, %edi
callq 0x3a14
movl %eax, %r15d
movl %r14d, %edi
callq 0x3a29
cmpl %r14d, 0xc(%rbx)
je 0x5557
subl %r12d, %r15d
movl %r15d, %ecx
negl %ecx
cmovsl %r15d, %ecx
subl %r13d, %eax
movl %eax, %edx
negl %edx
cmovsl %eax, %edx
cmpl %edx, %ecx
jne 0x5557
movq %rbx, %rdi
movl %r14d, %esi
movq -0x30(%rbp), %rdx
callq 0x5b1a
cmpl $-0x1, %eax
je 0x5568
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, 0xc(%rbx)
movb $0x1, 0x11(%rbx)
movb $0x1, %al
jmp 0x5559
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/King.cpp
// Function: King::King(int, int)
King::King(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'k';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x362e(%rip), %rax      # 0x8be8
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x6b, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/King.cpp
// Function: King::move(int, bool*)
bool King::move(int square, bool activeArray[64]){
  //Decoding square numbers:
  int fromRow = row(location);
  int fromCol = col(location);
  int toRow = row(square);
  int toCol = col(square);

  // Same square check
  if (square==location){
    return 0;
  }

  // The king can move 1 square in any direction
  if ( abs(fromRow-toRow)<2 && abs(fromCol-toCol)<2 ){
    location = square;
    hasMoved = 1;
    return 1;
  }
  return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %r14d
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x3a14
movl %eax, %r12d
movl 0xc(%rbx), %edi
callq 0x3a29
movl %eax, %r15d
movl %r14d, %edi
callq 0x3a14
movl %eax, %r13d
movl %r14d, %edi
callq 0x3a29
cmpl %r14d, 0xc(%rbx)
je 0x564f
subl %r13d, %r12d
movl %r12d, %ecx
negl %ecx
cmovsl %r12d, %ecx
cmpl $0x1, %ecx
ja 0x564f
subl %eax, %r15d
movl %r15d, %eax
negl %eax
cmovsl %r15d, %eax
cmpl $0x1, %eax
ja 0x564f
movl %r14d, 0xc(%rbx)
movb $0x1, 0x11(%rbx)
movb $0x1, %al
jmp 0x5651
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/King.cpp
// Function: King::castle(int)
void King::castle(int square){
  if (hasMoved == 0){
    location = square;
    hasMoved = 1;
  }
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x11(%rdi)
jne 0x5671
movl %esi, 0xc(%rdi)
movb $0x1, 0x11(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Knight.cpp
// Function: Knight::Knight(int, int)
Knight::Knight(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'n';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x357e(%rip), %rax      # 0x8c38
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x6e, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Knight.cpp
// Function: Knight::move(int, bool*)
bool Knight::move(int square, bool activeArray[64]){
  int currentPos = location;
  int dist = abs(currentPos - square);

  // Checks that the move is legal using relative position of start and end space.
  if (dist == 6 || dist == 10 || dist == 15 || dist == 17) {
    // Move is illegal if it involves going off the edge of the board
    if (row(currentPos)<2 && row(square)>5) {
      return 0;
    }
    if (row(currentPos)>5 && row(square)<2) {
      return 0;
    }
    if (col(currentPos)<2 && col(square)>5) {
      return 0;
    }
    if (col(currentPos)>5 && col(square)<2) {
      return 0;
    }

    // Moves piece and returns
    location = square;
    hasMoved = 1;
    return 1;
  }
	return 0; // Failure
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0xc(%rdi), %r15d
movl %r15d, %eax
subl %esi, %eax
movl %eax, %ecx
negl %ecx
cmovsl %eax, %ecx
xorl %eax, %eax
cmpl $0x11, %ecx
ja 0x5789
movl $0x28440, %edx          # imm = 0x28440
btl %ecx, %edx
jae 0x5789
movl %esi, %r14d
movq %rdi, %rbx
movl %r15d, %edi
callq 0x3a14
cmpl $0x1, %eax
jg 0x572d
movl %r14d, %edi
callq 0x3a14
cmpl $0x5, %eax
jg 0x577b
movl %r15d, %edi
callq 0x3a14
cmpl $0x6, %eax
jl 0x5747
movl %r14d, %edi
callq 0x3a14
cmpl $0x2, %eax
jl 0x577b
movl %r15d, %edi
callq 0x3a29
cmpl $0x1, %eax
jg 0x5761
movl %r14d, %edi
callq 0x3a29
cmpl $0x5, %eax
jg 0x577b
movl %r15d, %edi
callq 0x3a29
cmpl $0x6, %eax
jl 0x577f
movl %r14d, %edi
callq 0x3a29
cmpl $0x2, %eax
jge 0x577f
xorl %eax, %eax
jmp 0x5789
movl %r14d, 0xc(%rbx)
movb $0x1, 0x11(%rbx)
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Pawn.cpp
// Function: Pawn::Pawn(int, int)
Pawn::Pawn(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'p';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x34ae(%rip), %rax      # 0x8c88
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x70, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Piece.cpp
// Function: Piece::direction(int)
int Piece::direction(int destination){
	int dir;

	if (col(location) < col(destination)) {
		if (row(location) < row(destination)) {
			dir = 1;
		} else if (row(location) > row(destination)) {
			dir = 7;
		} else {
			dir = 0;
		}
	} else if (col(location) > col(destination)) {
		if (row(location) < row(destination)) {
			dir = 3;
		} else if (row(location) > row(destination)) {
			dir = 5;
		} else {
			dir = 4;
		}
	} else {
		if (row(location) < row(destination)) {
			dir = 2;
		} else {
			dir = 6;
		}
	}
	return dir;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %esi, %ebx
movq %rdi, %r14
movl 0xc(%rdi), %edi
callq 0x3a29
movl %eax, %r15d
movl %ebx, %edi
callq 0x3a29
movl 0xc(%r14), %edi
cmpl %eax, %r15d
jge 0x59db
callq 0x3a14
movl %eax, %r15d
movl %ebx, %edi
callq 0x3a14
movl %eax, %ecx
movl $0x1, %eax
cmpl %ecx, %r15d
jl 0x5a42
movl 0xc(%r14), %edi
callq 0x3a14
movl %eax, %r14d
movl %ebx, %edi
callq 0x3a14
xorl %ecx, %ecx
cmpl %eax, %r14d
movl $0x7, %eax
cmovlel %ecx, %eax
jmp 0x5a42
callq 0x3a29
movl %eax, %r12d
movl %ebx, %edi
callq 0x3a29
movl %eax, %r13d
movl 0xc(%r14), %edi
callq 0x3a14
movl %eax, %r15d
movl %ebx, %edi
callq 0x3a14
movl %eax, %ecx
cmpl %r13d, %r12d
jle 0x5a33
movl $0x3, %eax
cmpl %ecx, %r15d
jl 0x5a42
movl 0xc(%r14), %edi
callq 0x3a14
movl %eax, %r14d
movl %ebx, %edi
callq 0x3a14
movl %eax, %ecx
xorl %eax, %eax
cmpl %ecx, %r14d
setg %al
orl $0x4, %eax
jmp 0x5a42
xorl %eax, %eax
cmpl %ecx, %r15d
setge %al
leal 0x2(,%rax,4), %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Piece.cpp
// Function: Piece::checkStraight(int, bool*)
int Piece::checkStraight(int destination, bool activeArray[64]) {
	int dir = direction(destination);

	int east, north, west, south;

	switch (dir) {
		case 0: //East
			for (east = location+8; east < destination; east+=8) {
				if (activeArray[east] == 1) {
					return east;
				}
			}
			break;
		case 2: //North
			for (north = location+1; north < destination; north++) {
				if (activeArray[north] == 1) {
					return north;
				}
			}
			break;
		case 4: //West
			for (west = location-8; west > destination; west-=8) {
				if (activeArray[west] == 1) {
					return west;
				}
			}
			break;
		case 6: //South
			for (south = location-1; south > destination; south--) {
				if (activeArray[south] == 1) {
					return south;
				}
			}
			break;
	}

	//If there are no pieces found
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
callq 0x596c
cmpl $0x6, %eax
ja 0x5b09
movl %eax, %eax
leaq 0xac0(%rip), %rcx       # 0x653c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $0x8, %rdx
cmpq %rcx, %rdx
jge 0x5b09
addl $0x8, %eax
cmpb $0x0, (%rbx,%rdx)
leaq 0x8(%rdx), %rdx
je 0x5a93
jmp 0x5b0e
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $-0x8, %rdx
cmpq %rcx, %rdx
jle 0x5b09
addl $-0x8, %eax
cmpb $0x0, (%rbx,%rdx)
leaq -0x8(%rdx), %rdx
je 0x5ab5
jmp 0x5b0e
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
incq %rdx
cmpq %rcx, %rdx
jge 0x5b09
incl %eax
cmpb $0x0, (%rbx,%rdx)
leaq 0x1(%rdx), %rdx
je 0x5ad6
jmp 0x5b0e
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
decq %rdx
cmpq %rcx, %rdx
jle 0x5b09
decl %eax
cmpb $0x1, (%rbx,%rdx)
leaq -0x1(%rdx), %rdx
jne 0x5af6
jmp 0x5b0e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Piece.cpp
// Function: Piece::checkDiagonal(int, bool*)
int Piece::checkDiagonal(int destination, bool activeArray[64]) {
	int dir = direction(destination);
	switch (dir) {
		case 1: //North East
			for (int ne = location+9; ne < destination; ne+=9) {
				if (activeArray[ne] == 1) {
					return ne;
				}
			}
			break;
		case 3: //North West
			for (int nw = location-7; nw > destination; nw-=7) {
				if (activeArray[nw] == 1) {
					return nw;
				}
			}
			break;
		case 5: //South West
			for (int sw = location-9; sw > destination; sw-=9) {
				if (activeArray[sw] == 1) {
					return sw;
				}
			}
			break;
		case 7: //South East
			for (int se = location+7; se < destination; se+=7) {
				if (activeArray[se] == 1) {
					return se;
				}
			}
			break;
	}

	//If there are no pieces found
	return -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
callq 0x596c
decl %eax
cmpl $0x6, %eax
ja 0x5bd5
leaq 0xa14(%rip), %rcx       # 0x6558
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $0x9, %rdx
cmpq %rcx, %rdx
jge 0x5bd5
addl $0x9, %eax
cmpb $0x0, (%rbx,%rdx)
leaq 0x9(%rdx), %rdx
je 0x5b5b
jmp 0x5bda
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $-0x9, %rdx
cmpq %rcx, %rdx
jle 0x5bd5
addl $-0x9, %eax
cmpb $0x0, (%rbx,%rdx)
leaq -0x9(%rdx), %rdx
je 0x5b7d
jmp 0x5bda
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $-0x7, %rdx
cmpq %rcx, %rdx
jle 0x5bd5
addl $-0x7, %eax
cmpb $0x0, (%rbx,%rdx)
leaq -0x7(%rdx), %rdx
je 0x5b9f
jmp 0x5bda
movslq 0xc(%r15), %rax
movslq %r14d, %rcx
movq %rax, %rdx
addq $0x7, %rdx
cmpq %rcx, %rdx
jge 0x5bd5
addl $0x7, %eax
cmpb $0x1, (%rbx,%rdx)
leaq 0x7(%rdx), %rdx
jne 0x5bc1
jmp 0x5bda
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Queen.cpp
// Function: Queen::Queen(int, int)
Queen::Queen(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'q';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x30c2(%rip), %rax      # 0x8d20
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x71, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Queen.cpp
// Function: Queen::checkPath(int, bool*)
bool Queen::checkPath(int destination, bool activeArray[64]){
	int dir = direction(destination);
	if (dir%2 == 0) {
		if (checkStraight(destination, activeArray) == -1) {
			return 1;
		}
	} else {
		if (checkDiagonal(destination, activeArray) == -1) {
			return 1;
		}
	}
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movl %esi, %r14d
movq %rdi, %r15
callq 0x596c
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
testb $0x1, %al
jne 0x5cae
callq 0x5a52
jmp 0x5cb3
callq 0x5b1a
cmpl $-0x1, %eax
je 0x5cbc
xorl %eax, %eax
jmp 0x5cbe
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Queen.cpp
// Function: Queen::move(int, bool*)
bool Queen::move(int square, bool activeArray[64]){
	int currentLocation = location;
  // Illegal if moving to current position
  if (currentLocation == square) {
    return 0;
  }

  // Move OK if piece is moving to same row or col OR moving diagonally
  // AND path is free
  if (  ((row(currentLocation) == row(square)
        || col(currentLocation) == col(square))
        || (abs(row(square)-row(location)) == abs(col(square)-col(location))))
      && checkPath(square, activeArray)){
    location = square;
    hasMoved = 1;
    return 1;
  }
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0xc(%rdi), %r12d
cmpl %esi, %r12d
je 0x5d80
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
movl %r12d, %edi
callq 0x3a14
movl %eax, %r13d
movl %r14d, %edi
callq 0x3a14
cmpl %eax, %r13d
je 0x5d62
movl %r12d, %edi
callq 0x3a29
movl %eax, %r12d
movl %r14d, %edi
callq 0x3a29
cmpl %eax, %r12d
je 0x5d62
movl %r14d, %edi
callq 0x3a14
movl %eax, %r12d
movl 0xc(%rbx), %edi
callq 0x3a14
subl %eax, %r12d
movl %r12d, %r13d
negl %r13d
cmovsl %r12d, %r13d
movl %r14d, %edi
callq 0x3a29
movl %eax, %r12d
movl 0xc(%rbx), %edi
callq 0x3a29
subl %eax, %r12d
movl %r12d, %eax
negl %eax
cmovsl %r12d, %eax
cmpl %eax, %r13d
jne 0x5d80
movq (%rbx), %rax
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq *(%rax)
testb %al, %al
je 0x5d80
movl %r14d, 0xc(%rbx)
movb $0x1, 0x11(%rbx)
movb $0x1, %al
jmp 0x5d82
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Rook.cpp
// Function: Rook::Rook(int, int)
Rook::Rook(int startingSquare, int pieceIsWhite){
  location = startingSquare;
  pieceType = 'r';
  isWhite = pieceIsWhite;
  hasMoved = 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebx
movl %esi, %r14d
movq %rdi, %r15
callq 0x5954
leaq 0x2f9a(%rip), %rax      # 0x8d70
movq %rax, (%r15)
movl %r14d, 0xc(%r15)
movb $0x72, 0x8(%r15)
testl %ebx, %ebx
setne 0x10(%r15)
movb $0x0, 0x11(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Rook.cpp
// Function: Rook::move(int, bool*)
bool Rook::move(int square, bool activeArray[64]){
  int currentLocation = location;
  //Illegal if moving to current position
  if (currentLocation == square) {
    return 0;
  }

  // Move is legal if piece is moving to same row or col and path is empty
  if ((row(currentLocation) == row(square) || col(currentLocation) == col(square)) && checkStraight(square, activeArray) == -1) {
    location = square;
    hasMoved = 1;
    return 1;
  }
	return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl 0xc(%rdi), %r12d
cmpl %esi, %r12d
je 0x5e5d
movq %rdx, %r15
movl %esi, %r14d
movq %rdi, %rbx
movl %r12d, %edi
callq 0x3a14
movl %eax, %r13d
movl %r14d, %edi
callq 0x3a14
cmpl %eax, %r13d
je 0x5e4a
movl %r12d, %edi
callq 0x3a29
movl %eax, %r12d
movl %r14d, %edi
callq 0x3a29
cmpl %eax, %r12d
jne 0x5e5d
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x5a52
cmpl $-0x1, %eax
je 0x5e6e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r14d, 0xc(%rbx)
movb $0x1, 0x11(%rbx)
movb $0x1, %al
jmp 0x5e5f
// File: /workspace/github_cpp_makefile_star2_O1/tlaloc1313[P]chess-project/Rook.cpp
// Function: Rook::castle(int)
void Rook::castle(int square){
  if (hasMoved == 0){
    location = square;
    hasMoved = 1;
  }
  return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpb $0x0, 0x11(%rdi)
jne 0x5e8b
movl %esi, 0xc(%rdi)
movb $0x1, 0x11(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/kdungs[P]codecon/src/gloves.cc
// Function: main
int main() {
  auto gm = GloveMatcher{};

  auto line = std::string{};
  getline(std::cin, line);  // ignore number
  while (getline(std::cin, line)) {
    gm.process(line);
  }

  std::cout << gm.matched() << '\n';
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x70, %rsp
xorps %xmm0, %xmm0
leaq 0x38(%rsp), %rbx
movaps %xmm0, -0x8(%rbx)
movaps %xmm0, 0x8(%rbx)
movaps %xmm0, 0x18(%rbx)
movaps %xmm0, 0x28(%rbx)
leaq 0x68(%rsp), %rax
movq %rax, -0x30(%rax)
movq $0x1, -0x28(%rax)
movups %xmm0, -0x20(%rax)
movl $0x3f800000, -0x10(%rax) # imm = 0x3F800000
leaq 0x20(%rsp), %r13
movq %r13, -0x10(%r13)
movq $0x0, -0x8(%r13)
movb $0x0, (%r13)
movq 0x2c08(%rip), %rdi      # 0x3fe0
movq (%rdi), %rax
addq -0x18(%rax), %rdi
movl $0xa, %esi
callq 0x10c0
movsbl %al, %edx
movq 0x2bed(%rip), %r14      # 0x3fe0
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x1180
leaq 0x10(%rsp), %r15
leaq 0x30(%rsp), %r12
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x10c0
movsbl %al, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x1180
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x1447
movq %r12, %rdi
movq %r15, %rsi
callq 0x14d0
jmp 0x140a
xorl %esi, %esi
cmpq 0x50(%rsp), %rsi
sbbl %esi, %esi
orl 0x30(%rsp), %esi
movq 0x2b75(%rip), %rdi      # 0x3fd0
callq 0x1150
leaq 0xf(%rsp), %rsi
movb $0xa, (%rsi)
movl $0x1, %edx
movq %rax, %rdi
callq 0x1100
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x148c
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1bc8
xorl %eax, %eax
addq $0x70, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
jmp 0x14a6
movq %rax, %r14
movq 0x10(%rsp), %rdi
cmpq %r13, %rdi
je 0x14c0
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1bc8
movq %r14, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O1/kdungs[P]codecon/src/gloves.cc
// Function: GloveMatcher::process(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
auto process(const std::string& item) -> void {
    if (isPalindrome(item)) {  // we found a hat!
      return;
    }

    const auto hint = cache_.find(item);
    if (hint != cache_.end()) {
      cache_.erase(hint);
      ++matched_;
    } else {
      cache_.emplace(reverse(item));
    }
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rsi
leaq -0x1(%rsi), %rax
testq %rax, %rax
setle %dl
jle 0x1529
movq (%r14), %rcx
leaq (%rsi,%rcx), %rdi
decq %rdi
movb (%rcx), %r8b
cmpb (%rdi), %r8b
jne 0x1529
addq %rcx, %rsi
addq $-0x2, %rsi
incq %rcx
addq $-0x2, %rax
testq %rax, %rax
setle %dl
jle 0x1529
leaq -0x1(%rsi), %rdi
movb (%rcx), %r8b
incq %rcx
cmpb (%rsi), %r8b
movq %rdi, %rsi
je 0x150b
testb %dl, %dl
jne 0x1586
leaq 0x8(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x15c2
testq %rax, %rax
je 0x1550
movq %r15, %rdi
movq %rax, %rsi
callq 0x16da
incl (%rbx)
jmp 0x1586
movq %rsp, %rbx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x1317
movq %r15, %rdi
xorl %esi, %esi
movq %rbx, %rdx
callq 0x17ca
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x1586
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x10e0
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x10(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x15ae
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x10e0
movq %rbx, %rdi
callq 0x1160
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::Tree(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
Tree::Tree(
	std::string& input,
	std::string alphabet
	):
	input(input),
	alphabet(alphabet),
	B(input.length() + 1, 0),
	B_i(0),
	ranDFS(false),
	nIntNodes(1),
	nLeaves(0)
{
	input += '$';

	size_t size = sizeof(Node) * input.length() * 2;
	alloc_buf = (Node*)malloc(size);
	bzero(alloc_buf, size);

	alloc_i = 0;

	nextNodeId = input.length();
	root = newNode(assignId(), nullptr, 0, 0);
	lowestIntNode = root;
	root->suffixLink = root;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x18(%rdi), %r14
leaq 0x28(%rdi), %r13
movq %r13, 0x18(%rdi)
movq (%rdx), %rsi
movq 0x8(%rdx), %rdx
addq %rsi, %rdx
movq %r14, %rdi
callq 0x2fb0
movq %r15, 0x40(%rbx)
movl $0x0, 0x50(%rbx)
xorl %eax, %eax
movb %al, 0x54(%rbx)
movq $0x1, 0x58(%rbx)
leaq 0x68(%rbx), %r12
movq 0x8(%r15), %rsi
incq %rsi
leaq 0xf(%rsp), %rdx
movb %al, (%rdx)
leaq 0xe(%rsp), %rcx
movq %r12, %rdi
callq 0x2f50
movq %r15, %rdi
movl $0x24, %esi
callq 0x20d0
movq 0x8(%r15), %r12
imulq $0xb0, %r12, %r14
movq %r14, %rdi
callq 0x2170
movq %rax, %r15
movq %rax, (%rbx)
xorl %r13d, %r13d
movq %rax, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x2090
leal 0x1(%r12), %eax
movl %eax, 0x48(%rbx)
movl $0x1, 0x8(%rbx)
movl %r12d, 0x50(%r15)
movq %r13, (%r15)
movq %r13, 0x48(%r15)
movq %r15, 0x10(%rbx)
movq %r15, 0x60(%rbx)
movq %r15, 0x18(%r15)
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r15
movq (%r12), %rdi
testq %rdi, %rdi
je 0x246b
movq 0x78(%rbx), %rsi
subq %rdi, %rsi
callq 0x2120
jmp 0x246b
movq %rax, %r15
movq (%r14), %rdi
cmpq %r13, %rdi
je 0x247f
movq (%r13), %rsi
incq %rsi
callq 0x2120
movq %r15, %rdi
callq 0x21c0
nop
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::newNode(int, suffixtree::Node*, int, int)
Node *Tree::newNode(int id, Node *parent, int beg, int len) {
	Node *nxt = &alloc_buf[alloc_i++];
	nxt->id = id;
	nxt->parent = parent;
	nxt->beg = beg;
	nxt->len = len;
	if (parent != nullptr) {
		nxt->stringDepth = parent->stringDepth + len;
	}
	return nxt;
}

// Assembly:
movq (%rdi), %r9
movslq 0x8(%rdi), %rax
leal 0x1(%rax), %r10d
movl %r10d, 0x8(%rdi)
imulq $0x58, %rax, %rdi
leaq (%r9,%rdi), %rax
movl %esi, 0x50(%r9,%rdi)
movq %rdx, (%r9,%rdi)
movl %ecx, 0x48(%r9,%rdi)
movl %r8d, 0x4c(%r9,%rdi)
testq %rdx, %rdx
je 0x24bf
addl 0x54(%rdx), %r8d
movl %r8d, 0x54(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::Build()
void Tree::Build() {
	Node *n = root;
	for (int i = 0; i < input.length(); i++) {
		n = insertSuffix(n, i);
	}
	DisplayChildren(root);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x40(%rdi), %rax
cmpq $0x0, 0x8(%rax)
je 0x24fe
movq 0x10(%rbx), %rax
xorl %r14d, %r14d
movq %rbx, %rdi
movq %rax, %rsi
movl %r14d, %edx
callq 0x2512
incq %r14
movq 0x40(%rbx), %rcx
cmpq %r14, 0x8(%rcx)
ja 0x24e3
movq 0x10(%rbx), %rsi
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2598
nop
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::insertSuffix(suffixtree::Node*, int)
Node*
Tree::insertSuffix(
	Node *prevLeaf,
	int suffix
	)
{
	Node *u = prevLeaf->parent;

	nLeaves++;

	if (prevLeaf == root) {
		return findPathAndInsert(root, suffix, 0, input.length());

	} else if (u->suffixLink != nullptr) {
		//Case 1: u already existed at the start of iteration (suffix-1).
		Node *v = u->suffixLink;
		//u->stringDepth is equivalent to the length of alpha
		return findPathAndInsert(v, suffix, suffix + v->stringDepth,
			input.length() - suffix - v->stringDepth);

	} else if (u->parent != root) {
		//Case 2A: u was created during iteration (suffix-1), and u' is not root
		Node *uprime = u->parent;
		Node *vprime = uprime->suffixLink;
		//Beta is the edge label between u and uprime.
		int beta = u->beg;
		int betalen = u->len;

		Node *v = nodeHopToV(vprime, beta, betalen);
		u->suffixLink = v;

		return findPathAndInsert(v, suffix, suffix + v->stringDepth,
			input.length() - suffix - v->stringDepth);

	} else {
		//Case 2B: u was created during iteration (suffix-1), and u' is the root
		Node *uprime = u->parent; // root
		Node *vprime = uprime->suffixLink; // also the root
		int betaprime = u->beg + 1; // beta = x betaprime
		int betaprimelen = u->len - 1;

		Node *v = nodeHopToV(vprime, betaprime, betaprimelen);
		u->suffixLink = v;

		return findPathAndInsert(v, suffix, suffix + v->stringDepth,
			input.length() - suffix - v->stringDepth);
	}
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rax
movq %rdi, %r14
movq (%rsi), %r15
incl 0x5c(%rdi)
movl %edx, %ebx
movq 0x10(%rdi), %rsi
cmpq %rax, %rsi
je 0x254d
movq 0x18(%r15), %rax
testq %rax, %rax
jne 0x2575
movq (%r15), %rcx
movq 0x18(%rcx), %rax
movl 0x48(%r15), %edx
cmpq %rsi, %rcx
je 0x255e
movl 0x4c(%r15), %ecx
jmp 0x2566
movq 0x40(%r14), %rax
movl 0x8(%rax), %r8d
movq %r14, %rdi
movl %ebx, %edx
xorl %ecx, %ecx
jmp 0x258d
incl %edx
movl 0x4c(%r15), %ecx
decl %ecx
movq %r14, %rdi
movq %rax, %rsi
callq 0x297e
movq %rax, 0x18(%r15)
movl 0x54(%rax), %ecx
addl %ebx, %ecx
movq 0x40(%r14), %rdx
movl 0x8(%rdx), %r8d
subl %ecx, %r8d
movq %r14, %rdi
movq %rax, %rsi
movl %ebx, %edx
popq %rbx
popq %r14
popq %r15
jmp 0x268a
nop
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::DisplayChildren(suffixtree::Node*)
void
Tree::DisplayChildren(
	Node *node
	)
{
	Node *child = node->child;

	while (child != nullptr) {
		std::cout << "Node id: " << child->id << "Edge label: '";
		for (int i = child->beg; i < child->len + child->beg; i++) {
			std::cout << input[i];
		}
		std::cout << "'" << std::endl;

		child = child->sibling;
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq 0x8(%rsi), %r15
testq %r15, %r15
je 0x267b
movq %rdi, %rbx
movq 0x3a1e(%rip), %r14      # 0x5fd8
leaq 0x7(%rsp), %r13
leaq 0x1aba(%rip), %rbp      # 0x4080
movl $0x9, %edx
movq %r14, %rdi
leaq 0x1a95(%rip), %rsi      # 0x406a
callq 0x2130
movl 0x50(%r15), %esi
movq %r14, %rdi
callq 0x21b0
movl $0xd, %edx
movq %rax, %rdi
leaq 0x1a7f(%rip), %rsi      # 0x4074
callq 0x2130
cmpl $0x0, 0x4c(%r15)
jle 0x2637
movslq 0x48(%r15), %r12
movq 0x40(%rbx), %rax
movq (%rax), %rax
movb (%rax,%r12), %al
movb %al, 0x7(%rsp)
movl $0x1, %edx
movq %r14, %rdi
movq %r13, %rsi
callq 0x2130
incq %r12
movslq 0x4c(%r15), %rax
movslq 0x48(%r15), %rcx
addq %rax, %rcx
cmpq %rcx, %r12
jl 0x2605
movl $0x1, %edx
movq %r14, %rdi
movq %rbp, %rsi
callq 0x2130
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x20f0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20a0
movq 0x10(%r15), %r15
testq %r15, %r15
jne 0x25c6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::findPathAndInsert(suffixtree::Node*, int, int, int)
Node *
Tree::findPathAndInsert(
	Node *node,
	int suffix,
	int beg,
	int len
	)
{
	/*
	printf("= findPathAndInsert: ");
	PrintSegment(beg, len);
	printf(" -> ");
	PrintNodeLabel(node);
	printf("\n");
	*/

	if (len == 0) {
		printf("len is zero. why?\n");
	}

	Node *child = getChildByLabelBeginning(node, input[beg]);

	// No child by that label
	if (child == nullptr) {
		Node *nchild = newNode(suffix, node, beg, len);
		addChildToNode(node, nchild);

		return nchild;
	}

	for (int i = 1; i < len; i++) {
		if (i >= child->len) {
			return findPathAndInsert(child, suffix, beg + i, len - i);
		}
		if (input[beg + i] != input[child->beg + i]) {
			// SPLIT
			Node *mid = breakEdge(child, i);
			//printf("= splitting: ");
			//PrintNodeLabel(mid);
			//printf("\n");
			return findPathAndInsert(mid, suffix, (beg + i), (len - i));
		}
	}

	panic("shouldnt actually happen");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r15d
movl %ecx, %r14d
movl %edx, %ebp
movq %rsi, %r12
movq %rdi, %rbx
testl %r8d, %r8d
jne 0x26b4
leaq 0x1acc(%rip), %rdi      # 0x417b
callq 0x21a0
movq 0x40(%rbx), %rcx
movslq %r14d, %rax
movq (%rcx), %rcx
movq 0x8(%r12), %rsi
testq %rsi, %rsi
je 0x26dd
movb (%rcx,%rax), %dl
movslq 0x48(%rsi), %rdi
cmpb %dl, (%rcx,%rdi)
je 0x26dd
movq 0x10(%rsi), %rsi
testq %rsi, %rsi
jne 0x26cb
testq %rsi, %rsi
je 0x2738
movl %ebp, 0x4(%rsp)
cmpl $0x2, %r15d
setge %bpl
jl 0x277d
movl %r14d, %r9d
movl 0x4c(%rsi), %edi
movl %r15d, %r12d
cmpl $0x2, %edi
movl $0x1, %edx
cmovgel %edi, %edx
addq %rcx, %rax
movl $0x1, %r14d
cmpq %r14, %rdx
je 0x277f
movb (%rax,%r14), %dil
movslq 0x48(%rsi), %r8
addq %rcx, %r8
cmpb (%r14,%r8), %dil
jne 0x2793
incq %r14
cmpq %r12, %r14
setb %bpl
jne 0x2711
jmp 0x27bf
movq (%rbx), %rax
movslq 0x8(%rbx), %rcx
leal 0x1(%rcx), %edx
movl %edx, 0x8(%rbx)
imulq $0x58, %rcx, %rcx
leaq (%rax,%rcx), %r13
movl %ebp, 0x50(%rax,%rcx)
movq %r12, (%rax,%rcx)
movl %r14d, 0x48(%rax,%rcx)
movl %r15d, 0x4c(%rax,%rcx)
testq %r12, %r12
je 0x276d
addl 0x54(%r12), %r15d
movl %r15d, 0x54(%r13)
movq %rbx, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x2820
jmp 0x27c5
jmp 0x27bf
movl %r9d, %ecx
addl %edx, %ecx
subl %edx, %r15d
movq %rbx, %rdi
movl 0x4(%rsp), %edx
movl %r15d, %r8d
jmp 0x27b7
movl %r9d, %r15d
addl %r14d, %r15d
movq %rbx, %rdi
movl %r14d, %edx
callq 0x28be
subl %r14d, %r12d
movq %rbx, %rdi
movq %rax, %rsi
movl 0x4(%rsp), %edx
movl %r15d, %ecx
movl %r12d, %r8d
callq 0x268a
movq %rax, %r13
testb $0x1, %bpl
je 0x27d7
movq %r13, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1826(%rip), %rdi      # 0x4004
leaq 0x183f(%rip), %rsi      # 0x4024
movl $0x57, %edx
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x2140
nop
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::addChildToNode(suffixtree::Node*, suffixtree::Node*)
void 
Tree::addChildToNode(
	Node *parent,
	Node *child
	)
{
	Node *cur = parent->child;
	if (cur == nullptr) {
		parent->child = child;
		return;
	}

	char k = input[child->beg];
	if (k == '$') {
		if (cur != nullptr && input[cur->beg] == '$') {
			panic("shouldnt already have child with this label");
		}

		child->sibling = cur;
		parent->child = child;
		return;
	}

	Node *prev = nullptr;
	while(cur != nullptr) {
		if (k < input[cur->beg]) {
			child->sibling = cur;
			if (prev == nullptr) {
				parent->child = child;
			} else {
				prev->sibling = child;
			}
			return;
		}

		prev = cur;
		cur = cur->sibling;
	}
	prev->sibling = child;
}

// Assembly:
pushq %rax
movq 0x8(%rsi), %rax
addq $0x8, %rsi
testq %rax, %rax
je 0x2895
movq 0x40(%rdi), %rcx
movslq 0x48(%rdx), %rdi
movq (%rcx), %rcx
movb (%rcx,%rdi), %dil
movslq 0x48(%rax), %r8
movb (%rcx,%r8), %r8b
cmpb $0x24, %dil
jne 0x2857
cmpb $0x24, %r8b
je 0x289a
movq %rax, 0x10(%rdx)
jmp 0x2895
cmpb %r8b, %dil
jge 0x2861
xorl %r9d, %r9d
jmp 0x287d
movq %rax, %r8
movq 0x10(%r8), %rax
testq %rax, %rax
je 0x288e
movslq 0x48(%rax), %r10
movq %r8, %r9
movq %rax, %r8
cmpb (%rcx,%r10), %dil
jge 0x2864
movq %rax, 0x10(%rdx)
leaq 0x10(%r9), %rax
testq %r9, %r9
cmovneq %rax, %rsi
jmp 0x2895
addq $0x10, %r8
movq %r8, %rsi
movq %rdx, (%rsi)
popq %rax
retq
leaq 0x1796(%rip), %rdi      # 0x4037
leaq 0x177c(%rip), %rsi      # 0x4024
movl $0x101, %edx            # imm = 0x101
xorl %eax, %eax
callq 0x2040
movl $0x1, %edi
callq 0x2140
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::breakEdge(suffixtree::Node*, int)
Node *
Tree::breakEdge(
	Node *n,
	int i
	)
{
	//printf("= breakEdge(%d)\n", i);
	Node *parent = nullptr, *nNode = nullptr;

	parent = n->parent;

	//Make new node
	nNode = newNode(assignId(), parent, n->beg, i);
	//Remove n from parent's children, replace with new node.
	replaceChild(parent, nNode);

	n->sibling = nullptr;

	//Insert n under new node
	addChildToNode(nNode, n);

	//Alter n
	n->beg = n->beg + i;
	n->parent = nNode;
	n->len = n->len - i;

	//We have a new internal node
	nIntNodes++;
	if (lowestIntNode == nullptr ||
		nNode->stringDepth > lowestIntNode->stringDepth) {
		lowestIntNode = nNode;
	}

	return nNode;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rsi
movl 0x48(%rdi), %eax
leal 0x1(%rax), %ecx
movl %ecx, 0x48(%rdi)
movl 0x48(%r14), %ecx
movq (%rdi), %rdx
movslq 0x8(%rdi), %rdi
leal 0x1(%rdi), %r8d
movl %r8d, 0x8(%rbx)
imulq $0x58, %rdi, %rdi
leaq (%rdx,%rdi), %r15
movl %eax, 0x50(%rdx,%rdi)
movq %rsi, (%rdx,%rdi)
movl %ecx, 0x48(%rdx,%rdi)
movl %ebp, 0x4c(%rdx,%rdi)
testq %rsi, %rsi
je 0x2912
movl 0x54(%rsi), %eax
addl %ebp, %eax
movl %eax, 0x54(%r15)
movq %rbx, %rdi
movq %r15, %rdx
callq 0x29d4
movq $0x0, 0x10(%r14)
movq %rbx, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2820
addl %ebp, 0x48(%r14)
movq %r15, (%r14)
subl %ebp, 0x4c(%r14)
incl 0x58(%rbx)
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x2953
movl 0x54(%r15), %ecx
cmpl 0x54(%rax), %ecx
jle 0x2957
movq %r15, 0x60(%rbx)
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/raemarks[P]SuffixTree/src/SuffixTree.cpp
// Function: suffixtree::Tree::replaceChild(suffixtree::Node*, suffixtree::Node*)
void Tree::replaceChild(Node *parent, Node *node) {
	Node *prev = nullptr;
	Node *cur = parent->child;
	char k = input[node->beg];

	while (cur != nullptr) {
		if (k == input[cur->beg]) {
			node->sibling = cur->sibling;
			if (prev == nullptr) {
				parent->child = node;
			} else {
				prev->sibling = node;
			}
			return;
		}

		prev = cur;
		cur = cur->sibling;
	}
}

// Assembly:
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x2a31
movq 0x40(%rdi), %rcx
movslq 0x48(%rdx), %rdi
movq (%rcx), %rcx
movb (%rcx,%rdi), %dil
movslq 0x48(%rax), %r8
cmpb (%rcx,%r8), %dil
jne 0x29fb
xorl %r8d, %r8d
jmp 0x2a17
movq %rax, %r9
movq 0x10(%r9), %rax
testq %rax, %rax
je 0x2a31
movslq 0x48(%rax), %r10
movq %r9, %r8
movq %rax, %r9
cmpb (%rcx,%r10), %dil
jne 0x29fe
addq $0x8, %rsi
movq 0x10(%rax), %rax
movq %rax, 0x10(%rdx)
leaq 0x10(%r8), %rax
testq %r8, %r8
cmoveq %rsi, %rax
movq %rdx, (%rax)
retq