LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Chessman/Chessman.cpp
// Function: Chessman::isMoveValid(Board const&, Move const&) const
bool Chessman::isMoveValid(const Board &board, const Move &move) const {
  std::list<Move> moves = this->getPossibleMoves(board);
  for (std::list<Move>::iterator it = moves.begin(); it != moves.end(); it++) {
    if (*it == move)
    { return true; }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rsi, %rdx
movq %rdi, %rsi
movq (%rdi), %rax
leaq -0x30(%rbp), %r14
movq %r14, %rdi
callq *0x18(%rax)
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x3800
leaq 0x10(%r15), %rdi
movq %rbx, %rsi
callq 0x40d2
testb %al, %al
je 0x37e8
leaq -0x30(%rbp), %rdi
cmpq %rdi, %r15
setne %bl
callq 0x2a40
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x2a40
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Chessman/Queen.cpp
// Function: Queen::getPossibleMoves[abi:cxx11](Board const&) const
std::list<Move> Queen::getPossibleMoves(const Board &board) const {
  std::list<Move> moves;
  if (!isCaptured()) {
    bool top = true;
    bool right = true;
    bool bottom = true;
    bool left = true;
    bool leftTop = true;
    bool rightTop = true;
    bool leftBottom = true;
    bool rightBottom = true;
    int i = 1;

    while (top || right || bottom || left || leftTop || rightTop || leftBottom || rightBottom) {
      checkMove(board, moves, leftTop, i, -i);
      checkMove(board, moves, rightTop, i, i);
      checkMove(board, moves, leftBottom, -i, -i);
      checkMove(board, moves, rightBottom, -i, i);
      checkMove(board, moves, top, i, 0);
      checkMove(board, moves, right, 0, i);
      checkMove(board, moves, bottom, -i, 0);
      checkMove(board, moves, left, 0, -i);
      i++;
    }
  }
  return moves;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
andq $0x0, 0x10(%rdi)
movq %rsi, %rdi
callq 0x37ae
testb %al, %al
je 0x3ea5
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %al
leaq -0x30(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2f(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2e(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2d(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2c(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2b(%rbp), %rcx
movb %al, (%rcx)
leaq -0x2a(%rbp), %rcx
movb %al, (%rcx)
leaq -0x29(%rbp), %rcx
movb %al, (%rcx)
pushq $0x1
popq %r12
pushq $-0x1
popq %r13
testb $0x1, %al
jne 0x3f0d
cmpb $0x0, -0x2f(%rbp)
jne 0x3f0d
cmpb $0x0, -0x2e(%rbp)
jne 0x3f0d
cmpb $0x0, -0x2d(%rbp)
jne 0x3f0d
cmpb $0x0, -0x2c(%rbp)
jne 0x3f0d
cmpb $0x0, -0x2b(%rbp)
jne 0x3f0d
cmpb $0x0, -0x2a(%rbp)
jne 0x3f0d
cmpb $0x1, -0x29(%rbp)
jne 0x3e93
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2c(%rbp), %rcx
movl %r12d, %r8d
movl %r13d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2b(%rbp), %rcx
movl %r12d, %r8d
movl %r12d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2a(%rbp), %rcx
movl %r13d, %r8d
movl %r13d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x29(%rbp), %rcx
movl %r13d, %r8d
movl %r12d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x30(%rbp), %rcx
movl %r12d, %r8d
xorl %r9d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2f(%rbp), %rcx
xorl %r8d, %r8d
movl %r12d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2e(%rbp), %rcx
movl %r13d, %r8d
xorl %r9d, %r9d
callq 0x2f6c
movq %r15, %rdi
movq %r14, %rsi
movq %rbx, %rdx
leaq -0x2d(%rbp), %rcx
xorl %r8d, %r8d
movl %r13d, %r9d
callq 0x2f6c
incl %r12d
movb -0x30(%rbp), %al
decl %r13d
jmp 0x3edf
jmp 0x3fdd
movq %rax, %r14
movq %rbx, %rdi
callq 0x2a40
movq %r14, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Move.cpp
// Function: Move::Move(Move const&)
Move::Move(const Move &move)
  : origin(move.origin), target(move.target), type(move.type), capturedChessman(){
    if(move.getCapturedChessman() == nullptr) {
      this->capturedChessman = nullptr;
    } else {
      this->capturedChessman = move.getCapturedChessman()->clone();
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq (%rsi), %rax
movq %rax, (%rdi)
movq 0x8(%rsi), %rax
movq %rax, 0x8(%rdi)
movl 0x10(%rsi), %eax
movl %eax, 0x10(%rdi)
andq $0x0, 0x18(%rdi)
movq 0x18(%rsi), %rdi
testq %rdi, %rdi
je 0x405a
movq (%rdi), %rax
callq *(%rax)
jmp 0x405c
xorl %eax, %eax
movq %rax, 0x18(%rbx)
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::Board(std::__cxx11::list<Move*, std::allocator<Move*>>)
Board::Board(std::list<Move *> moves)
  : currentColour(Chessman::Colour::White) {
  this->board = createStartBoard();
  while (moves.size() != 0) {
    applyMove(moves.front());
    delete moves.front();
    moves.pop_front();
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movb $0x1, 0x8(%rdi)
leaq 0x10(%rdi), %rbx
movq %rbx, 0x18(%rdi)
movq %rbx, 0x10(%rdi)
andq $0x0, 0x20(%rdi)
movq %rsi, %r12
leaq 0x28(%rdi), %r14
movq %r14, 0x30(%rdi)
movq %r14, 0x28(%rdi)
andq $0x0, 0x38(%rdi)
callq 0x419a
movq %rax, (%r15)
cmpq $0x0, 0x10(%r12)
je 0x4629
movq (%r12), %rax
movq 0x10(%rax), %rsi
movq %r15, %rdi
callq 0x4656
movq (%r12), %rax
movq 0x10(%rax), %r13
testq %r13, %r13
je 0x4617
movq %r13, %rdi
callq 0x4072
movq %r13, %rdi
callq 0x20f0
movq %r12, %rdi
callq 0x5474
jmp 0x45ea
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x463a
movq %rax, %r15
movq %r14, %rdi
callq 0x2840
movq %rbx, %rdi
callq 0x553a
movq %r15, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::Board(Board const&)
Board::Board(const Board &b) {
  this->board = new Chessman**[8];

  for (int x = 0; x < 8; x++) {
    this->board[x] = new Chessman*[8];
    for (int y = 0; y < 8; y++) {
      if (b.getChessman(Position(x,y)) != nullptr) {
        this->board[x][y] = b.getChessman(Position(x,y))->clone();
      }
    }
  }
  for(Chessman* c : b.capturedChessmen) {
    this->capturedChessmen.push_back(c->clone());
  }
  for(Move* m : b.previousMoves) {
    this->previousMoves.push_back(new Move(*m));
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r12
leaq 0x10(%rdi), %rax
movq %rax, 0x18(%rdi)
movq %rax, -0x40(%rbp)
movq %rax, 0x10(%rdi)
andq $0x0, 0x20(%rdi)
movq %rsi, %r15
leaq 0x28(%rdi), %rax
movq %rax, 0x30(%rdi)
movq %rax, -0x38(%rbp)
movq %rax, 0x28(%rdi)
andq $0x0, 0x38(%rdi)
pushq $0x40
popq %rdi
callq 0x2030
movq %rax, (%r12)
xorl %r13d, %r13d
leaq -0x50(%rbp), %rbx
cmpq $0x8, %r13
je 0x49d5
pushq $0x40
popq %rdi
callq 0x2030
movq (%r12), %rcx
movq %rax, (%rcx,%r13,8)
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x49d0
movq %rbx, %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x286e
movq -0x50(%rbp), %rsi
movq %r15, %rdi
callq 0x4a86
testq %rax, %rax
je 0x49cb
leaq -0x48(%rbp), %rdi
movl %r13d, %esi
movl %r14d, %edx
callq 0x286e
movq -0x48(%rbp), %rsi
movq %r15, %rdi
callq 0x4a86
movq (%rax), %rcx
movq %rax, %rdi
callq *(%rcx)
movq (%r12), %rcx
movq (%rcx,%r13,8), %rcx
movq %rax, (%rcx,%r14,8)
incq %r14
jmp 0x4977
incq %r13
jmp 0x495e
leaq 0x10(%r15), %r14
leaq -0x30(%rbp), %rbx
movq %r14, %r12
movq (%r12), %r12
cmpq %r14, %r12
je 0x4a05
movq 0x10(%r12), %rdi
movq (%rdi), %rax
callq *(%rax)
movq %rax, -0x30(%rbp)
movq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x5482
jmp 0x49e0
addq $0x28, %r15
leaq -0x30(%rbp), %r14
movq %r15, %rbx
movq (%rbx), %rbx
cmpq %r15, %rbx
je 0x4a44
movq 0x10(%rbx), %r13
pushq $0x20
popq %rdi
callq 0x2110
movq %rax, %r12
movq %rax, %rdi
movq %r13, %rsi
callq 0x4028
movq %r12, -0x30(%rbp)
movq -0x38(%rbp), %rdi
movq %r14, %rsi
callq 0x5492
jmp 0x4a10
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4a68
movq %rax, %rbx
movq %r12, %rdi
callq 0x20f0
jmp 0x4a6b
jmp 0x4a68
jmp 0x4a68
jmp 0x4a68
movq %rax, %rbx
movq -0x38(%rbp), %rdi
callq 0x2840
movq -0x40(%rbp), %rdi
callq 0x553a
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::~Board()
Board::~Board() {
  for (int x = 0; x < 8; x++) {
    for (int y = 0; y < 8; y++) {
      if (this->board[x][y] != nullptr) {
        delete this->board[x][y];
      }
    }
  }
  for (int i = 0; i < 8; i++) {
    delete[] this->board[i];
  }
  delete[] this->board;
  for(Chessman* c : this->capturedChessmen) {
    delete c;
  }
  for(Move* m : this->previousMoves) {
    delete m;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
xorl %r14d, %r14d
cmpq $0x8, %r14
je 0x4b00
xorl %r15d, %r15d
cmpq $0x8, %r15
je 0x4afb
movq (%rbx), %rax
movq (%rax,%r14,8), %rax
movq (%rax,%r15,8), %rdi
testq %rdi, %rdi
je 0x4af6
movq (%rdi), %rax
callq *0x10(%rax)
incq %r15
jmp 0x4ada
incq %r14
jmp 0x4ad1
xorl %r14d, %r14d
movq (%rbx), %rdi
cmpq $0x8, %r14
je 0x4b1f
movq (%rdi,%r14,8), %rdi
testq %rdi, %rdi
je 0x4b1a
callq 0x2160
incq %r14
jmp 0x4b03
testq %rdi, %rdi
je 0x4b29
callq 0x2160
leaq 0x10(%rbx), %r14
movq %r14, %r15
movq (%r15), %r15
cmpq %r14, %r15
je 0x4b49
movq 0x10(%r15), %rdi
testq %rdi, %rdi
je 0x4b30
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x4b30
addq $0x28, %rbx
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x4b75
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x4b6b
movq %r15, %rdi
callq 0x4072
movq %r15, %rdi
callq 0x20f0
jmp 0x4b50
movq %rbx, %rdi
callq 0x2840
movq %r14, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x553a
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::getAllPossibleMoves[abi:cxx11](Chessman::Colour) const
std::list<Move> Board::getAllPossibleMoves(Chessman::Colour colour) const {
  std::list<Move> list;
  for (int i = 0; i < 8; i++) {
    for (int j = 0; j < 8; j++) {
      if (this->board[i][j] != nullptr && this->board[i][j]->getColour() == colour) {
        list.splice(list.end(), this->board[i][j]->getPossibleMoves(*this));
      }
    }
  }
  return list;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
movq %rdi, -0x30(%rbp)
andq $0x0, 0x10(%rdi)
movl %edx, %r14d
movq %rsi, %r15
xorl %r13d, %r13d
cmpq $0x8, %r13
je 0x4c1d
xorl %r12d, %r12d
cmpq $0x8, %r12
je 0x4c18
movq (%r15), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x4c13
callq 0x379a
cmpb %r14b, %al
jne 0x4c13
movq (%r15), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%r12,8), %rsi
movq (%rsi), %rax
leaq -0x48(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq -0x30(%rbp), %rdi
movq %rdi, %rsi
movq %rbx, %rdx
callq 0x54a2
movq %rbx, %rdi
callq 0x2a40
incq %r12
jmp 0x4bc1
incq %r13
jmp 0x4bb8
movq -0x30(%rbp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4c32
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x2a40
movq %r14, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::isCheck() const
bool Board::isCheck() const {
  std::list<Move> moves = getAllPossibleMoves(!this->currentColour);
  for (Move m : moves) {
    Chessman *target = board[m.getTarget().getX()][m.getTarget().getY()];
    if (target != nullptr
        && target->getType() == Chessman::FigureType::King
        && target->getColour() == this->currentColour) {
      return true;
    }
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movzbl 0x8(%rdi), %edi
callq 0x385b
movzbl %al, %edx
leaq -0x50(%rbp), %r13
movq %r13, %rdi
movq %rbx, %rsi
callq 0x4b8e
leaq -0x70(%rbp), %r15
movq %r13, %r14
movq (%r14), %r14
cmpq %r13, %r14
je 0x4d16
leaq 0x10(%r14), %rsi
movq %r15, %rdi
callq 0x4028
movq (%rbx), %r12
movq %r15, %rdi
callq 0x4092
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r15, %rdi
callq 0x4092
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x28ae
cltq
movq (%r12,%rax,8), %r12
testq %r12, %r12
je 0x4d03
movq %r12, %rdi
callq 0x3830
testl %eax, %eax
jne 0x4d03
movq %r12, %rdi
callq 0x379a
cmpb %al, 0x8(%rbx)
je 0x4d0d
movq %r15, %rdi
callq 0x4072
jmp 0x4c98
leaq -0x70(%rbp), %rdi
callq 0x4072
leaq -0x50(%rbp), %rdi
cmpq %rdi, %r14
setne %bl
callq 0x2a40
movl %ebx, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4d3f
movq %rax, %rbx
jmp 0x4d4b
jmp 0x4d3f
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x4072
leaq -0x50(%rbp), %rdi
callq 0x2a40
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::move(Move*)
void Board::move(Move *move) {

  Position origin = move->getOrigin();
  Position target = move->getTarget();
  Chessman *currentChessman = this->board[origin.getX()][origin.getY()];
  this->board[origin.getX()][origin.getY()] = nullptr;

  Chessman *targetChessman = this->board[target.getX()][target.getY()];
  if (targetChessman != nullptr) {
    targetChessman->capture();
    move->setCaptureMove(targetChessman);
    capturedChessmen.push_back(targetChessman);
  }
  this->board[target.getX()][target.getY()] = currentChessman;
  currentChessman->setCurrentPosition(target);
  this->previousMoves.push_back(new Move(*move));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x4088
leaq -0x48(%rbp), %r13
movq %rax, (%r13)
movq %r14, %rdi
callq 0x4092
leaq -0x30(%rbp), %rcx
movq %rax, (%rcx)
movq (%rbx), %r15
movq %r13, %rdi
callq 0x28a6
cltq
movq (%r15,%rax,8), %r15
movq %r13, %rdi
callq 0x28ae
cltq
movq (%r15,%rax,8), %r15
movq (%rbx), %r12
movq %r13, %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r13, %rdi
callq 0x28ae
cltq
andq $0x0, (%r12,%rax,8)
movq (%rbx), %r12
leaq -0x30(%rbp), %r13
movq %r13, %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r13, %rdi
callq 0x28ae
cltq
movq (%r12,%rax,8), %r12
movq %r12, -0x38(%rbp)
testq %r12, %r12
je 0x4e1d
movq %r12, %rdi
callq 0x37a4
movq %r14, %rdi
movq %r12, %rsi
callq 0x40b2
leaq 0x10(%rbx), %rdi
leaq -0x38(%rbp), %rsi
callq 0x550e
movq (%rbx), %r13
leaq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x28a6
cltq
movq (%r13,%rax,8), %r13
movq %r12, %rdi
callq 0x28ae
cltq
movq %r15, (%r13,%rax,8)
movq (%r12), %rsi
movq %r15, %rdi
callq 0x3844
pushq $0x20
popq %rdi
callq 0x2110
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x4028
addq $0x28, %rbx
leaq -0x40(%rbp), %rsi
movq %r15, (%rsi)
movq %rbx, %rdi
callq 0x5492
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::undoLastMove()
void Board::undoLastMove() {
  if (previousMoves.size() == 0) {
    return;
  }
  Move *m = previousMoves.back();
  previousMoves.pop_back();

  Position origin = m->getOrigin();
  Position target = m->getTarget();
  Chessman *currentChessman = this->board[target.getX()][target.getY()];
  if (m->hasType(Move::Promotion)) {
    delete currentChessman;
    currentChessman = capturedChessmen.back();
    capturedChessmen.pop_back();
  }

  if (m->hasType(Move::Capture)) {
    this->board[target.getX()][target.getY()] = m->getCapturedChessman()->clone();
    this->board[target.getX()][target.getY()]->unsetCapture();
  } else {
    this->board[target.getX()][target.getY()] = nullptr;
  }
  this->board[origin.getX()][origin.getY()] = currentChessman;
  currentChessman->setCurrentPosition(origin);

  if (m->hasType(Move::Casteling)) {
    this->changeCurrentColour();
    undoLastMove();
  }
  this->changeCurrentColour();
  delete m;
}

// Assembly:
cmpq $0x0, 0x38(%rdi)
je 0x5040
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
addq $0x28, %rdi
movq 0x30(%rbx), %rax
movq 0x10(%rax), %r14
callq 0x551e
movq %r14, %rdi
callq 0x4088
movq %rax, -0x40(%rbp)
movq %r14, %rdi
callq 0x4092
leaq -0x30(%rbp), %r15
movq %rax, (%r15)
movq (%rbx), %r12
movq %r15, %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r15, %rdi
callq 0x28ae
cltq
movq (%r12,%rax,8), %r15
pushq $0x4
popq %rsi
movq %r14, %rdi
callq 0x40a6
testb %al, %al
je 0x4f3c
testq %r15, %r15
je 0x4f2b
movq (%r15), %rax
movq %r15, %rdi
callq *0x10(%rax)
leaq 0x10(%rbx), %rdi
movq 0x18(%rbx), %rax
movq 0x10(%rax), %r15
callq 0x552c
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x40a6
testb %al, %al
je 0x4fac
movq %r14, %rdi
callq 0x4068
movq (%rax), %rcx
movq %rax, %rdi
callq *(%rcx)
movq %rax, -0x38(%rbp)
movq (%rbx), %r12
leaq -0x30(%rbp), %r13
movq %r13, %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r13, %rdi
callq 0x28ae
cltq
movq -0x38(%rbp), %rcx
movq %rcx, (%r12,%rax,8)
movq (%rbx), %r12
movq %r13, %rdi
callq 0x28a6
cltq
movq (%r12,%rax,8), %r12
movq %r13, %rdi
callq 0x28ae
cltq
movq (%r12,%rax,8), %rdi
callq 0x37b8
jmp 0x4fd2
movq (%rbx), %r13
leaq -0x30(%rbp), %r12
movq %r12, %rdi
callq 0x28a6
cltq
movq (%r13,%rax,8), %r13
movq %r12, %rdi
callq 0x28ae
cltq
andq $0x0, (%r13,%rax,8)
movq (%rbx), %r13
leaq -0x40(%rbp), %r12
movq %r12, %rdi
callq 0x28a6
cltq
movq (%r13,%rax,8), %r13
movq %r12, %rdi
callq 0x28ae
cltq
movq %r15, (%r13,%rax,8)
movq (%r12), %rsi
movq %r15, %rdi
callq 0x3844
pushq $0x2
popq %rsi
movq %r14, %rdi
callq 0x40a6
testb %al, %al
je 0x501e
xorb $0x1, 0x8(%rbx)
movq %rbx, %rdi
callq 0x4ea4
xorb $0x1, 0x8(%rbx)
movq %r14, %rdi
callq 0x4072
movq %r14, %rdi
callq 0x20f0
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::isCheckmate() const
bool Board::isCheckmate() const {
  if (!this->isCheck()) {
    return false;
  }
  std::list<Move> moves = getAllPossibleMoves(this->currentColour);
  Board *b = new Board(*this);
  for (Move m : moves) {
    Move *m2 = new Move(m);
    if (b->applyMove(m2)) {
      delete b;
      delete m2;
      return false;
    }
    delete m2;
    b->undoLastMove();
  }
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
callq 0x4c62
testb %al, %al
je 0x534c
movzbl 0x8(%rbx), %edx
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x4b8e
pushq $0x40
popq %rdi
callq 0x2110
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x490a
leaq -0x40(%rbp), %r12
movq (%r12), %r12
leaq -0x40(%rbp), %rax
cmpq %rax, %r12
sete %r15b
je 0x5341
leaq 0x10(%r12), %rsi
leaq -0x60(%rbp), %rdi
callq 0x4028
pushq $0x20
popq %rdi
callq 0x2110
movq %rax, %rbx
movq %rax, %rdi
leaq -0x60(%rbp), %rsi
callq 0x4028
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4656
movl %eax, %r13d
testb %al, %al
je 0x5317
movq %r14, %rdi
callq 0x4ac0
movq %r14, %rdi
callq 0x20f0
movq %rbx, %rdi
callq 0x4072
movq %rbx, %rdi
callq 0x20f0
jmp 0x532f
movq %rbx, %rdi
callq 0x4072
movq %rbx, %rdi
callq 0x20f0
movq %r14, %rdi
callq 0x4ea4
leaq -0x60(%rbp), %rdi
callq 0x4072
testb %r13b, %r13b
je 0x52a9
leaq -0x40(%rbp), %rdi
callq 0x2a40
jmp 0x534f
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %r14, %rdi
callq 0x20f0
jmp 0x538e
jmp 0x537d
movq %rax, %r15
movq %rbx, %rdi
callq 0x20f0
jmp 0x5385
movq %rax, %r15
jmp 0x538e
movq %rax, %r15
leaq -0x60(%rbp), %rdi
callq 0x4072
leaq -0x40(%rbp), %rdi
callq 0x2a40
movq %r15, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/Model/Board.cpp
// Function: Board::isPromotion(Move*) const
bool Board::isPromotion(Move *move) const {
  Chessman *currentChessman = getChessman(move->getTarget());
  if (currentChessman == nullptr) {
    return false;
  }
  if (currentChessman->getType() != Chessman::Pawn) {
    return false;
  }
  if (move->getTarget().getX() == 0 || move->getTarget().getX() == 7) {
    move->addType(Move::Promotion);
    return true;
  }
  return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x4092
movq %r14, %rdi
movq %rax, %rsi
callq 0x4a86
testq %rax, %rax
je 0x5468
movq %rax, %rdi
callq 0x3830
cmpl $0x2, %eax
jne 0x5468
movq %rbx, %rdi
callq 0x4092
leaq -0x20(%rbp), %rdi
movq %rax, (%rdi)
callq 0x28a6
testl %eax, %eax
je 0x5459
movq %rbx, %rdi
callq 0x4092
leaq -0x18(%rbp), %rdi
movq %rax, (%rdi)
callq 0x28a6
cmpl $0x7, %eax
jne 0x5468
pushq $0x4
popq %rsi
movq %rbx, %rdi
callq 0x409c
movb $0x1, %al
jmp 0x546a
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::printBoard(Board const*) const
void View::printBoard(Board const *board) const {
  printBoardLabel();
  printTopBoardLine();
  for (int i = 0; i < 8; i ++) {

    std::cout << i + 1 << " │ ";
    for (int j = 0; j < 8; j ++) {
      printChessman(board->getChessman(Position(i, j)));
      std::cout << " │ ";
    }
    std::cout << " "  << i + 1 << std::endl;
    if (i < 7) {
      printBoardLine();
    }
  }
  printBottomBoardLine();
  printBoardLabel();

}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
callq 0x59b2
callq 0x59d2
xorl %r12d, %r12d
movq 0x56e0(%rip), %r14      # 0xafd0
leaq 0x17a5(%rip), %r15      # 0x709c
cmpl $0x8, %r12d
je 0x5998
leal 0x1(%r12), %esi
movq %r14, %rdi
movl %esi, -0x2c(%rbp)
callq 0x21c0
movq %rax, %rdi
movq %r15, %rsi
callq 0x2100
xorl %r13d, %r13d
cmpl $0x8, %r13d
je 0x5958
leaq -0x38(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x286e
movq -0x38(%rbp), %rsi
movq %rbx, %rdi
callq 0x4a86
movq %rax, %rsi
callq 0x59f2
movq %r14, %rdi
movq %r15, %rsi
callq 0x2100
incl %r13d
jmp 0x591f
movq %r14, %rdi
leaq 0x19aa(%rip), %rsi      # 0x730c
callq 0x2100
movq %rax, %rdi
movl -0x2c(%rbp), %r13d
movl %r13d, %esi
callq 0x21c0
movq %rax, %rdi
callq 0x20b0
cmpl $0x7, %r12d
movl %r13d, %r12d
je 0x58f7
callq 0x5a50
movl %r13d, %r12d
jmp 0x58f7
callq 0x5a70
callq 0x59b2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::getPromotionType() const
Chessman::FigureType View::getPromotionType() const {
  while (true) {
    std::cout << "Please specify the figure you want your pawn be promoted to:" << std::endl;
    std::cout << "Q(Queen), K(Knight), R(Rook), B(Bishop)" << std::endl;
    std::string type;
    std::cin >> type;
    switch (toupper(type[0])) {
      case 'Q':
        return Chessman::Queen;
      case 'K':
        return Chessman::Knight;
      case 'R':
        return Chessman::Rook;
      case 'B':
        return Chessman::Bishop;
      default:
        continue;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq 0x54c8(%rip), %rbx      # 0xafd0
movq 0x54d1(%rip), %r12      # 0xafe0
leaq -0x48(%rbp), %r13
movq %rbx, %rdi
leaq 0x1773(%rip), %rsi      # 0x7290
callq 0x2100
movq %rax, %rdi
callq 0x20b0
movq %rbx, %rdi
leaq 0x1799(%rip), %rsi      # 0x72cd
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq -0x38(%rbp), %rax
movq %rax, -0x48(%rbp)
andq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq %r12, %rdi
movq %r13, %rsi
callq 0x2150
movq -0x48(%rbp), %rax
movsbl (%rax), %edi
callq 0x21f0
movb $0x1, %r15b
cmpl $0x42, %eax
je 0x5b8c
cmpl $0x4b, %eax
je 0x5b84
cmpl $0x51, %eax
je 0x5b88
cmpl $0x52, %eax
jne 0x5ba3
pushq $0x4
jmp 0x5b8e
pushq $0x3
jmp 0x5b8e
pushq $0x1
jmp 0x5b8e
pushq $0x5
popq %r14
movq %r13, %rdi
callq 0x20a0
testb %r15b, %r15b
je 0x5b13
jmp 0x5ba8
xorl %r15d, %r15d
jmp 0x5b90
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq -0x48(%rbp), %rdi
callq 0x20a0
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::saveToFile(std::__cxx11::list<Move*, std::allocator<Move*>>) const
void View::saveToFile(std::list<Move*> moves) const {
  std::ofstream myStream("./SaveFile.txt");
  if(myStream.is_open()) {
    for(Move *m : moves){
      myStream << (char) ('A' + m->getOrigin().getY()) << m->getOrigin().getX() + 1 << " "
        << (char) ('A' + m->getTarget().getY()) << m->getTarget().getX() + 1 << std::endl;
    }
  }
  myStream.close();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
leaq 0x1403(%rip), %rsi      # 0x73c7
leaq -0x248(%rbp), %rdi
pushq $0x10
popq %rdx
callq 0x2130
leaq -0x1d8(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x60ac
leaq -0x30(%rbp), %r15
movq %r14, %rbx
movq (%rbx), %rbx
cmpq %r14, %rbx
je 0x60ac
movq 0x10(%rbx), %r12
movq %r12, %rdi
callq 0x4088
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x28ae
addb $0x41, %al
movsbl %al, %esi
leaq -0x248(%rbp), %rdi
callq 0x2140
movq %rax, %r13
movq %r12, %rdi
callq 0x4088
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x28a6
incl %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
leaq 0x12ba(%rip), %rsi      # 0x730c
callq 0x2100
movq %rax, %r13
movq %r12, %rdi
callq 0x4092
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x28ae
addb $0x41, %al
movsbl %al, %esi
movq %r13, %rdi
callq 0x2140
movq %rax, %r13
movq %r12, %rdi
callq 0x4092
movq %rax, -0x30(%rbp)
movq %r15, %rdi
callq 0x28a6
incl %eax
movq %r13, %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %rdi
callq 0x20b0
jmp 0x5fee
leaq -0x248(%rbp), %rdi
callq 0x2180
leaq -0x248(%rbp), %rdi
callq 0x2190
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x60de
jmp 0x60de
jmp 0x60de
jmp 0x60de
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x2190
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O2/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::loadFromFile[abi:cxx11]() const
std::list<Move*> View::loadFromFile() const {
  std::list<Move*> moves;
  std::ifstream myStream("./SaveFile.txt");
  if(!myStream.is_open()) {
    std::cout << "There is no savefile to open" << std::endl;
    myStream.close();
    return moves;
  }
  std::string line;
  while(getline(myStream,line)) {
    if (line.size() == 5) {
      moves.push_back(new Move(Position(line.substr(0, 2)), Position(line.substr(3, 5))));
    }
  }
  myStream.close();
  return moves;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
movq %rdi, -0x30(%rbp)
andq $0x0, 0x10(%rdi)
leaq 0x12a6(%rip), %rsi      # 0x73c7
leaq -0x2b0(%rbp), %rdi
pushq $0x8
popq %rdx
callq 0x21e0
leaq -0x238(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x6219
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x2b0(%rbp), %r13
leaq -0x68(%rbp), %r15
movq %r13, %rdi
movq %r15, %rsi
callq 0x2050
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x6242
cmpq $0x5, -0x60(%rbp)
jne 0x615f
pushq $0x20
popq %rdi
callq 0x2110
movq %rax, %r12
leaq -0xa8(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
xorl %edx, %edx
pushq $0x2
popq %rcx
callq 0x2120
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x287a
leaq -0x88(%rbp), %rbx
movq %rbx, %rdi
movq %r15, %rsi
pushq $0x3
popq %rdx
pushq $0x5
popq %rcx
callq 0x2120
movb $0x1, %r14b
leaq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x287a
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq %r12, %rdi
callq 0x3ffc
movq %r12, -0x48(%rbp)
xorl %r14d, %r14d
movq -0x30(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5492
leaq -0x88(%rbp), %rdi
callq 0x20a0
leaq -0xa8(%rbp), %rdi
callq 0x20a0
jmp 0x615f
movq 0x4db0(%rip), %rdi      # 0xafd0
leaq 0x11af(%rip), %rsi      # 0x73d6
callq 0x2100
movq %rax, %rdi
callq 0x20b0
leaq -0x2b0(%rbp), %rdi
callq 0x2060
jmp 0x6257
leaq -0x2b0(%rbp), %rdi
callq 0x2060
leaq -0x68(%rbp), %rdi
callq 0x20a0
leaq -0x2b0(%rbp), %rdi
callq 0x2080
movq -0x30(%rbp), %rax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x6294
movq %rax, %rbx
jmp 0x62d6
movq %rax, %rbx
jmp 0x62ca
jmp 0x6294
movq %rax, %rbx
jmp 0x62b9
movq %rax, %rbx
movb $0x1, %r14b
jmp 0x62a8
movq %rax, %rbx
jmp 0x62c1
movq %rax, %rbx
leaq -0x88(%rbp), %rdi
callq 0x20a0
leaq -0xa8(%rbp), %rdi
callq 0x20a0
testb %r14b, %r14b
je 0x62c1
movq %r12, %rdi
callq 0x20f0
leaq -0x68(%rbp), %rdi
callq 0x20a0
leaq -0x2b0(%rbp), %rdi
callq 0x2080
movq -0x30(%rbp), %rdi
callq 0x2840
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O2/shuwenyue[P]MD_code_cell_list/box.cpp
// Function: box::boundaries(double, double)
double box::boundaries (double length, double BoxLength)
{

	while (length > (BoxLength/2))
	{
		length = length - BoxLength;
	}

	while (length < (-BoxLength/2))
	{
		length = length + BoxLength;
	}
			
	return length;
}

// Assembly:
movsd 0xae4(%rip), %xmm2      # 0x5018
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jbe 0x4544
subsd %xmm1, %xmm0
jmp 0x4538
movsd 0xce4(%rip), %xmm2      # 0x5230
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jbe 0x455c
addsd %xmm1, %xmm0
jmp 0x4550
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mh0fm4[P]SCDC/test/units/dataprov_relay/relay.c
// Function: main
int main(int argc, char *argv[])
{
  --argc; ++argv;

  scdc_init(SCDC_INIT_DEFAULT);

  scdc_dataprov_t dp = scdc_dataprov_open("relay_service", "relay");

  /* configure relay from (local) 'scdc+tcp://.../relay_service/local_path' to (target)'scdc+tcp://target_hostname/target_path' */
  const char *cmd = "scdc:/relay_service/CONFIG put relay local_path scdc+tcp://target_hostname/target_path";

  scdc_dataset_cmd(SCDC_DATASET_NULL, cmd, NULL, NULL);

  scdc_nodeport_t np = scdc_nodeport_open("tcp");

  scdc_nodeport_start(np, SCDC_NODEPORT_START_ASYNC_UNTIL_CANCEL);

  printf("running: ENTER to exit");
  getchar();
  printf("quiting\n");

  scdc_nodeport_stop(np);

  scdc_nodeport_close(np);

  scdc_dataprov_close(dp);

  scdc_release();

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x39266(%rip), %rdi     # 0x4544d
xorl %eax, %eax
callq 0xc295
leaq 0x37e0f(%rip), %rdi     # 0x44004
leaq 0x381ee(%rip), %rsi     # 0x443ea
xorl %eax, %eax
callq 0xc5f0
movq %rax, %rbx
leaq 0x37e05(%rip), %rsi     # 0x44012
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xd6d0
leaq 0x39746(%rip), %rdi     # 0x45967
xorl %eax, %eax
callq 0xc78e
movq %rax, %r14
pushq $0x4
popq %rsi
movq %rax, %rdi
callq 0xc868
leaq 0x37e2c(%rip), %rdi     # 0x44069
xorl %eax, %eax
callq 0xb070
callq 0xb760
leaq 0x37e30(%rip), %rdi     # 0x44080
callq 0xb860
movq %r14, %rdi
callq 0xc897
movq %r14, %rdi
callq 0xc846
movq %rbx, %rdi
callq 0xc6ae
callq 0xc3aa
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: WriteLog()
int WriteLog()
{
  static time_t t,t_alt = 0;
    int day,hour;
    char fname[256];
    time(&t);
    FILE *fp;
    struct tm * ptm;
    ptm = gmtime(&t);

    day = (t%(24*3600*4))/(24*3600);
    hour = (t%(24*3600))/(3600*4)*4;

    if (e3dc_config.debug) {

    if (hour!=t_alt) // neuer Tag
    {
//        int tt = (t%(24*3600)+12*3600);
        snprintf(fname,sizeof(fname),"%s.%i.%i.txt",e3dc_config.logfile,day,hour);
        fp = fopen(fname,"w");       // altes logfile löschen
        fclose(fp);
    }
        sprintf(fname,"%s.%i.%i.txt",e3dc_config.logfile,day,hour);
        fp = fopen(fname, "a");
    if(!fp)
        fp = fopen(fname, "w");
    if(fp)
    fprintf(fp,"%s\n",Log);
        fclose(fp);}
        t_alt = hour;
;
return(0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x35128(%rip), %rbx     # 0x37b98
movq %rbx, %rdi
callq 0x2250
movq %rbx, %rdi
callq 0x2220
movq 0x35111(%rip), %rcx     # 0x37b98
movl $0x54600, %esi          # imm = 0x54600
movq %rcx, %rax
cqto
idivq %rsi
movq %rdx, %rax
movl $0x15180, %esi          # imm = 0x15180
cltd
idivl %esi
movl %eax, %ebx
movl $0x15180, %esi          # imm = 0x15180
movq %rcx, %rax
cqto
idivq %rsi
movq %rdx, %rax
movl $0x3840, %ecx           # imm = 0x3840
cltd
idivl %ecx
movl %eax, %ebp
shll $0x2, %ebp
movslq %ebp, %r15
cmpb $0x1, 0x3437d(%rip)     # 0x36e45
jne 0x2b7f
cmpq %r15, 0x350cb(%rip)     # 0x37ba0
je 0x2b14
leaq 0x28a17(%rip), %rdx     # 0x2b4f5
leaq 0x340cf(%rip), %rcx     # 0x36bb4
movq %rsp, %r14
movl $0x100, %esi            # imm = 0x100
movq %r14, %rdi
movl %ebx, %r8d
movl %ebp, %r9d
xorl %eax, %eax
callq 0x2480
leaq 0x289fe(%rip), %rsi     # 0x2b502
movq %r14, %rdi
callq 0x22f0
movq %rax, %rdi
callq 0x2290
leaq 0x289da(%rip), %rsi     # 0x2b4f5
leaq 0x34092(%rip), %rdx     # 0x36bb4
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2050
leaq 0x290e7(%rip), %rsi     # 0x2bc22
movq %r14, %rdi
callq 0x22f0
testq %rax, %rax
jne 0x2b5c
leaq 0x289b3(%rip), %rsi     # 0x2b502
movq %rsp, %rdi
callq 0x22f0
testq %rax, %rax
je 0x2b96
movq %rax, %rbx
leaq 0x2a3e5(%rip), %rsi     # 0x2cf4b
leaq 0x34473(%rip), %rdx     # 0x36fe0
movq %rax, %rdi
xorl %eax, %eax
callq 0x23f0
movq %rbx, %rdi
callq 0x2290
movq %r15, 0x3501a(%rip)     # 0x37ba0
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebx, %ebx
jmp 0x2b77
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: WriteSoC()
int WriteSoC()
{
    char fname[256];
    sprintf(fname,"soc.txt");

    FILE *fp;
        fp = fopen(fname,"a");       // altes logfile löschen
    if(!fp)
        fp = fopen(fname, "w");
    if(fp)
    {
        fprintf(fp,"%s\n",Log);
        fclose(fp);
    }
return(0);
}

// Assembly:
pushq %rbx
subq $0x100, %rsp            # imm = 0x100
movabsq $0x7478742e636f73, %rax # imm = 0x7478742E636F73
movq %rsp, %rdi
movq %rax, (%rdi)
leaq 0x29069(%rip), %rsi     # 0x2bc22
callq 0x22f0
testq %rax, %rax
jne 0x2bd7
leaq 0x28938(%rip), %rsi     # 0x2b502
movq %rsp, %rdi
callq 0x22f0
testq %rax, %rax
je 0x2bfa
movq %rax, %rbx
leaq 0x2a36a(%rip), %rsi     # 0x2cf4b
leaq 0x343f8(%rip), %rdx     # 0x36fe0
movq %rax, %rdi
xorl %eax, %eax
callq 0x23f0
movq %rbx, %rdi
callq 0x2290
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: iRelayEin(char const*)
int iRelayEin(const char * cmd)
{
//    if (isocket >= 0&&int32_t(e3dc_config.BWWP_ip)>0);
  {
    relay_ip = e3dc_config.BWWP_ip;
    int iPort = e3dc_config.BWWP_port;
    send.resize(2);
    receive.resize(8);
    memcpy(&send[0],&cmd[0],2);
    isocket = SocketConnect(relay_ip, iPort);
//      isocket = SocketConnect_noblock(relay_ip, iPort);
    if (isocket > 0){
        SocketSendData(isocket,&send[0],2);
    sleep(1);
       iLength = SocketRecvData(isocket,&receive[0],receive.size());
        SocketClose(isocket);
    }
  }
    return receive[0];
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x309ab(%rip), %rax     # 0x369b8
movq %rax, 0x31c44(%rip)     # 0x37c58
movl 0x30a16(%rip), %ebp     # 0x36a30
leaq 0x31c3f(%rip), %rdi     # 0x37c60
pushq $0x2
popq %rsi
callq 0x12422
leaq 0x31c48(%rip), %rdi     # 0x37c78
pushq $0x8
popq %rsi
callq 0x12422
movq 0x31c21(%rip), %rax     # 0x37c60
movzwl (%rbx), %ecx
movw %cx, (%rax)
movq 0x31c0c(%rip), %rdi     # 0x37c58
movl %ebp, %esi
callq 0x1d43e
movl %eax, 0x31d0f(%rip)     # 0x37d68
testl %eax, %eax
jle 0x60a4
movq 0x31bfc(%rip), %rsi     # 0x37c60
pushq $0x2
popq %rdx
movl %eax, %edi
callq 0x1d70b
pushq $0x1
popq %rdi
callq 0x21b0
movl 0x31cec(%rip), %edi     # 0x37d68
movq 0x31bf5(%rip), %rsi     # 0x37c78
movl 0x31bf7(%rip), %edx     # 0x37c80
subl %esi, %edx
callq 0x1d758
cltq
movq %rax, 0x31ba7(%rip)     # 0x37c40
movl 0x31cc9(%rip), %edi     # 0x37d68
callq 0x1d6f4
movq 0x31bcd(%rip), %rax     # 0x37c78
movzbl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: mqtt()
int mqtt()
{
if ((e3dc_config.MQTTavl > 0)&&(tE3DC % e3dc_config.MQTTavl) == 0)
{
    
    char buf[127];
//    sprintf(buf,"E3DC-Control/Avl -m %i",iAvalPower);
    sprintf(buf,"E3DC-Control/Aval -m '%i' ",ireq_Heistab);
    MQTTsend(e3dc_config.mqtt2_ip,buf);
    sprintf(buf,"E3DC-Control/BattL -m '%i' ",iBattLoad);
    MQTTsend(e3dc_config.mqtt2_ip,buf);
    sprintf(buf,"E3DC-Control/Grid -m '%0.2f %0.2f %0.2f %0.2f %0.2f'",fPower_Grid,fBatt_SOC,float(iPower_Bat),fcurrentGrid,fsollGrid);
    MQTTsend(e3dc_config.mqtt2_ip,buf);

    if (e3dc_config.debug) printf("D4b\n");

}
    return 0;
}

// Assembly:
movslq 0x3060c(%rip), %rcx     # 0x36eb0
testq %rcx, %rcx
jle 0x6981
movq 0x32644(%rip), %rax     # 0x38ef8
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x6981
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl 0x3262e(%rip), %edx     # 0x38f00
leaq 0x25363(%rip), %rsi     # 0x2bc3c
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x3007b(%rip), %r14     # 0x36968
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2c05
movl 0x32606(%rip), %edx     # 0x38f04
leaq 0x25352(%rip), %rsi     # 0x2bc57
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2c05
cvtss2sd 0x325e6(%rip), %xmm0    # 0x38f08
cvtss2sd 0x2fa26(%rip), %xmm1    # 0x36350
cvtsi2ssl 0x325da(%rip), %xmm2 # 0x38f0c
cvtss2sd %xmm2, %xmm2
cvtss2sd 0x325d2(%rip), %xmm3    # 0x38f10
cvtss2sd 0x325ce(%rip), %xmm4    # 0x38f14
leaq 0x25326(%rip), %rsi     # 0x2bc73
movq %rbx, %rdi
movb $0x5, %al
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2c05
cmpb $0x1, 0x304dc(%rip)     # 0x36e45
jne 0x6977
leaq 0x2643a(%rip), %rdi     # 0x2cdac
callq 0x2440
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: tasmotastatus(int)
int tasmotastatus(int ch)
{
    //           Test zur Abfrage des Tesmota Relais
    if (strcmp(e3dc_config.mqtt_ip,"0.0.0.0")!=0)
    {
        
        char buf[1024];
        static int WP_status = -1;
        int status;
        char path[1024];
//        if (WP_status < 2)
        {
            if (e3dc_config.debug) printf("W1\n");
            mfp == NULL;
            sprintf(buf,"mosquitto_sub -h %s -t stat/tasmota/POWER%i -W 1 -C 1",e3dc_config.mqtt_ip,ch);
            mfp = popen(buf, "r");
//            int fd = fileno(mfp);
//            int flags = fcntl(fd, F_GETFL, 0);
//            flags |= O_NONBLOCK;
//            fcntl(fd, F_SETFL, flags);
            WP_status = 2;
        }
        if (e3dc_config.debug) printf("W2\n");
        if (mfp != NULL)
        if (fgets(path, 1024, mfp) != NULL)
        {
            if (strcmp(path,"ON\n")==0)
                WP_status = 1;
            if (strcmp(path,"OFF\n")==0)
                WP_status = 0;
        }
//        if (WP_status < 2)
        if (mfp != NULL)
        {
            status = pclose(mfp);
            mfp = NULL;
        }
        if (e3dc_config.debug) printf("W2a\n");
        return WP_status;
}
    return 0;
}

// Assembly:
movabsq $0x302e302e302e30, %rax # imm = 0x302E302E302E30
cmpq %rax, 0x2ffbf(%rip)     # 0x36954
je 0x6aa3
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %edi, %ebx
cmpb $0x1, 0x30497(%rip)     # 0x36e45
jne 0x69bc
leaq 0x2699b(%rip), %rdi     # 0x2d352
callq 0x2440
leaq 0x252e5(%rip), %rsi     # 0x2bca8
leaq 0x2ff8a(%rip), %rdx     # 0x36954
leaq 0x400(%rsp), %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2050
leaq 0x26e73(%rip), %rsi     # 0x2d858
movq %r14, %rdi
callq 0x20a0
movq %rax, 0x32524(%rip)     # 0x38f18
movl $0x2, 0x2f956(%rip)     # 0x36354
cmpb $0x1, 0x30440(%rip)     # 0x36e45
jne 0x6a1a
leaq 0x26948(%rip), %rdi     # 0x2d356
callq 0x2440
movq 0x324fe(%rip), %rax     # 0x38f18
testq %rax, %rax
je 0x6a64
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2470
testq %rax, %rax
je 0x6a64
cmpl $0xa4e4f, (%rsp)        # imm = 0xA4E4F
jne 0x6a47
movl $0x1, 0x2f90d(%rip)     # 0x36354
leaq 0x25290(%rip), %rsi     # 0x2bcde
movq %rsp, %rdi
pushq $0x5
popq %rdx
callq 0x22c0
testl %eax, %eax
jne 0x6a64
andl $0x0, 0x2f8f0(%rip)     # 0x36354
movq 0x324ad(%rip), %rdi     # 0x38f18
testq %rdi, %rdi
je 0x6a7d
callq 0x23e0
andq $0x0, 0x3249b(%rip)     # 0x38f18
cmpb $0x1, 0x303c1(%rip)     # 0x36e45
jne 0x6a92
leaq 0x26323(%rip), %rdi     # 0x2cdb0
callq 0x2440
movl 0x2f8bc(%rip), %eax     # 0x36354
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: tasmotaon(int)
int tasmotaon(int ch)
{
    char buf[127];
    if (e3dc_config.tasmota)
    {
        sprintf(buf,"cmnd/tasmota/POWER%i -m 1",ch);
        MQTTsend(e3dc_config.mqtt_ip,buf);
        tasmota_status[ch-1] = 1;
    }    return 0;
}

// Assembly:
cmpb $0x1, 0x300a0(%rip)     # 0x36e4a
jne 0x6df9
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x24f8b(%rip), %rsi     # 0x2bd4a
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x2fb7f(%rip), %rdi     # 0x36954
movq %r14, %rsi
callq 0x2c05
movslq %ebx, %rax
leaq 0x2f549(%rip), %rcx     # 0x36330
movl $0x1, -0x4(%rcx,%rax,4)
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: tasmotaoff(int)
int tasmotaoff(int ch)
{
    char buf[127];
    if (e3dc_config.tasmota)
    {
        sprintf(buf,"cmnd/tasmota/POWER%i -m 0",ch);
        MQTTsend(e3dc_config.mqtt_ip,buf);
        tasmota_status[ch-1] = 0;
    }    return 0;
}

// Assembly:
cmpb $0x1, 0x30047(%rip)     # 0x36e4a
jne 0x6e4f
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x24f4c(%rip), %rsi     # 0x2bd64
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x2fb26(%rip), %rdi     # 0x36954
movq %r14, %rsi
callq 0x2c05
movslq %ebx, %rax
leaq 0x2f4f0(%rip), %rcx     # 0x36330
andl $0x0, -0x4(%rcx,%rax,4)
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: shelly_get()
int shelly_get(){
    FILE *fp;
    char line[256];
    int WP_status,status;
    char path[1024];
    
    fp = NULL;
    if (shellytimer < t) 
    {
        sprintf(line,"curl -s -X GET 'http://%s/rpc/Light.GetStatus?id=0'",e3dc_config.shelly0V10V_ip);
        fp = popen(line, "r");
        //    system(line);
        const cJSON *item = NULL;
        if (fp != NULL)
            if (fgets(path, 1024, fp) != NULL)
                
            {
                
                std::string feld;
                cJSON *wolf_json = cJSON_Parse(path);
                feld = "brightness";
                char * c = &feld[0];
                item = cJSON_GetObjectItemCaseSensitive(wolf_json, c );
                
            }
        status = pclose(fp);
        if (item!=NULL)
            return(item->valueint);
        else
        {
            shellytimer = t+600;
            return(-1);
        }
    }
    return(-2);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x528, %rsp            # imm = 0x528
movq 0x320bd(%rip), %rax     # 0x38f20
cmpq 0x30d6e(%rip), %rax     # 0x37bd8
jge 0x6f0a
leaq 0x24f07(%rip), %rsi     # 0x2bd7e
leaq 0x2fb80(%rip), %rdx     # 0x369fe
xorl %r14d, %r14d
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x269c1(%rip), %rsi     # 0x2d858
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
testq %rax, %rax
je 0x6f11
leaq 0x120(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x2470
testq %rax, %rax
je 0x6f0e
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x120(%rsp), %rdi
callq 0x28719
movq %rax, %r14
leaq 0x24ec9(%rip), %rsi     # 0x2bdb2
movq %rsp, %rdi
callq 0x2530
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x28e9b
movq %rax, %r14
movq %rsp, %rdi
callq 0x2578
jmp 0x6f11
pushq $-0x2
jmp 0x6f39
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x23e0
testq %r14, %r14
je 0x6f24
movl 0x28(%r14), %eax
jmp 0x6f3a
movl $0x258, %eax            # imm = 0x258
addq 0x30ca8(%rip), %rax     # 0x37bd8
movq %rax, 0x31fe9(%rip)     # 0x38f20
pushq $-0x1
popq %rax
addq $0x528, %rsp            # imm = 0x528
popq %rbx
popq %r14
retq
jmp 0x6f47
movq %rax, %rbx
movq %rsp, %rdi
callq 0x2578
movq %rbx, %rdi
callq 0x24d0
// File: /workspace/github_cpp_makefile_star2_O2/Eba-M[P]E3DC-Control/RscpExampleMain.cpp
// Function: shelly(int)
int shelly(int ALV)
{
    char path[1024];
    char buf[127];
    static int ALV_alt = -1;
    FILE *fp;
    fp==NULL;
    if (ALV>0&&ALV<e3dc_config.shelly0V10Vmin) ALV = e3dc_config.shelly0V10Vmin;
    if (ALV>e3dc_config.shelly0V10Vmax) ALV = e3dc_config.shelly0V10Vmax;
    if (e3dc_config.shelly0V10V&&shellytimer < t&&ALV!=ALV_alt)
    {
        if (ALV>0)
            sprintf(buf,"curl -s -X POST -d '{""id"":0, ""on"":true, ""brightness"":%i}' ""http://%s/rpc/Light.Set?",ALV,e3dc_config.shelly0V10V_ip);
        else
            sprintf(buf,"curl -s -X POST -d '{""id"":0, ""on"":false, ""brightness"":%i}' ""http://%s/rpc/Light.Set?",ALV,e3dc_config.shelly0V10V_ip);
        fp = popen(buf, "r");
        
        if (fp != NULL)
            if (fgets(path, 1024, fp) != NULL)
            {
                ALV_alt = ALV;
            }
    if (fp != NULL)
        pclose(fp);
    }
    return ALV_alt;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x488, %rsp            # imm = 0x488
movl 0x2fcb2(%rip), %ebx     # 0x36eb4
cmpl %edi, %ebx
cmovlel %edi, %ebx
testl %edi, %edi
cmovlel %edi, %ebx
movl 0x2fca6(%rip), %eax     # 0x36eb8
cmpl %eax, %ebx
cmovgel %eax, %ebx
cmpb $0x1, 0x2fc2b(%rip)     # 0x36e49
jne 0x72a5
movq 0x31cf5(%rip), %rax     # 0x38f20
cmpq 0x309a6(%rip), %rax     # 0x37bd8
jge 0x72a5
cmpl 0x2f126(%rip), %ebx     # 0x36360
je 0x72a5
testl %ebx, %ebx
leaq 0x24c20(%rip), %rax     # 0x2be65
leaq 0x24c66(%rip), %rsi     # 0x2beb2
cmovgq %rax, %rsi
leaq 0x2f7a7(%rip), %rcx     # 0x369fe
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x265eb(%rip), %rsi     # 0x2d858
movq %r14, %rdi
callq 0x20a0
testq %rax, %rax
je 0x72a5
movq %rax, %r14
leaq 0x80(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2470
testq %rax, %rax
je 0x729d
movl %ebx, 0x2f0c3(%rip)     # 0x36360
movq %r14, %rdi
callq 0x23e0
movl 0x2f0b5(%rip), %eax     # 0x36360
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r14
retq