LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/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
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, 0x8(%rdi)
movq %rdi, (%rdi)
movq %rdi, -0x30(%rbp)
movq $0x0, 0x10(%rdi)
xorl %r13d, %r13d
leaq -0x50(%rbp), %r12
movl %edx, -0x34(%rbp)
xorl %ebx, %ebx
movq (%r15), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx,8), %rdi
testq %rdi, %rdi
je 0x4e06
callq 0x37b2
cmpb %r14b, %al
jne 0x4e06
movq (%r15), %rax
movq (%rax,%r13,8), %rax
movq (%rax,%rbx,8), %rsi
movq (%rsi), %rax
movq %r12, %rdi
movq %r15, %rdx
callq *0x18(%rax)
movq -0x50(%rbp), %rsi
cmpq %r12, %rsi
je 0x4dfe
movq %r12, %r14
movq -0x30(%rbp), %r12
movq %r12, %rdi
movq %r14, %rdx
callq 0x20a0
movq -0x40(%rbp), %rax
addq %rax, 0x10(%r12)
movq %r14, %r12
movl -0x34(%rbp), %r14d
movq $0x0, -0x40(%rbp)
movq %r12, %rdi
callq 0x2b00
incq %rbx
cmpq $0x8, %rbx
jne 0x4d9a
incq %r13
cmpq $0x8, %r13
jne 0x4d98
movq -0x30(%rbp), %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x4e2d
movq %rax, %r14
movq -0x30(%rbp), %rdi
callq 0x2b00
movq %r14, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3873
movzbl %al, %edx
leaq -0x50(%rbp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4d64
movq (%r14), %r15
cmpq %r14, %r15
setne %r14b
je 0x4f1e
leaq -0x70(%rbp), %r12
leaq 0x10(%r15), %rsi
movq %r12, %rdi
callq 0x408c
movq (%rbx), %r13
movq %r12, %rdi
callq 0x40f8
movq %rax, -0x38(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x2956
cltq
movq (%r13,%rax,8), %r13
movq %r12, %rdi
callq 0x40f8
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x295e
cltq
movq (%r13,%rax,8), %r13
testq %r13, %r13
je 0x4f06
movq %r13, %rdi
callq 0x3848
testl %eax, %eax
jne 0x4f06
movq %r13, %rdi
callq 0x37b2
cmpb %al, 0x8(%rbx)
je 0x4f3d
movq %r12, %rdi
callq 0x40d8
movq (%r15), %r15
leaq -0x50(%rbp), %rax
cmpq %rax, %r15
setne %r14b
jne 0x4ea1
leaq -0x50(%rbp), %rdi
callq 0x2b00
andb $0x1, %r14b
movl %r14d, %eax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x70(%rbp), %rdi
callq 0x40d8
jmp 0x4f1e
jmp 0x4f51
movq %rax, %rbx
jmp 0x4f5d
jmp 0x4f51
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x40d8
leaq -0x50(%rbp), %rdi
callq 0x2b00
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O1/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 $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x40ee
leaq -0x40(%rbp), %r13
movq %rax, (%r13)
movq %r14, %rdi
callq 0x40f8
leaq -0x38(%rbp), %r12
movq %rax, (%r12)
movq (%rbx), %r15
movq %r13, %rdi
callq 0x2956
cltq
movq (%r15,%rax,8), %r15
movq %r13, %rdi
callq 0x295e
cltq
movq (%r15,%rax,8), %rax
movq %rax, -0x30(%rbp)
movq (%rbx), %r15
movq %r13, %rdi
callq 0x2956
cltq
movq (%r15,%rax,8), %r15
movq %r13, %rdi
callq 0x295e
cltq
movq $0x0, (%r15,%rax,8)
movq (%rbx), %r15
movq %r12, %rdi
callq 0x2956
cltq
movq (%r15,%rax,8), %r15
movq %r12, %rdi
callq 0x295e
cltq
movq (%r15,%rax,8), %r12
testq %r12, %r12
je 0x5043
movq %r12, %rdi
callq 0x37bc
movq %r14, %rdi
movq %r12, %rsi
callq 0x4118
leaq 0x10(%rbx), %r13
movl $0x18, %edi
callq 0x2120
movq %r12, 0x10(%rax)
movq %rax, %rdi
movq %r13, %rsi
callq 0x2050
incq 0x20(%rbx)
movq (%rbx), %r15
leaq -0x38(%rbp), %r12
movq %r12, %rdi
callq 0x2956
cltq
movq (%r15,%rax,8), %r15
movq %r12, %rdi
callq 0x295e
cltq
movq -0x30(%rbp), %rdi
movq %rdi, (%r15,%rax,8)
movq (%r12), %rsi
callq 0x385c
movl $0x20, %edi
callq 0x2120
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x408c
leaq 0x28(%rbx), %r14
movl $0x18, %edi
callq 0x2120
movq %r15, 0x10(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2050
incq 0x38(%rbx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r15, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x21d0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x4e5e
testb %al, %al
je 0x55f4
movzbl 0x8(%rbx), %edx
leaq -0x40(%rbp), %rdi
movq %rbx, %rsi
callq 0x4d64
movl $0x40, %edi
callq 0x2120
movq %rax, %r14
movq %rax, %rdi
movq %rbx, %rsi
callq 0x4a2a
leaq -0x40(%rbp), %r12
movq (%r12), %r12
leaq -0x40(%rbp), %rax
cmpq %rax, %r12
sete %r15b
je 0x55e9
leaq 0x10(%r12), %rsi
leaq -0x60(%rbp), %rdi
callq 0x408c
movl $0x20, %edi
callq 0x2120
movq %rax, %r13
movq %rax, %rdi
leaq -0x60(%rbp), %rsi
callq 0x408c
movq %r14, %rdi
movq %r13, %rsi
callq 0x474e
movl %eax, %ebx
testb %al, %al
je 0x55c0
movq %r14, %rdi
callq 0x4c76
movq %r14, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x40d8
movq %r13, %rdi
callq 0x2100
jmp 0x55d8
movq %r13, %rdi
callq 0x40d8
movq %r13, %rdi
callq 0x2100
movq %r14, %rdi
callq 0x50d8
leaq -0x60(%rbp), %rdi
callq 0x40d8
testb %bl, %bl
je 0x5551
leaq -0x40(%rbp), %rdi
callq 0x2b00
jmp 0x55f7
xorl %r15d, %r15d
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %r14, %rdi
callq 0x2100
jmp 0x5636
jmp 0x5625
movq %rax, %rbx
movq %r13, %rdi
callq 0x2100
jmp 0x562d
movq %rax, %rbx
jmp 0x5636
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
callq 0x40d8
leaq -0x40(%rbp), %rdi
callq 0x2b00
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x40f8
leaq -0x20(%rbp), %r15
movq %rax, (%r15)
movq (%r14), %r14
movq %r15, %rdi
callq 0x2956
cltq
movq (%r14,%rax,8), %r14
movq %r15, %rdi
callq 0x295e
cltq
movq (%r14,%rax,8), %rdi
testq %rdi, %rdi
je 0x573a
callq 0x3848
cmpl $0x2, %eax
jne 0x573a
movq %rbx, %rdi
callq 0x40f8
leaq -0x20(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2956
testl %eax, %eax
je 0x5729
movq %rbx, %rdi
callq 0x40f8
leaq -0x28(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2956
cmpl $0x7, %eax
jne 0x573a
movq %rbx, %rdi
movl $0x4, %esi
callq 0x4102
movb $0x1, %al
jmp 0x573c
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, -0x38(%rbp)
callq 0x595a
callq 0x59a8
xorl %eax, %eax
movq 0x575c(%rip), %rbx      # 0xafd0
leaq 0x1851(%rip), %r14      # 0x70cc
movq -0x38(%rbp), %r15
movl %eax, %r12d
leal 0x1(%r12), %esi
movq %rbx, %rdi
movl %esi, -0x2c(%rbp)
callq 0x21c0
movl $0x5, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2150
xorl %r13d, %r13d
leaq -0x40(%rbp), %rdi
movl %r12d, %esi
movl %r13d, %edx
callq 0x291e
movq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x4c3c
movq %rax, %rsi
callq 0x59f6
movl $0x5, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2150
incl %r13d
cmpl $0x8, %r13d
jne 0x58a5
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1a4c(%rip), %rsi      # 0x733c
callq 0x2150
movq %rbx, %rdi
movl -0x2c(%rbp), %esi
callq 0x21c0
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %r13, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
cmpl $0x7, %r12d
je 0x5935
callq 0x5b3e
movl -0x2c(%rbp), %eax
cmpl $0x8, %eax
jne 0x587f
callq 0x5b8c
callq 0x595a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/IncredibleHannes[P]QMUL-ChessGame/src/View/View.cpp
// Function: View::printChessman(Chessman const*) const
void View::printChessman(Chessman const *chessman) const {
  if (chessman == nullptr) {
    std::cout << " ";
    return;
  }
  if (chessman->getColour() != Chessman::White) {
    switch (chessman->getType()) {
      case Chessman::Bishop :
        std::cout << "♗";
        break;
      case Chessman::King :
        std::cout << "♔";
        break;
      case Chessman::Knight :
        std::cout << "♘";
        break;
      case Chessman::Pawn :
        std::cout << "♙";
        break;
      case Chessman::Queen :
        std::cout << "♕";
        break;
      case Chessman::Rook :
        std::cout << "♖";
        break;
    }
  } else {
    switch (chessman->getType()) {
      case Chessman::Bishop :
        std::cout << "♝";
        break;
      case Chessman::King :
        std::cout << "♚";
        break;
      case Chessman::Knight :
        std::cout << "♞";
        break;
      case Chessman::Pawn :
        std::cout << "♟";
        break;
      case Chessman::Queen :
        std::cout << "♛";
        break;
      case Chessman::Rook :
        std::cout << "♜";
        break;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
testq %rsi, %rsi
je 0x5a47
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x37b2
movl %eax, %r14d
movq %rbx, %rdi
callq 0x3848
testb %r14b, %r14b
je 0x5a5f
cmpl $0x5, %eax
ja 0x5a89
movl %eax, %eax
leaq 0x1661(%rip), %rcx      # 0x708c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x5595(%rip), %rdi      # 0xafd0
leaq 0x1800(%rip), %rsi      # 0x7242
jmp 0x5b2f
movq 0x5582(%rip), %rdi      # 0xafd0
leaq 0x18e7(%rip), %rsi      # 0x733c
movl $0x1, %edx
jmp 0x5b34
cmpl $0x5, %eax
ja 0x5a89
movl %eax, %eax
leaq 0x1607(%rip), %rcx      # 0x7074
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x5553(%rip), %rdi      # 0xafd0
leaq 0x17a6(%rip), %rsi      # 0x722a
jmp 0x5b2f
popq %rbx
popq %r14
popq %rbp
retq
movq 0x553b(%rip), %rdi      # 0xafd0
leaq 0x17b6(%rip), %rsi      # 0x7252
jmp 0x5b2f
movq 0x5528(%rip), %rdi      # 0xafd0
leaq 0x178b(%rip), %rsi      # 0x723a
jmp 0x5b2f
movq 0x5518(%rip), %rdi      # 0xafd0
leaq 0x178b(%rip), %rsi      # 0x724a
jmp 0x5b2f
movq 0x5508(%rip), %rdi      # 0xafd0
leaq 0x1763(%rip), %rsi      # 0x7232
jmp 0x5b2f
movq 0x54f8(%rip), %rdi      # 0xafd0
leaq 0x1767(%rip), %rsi      # 0x7246
jmp 0x5b2f
movq 0x54e8(%rip), %rdi      # 0xafd0
leaq 0x173f(%rip), %rsi      # 0x722e
jmp 0x5b2f
movq 0x54d8(%rip), %rdi      # 0xafd0
leaq 0x174f(%rip), %rsi      # 0x724e
jmp 0x5b2f
movq 0x54c8(%rip), %rdi      # 0xafd0
leaq 0x1727(%rip), %rsi      # 0x7236
jmp 0x5b2f
movq 0x54b8(%rip), %rdi      # 0xafd0
leaq 0x171f(%rip), %rsi      # 0x723e
jmp 0x5b2f
movq 0x54a8(%rip), %rdi      # 0xafd0
leaq 0x16f7(%rip), %rsi      # 0x7226
movl $0x3, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x2150
nop
// File: /workspace/github_cpp_makefile_star2_O1/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
leaq -0x38(%rbp), %r12
movq 0x52f0(%rip), %rbx      # 0xafd0
movl $0x3c, %edx
movq %rbx, %rdi
leaq 0x15d1(%rip), %rsi      # 0x72c0
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
movl $0x27, %edx
movq %rbx, %rdi
leaq 0x15d3(%rip), %rsi      # 0x72fd
callq 0x2150
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
movq %r12, -0x48(%rbp)
movq $0x0, -0x40(%rbp)
movb $0x0, -0x38(%rbp)
movq 0x5273(%rip), %rdi      # 0xafe0
leaq -0x48(%rbp), %rsi
callq 0x2160
movq -0x48(%rbp), %r15
movsbl (%r15), %edi
callq 0x2210
movb $0x1, %r13b
cmpl $0x50, %eax
jg 0x5d9d
cmpl $0x42, %eax
je 0x5db4
cmpl $0x4b, %eax
jne 0x5daf
movl $0x3, %r14d
jmp 0x5dc2
cmpl $0x51, %eax
je 0x5dbc
cmpl $0x52, %eax
jne 0x5daf
movl $0x4, %r14d
jmp 0x5dc2
xorl %r13d, %r13d
jmp 0x5dc2
movl $0x5, %r14d
jmp 0x5dc2
movl $0x1, %r14d
cmpq %r12, %r15
je 0x5dcf
movq %r15, %rdi
callq 0x2100
testb %r13b, %r13b
je 0x5ce0
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq -0x48(%rbp), %rdi
cmpq %r12, %rdi
je 0x5dfb
callq 0x2100
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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, %rbx
leaq 0xf8b(%rip), %rsi       # 0x73f7
leaq -0x248(%rbp), %rdi
movl $0x10, %edx
callq 0x2140
leaq -0x1d8(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x6594
movq (%rbx), %r12
cmpq %rbx, %r12
je 0x6594
leaq -0x38(%rbp), %r15
movq 0x10(%r12), %r13
movq %r13, %rdi
callq 0x40ee
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x295e
addb $0x41, %al
movb %al, -0x30(%rbp)
movl $0x1, %edx
leaq -0x248(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x2150
movq %rax, %r14
movq %r13, %rdi
callq 0x40ee
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2956
incl %eax
movq %r14, %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0xe31(%rip), %rsi       # 0x733c
callq 0x2150
movq %r13, %rdi
callq 0x40f8
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x295e
addb $0x41, %al
movb %al, -0x38(%rbp)
movl $0x1, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2150
movq %rax, %r14
movq %r13, %rdi
callq 0x40f8
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x2956
incl %eax
movq %r14, %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
movq (%r12), %r12
cmpq %rbx, %r12
jne 0x64a1
leaq -0x248(%rbp), %rdi
callq 0x2180
movq 0x4a21(%rip), %rax      # 0xafc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq -0x240(%rbp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, -0x248(%rbp,%rcx)
callq 0x20e0
leaq -0x150(%rbp), %rdi
callq 0x2090
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x65f0
jmp 0x65f0
jmp 0x65f0
jmp 0x65f0
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x2190
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 0x31c(%rip), %xmm2      # 0x5018
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jbe 0x4d0c
subsd %xmm1, %xmm0
jmp 0x4d00
movsd 0x51c(%rip), %xmm2      # 0x5230
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jbe 0x4d24
addsd %xmm1, %xmm0
jmp 0x4d18
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/shuwenyue[P]MD_code_cell_list/box.cpp
// Function: box::pbc(double, double)
double box::pbc (double position, double BoxLength)
{
	if (position > BoxLength)
    {
        position = position - BoxLength;                                    
    }

	if (position < 0)
    {
        position = position + BoxLength;                                    
    }
	
	return position;
}

// Assembly:
movapd %xmm0, %xmm2
subsd %xmm1, %xmm2
movapd %xmm1, %xmm3
cmpltsd %xmm0, %xmm3
andpd %xmm3, %xmm2
andnpd %xmm0, %xmm3
orpd %xmm2, %xmm3
addsd %xmm3, %xmm1
xorpd %xmm2, %xmm2
movapd %xmm3, %xmm0
cmpltsd %xmm2, %xmm0
andpd %xmm0, %xmm1
andnpd %xmm3, %xmm0
orpd %xmm1, %xmm0
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x50046(%rip), %rdi     # 0x5c49d
xorl %eax, %eax
callq 0xc509
leaq 0x4eb9f(%rip), %rdi     # 0x5b004
leaq 0x4ef7e(%rip), %rsi     # 0x5b3ea
xorl %eax, %eax
callq 0xc8cb
movq %rax, %rbx
leaq 0x4eb95(%rip), %rsi     # 0x5b012
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xdf4c
leaq 0x50526(%rip), %rdi     # 0x5c9b7
xorl %eax, %eax
callq 0xcad0
movq %rax, %r14
movl $0x4, %esi
movq %rax, %rdi
callq 0xcbe4
leaq 0x4ebba(%rip), %rdi     # 0x5b069
xorl %eax, %eax
callq 0xb080
callq 0xb730
leaq 0x4ebbe(%rip), %rdi     # 0x5b080
callq 0xb840
movq %r14, %rdi
callq 0xcc15
movq %r14, %rdi
callq 0xcbc2
movq %rbx, %rdi
callq 0xc9c6
callq 0xc60e
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x108, %rsp            # imm = 0x108
leaq 0x37e67(%rip), %rbx     # 0x3ab78
movq %rbx, %rdi
callq 0x2250
movq %rbx, %rdi
callq 0x2220
movq 0x37e50(%rip), %rcx     # 0x3ab78
movabsq $0x1845c8a0ce512957, %rdi # imm = 0x1845C8A0CE512957
movq %rcx, %rax
imulq %rdi
movq %rdx, %rsi
movq %rdx, %rax
sarq $0xf, %rax
movq %rdx, %r8
shrq $0x3f, %r8
addq %r8, %rax
imulq $0x54600, %rax, %rdx    # imm = 0x54600
movq %rcx, %rax
subq %rdx, %rax
imulq %rdi
movq %rdx, %rbx
sarq $0xd, %rsi
addq %r8, %rsi
imulq $0x15180, %rsi, %rax    # imm = 0x15180
subq %rax, %rcx
movabsq $0x48d159e26af37c05, %rdx # imm = 0x48D159E26AF37C05
movq %rcx, %rax
imulq %rdx
movq %rdx, %r14
movq %rdx, %rax
shrq $0x3f, %rax
shrq $0xc, %r14
addl %eax, %r14d
shll $0x2, %r14d
cmpb $0x1, 0x37089(%rip)     # 0x39e25
movslq %r14d, %r12
jne 0x2e66
movq %rbx, %rax
shrq $0x3f, %rax
shrq $0xd, %rbx
addl %eax, %ebx
cmpq %r12, 0x37dc7(%rip)     # 0x3ab80
je 0x2df8
leaq 0x2d7ff(%rip), %rdx     # 0x305c1
leaq 0x36dcb(%rip), %rcx     # 0x39b94
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movl %ebx, %r8d
movl %r14d, %r9d
xorl %eax, %eax
callq 0x2450
leaq 0x2d7e6(%rip), %rsi     # 0x305ce
movq %r15, %rdi
callq 0x22e0
movq %rax, %rdi
callq 0x2290
leaq 0x2d7c2(%rip), %rsi     # 0x305c1
leaq 0x36d8e(%rip), %rdx     # 0x39b94
movq %rsp, %r15
movq %r15, %rdi
movl %ebx, %ecx
movl %r14d, %r8d
xorl %eax, %eax
callq 0x2050
leaq 0x2decf(%rip), %rsi     # 0x30cee
movq %r15, %rdi
callq 0x22e0
movq %rax, %rbx
testq %rax, %rax
jne 0x2e41
leaq 0x2d798(%rip), %rsi     # 0x305ce
movq %rsp, %rdi
callq 0x22e0
movq %rax, %rbx
testq %rbx, %rbx
je 0x2e5e
leaq 0x2f2ce(%rip), %rsi     # 0x3211b
leaq 0x3716c(%rip), %rdx     # 0x39fc0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x23b0
movq %rbx, %rdi
callq 0x2290
movq %r12, 0x37d13(%rip)     # 0x3ab80
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x2de51(%rip), %rsi     # 0x30cee
callq 0x22e0
movq %rax, %rbx
testq %rax, %rax
jne 0x2ebc
leaq 0x2d71d(%rip), %rsi     # 0x305ce
movq %rsp, %rdi
callq 0x22e0
movq %rax, %rbx
testq %rbx, %rbx
je 0x2ee1
leaq 0x2f253(%rip), %rsi     # 0x3211b
leaq 0x370f1(%rip), %rdx     # 0x39fc0
movq %rbx, %rdi
xorl %eax, %eax
callq 0x23b0
movq %rbx, %rdi
callq 0x2290
xorl %eax, %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x331c9(%rip), %rax     # 0x39998
movq %rax, 0x34462(%rip)     # 0x3ac38
movl 0x33234(%rip), %ebp     # 0x39a10
leaq 0x3445d(%rip), %rdi     # 0x3ac40
movl $0x2, %esi
callq 0x152b0
leaq 0x34464(%rip), %rdi     # 0x3ac58
movl $0x8, %esi
callq 0x152b0
movq 0x3443b(%rip), %rax     # 0x3ac40
movzwl (%rbx), %ecx
movw %cx, (%rax)
movq 0x34426(%rip), %rdi     # 0x3ac38
movl %ebp, %esi
callq 0x20786
movl %eax, 0x34529(%rip)     # 0x3ad48
testl %eax, %eax
jle 0x686e
movq 0x34416(%rip), %rsi     # 0x3ac40
movl %eax, %edi
movl $0x2, %edx
callq 0x20a84
movl $0x1, %edi
callq 0x21b0
movl 0x34502(%rip), %edi     # 0x3ad48
movq 0x3440b(%rip), %rsi     # 0x3ac58
movl 0x3440d(%rip), %edx     # 0x3ac60
subl %esi, %edx
callq 0x20adc
cltq
movq %rax, 0x343bd(%rip)     # 0x3ac20
movl 0x344df(%rip), %edi     # 0x3ad48
callq 0x20a6d
movq 0x343e3(%rip), %rax     # 0x3ac58
movzbl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 0x32ba1(%rip), %rcx     # 0x39e90
testq %rcx, %rcx
jle 0x73cc
movq 0x34bd9(%rip), %rax     # 0x3bed8
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x73cc
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl 0x34bc3(%rip), %edx     # 0x3bee0
leaq 0x299e4(%rip), %rsi     # 0x30d08
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x32610(%rip), %r14     # 0x39948
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eec
movl 0x34b9b(%rip), %edx     # 0x3bee4
leaq 0x299d3(%rip), %rsi     # 0x30d23
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eec
cvtss2sd 0x34b7b(%rip), %xmm0    # 0x3bee8
cvtss2sd 0x31fbb(%rip), %xmm1    # 0x39330
cvtsi2ssl 0x34b6f(%rip), %xmm2 # 0x3beec
cvtss2sd %xmm2, %xmm2
cvtss2sd 0x34b67(%rip), %xmm3    # 0x3bef0
cvtss2sd 0x34b63(%rip), %xmm4    # 0x3bef4
leaq 0x299a7(%rip), %rsi     # 0x30d3f
movq %rbx, %rdi
movb $0x5, %al
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eec
cmpb $0x1, 0x32a71(%rip)     # 0x39e25
jne 0x73c2
leaq 0x2aab7(%rip), %rdi     # 0x31e74
callq 0x2400
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x32554(%rip)     # 0x39934
je 0x74ec
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %edi, %ebx
cmpb $0x1, 0x32a2c(%rip)     # 0x39e25
jne 0x7407
leaq 0x2b120(%rip), %rdi     # 0x32522
callq 0x2400
leaq 0x29966(%rip), %rsi     # 0x30d74
leaq 0x3251f(%rip), %rdx     # 0x39934
leaq 0x400(%rsp), %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2050
leaq 0x2b5f8(%rip), %rsi     # 0x32a28
movq %r14, %rdi
callq 0x20a0
movq %rax, 0x34ab9(%rip)     # 0x3bef8
movl $0x2, 0x31eeb(%rip)     # 0x39334
cmpb $0x1, 0x329d5(%rip)     # 0x39e25
jne 0x745e
leaq 0x2b0cd(%rip), %rdi     # 0x32526
callq 0x2400
movq 0x34a93(%rip), %rdx     # 0x3bef8
testq %rdx, %rdx
je 0x74aa
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
callq 0x2440
testq %rax, %rax
je 0x74aa
cmpl $0xa4e4f, (%rsp)        # imm = 0xA4E4F
jne 0x748f
movl $0x1, 0x31ea5(%rip)     # 0x39334
movl $0xa46464f, %eax        # imm = 0xA46464F
xorl (%rsp), %eax
movzbl 0x4(%rsp), %ecx
orl %eax, %ecx
jne 0x74aa
movl $0x0, 0x31e8a(%rip)     # 0x39334
movq 0x34a47(%rip), %rdi     # 0x3bef8
testq %rdi, %rdi
je 0x74c6
callq 0x23a0
movq $0x0, 0x34a32(%rip) # 0x3bef8
cmpb $0x1, 0x32958(%rip)     # 0x39e25
jne 0x74db
leaq 0x2a9a2(%rip), %rdi     # 0x31e78
callq 0x2400
movl 0x31e53(%rip), %eax     # 0x39334
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x32611(%rip)     # 0x39e2a
jne 0x7868
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x295e8(%rip), %rsi     # 0x30e16
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x320f0(%rip), %rdi     # 0x39934
movq %r14, %rsi
callq 0x2eec
movslq %ebx, %rax
leaq 0x31aba(%rip), %rcx     # 0x39310
movl $0x1, -0x4(%rcx,%rax,4)
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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, 0x325b8(%rip)     # 0x39e2a
jne 0x78c1
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x295a9(%rip), %rsi     # 0x30e30
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x32097(%rip), %rdi     # 0x39934
movq %r14, %rsi
callq 0x2eec
movslq %ebx, %rax
leaq 0x31a61(%rip), %rcx     # 0x39310
movl $0x0, -0x4(%rcx,%rax,4)
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0x520, %rsp            # imm = 0x520
movq 0x34629(%rip), %rcx     # 0x3bf00
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq 0x332d5(%rip), %rcx     # 0x3abb8
jge 0x79d3
leaq 0x2955a(%rip), %rsi     # 0x30e4a
leaq 0x320e7(%rip), %rdx     # 0x399de
xorl %r14d, %r14d
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x2b118(%rip), %rsi     # 0x32a28
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
testq %rax, %rax
je 0x79a8
leaq 0x120(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x2440
testq %rax, %rax
je 0x79a5
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x120(%rsp), %rdi
callq 0x2c8d2
movq %rax, %r14
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
leaq 0x2950d(%rip), %rcx     # 0x30e7e
movl $0xa, %r8d
xorl %esi, %esi
callq 0x2410
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x2d176
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x79a8
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x22b0
jmp 0x79a8
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x23a0
testq %r14, %r14
je 0x79bb
movl 0x28(%r14), %eax
jmp 0x79d3
movl $0x258, %eax            # imm = 0x258
addq 0x331f1(%rip), %rax     # 0x3abb8
movq %rax, 0x34532(%rip)     # 0x3bf00
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x520, %rsp            # imm = 0x520
popq %rbx
popq %r14
popq %r15
retq
jmp 0x79e2
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x79fb
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x24a0
// File: /workspace/github_cpp_makefile_star2_O1/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 0x3219b(%rip), %ebx     # 0x39e94
cmpl %edi, %ebx
cmovlel %edi, %ebx
testl %edi, %edi
cmovlel %edi, %ebx
movl 0x3218f(%rip), %eax     # 0x39e98
cmpl %eax, %ebx
cmovgel %eax, %ebx
cmpb $0x1, 0x32114(%rip)     # 0x39e29
jne 0x7d9c
movq 0x341de(%rip), %rax     # 0x3bf00
cmpq 0x32e8f(%rip), %rax     # 0x3abb8
jge 0x7d9c
cmpl 0x3160f(%rip), %ebx     # 0x39340
je 0x7d9c
testl %ebx, %ebx
leaq 0x291f5(%rip), %rax     # 0x30f31
leaq 0x2923b(%rip), %rsi     # 0x30f7e
cmovgq %rax, %rsi
leaq 0x31c90(%rip), %rcx     # 0x399de
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x2acc4(%rip), %rsi     # 0x32a28
movq %r14, %rdi
callq 0x20a0
testq %rax, %rax
je 0x7d9c
movq %rax, %r14
leaq 0x80(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2440
testq %rax, %rax
je 0x7d94
movl %ebx, 0x315ac(%rip)     # 0x39340
movq %r14, %rdi
callq 0x23a0
movl 0x3159e(%rip), %eax     # 0x39340
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/Waermepumpe.cpp
// Function: debugout(char*)
int debugout(char buffer [100])
//        if (debug)
{
    FILE *fp;

    timeinfo = localtime (&rawtime);
    fp = fopen("debug1.out","a");
    fprintf(fp,"%s %s\n",asctime(timeinfo),buffer);
    fclose(fp);
    return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x244f6(%rip), %rdi     # 0x44ff8
callq 0x21a0
movq %rax, 0x2447a(%rip)     # 0x44f88
leaq 0x116ab(%rip), %rdi     # 0x321c0
leaq 0x101d2(%rip), %rsi     # 0x30cee
callq 0x22e0
movq %rax, %r14
movq 0x2445d(%rip), %rdi     # 0x44f88
callq 0x20f0
leaq 0x11694(%rip), %rsi     # 0x321cb
movq %r14, %rdi
movq %rax, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x23b0
movq %r14, %rdi
callq 0x2290
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/Waermepumpe.cpp
// Function: MQTTsend1(char*, char*)
int MQTTsend1(char host[20],char buffer[127])

{
    char cbuf[768];
    if (strcmp(host,"0.0.0.0")!=0) //gültige hostadresse
    {
        sprintf(cbuf, "mosquitto_pub -r -h %s -t %s", host,buffer);
        int ret = system(cbuf);
        if (debug)
        debugout(cbuf);
        return ret;
    } else
    return(-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x300, %rsp            # imm = 0x300
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xfa5e(%rip), %rsi      # 0x305d0
callq 0x2390
testl %eax, %eax
je 0x20bb2
leaq 0xfa56(%rip), %rsi      # 0x305d8
movq %rsp, %r15
movq %r15, %rdi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x2050
movq %r15, %rdi
callq 0x2210
movl %eax, %ebx
cmpb $0x1, 0x2445a(%rip)     # 0x45000
jne 0x20bb7
movq %rsp, %rdi
callq 0x20af4
jmp 0x20bb7
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x300, %rsp            # imm = 0x300
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/Waermepumpe.cpp
// Function: tasmotaon1(e3dc_config_t&)
int tasmotaon1(e3dc_config_t &e3dc)
{
    char buf[127];
    sprintf(buf,"cmnd/%s/POWER -m ON",e3dc.BWWPTasmota);
    if (Tasmotastatus <= 0){
        MQTTsend1(e3dc.mqtt2_ip,buf);
    }
        Tasmotastatus = 1;
    return 0;
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
leaq 0x3f6(%rdi), %rdx
leaq 0x115f3(%rip), %rsi     # 0x321d2
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
cmpl $0x0, 0x18778(%rip)     # 0x39368
jg 0x20c01
addq $0x50, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x20b59
movl $0x1, 0x1875d(%rip)     # 0x39368
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/Waermepumpe.cpp
// Function: tasmotaoff1(e3dc_config_t&)
int tasmotaoff1(e3dc_config_t &e3dc)
{
    char buf[127];
    sprintf(buf,"cmnd/%s/POWER -m OFF",e3dc.BWWPTasmota);
    if (Tasmotastatus == 1)
    MQTTsend1(e3dc.mqtt2_ip,buf);
    Tasmotastatus = 0;
    return 0;
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
leaq 0x3f6(%rdi), %rdx
leaq 0x115b7(%rip), %rsi     # 0x321e6
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
cmpl $0x1, 0x18728(%rip)     # 0x39368
jne 0x20c51
addq $0x50, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x20b59
movl $0x0, 0x1870d(%rip)     # 0x39368
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/awattar.cpp
// Function: Checkfile(char*, int)
bool Checkfile(char myfile[20],int minuten)
{
    struct stat stats;
     time_t  tm,tm_dt;
     time(&tm);
     if (stat(myfile,&stats)==0)
     {
         tm_dt = *(&stats.st_mtime);
         tm = (tm - tm_dt);
         if (tm >0 && tm < minuten*60)
             return false;  // zu jung
         else
             return true;
     } else return true;    // nicht vorhanden
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x98, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq %rsp, %rdi
callq 0x2250
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x2240
movl %eax, %ecx
movb $0x1, %al
testl %ecx, %ecx
je 0x24aab
addq $0x98, %rsp
popq %rbx
popq %r14
retq
movq (%rsp), %rcx
subq 0x60(%rsp), %rcx
movq %rcx, (%rsp)
jle 0x24aa0
imull $0x3c, %ebx, %edx
movslq %edx, %rdx
cmpq %rdx, %rcx
jge 0x24aa0
xorl %eax, %eax
jmp 0x24aa0
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/awattar.cpp
// Function: CheckWallbox(char*)
bool CheckWallbox(char file[128])
/*
Mit dieser Funktion wird überprüft, ob die Wallbox für das Laden zu
aWATTar -Tarifen freigeschaltet werden muss.
Wenn über den Webserver eine neue Ladedaueränderung erkannt wurde
oder jede Stunde wird aWATTar aufgerufen, um die neuen aWATTar preise zu verarbeiten.
 */
{
    struct stat stats;
     time_t  tm,tm_dt;
     time(&tm);
     stat(file,&stats);
     tm_dt = *(&stats.st_mtime);
     tm = (tm - tm_dt);
    if (tm > 60) tm_Wallbox_dt = tm_dt; //älter als 10s?
    if (tm_dt==tm_Wallbox_dt) // neu erstellt oder alt? nur bei änderung
    {
        return false;
    }
    else
    {
        tm_Wallbox_dt = tm_dt;
        return true;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0xa0, %rsp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2250
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2240
movq 0x58(%r15), %rax
movq (%r14), %rcx
subq %rax, %rcx
movq %rcx, (%r14)
cmpq $0x3d, %rcx
jl 0x24b0f
movq %rax, 0x205e9(%rip)     # 0x450f8
movq 0x205e2(%rip), %rcx     # 0x450f8
cmpq %rcx, %rax
je 0x24b22
movq %rax, 0x205d6(%rip)     # 0x450f8
cmpq %rcx, %rax
setne %al
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/awattar.cpp
// Function: PutWallbox(std::vector<ch_s, std::allocator<ch_s>>&)
bool PutWallbox(std::vector<ch_s> &ch)
{
    FILE *mfp;
    char path[100];
    mfp = NULL;
    mfp = fopen("e3dc.wallbox.out","w");
    if (mfp)
    if (ch.size()>0)
        for (int j = 0; j < ch.size(); j++ ){
            fprintf(mfp,"%0.2f %i %i %0.2f \n",float((ch[j].hh%(24*3600))/3600.0), ch[j].hh,ch[j].ch,ch[j].pp);}
    
    if (mfp)
    fclose(mfp);

    return true;}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xda16(%rip), %rdi      # 0x32560
leaq 0xba7d(%rip), %rsi      # 0x305ce
callq 0x22e0
testq %rax, %rax
je 0x24c14
movq %rax, %r14
movq 0x8(%rbx), %rax
cmpq (%rbx), %rax
je 0x24c0c
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x24c0c
movl $0xc, %r12d
xorl %r13d, %r13d
movabsq $0x1845c8a0ce512957, %rbp # imm = 0x1845C8A0CE512957
leaq 0xd9db(%rip), %r15      # 0x32571
movq -0xc(%rsi,%r12), %r8
movq %r8, %rax
imulq %rbp
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0xd, %rdx
addq %rax, %rdx
imulq $0x15180, %rdx, %rax    # imm = 0x15180
movq %r8, %rcx
subq %rax, %rcx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
divsd 0xb6ac(%rip), %xmm0     # 0x30278
cvtsd2ss %xmm0, %xmm0
cvtss2sd %xmm0, %xmm0
movl -0x4(%rsi,%r12), %ecx
xorps %xmm1, %xmm1
cvtss2sd (%rsi,%r12), %xmm1
movq %r14, %rdi
movq %r15, %rsi
movq %r8, %rdx
movb $0x2, %al
callq 0x23b0
incq %r13
movq (%rbx), %rsi
movq 0x8(%rbx), %rax
subq %rsi, %rax
sarq $0x4, %rax
addq $0x10, %r12
cmpq %r13, %rax
ja 0x24b96
movq %r14, %rdi
callq 0x2290
movb $0x1, %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/awattar.cpp
// Function: GetWallbox(std::vector<ch_s, std::allocator<ch_s>>&)
bool GetWallbox(std::vector<ch_s> &ch)
{
    FILE *mfp;
    mfp = NULL;
    mfp = fopen("e3dc.wallbox.out","r");
    char path[100];
    int status;
    char var [4] [20];
    memset(path, 0x00, sizeof(path));

    if (mfp != NULL)
        while (fgets(path, sizeof(path), mfp) != NULL)
        {
            status = sscanf(path, "%s %s %s %s", var[3], var[0], var[1], var[2]);
            cc.hh = atoi(var[0]);
            cc.ch = atoi(var[1]);
            cc.pp = atof(var[2]);
            ch.push_back(cc);
        }
    //        if (WP_status < 2)
    if (mfp != NULL)
        pclose(mfp);

    return true;}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq 0xd920(%rip), %rdi      # 0x32560
leaq 0xdde1(%rip), %rsi      # 0x32a28
callq 0x22e0
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x50(%rsp)
movl $0x0, 0x60(%rsp)
testq %rax, %rax
je 0x24d56
movq %rax, %r14
movq %rsp, %rdi
movl $0x64, %esi
movq %rax, %rdx
callq 0x2440
testq %rax, %rax
je 0x24d49
leaq 0x84(%rsp), %r12
leaq 0x98(%rsp), %r13
movq %rsp, %r15
leaq 0x70(%rsp), %rbp
movq %r15, %rdi
leaq 0xd8ca(%rip), %rsi      # 0x32585
leaq 0xac(%rsp), %rdx
movq %rbp, %rcx
movq %r12, %r8
movq %r13, %r9
xorl %eax, %eax
callq 0x2280
movq %rbp, %rdi
callq 0x2420
cltq
movq %rax, 0x2041c(%rip)     # 0x45100
movq %r12, %rdi
callq 0x2420
movl %eax, 0x20416(%rip)     # 0x45108
movq %r13, %rdi
callq 0x2310
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x20406(%rip)    # 0x4510c
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x24d21
movups 0x203e9(%rip), %xmm0    # 0x45100
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x24d30
movq %rbx, %rdi
leaq 0x203d5(%rip), %rdx     # 0x45100
callq 0x240ea
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2440
testq %rax, %rax
jne 0x24cb1
testq %r14, %r14
je 0x24d56
movq %r14, %rdi
callq 0x23a0
movb $0x1, %al
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/Eba-M[P]E3DC-Control/awattar.cpp
// Function: Highprice(std::vector<watt_s, std::allocator<watt_s>>&, int, int, float)
int Highprice(std::vector<watt_s> &w,int ab,int bis,float preis)    // Anzahle Einträge mit > preis
{                                            // l1 = erste position h1 = letzte Position
                                             // maxsoc = max erreichter Soc
    int x1 = 0;
    for (int j = ab; (j <= bis)&&(j<w.size()); j++ )
    {
// Suchen nach Hoch und Tiefs
        if (w[j].pp > preis) x1++;
    }
    return x1;
}

// Assembly:
xorl %eax, %eax
cmpl %edx, %esi
jg 0x24dc1
movq (%rdi), %rax
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rcx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rcx
movslq %esi, %rdi
leaq (%rdi,%rdi,2), %r8
leaq (%rax,%r8,8), %r8
addq $0x8, %r8
subl %esi, %edx
incl %edx
xorl %eax, %eax
cmpq %rdi, %rcx
jbe 0x24dc1
movss (%r8), %xmm1
xorl %esi, %esi
ucomiss %xmm0, %xmm1
seta %sil
addl %esi, %eax
incq %rdi
addq $0x18, %r8
decl %edx
jne 0x24da1
retq