LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/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, %r15
callq 0x4e48
testb %al, %al
je 0x559d
movzbl 0x8(%r15), %edx
leaq -0x40(%rbp), %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x4d4e
movl $0x40, %edi
callq 0x2120
movq %rax, %rbx
movq %rax, %rdi
movq %r15, %rsi
callq 0x4a10
movq -0x40(%rbp), %r15
movb $0x1, %r12b
cmpq %r14, %r15
je 0x55ce
leaq -0x60(%rbp), %r12
leaq 0x10(%r15), %rsi
movq %r12, %rdi
callq 0x4074
movl $0x20, %edi
callq 0x2120
movq %rax, %r13
movq %rax, %rdi
movq %r12, %rsi
callq 0x4074
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4736
testb %al, %al
jne 0x55a2
movq %r13, %rdi
callq 0x40c0
movq %r13, %rdi
callq 0x2100
movq %rbx, %rdi
callq 0x50b0
movq %r12, %rdi
callq 0x40c0
movq (%r15), %r15
cmpq %r14, %r15
jne 0x553d
movb $0x1, %r12b
jmp 0x55ce
xorl %r12d, %r12d
jmp 0x55d7
movq %rbx, %rdi
callq 0x4c5c
movq %rbx, %rdi
callq 0x2100
movq %r13, %rdi
callq 0x40c0
movq %r13, %rdi
callq 0x2100
leaq -0x60(%rbp), %rdi
callq 0x40c0
xorl %r12d, %r12d
leaq -0x40(%rbp), %rdi
callq 0x2b06
movl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x2100
jmp 0x5616
jmp 0x5605
movq %rax, %r14
movq %r13, %rdi
callq 0x2100
jmp 0x560d
movq %rax, %r14
jmp 0x5616
movq %rax, %r14
leaq -0x60(%rbp), %rdi
callq 0x40c0
leaq -0x40(%rbp), %rdi
callq 0x2b06
movq %r14, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x40e0
leaq -0x20(%rbp), %r15
movq %rax, (%r15)
movq (%r14), %r14
movq %r15, %rdi
callq 0x2962
cltq
movq (%r14,%rax,8), %r14
movq %r15, %rdi
callq 0x296a
cltq
movq (%r14,%rax,8), %rdi
testq %rdi, %rdi
je 0x570c
callq 0x3844
cmpl $0x2, %eax
jne 0x570c
movq %rbx, %rdi
callq 0x40e0
leaq -0x20(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2962
testl %eax, %eax
je 0x56fb
movq %rbx, %rdi
callq 0x40e0
leaq -0x28(%rbp), %rdi
movq %rax, (%rdi)
callq 0x2962
cmpl $0x7, %eax
jne 0x570c
movq %rbx, %rdi
movl $0x4, %esi
callq 0x40ea
movb $0x1, %al
jmp 0x570e
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5920
callq 0x596e
xorl %r13d, %r13d
movq 0x5793(%rip), %rbx      # 0xafd0
leaq 0x1884(%rip), %r14      # 0x70c8
leal 0x1(%r13), %esi
movq %rbx, %rdi
movl %esi, -0x2c(%rbp)
callq 0x21c0
movl $0x5, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x2150
xorl %r12d, %r12d
movq -0x38(%rbp), %r15
leaq -0x40(%rbp), %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x292a
movq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x4c22
movq %rax, %rsi
callq 0x59bc
movl $0x5, %edx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2150
incl %r12d
cmpl $0x8, %r12d
jne 0x586a
movl $0x1, %edx
movq %rbx, %rdi
leaq 0x1a83(%rip), %rsi      # 0x7338
callq 0x2150
movq %rbx, %rdi
movl -0x2c(%rbp), %r15d
movl %r15d, %esi
callq 0x21c0
movq %rax, %r12
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2110
movsbl %al, %esi
movq %r12, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x20b0
cmpl $0x7, %r13d
je 0x5906
callq 0x5b04
movl %r15d, %r13d
jmp 0x5844
callq 0x5b52
callq 0x5920
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x5a0d
movq %rsi, %rbx
movq %rsi, %rdi
callq 0x37ae
movl %eax, %r14d
movq %rbx, %rdi
callq 0x3844
testb %r14b, %r14b
je 0x5a25
cmpl $0x5, %eax
ja 0x5a4f
movl %eax, %eax
leaq 0x1697(%rip), %rcx      # 0x7088
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x55cf(%rip), %rdi      # 0xafd0
leaq 0x1836(%rip), %rsi      # 0x723e
jmp 0x5af5
movq 0x55bc(%rip), %rdi      # 0xafd0
leaq 0x191d(%rip), %rsi      # 0x7338
movl $0x1, %edx
jmp 0x5afa
cmpl $0x5, %eax
ja 0x5a4f
movl %eax, %eax
leaq 0x163d(%rip), %rcx      # 0x7070
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq 0x558d(%rip), %rdi      # 0xafd0
leaq 0x17dc(%rip), %rsi      # 0x7226
jmp 0x5af5
popq %rbx
popq %r14
popq %rbp
retq
movq 0x5575(%rip), %rdi      # 0xafd0
leaq 0x17ec(%rip), %rsi      # 0x724e
jmp 0x5af5
movq 0x5562(%rip), %rdi      # 0xafd0
leaq 0x17c1(%rip), %rsi      # 0x7236
jmp 0x5af5
movq 0x5552(%rip), %rdi      # 0xafd0
leaq 0x17c1(%rip), %rsi      # 0x7246
jmp 0x5af5
movq 0x5542(%rip), %rdi      # 0xafd0
leaq 0x1799(%rip), %rsi      # 0x722e
jmp 0x5af5
movq 0x5532(%rip), %rdi      # 0xafd0
leaq 0x179d(%rip), %rsi      # 0x7242
jmp 0x5af5
movq 0x5522(%rip), %rdi      # 0xafd0
leaq 0x1775(%rip), %rsi      # 0x722a
jmp 0x5af5
movq 0x5512(%rip), %rdi      # 0xafd0
leaq 0x1785(%rip), %rsi      # 0x724a
jmp 0x5af5
movq 0x5502(%rip), %rdi      # 0xafd0
leaq 0x175d(%rip), %rsi      # 0x7232
jmp 0x5af5
movq 0x54f2(%rip), %rdi      # 0xafd0
leaq 0x1755(%rip), %rsi      # 0x723a
jmp 0x5af5
movq 0x54e2(%rip), %rdi      # 0xafd0
leaq 0x172d(%rip), %rsi      # 0x7222
movl $0x3, %edx
popq %rbx
popq %r14
popq %rbp
jmp 0x2150
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x532a(%rip), %rbx      # 0xafd0
movl $0x3c, %edx
movq %rbx, %rdi
leaq 0x1607(%rip), %rsi      # 0x72bc
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 0x1609(%rip), %rsi      # 0x72f9
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 0x52ad(%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 0x5d63
cmpl $0x42, %eax
je 0x5d7a
cmpl $0x4b, %eax
jne 0x5d75
movl $0x3, %r14d
jmp 0x5d88
cmpl $0x51, %eax
je 0x5d82
cmpl $0x52, %eax
jne 0x5d75
movl $0x4, %r14d
jmp 0x5d88
xorl %r13d, %r13d
jmp 0x5d88
movl $0x5, %r14d
jmp 0x5d88
movl $0x1, %r14d
cmpq %r12, %r15
je 0x5d95
movq %r15, %rdi
callq 0x2100
testb %r13b, %r13b
je 0x5ca6
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 0x5dc1
callq 0x2100
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xfcb(%rip), %rsi       # 0x73f3
leaq -0x248(%rbp), %rdi
movl $0x10, %edx
callq 0x2140
leaq -0x1d8(%rbp), %rdi
callq 0x2070
testb %al, %al
je 0x6550
movq (%rbx), %r12
cmpq %rbx, %r12
je 0x6550
leaq -0x38(%rbp), %r15
movq 0x10(%r12), %r13
movq %r13, %rdi
callq 0x40d6
movq %rax, -0x48(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x296a
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 0x40d6
movq %rax, -0x30(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x2962
incl %eax
movq %r14, %rdi
movl %eax, %esi
callq 0x21c0
movq %rax, %r14
movl $0x1, %edx
movq %rax, %rdi
leaq 0xe71(%rip), %rsi       # 0x7338
callq 0x2150
movq %r13, %rdi
callq 0x40e0
movq %rax, -0x40(%rbp)
leaq -0x40(%rbp), %rdi
callq 0x296a
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 0x40e0
movq %rax, -0x38(%rbp)
movq %r15, %rdi
callq 0x2962
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 0x645d
leaq -0x248(%rbp), %rdi
callq 0x2180
movq 0x4a65(%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 0x65ac
jmp 0x65ac
jmp 0x65ac
jmp 0x65ac
movq %rax, %rbx
leaq -0x248(%rbp), %rdi
callq 0x2190
movq %rbx, %rdi
callq 0x21d0
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0x404(%rip), %xmm2      # 0x5018
mulsd %xmm1, %xmm2
ucomisd %xmm2, %xmm0
jbe 0x4c24
subsd %xmm1, %xmm0
jmp 0x4c18
movsd 0x604(%rip), %xmm2      # 0x5230
mulsd %xmm1, %xmm2
ucomisd %xmm0, %xmm2
jbe 0x4c3c
addsd %xmm1, %xmm0
jmp 0x4c30
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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 0xc8c3
movq %rax, %rbx
leaq 0x4eb95(%rip), %rsi     # 0x5b012
xorl %edi, %edi
xorl %edx, %edx
xorl %ecx, %ecx
xorl %eax, %eax
callq 0xdf2f
leaq 0x50526(%rip), %rdi     # 0x5c9b7
xorl %eax, %eax
callq 0xcacb
movq %rax, %r14
movl $0x4, %esi
movq %rax, %rdi
callq 0xcbdf
leaq 0x4ebba(%rip), %rdi     # 0x5b069
xorl %eax, %eax
callq 0xb080
callq 0xb730
leaq 0x4ebbe(%rip), %rdi     # 0x5b080
callq 0xb840
movq %r14, %rdi
callq 0xcc10
movq %r14, %rdi
callq 0xcbbd
movq %rbx, %rdi
callq 0xc9be
callq 0xc60a
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/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, %rdx # imm = 0x1845C8A0CE512957
movq %rcx, %rax
imulq %rdx
movq %rdx, %rax
shrq $0x3f, %rax
movq %rdx, %rsi
sarq $0xd, %rsi
addq %rax, %rsi
imulq $0x15180, %rsi, %rsi    # imm = 0x15180
movq %rcx, %rdi
subq %rsi, %rdi
movslq %edi, %rbx
imulq $-0x6e5d4c3b, %rbx, %rsi # imm = 0x91A2B3C5
shrq $0x20, %rsi
addl %esi, %ebx
movl %ebx, %esi
shrl $0x1f, %esi
sarl $0xd, %ebx
addl %esi, %ebx
shll $0x2, %ebx
movslq %ebx, %r12
cmpb $0x1, 0x370a8(%rip)     # 0x39e25
jne 0x2e64
sarq $0xf, %rdx
addq %rax, %rdx
imulq $0x54600, %rdx, %rax    # imm = 0x54600
subq %rax, %rcx
movslq %ecx, %r14
imulq $-0x3dd1baf9, %r14, %rax # imm = 0xC22E4507
shrq $0x20, %rax
addl %eax, %r14d
movl %r14d, %eax
shrl $0x1f, %eax
sarl $0x10, %r14d
addl %eax, %r14d
cmpq %r12, 0x37dc7(%rip)     # 0x3ab80
je 0x2df8
leaq 0x2d803(%rip), %rdx     # 0x305c5
leaq 0x36dcb(%rip), %rcx     # 0x39b94
movq %rsp, %r15
movl $0x100, %esi            # imm = 0x100
movq %r15, %rdi
movl %r14d, %r8d
movl %ebx, %r9d
xorl %eax, %eax
callq 0x2450
leaq 0x2d7ea(%rip), %rsi     # 0x305d2
movq %r15, %rdi
callq 0x22e0
movq %rax, %rdi
callq 0x2290
leaq 0x2d7c6(%rip), %rsi     # 0x305c5
leaq 0x36d8e(%rip), %rdx     # 0x39b94
movq %rsp, %r15
movq %r15, %rdi
movl %r14d, %ecx
movl %ebx, %r8d
xorl %eax, %eax
callq 0x2050
leaq 0x2ded2(%rip), %rsi     # 0x30cf2
movq %r15, %rdi
callq 0x22e0
testq %rax, %rax
jne 0x2e41
leaq 0x2d79e(%rip), %rsi     # 0x305d2
movq %rsp, %rdi
callq 0x22e0
testq %rax, %rax
je 0x2e7c
movq %rax, %rbx
leaq 0x2f2d0(%rip), %rsi     # 0x3211b
leaq 0x3716e(%rip), %rdx     # 0x39fc0
movq %rax, %rdi
xorl %eax, %eax
callq 0x23b0
movq %rbx, %rdi
callq 0x2290
movq %r12, 0x37d15(%rip)     # 0x3ab80
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r14
popq %r15
retq
xorl %ebx, %ebx
jmp 0x2e5c
// File: /workspace/github_cpp_makefile_star2_O3/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 0x2de53(%rip), %rsi     # 0x30cf2
callq 0x22e0
testq %rax, %rax
jne 0x2ebd
leaq 0x2d722(%rip), %rsi     # 0x305d2
movq %rsp, %rdi
callq 0x22e0
testq %rax, %rax
je 0x2ee0
movq %rax, %rbx
leaq 0x2f254(%rip), %rsi     # 0x3211b
leaq 0x370f2(%rip), %rdx     # 0x39fc0
movq %rax, %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_O3/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 0x33189(%rip), %rax     # 0x39998
movq %rax, 0x34422(%rip)     # 0x3ac38
movl 0x331f4(%rip), %ebp     # 0x39a10
leaq 0x3441d(%rip), %rdi     # 0x3ac40
movl $0x2, %esi
callq 0x151b2
leaq 0x34424(%rip), %rdi     # 0x3ac58
movl $0x8, %esi
callq 0x151b2
movq 0x343fb(%rip), %rax     # 0x3ac40
movzwl (%rbx), %ecx
movw %cx, (%rax)
movq 0x343e6(%rip), %rdi     # 0x3ac38
movl %ebp, %esi
callq 0x20617
movl %eax, 0x344e9(%rip)     # 0x3ad48
testl %eax, %eax
jle 0x68ae
movq 0x343d6(%rip), %rsi     # 0x3ac40
movl %eax, %edi
movl $0x2, %edx
callq 0x20921
movl $0x1, %edi
callq 0x21b0
movl 0x344c2(%rip), %edi     # 0x3ad48
movq 0x343cb(%rip), %rsi     # 0x3ac58
movl 0x343cd(%rip), %edx     # 0x3ac60
subl %esi, %edx
callq 0x2096d
cltq
movq %rax, 0x3437d(%rip)     # 0x3ac20
movl 0x3449f(%rip), %edi     # 0x3ad48
callq 0x2090a
movq 0x343a3(%rip), %rax     # 0x3ac58
movzbl (%rax), %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x32b55(%rip), %rcx     # 0x39e90
testq %rcx, %rcx
jle 0x7418
movq 0x34b8d(%rip), %rax     # 0x3bed8
cqto
idivq %rcx
testq %rdx, %rdx
jne 0x7418
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl 0x34b77(%rip), %edx     # 0x3bee0
leaq 0x2999c(%rip), %rsi     # 0x30d0c
movq %rsp, %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x325c4(%rip), %r14     # 0x39948
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eeb
movl 0x34b4f(%rip), %edx     # 0x3bee4
leaq 0x2998b(%rip), %rsi     # 0x30d27
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eeb
cvtss2sd 0x34b2f(%rip), %xmm0    # 0x3bee8
cvtss2sd 0x31f6f(%rip), %xmm1    # 0x39330
cvtsi2ssl 0x34b23(%rip), %xmm2 # 0x3beec
cvtss2sd %xmm2, %xmm2
cvtss2sd 0x34b1b(%rip), %xmm3    # 0x3bef0
cvtss2sd 0x34b17(%rip), %xmm4    # 0x3bef4
leaq 0x2995f(%rip), %rsi     # 0x30d43
movq %rbx, %rdi
movb $0x5, %al
callq 0x2050
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2eeb
cmpb $0x1, 0x32a25(%rip)     # 0x39e25
jne 0x740e
leaq 0x2aa6c(%rip), %rdi     # 0x31e75
callq 0x2400
addq $0x88, %rsp
popq %rbx
popq %r14
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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, 0x32508(%rip)     # 0x39934
je 0x753b
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %edi, %ebx
cmpb $0x1, 0x329e0(%rip)     # 0x39e25
jne 0x7453
leaq 0x2b0dc(%rip), %rdi     # 0x3252a
callq 0x2400
leaq 0x2991e(%rip), %rsi     # 0x30d78
leaq 0x324d3(%rip), %rdx     # 0x39934
leaq 0x400(%rsp), %r14
movq %r14, %rdi
movl %ebx, %ecx
xorl %eax, %eax
callq 0x2050
leaq 0x2b5b4(%rip), %rsi     # 0x32a30
movq %r14, %rdi
callq 0x20a0
movq %rax, 0x34a6d(%rip)     # 0x3bef8
movl $0x2, 0x31e9f(%rip)     # 0x39334
cmpb $0x1, 0x32989(%rip)     # 0x39e25
jne 0x74b1
leaq 0x2b089(%rip), %rdi     # 0x3252e
callq 0x2400
movq 0x34a47(%rip), %rax     # 0x3bef8
testq %rax, %rax
je 0x74f9
movq %rsp, %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2440
testq %rax, %rax
je 0x74f9
cmpl $0xa4e4f, (%rsp)        # imm = 0xA4E4F
jne 0x74de
movl $0x1, 0x31e56(%rip)     # 0x39334
movl $0xa46464f, %eax        # imm = 0xA46464F
xorl (%rsp), %eax
movzbl 0x4(%rsp), %ecx
orl %eax, %ecx
jne 0x74f9
movl $0x0, 0x31e3b(%rip)     # 0x39334
movq 0x349f8(%rip), %rdi     # 0x3bef8
testq %rdi, %rdi
je 0x7515
callq 0x23a0
movq $0x0, 0x349e3(%rip) # 0x3bef8
cmpb $0x1, 0x32909(%rip)     # 0x39e25
jne 0x752a
leaq 0x2a954(%rip), %rdi     # 0x31e79
callq 0x2400
movl 0x31e04(%rip), %eax     # 0x39334
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/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, 0x325c3(%rip)     # 0x39e2a
jne 0x78b6
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x2959e(%rip), %rsi     # 0x30e1a
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x320a2(%rip), %rdi     # 0x39934
movq %r14, %rsi
callq 0x2eeb
movslq %ebx, %rax
leaq 0x31a6c(%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_O3/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, 0x3256a(%rip)     # 0x39e2a
jne 0x790f
pushq %r14
pushq %rbx
subq $0x88, %rsp
movl %edi, %ebx
leaq 0x2955f(%rip), %rsi     # 0x30e34
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x32049(%rip), %rdi     # 0x39934
movq %r14, %rsi
callq 0x2eeb
movslq %ebx, %rax
leaq 0x31a13(%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_O3/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 0x345db(%rip), %rcx     # 0x3bf00
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
cmpq 0x33287(%rip), %rcx     # 0x3abb8
jge 0x7a21
leaq 0x29510(%rip), %rsi     # 0x30e4e
leaq 0x32099(%rip), %rdx     # 0x399de
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
leaq 0x2b0d5(%rip), %rsi     # 0x32a30
movq %rbx, %rdi
callq 0x20a0
movq %rax, %rbx
testq %rax, %rax
je 0x7a01
leaq 0x120(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rbx, %rdx
callq 0x2440
testq %rax, %rax
je 0x7a01
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
movq $0x0, -0x8(%r15)
movb $0x0, (%r15)
leaq 0x120(%rsp), %rdi
callq 0x2c943
movq %rax, %r14
movq %rsp, %rdi
movq 0x8(%rdi), %rdx
leaq 0x294c6(%rip), %rcx     # 0x30e82
movl $0xa, %r8d
xorl %esi, %esi
callq 0x2410
movq (%rsp), %rsi
movq %r14, %rdi
callq 0x2d1d7
movq %rax, %r14
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x79ee
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x23a0
testq %r14, %r14
je 0x7a09
movl 0x28(%r14), %eax
jmp 0x7a21
movq %rbx, %rdi
callq 0x23a0
movl $0x258, %eax            # imm = 0x258
addq 0x331a3(%rip), %rax     # 0x3abb8
movq %rax, 0x344e4(%rip)     # 0x3bf00
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x520, %rsp            # imm = 0x520
popq %rbx
popq %r14
popq %r15
retq
jmp 0x7a30
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x7a49
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x22b0
movq %rbx, %rdi
callq 0x24a0
// File: /workspace/github_cpp_makefile_star2_O3/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 0x32144(%rip), %ebx     # 0x39e94
cmpl %edi, %ebx
cmovlel %edi, %ebx
testl %edi, %edi
cmovlel %edi, %ebx
movl 0x32138(%rip), %eax     # 0x39e98
cmpl %eax, %ebx
cmovgel %eax, %ebx
cmpb $0x1, 0x320bd(%rip)     # 0x39e29
jne 0x7df3
movq 0x34187(%rip), %rax     # 0x3bf00
cmpq 0x32e38(%rip), %rax     # 0x3abb8
jge 0x7df3
cmpl 0x315b8(%rip), %ebx     # 0x39340
je 0x7df3
testl %ebx, %ebx
leaq 0x291a2(%rip), %rax     # 0x30f35
leaq 0x291e8(%rip), %rsi     # 0x30f82
cmovgq %rax, %rsi
leaq 0x31c39(%rip), %rcx     # 0x399de
movq %rsp, %r14
movq %r14, %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x2050
leaq 0x2ac75(%rip), %rsi     # 0x32a30
movq %r14, %rdi
callq 0x20a0
testq %rax, %rax
je 0x7df3
movq %rax, %r14
leaq 0x80(%rsp), %rdi
movl $0x400, %esi            # imm = 0x400
movq %rax, %rdx
callq 0x2440
testq %rax, %rax
je 0x7deb
movl %ebx, 0x31555(%rip)     # 0x39340
movq %r14, %rdi
callq 0x23a0
movl 0x31547(%rip), %eax     # 0x39340
addq $0x488, %rsp            # imm = 0x488
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x24662(%rip), %rdi     # 0x44ff8
callq 0x21a0
movq %rax, 0x245e6(%rip)     # 0x44f88
leaq 0x1181f(%rip), %rdi     # 0x321c8
leaq 0x10342(%rip), %rsi     # 0x30cf2
callq 0x22e0
movq %rax, %r14
movq 0x245c9(%rip), %rdi     # 0x44f88
callq 0x20f0
leaq 0x11808(%rip), %rsi     # 0x321d3
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_O3/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 0xfbce(%rip), %rsi      # 0x305d4
callq 0x2390
testl %eax, %eax
je 0x20a46
leaq 0xfbc6(%rip), %rsi      # 0x305dc
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, 0x245c6(%rip)     # 0x45000
jne 0x20a4b
movq %rsp, %rdi
callq 0x20988
jmp 0x20a4b
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_O3/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 0x11767(%rip), %rsi     # 0x321da
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
cmpl $0x0, 0x188e4(%rip)     # 0x39368
jg 0x20a95
addq $0x50, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x209ed
movl $0x1, 0x188c9(%rip)     # 0x39368
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x1172b(%rip), %rsi     # 0x321ee
movq %rsp, %rdi
xorl %eax, %eax
callq 0x2050
cmpl $0x1, 0x18894(%rip)     # 0x39368
jne 0x20ae5
addq $0x50, %rbx
movq %rsp, %rsi
movq %rbx, %rdi
callq 0x209ed
movl $0x0, 0x18879(%rip)     # 0x39368
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0x249f7
addq $0x98, %rsp
popq %rbx
popq %r14
retq
movq (%rsp), %rcx
subq 0x60(%rsp), %rcx
jle 0x249ec
imull $0x3c, %ebx, %edx
movslq %edx, %rdx
cmpq %rdx, %rcx
jge 0x249ec
xorl %eax, %eax
jmp 0x249ec
// File: /workspace/github_cpp_makefile_star2_O3/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), %rcx
movq (%r14), %rax
subq %rcx, %rax
cmpq $0x3d, %rax
setl %al
jge 0x24a5d
cmpq 0x206a1(%rip), %rcx     # 0x450f8
jne 0x24a5d
xorl %eax, %eax
jmp 0x24a64
movq %rcx, 0x20694(%rip)     # 0x450f8
addq $0xa0, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/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 0xdae2(%rip), %rdi      # 0x32568
leaq 0xbb45(%rip), %rsi      # 0x305d2
callq 0x22e0
testq %rax, %rax
je 0x24b43
movq %rax, %r14
movq (%rbx), %rsi
cmpq %rsi, 0x8(%rbx)
je 0x24b3b
movl $0xc, %r12d
xorl %r13d, %r13d
movabsq $0x1845c8a0ce512957, %rbp # imm = 0x1845C8A0CE512957
leaq 0xdab4(%rip), %r15      # 0x32579
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 0xb77d(%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 0x24ac5
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_O3/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 0xd9f9(%rip), %rdi      # 0x32568
leaq 0xdeba(%rip), %rsi      # 0x32a30
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 0x24c80
movq %rax, %r14
movq %rsp, %rdi
movl $0x64, %esi
movq %rax, %rdx
callq 0x2440
testq %rax, %rax
je 0x24c78
leaq 0x84(%rsp), %r12
leaq 0x98(%rsp), %r13
movq %rsp, %r15
leaq 0x70(%rsp), %rbp
movq %r15, %rdi
leaq 0xd9a3(%rip), %rsi      # 0x3258d
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, 0x204ed(%rip)     # 0x45100
movq %r12, %rdi
callq 0x2420
movl %eax, 0x204e7(%rip)     # 0x45108
movq %r13, %rdi
callq 0x2310
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x204d7(%rip)    # 0x4510c
movq 0x8(%rbx), %rsi
cmpq 0x10(%rbx), %rsi
je 0x24c50
movups 0x204ba(%rip), %xmm0    # 0x45100
movups %xmm0, (%rsi)
addq $0x10, 0x8(%rbx)
jmp 0x24c5f
movq %rbx, %rdi
leaq 0x204a6(%rip), %rdx     # 0x45100
callq 0x24054
movq %r15, %rdi
movl $0x64, %esi
movq %r14, %rdx
callq 0x2440
testq %rax, %rax
jne 0x24be0
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_O3/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 0x24ceb
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 0x24ceb
movss (%r8), %xmm1
xorl %esi, %esi
ucomiss %xmm0, %xmm1
seta %sil
addl %esi, %eax
incq %rdi
addq $0x18, %r8
decl %edx
jne 0x24ccb
retq
// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/awattar.cpp
// Function: Lowprice(std::vector<watt_s, std::allocator<watt_s>>&, int, int, float)
int Lowprice(std::vector<watt_s> &w,int ab,int bis,float preis)    // Anzahle Einträge mit < Preisf
{                                            // l1 = erste position h1 = letzte Position
    int x1 = 0;
    for (int j = ab; j <= bis; j++ )
    {
// Suchen nach Hoch und Tiefs
        if (w[j].pp < preis) x1++;
    }
    return x1;
}

// Assembly:
xorl %eax, %eax
cmpl %edx, %esi
jg 0x24e62
movq (%rdi), %rax
movslq %esi, %rcx
leaq (%rcx,%rcx,2), %rcx
leaq (%rax,%rcx,8), %rcx
addq $0x8, %rcx
subl %esi, %edx
incl %edx
xorl %eax, %eax
xorl %esi, %esi
ucomiss (%rcx), %xmm0
seta %sil
addl %esi, %eax
addq $0x18, %rcx
decl %edx
jne 0x24e4f
retq
// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/awattar.cpp
// Function: SucheDiff(std::vector<watt_s, std::allocator<watt_s>>&, int, float, float)
bool SucheDiff(std::vector<watt_s> &w,int ab, float aufschlag,float Diff)  // ab = Index bis Diff zwischen high und low erreicht
{
    high = w[ab];
    low = w[ab];
    h1 = ab;
    l1 = ab;
 
    for (int j = ab; (j < w.size()); j++ )
    {
// Suchen nach Hoch und Tiefs
        if (w[j].pp > high.pp) {
            high = w[j];
            h1 = j;
        } else
          if  (w[j].pp < low.pp) {
              low = w[j];
              l1 = j;
          }
        float erg = (low.pp )*(aufschlag-1)+ Diff;
        if ((high.pp - low.pp) > (low.pp)*(aufschlag-1)+ Diff)
        return true;
    }

    return false;
}

// Assembly:
movslq %esi, %rcx
movq (%rdi), %rax
leaq (%rcx,%rcx,2), %r8
movq 0x10(%rax,%r8,8), %rdx
movq %rdx, 0x20131(%rip)     # 0x45120
movups (%rax,%r8,8), %xmm2
movups %xmm2, 0x20115(%rip)    # 0x45110
movq 0x10(%rax,%r8,8), %rdx
movq %rdx, 0x20131(%rip)     # 0x45138
movups (%rax,%r8,8), %xmm2
movups %xmm2, 0x20115(%rip)    # 0x45128
movl %ecx, 0x20127(%rip)     # 0x45140
movl %ecx, 0x20125(%rip)     # 0x45144
movq 0x8(%rdi), %rdi
subq %rax, %rdi
sarq $0x3, %rdi
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rdi, %rdx
cmpq %rcx, %rdx
jbe 0x250e5
addss 0xb39b(%rip), %xmm0     # 0x303e4
movss 0x200c7(%rip), %xmm2    # 0x45118
incq %rcx
leaq (%rax,%r8,8), %rdi
movss 0x8(%rdi), %xmm3
ucomiss %xmm2, %xmm3
jbe 0x25087
movups (%rdi), %xmm2
movups %xmm2, 0x200a4(%rip)    # 0x45110
movq 0x10(%rdi), %rax
movq %rax, 0x200a9(%rip)     # 0x45120
movl %esi, 0x200c3(%rip)     # 0x45140
movss 0x20093(%rip), %xmm2    # 0x45118
jmp 0x250af
movss 0x200a1(%rip), %xmm4    # 0x45130
ucomiss %xmm3, %xmm4
jbe 0x250af
movq 0x10(%rdi), %rax
movq %rax, 0x20099(%rip)     # 0x45138
movups (%rdi), %xmm3
movups %xmm3, 0x2007f(%rip)    # 0x45128
movl %esi, 0x20095(%rip)     # 0x45144
movss 0x20079(%rip), %xmm3    # 0x45130
movaps %xmm2, %xmm4
subss %xmm3, %xmm4
mulss %xmm0, %xmm3
addss %xmm1, %xmm3
ucomiss %xmm3, %xmm4
seta %al
ja 0x250e4
leaq 0x1(%rcx), %r8
addq $0x18, %rdi
incl %esi
cmpq %rcx, %rdx
movq %r8, %rcx
ja 0x25058
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/awattar.cpp
// Function: SuchePos(std::vector<watt_s, std::allocator<watt_s>>&, int)
int SuchePos(std::vector<watt_s> &w,int bis)  // ab = Index bis zeitangabe in Minuten Suchen nach dem Zeitpunkt oder Sekunden nach 1970
{
    time_t  rawtime;
    struct tm * ptm;
    time(&rawtime);
    ptm = gmtime (&rawtime);
    ptm->tm_hour = bis/60;
    if (bis <= 48*60)
    {
    if (ptm->tm_hour>24) ptm->tm_hour = ptm->tm_hour-24;
    rawtime = mktime(ptm);
    if (bis/60 > 24)
    rawtime = rawtime + 24*3600;
    ptm = gmtime (&rawtime);
    }
    else rawtime = bis;
    int zeit, ret=-1;
    for (int j = 0; ((j < w.size())&&(w[j].hh<rawtime)); j++ )
    {
// Suchen nach Hoch und Tiefs
        zeit = w[j].hh%(24*3600)/60;
        ret = j;
    }
    time(&rawtime);
    ptm = gmtime (&rawtime);
    return ret;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebp
movq %rdi, %rbx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
callq 0x2220
movslq %ebp, %rdx
imulq $-0x77777777, %rdx, %rcx # imm = 0x88888889
shrq $0x20, %rcx
addl %ebp, %ecx
movl %ecx, %esi
shrl $0x1f, %esi
sarl $0x5, %ecx
addl %esi, %ecx
movl %ecx, 0x8(%rax)
cmpl $0xb40, %edx            # imm = 0xB40
jg 0x25165
cmpl $0x5dc, %ebp            # imm = 0x5DC
jl 0x2513d
addl $-0x18, %ecx
movl %ecx, 0x8(%rax)
movq %rax, %rdi
callq 0x2180
leaq 0x15180(%rax), %rcx
cmpl $0x5dc, %ebp            # imm = 0x5DC
cmovlq %rax, %rcx
leaq 0x8(%rsp), %rdi
movq %rcx, (%rdi)
callq 0x2220
jmp 0x2516c
movl %ebp, %eax
movq %rax, 0x8(%rsp)
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
subq %rax, %rcx
je 0x251ca
sarq $0x3, %rcx
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
imulq %rcx, %rdx
movq 0x8(%rsp), %rcx
cmpq $0x1, %rdx
adcq $0x0, %rdx
cmpq %rcx, (%rax)
jge 0x251ca
leal -0x1(%rdx), %ebx
addq $0x18, %rax
movl $0x1, %esi
subq %rdx, %rsi
xorl %edx, %edx
cmpq %rdx, %rsi
je 0x251ca
decq %rdx
leaq 0x18(%rax), %rdi
cmpq %rcx, (%rax)
movq %rdi, %rax
jl 0x251b2
notl %edx
movl %edx, %ebx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x2250
movq %r14, %rdi
callq 0x2220
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Eba-M[P]E3DC-Control/awattar.cpp
// Function: suchenSolar(std::vector<wetter_s, std::allocator<wetter_s>>&, int, float&)
int suchenSolar(std::vector<wetter_s> &w,int x1,float &Verbrauch)
// Suchen Zeitpunkt für den ersten solaren Überschuss
// -1 = kein Überschuss gefunden
// ansonsten Anzahl der 15min Einträge sowie den aufgelaufenen Verbrauch
{
    
    Verbrauch = 0;
    for (;x1<w.size()&&w[x1].hourly>w[x1].solar;x1++)
    {
        Verbrauch = Verbrauch + w[x1].hourly + w[x1].wpbedarf - w[x1].solar;
    }
    return x1;
}

// Assembly:
movl %esi, %eax
movl $0x0, (%rdx)
movq (%rdi), %r8
movq 0x8(%rdi), %rcx
subq %r8, %rcx
sarq $0x3, %rcx
movabsq $0x6db6db6db6db6db7, %rsi # imm = 0x6DB6DB6DB6DB6DB7
imulq %rcx, %rsi
movslq %eax, %rcx
cmpq %rcx, %rsi
jbe 0x25251
imulq $0x38, %rcx, %rax
addq %r8, %rax
addq $0x24, %rax
xorps %xmm0, %xmm0
movss -0x10(%rax), %xmm2
movss -0x8(%rax), %xmm1
ucomiss %xmm1, %xmm2
jbe 0x2524f
addss %xmm2, %xmm0
addss (%rax), %xmm0
subss %xmm1, %xmm0
movss %xmm0, (%rdx)
incq %rcx
addq $0x38, %rax
cmpq %rcx, %rsi
ja 0x25224
movl %ecx, %eax
retq