LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::operator==(Matrix const&)
bool Matrix::operator == ( const Matrix& rhs ){
  if( _m != rhs._m || _n != rhs._n || _error || rhs._error ){
    return 0;
  }
  bool result = 1;
  for( uint i = 0; i < m(); i++ ){
    for( uint j = 0; j < n(); j++ ){
      if( _data[i][j] != rhs._data[i][j] )
	result = false;
    }
  }
  return result;
}

// Assembly:
movl 0x18(%rdi), %ecx
cmpl 0x18(%rsi), %ecx
jne 0x28bc
movl 0x1c(%rdi), %edx
cmpl 0x1c(%rsi), %edx
jne 0x28bc
cmpb $0x0, 0x31(%rdi)
jne 0x28bc
cmpb $0x0, 0x31(%rsi)
je 0x28c1
xorl %eax, %eax
andb $0x1, %al
retq
testq %rcx, %rcx
je 0x291c
pushq %rbp
pushq %rbx
movq (%rdi), %rdi
movq (%rsi), %rsi
movb $0x1, %al
xorl %r8d, %r8d
testq %rdx, %rdx
je 0x2910
leaq (,%r8,8), %r9
leaq (%r9,%r9,2), %r10
movq (%rdi,%r10), %r9
movq (%rsi,%r10), %r10
xorl %r11d, %r11d
movsd (%r9,%r11,8), %xmm0
ucomisd (%r10,%r11,8), %xmm0
setnp %bl
sete %bpl
andb %bl, %bpl
andb %bpl, %al
incq %r11
cmpq %r11, %rdx
jne 0x28ef
incq %r8
cmpq %rcx, %r8
jne 0x28d3
popq %rbx
popq %rbp
jmp 0x28be
movb $0x1, %al
jmp 0x28be
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::operator<<(double)
Matrix& Matrix::operator << ( double input ){
  //The IO iterators can be an issue here. Currently, resize() handles that.
  if( _m == 0 || _n == 0 || _error ){
    _print_error( "Attempting to input into an empty matrix." );
    _error = 1;
  }
  _data[_m_in][_n_in] = input;
  _n_in++;
  if( _n_in == _n ){
    _n_in = 0;
    _m_in++;
  }
  if( _m_in == _m ){
    _m_in = 0;
  }
  _det_up_to_date = 0;
  return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
cmpl $0x0, 0x18(%rdi)
sete %cl
movl 0x1c(%rdi), %eax
testl %eax, %eax
sete %dl
orb %cl, %dl
jne 0x294f
cmpb $0x1, 0x31(%rbx)
jne 0x29a8
movsd %xmm0, 0x8(%rsp)
leaq 0x20(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x66eb(%rip), %rsi      # 0x9050
leaq 0x670d(%rip), %rdx      # 0x9079
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x4d30
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4502
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x299b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
movb $0x1, 0x31(%rbx)
movl 0x1c(%rbx), %eax
movsd 0x8(%rsp), %xmm0
movl 0x20(%rbx), %ecx
movq (%rbx), %rdx
leaq (%rcx,%rcx,2), %rsi
movl 0x24(%rbx), %edi
movq (%rdx,%rsi,8), %rdx
movsd %xmm0, (%rdx,%rdi,8)
leal 0x1(%rdi), %edx
movl %edx, 0x24(%rbx)
cmpl %eax, %edx
jne 0x29d4
movl $0x0, 0x24(%rbx)
incl %ecx
movl %ecx, 0x20(%rbx)
cmpl 0x18(%rbx), %ecx
jne 0x29e0
movl $0x0, 0x20(%rbx)
movb $0x0, 0x38(%rbx)
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x10(%rsp), %rdi
cmpq %r15, %rdi
je 0x2a0b
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::clear()
void Matrix::clear(){
  _m_in = _n_in = _m_out = _n_out = 0; //Reset all IO iterators.
  _error = 0;
  for( uint i = 0; i < _m; i++ ){
    for( uint j = 0; j < _n; j++ ){
      _data[i][j] = 0.0;
    }
  }
  _det_up_to_date = 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movb $0x0, 0x31(%rdi)
xorps %xmm0, %xmm0
movups %xmm0, 0x20(%rdi)
movl 0x18(%rdi), %eax
testq %rax, %rax
je 0x2a69
movl 0x1c(%rbx), %r15d
movq (%rbx), %r12
movq %r15, %r14
shlq $0x3, %r14
shlq $0x3, %rax
leaq (%rax,%rax,2), %r13
xorl %ebp, %ebp
testl %r15d, %r15d
je 0x2a60
movq (%r12,%rbp), %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x20a0
addq $0x18, %rbp
cmpq %rbp, %r13
jne 0x2a4d
movb $0x0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::print()
void Matrix::print(){
  for( uint i = 0; i < _m; i++ ){
    for( uint j = 0; j < _n; j++ ){
      cout << _data[i][j] << " ";  
    }
    cout << endl;
  }
}

// Assembly:
cmpl $0x0, 0x18(%rdi)
je 0x2b20
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r12d, %r12d
movq 0xa53a(%rip), %r14      # 0xcfd8
leaq 0x66f5(%rip), %r15      # 0x919a
cmpl $0x0, 0x1c(%rbx)
je 0x2ae0
leaq (%r12,%r12,2), %r13
xorl %ebp, %ebp
movq (%rbx), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%rbp,8), %xmm0
movq %r14, %rdi
callq 0x21b0
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x2170
incq %rbp
movl 0x1c(%rbx), %eax
cmpq %rax, %rbp
jb 0x2ab1
movq (%r14), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %r14, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
incq %r12
movl 0x18(%rbx), %eax
cmpq %rax, %r12
jb 0x2aa5
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::print_test[abi:cxx11]()
string Matrix::print_test(){
  std::stringstream ss;
  for( uint i = 0; i < _m; i++ ){
    for( uint j = 0; j < _n; j++ ){
      ss << _data[i][j] << " ";  
    }
  }
  string s = ss.str();
  return s.substr(0, s.size()-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1b8, %rsp            # imm = 0x1B8
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
leaq 0x30(%rsp), %rdi
callq 0x20c0
movl 0x18(%r14), %ecx
testl %ecx, %ecx
je 0x2bb4
leaq 0x40(%rsp), %r15
movl 0x1c(%r14), %eax
xorl %r13d, %r13d
leaq 0x663a(%rip), %r12      # 0x919a
testl %eax, %eax
movl $0x0, %eax
je 0x2baa
leaq (,%r13,2), %rbp
addq %r13, %rbp
xorl %ebx, %ebx
movq (%r14), %rax
movq (%rax,%rbp,8), %rax
movsd (%rax,%rbx,8), %xmm0
movq %r15, %rdi
callq 0x21b0
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2170
incq %rbx
movl 0x1c(%r14), %eax
cmpq %rax, %rbx
jb 0x2b76
movl 0x18(%r14), %ecx
incq %r13
movl %ecx, %edx
cmpq %rdx, %r13
jb 0x2b60
leaq 0x48(%rsp), %rsi
leaq 0x10(%rsp), %rdi
callq 0x21a0
leaq 0x10(%rsp), %rsi
movq 0x8(%rsi), %rcx
decq %rcx
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x2160
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2bf9
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
movq 0xa3c0(%rip), %rsi      # 0xcfc0
leaq 0x30(%rsp), %rdi
callq 0x20e0
leaq 0xb0(%rsp), %rdi
callq 0x2060
movq %rbx, %rax
addq $0x1b8, %rsp            # imm = 0x1B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x2c51
movq 0x20(%rsp), %rsi
incq %rsi
callq 0x2140
jmp 0x2c51
jmp 0x2c4e
movq %rax, %rbx
movq 0xa368(%rip), %rsi      # 0xcfc0
leaq 0x30(%rsp), %rdi
callq 0x20e0
leaq 0xb0(%rsp), %rdi
callq 0x2060
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::addToRow(Matrix const&, unsigned int)
Matrix Matrix::addToRow( const Matrix& rhs, const uint row ){
  if( (row > 0 && row <= _m) || rhs._m != 1 ){
    Matrix result = *this;
    for( uint i = 0; i < _n; i++ ){
      result._data[row-1][i] = result._data[row-1][i] + rhs._data[0][i];
    }
    return result;
  }
  else {
    _error = 1;
    return *this;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %ecx, %ebp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
decl %ebp
cmpl 0x18(%rsi), %ebp
jb 0x2d14
cmpl $0x1, 0x18(%r14)
jne 0x2d14
movb $0x1, 0x31(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2848
jmp 0x2d54
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2848
movl 0x1c(%r15), %eax
testq %rax, %rax
je 0x2d54
movl %ebp, %ecx
movq (%rbx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
movq (%r14), %rdx
movq (%rdx), %rdx
xorl %esi, %esi
movsd (%rcx,%rsi,8), %xmm0
addsd (%rdx,%rsi,8), %xmm0
movsd %xmm0, (%rcx,%rsi,8)
incq %rsi
cmpq %rsi, %rax
jne 0x2d3d
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::ADDToRow(Matrix const&, unsigned int)
Matrix& Matrix::ADDToRow( const Matrix& rhs, const uint row ){
  if( (row > 0 && row <= _m) || rhs._m != 1 ){
    for( uint i = 0; i < _n; i++ ){
      _data[row-1][i] = _data[row-1][i] + rhs._data[0][i];
    }
  }
  else {
    _error = 1;
  }
  return *this;
}

// Assembly:
movq %rdi, %rax
decl %edx
cmpl 0x18(%rdi), %edx
jb 0x2d77
cmpl $0x1, 0x18(%rsi)
jne 0x2d77
movb $0x1, 0x31(%rax)
retq
movl 0x1c(%rax), %ecx
testq %rcx, %rcx
je 0x2dab
movl %edx, %edx
movq (%rax), %rdi
leaq (%rdx,%rdx,2), %rdx
movq (%rdi,%rdx,8), %rdx
movq (%rsi), %rsi
movq (%rsi), %rsi
xorl %edi, %edi
movsd (%rdx,%rdi,8), %xmm0
addsd (%rsi,%rdi,8), %xmm0
movsd %xmm0, (%rdx,%rdi,8)
incq %rdi
cmpq %rdi, %rcx
jne 0x2d94
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::switchRows(unsigned int, unsigned int)
Matrix Matrix::switchRows( const uint row1, const uint row2 ){
  Matrix result = *this;
  vector<double> temp = result._data[row1-1];
  result._data[row1-1] = result._data[row2-1];
  result._data[row2-1] = temp;
  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %ecx, %r14d
movl %edx, %r15d
movq %rdi, %rbx
callq 0x2848
decl %r15d
leaq (%r15,%r15,2), %r15
leaq (,%r15,8), %rsi
addq (%rbx), %rsi
leaq 0x8(%rsp), %rdi
callq 0x454c
decl %r14d
movq (%rbx), %rax
leaq (%r14,%r14,2), %r14
leaq (%rax,%r14,8), %rsi
leaq (%rax,%r15,8), %rdi
callq 0x42fc
shlq $0x3, %r14
addq (%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x42fc
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2e21
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x2e4d
movq %rax, %r14
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2e4d
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x410a
movq %r14, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::SWITCHRows(unsigned int, unsigned int)
Matrix& Matrix::SWITCHRows( const uint row1, const uint row2 ){
  vector<double> temp = _data[row1-1];
  _data[row1-1] = _data[row2-1];
  _data[row2-1] = temp;
  return *this;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movl %edx, %r14d
movq %rdi, %rbx
decl %esi
shlq $0x3, %rsi
leaq (%rsi,%rsi,2), %r15
movq (%rdi), %rsi
addq %r15, %rsi
leaq 0x8(%rsp), %rdi
callq 0x454c
decl %r14d
movq (%rbx), %rdi
leaq (%r14,%r14,2), %r14
leaq (%rdi,%r14,8), %rsi
addq %r15, %rdi
callq 0x42fc
shlq $0x3, %r14
addq (%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x42fc
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2ec8
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x2eef
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::multiplyRow(double, unsigned int)
Matrix Matrix::multiplyRow( const double d, const uint row ){
  if( row > 0 && row <= _m ){
    Matrix result = *this;
    for( uint i = 0; i < _n; i++ ){
      result._data[row-1][i] = result._data[row-1][i] * d;
    }
    return result;
  }
  else {
    _error = 1;
    return *this;
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
decl %ebp
cmpl 0x18(%rsi), %ebp
jae 0x2f56
movq %rbx, %rdi
movq %r14, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x2848
movsd 0x8(%rsp), %xmm1
movl 0x1c(%r14), %eax
testq %rax, %rax
je 0x2f66
movl %ebp, %ecx
movq (%rbx), %rdx
leaq (%rcx,%rcx,2), %rcx
movq (%rdx,%rcx,8), %rcx
xorl %edx, %edx
movsd (%rcx,%rdx,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rcx,%rdx,8)
incq %rdx
cmpq %rdx, %rax
jne 0x2f3e
jmp 0x2f66
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2848
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::MULTIPLYRow(double, unsigned int)
Matrix& Matrix::MULTIPLYRow( const double d, const uint row ){
  if( row > 0 && row <= _m ){
    for( uint i = 0; i < _n; i++ ){
      _data[row-1][i] = _data[row-1][i] * d;
    }
  }
  else {
    _error = 1;
  }
  return *this;
}

// Assembly:
movq %rdi, %rax
decl %esi
cmpl 0x18(%rdi), %esi
jae 0x2faa
movl 0x1c(%rax), %ecx
testq %rcx, %rcx
je 0x2fa9
movl %esi, %edx
movq (%rax), %rsi
leaq (%rdx,%rdx,2), %rdx
movq (%rsi,%rdx,8), %rdx
xorl %esi, %esi
movsd (%rdx,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rdx,%rsi,8)
incq %rsi
cmpq %rsi, %rcx
jne 0x2f93
retq
movb $0x1, 0x31(%rax)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::submatrix(unsigned int, unsigned int, unsigned int, unsigned int)
Matrix Matrix::submatrix( uint row, uint col, uint rows, uint cols ){
  if( row + rows - 1 <= _m && col + cols - 1 <= _n && rows != 0 && cols != 0 ){
    Matrix result( rows, cols );
    for( uint i = 0; i < rows; i++ ){
      for( uint j = 0; j < cols; j++ ){
	result._data[i][j] = _data[i+row-1][j+col-1];
      }
    }
    return result;
  }
  else {
    _error = 1;
    return *this;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %r8d, %r13d
movl %edx, %r15d
movq %rsi, %rbp
movq %rdi, %rbx
leal (%r15,%r13), %eax
decl %eax
cmpl 0x18(%rsi), %eax
jbe 0x32fd
movb $0x1, 0x31(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2848
jmp 0x3372
movl %r9d, %r12d
testl %r9d, %r9d
je 0x32ec
testl %r13d, %r13d
je 0x32ec
movl %ecx, %r14d
leal (%r14,%r12), %eax
decl %eax
cmpl 0x1c(%rbp), %eax
ja 0x32ec
decl %r15d
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x26dc
movq (%rbp), %rax
movq (%rbx), %rcx
movl %r13d, %edx
movl %r12d, %esi
decl %r14d
xorl %edi, %edi
leal (%r15,%rdi), %r8d
leaq (%r8,%r8,2), %r8
movq (%rax,%r8,8), %r8
leaq (%rdi,%rdi,2), %r9
movq (%rcx,%r9,8), %r9
xorl %r10d, %r10d
leal (%r14,%r10), %r11d
movsd (%r8,%r11,8), %xmm0
movsd %xmm0, (%r9,%r10,8)
incq %r10
cmpq %r10, %rsi
jne 0x3352
incq %rdi
cmpq %rdx, %rdi
jne 0x333b
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::add(Matrix const&)
Matrix Matrix::add( const Matrix& rhs ){
  if( _m == rhs._m && _n == rhs._n ){
    Matrix result = *this;
    for( uint i = 0; i < _m; i++ ){
      for( uint j = 0; j < _n; j++ ){
	result._data[i][j] = result._data[i][j] + rhs._data[i][j];
      }
    }
    return result;
  }
  else {
    _error = 1;
    return *this;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x18(%rsi), %eax
cmpl 0x18(%rdx), %eax
jne 0x3473
movq %rdx, %r15
movl 0x1c(%r14), %eax
cmpl 0x1c(%rdx), %eax
jne 0x3473
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2848
movl 0x18(%r14), %eax
testq %rax, %rax
je 0x3483
movl 0x1c(%r14), %ecx
movq (%rbx), %rdx
movq (%r15), %rsi
xorl %edi, %edi
testq %rcx, %rcx
je 0x3469
leaq (,%rdi,8), %r8
leaq (%r8,%r8,2), %r9
movq (%rdx,%r9), %r8
movq (%rsi,%r9), %r9
xorl %r10d, %r10d
movsd (%r8,%r10,8), %xmm0
addsd (%r9,%r10,8), %xmm0
movsd %xmm0, (%r8,%r10,8)
incq %r10
cmpq %r10, %rcx
jne 0x344f
incq %rdi
cmpq %rax, %rdi
jne 0x3433
jmp 0x3483
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2848
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::mul(Matrix const&)
Matrix Matrix::mul( const Matrix& rhs ){
  if( _n == rhs._m ){
    Matrix result( _m, rhs._n );
    for( uint i = 0; i < _m; i++ ){
      for( uint j = 0; j < rhs._n; j++ ){
	int sum = 0;
	for( uint k = 0; k < _n; k++ ){
	  sum = sum + ( _data[i][k] * rhs._data[k][j] );
	}
	result._data[i][j] = sum;
      }
    }
    return result;
  }
  else {
    _error = 1;
    return *this;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movl 0x1c(%rsi), %eax
cmpl 0x18(%rdx), %eax
jne 0x36bc
movq %rdx, %r15
movl 0x18(%r14), %esi
movl 0x1c(%rdx), %edx
movq %rdi, (%rsp)
callq 0x26dc
movl 0x18(%r14), %eax
testq %rax, %rax
je 0x36b6
movl 0x1c(%r15), %ecx
movl 0x1c(%r14), %edx
movq (%rsp), %rsi
movq (%rsi), %rsi
xorl %edi, %edi
testq %rcx, %rcx
je 0x36ae
leaq (,%rdi,8), %r8
leaq (%r8,%r8,2), %r10
movq (%r14), %r8
addq %r10, %r8
movq (%r15), %r9
movq (%rsi,%r10), %r10
xorl %r11d, %r11d
testq %rdx, %rdx
je 0x369c
movq (%r8), %r12
xorl %r13d, %r13d
movq %r9, %rbp
xorl %ebx, %ebx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd (%r12,%r13,8), %xmm1
movq (%rbp), %rbx
mulsd (%rbx,%r11,8), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %ebx
incq %r13
addq $0x18, %rbp
cmpq %r13, %rdx
jne 0x3668
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
jmp 0x36a0
xorpd %xmm0, %xmm0
movsd %xmm0, (%r10,%r11,8)
incq %r11
cmpq %rcx, %r11
jne 0x3658
incq %rdi
cmpq %rax, %rdi
jne 0x3637
movq (%rsp), %rax
jmp 0x36cf
movb $0x1, 0x31(%r14)
movq %rdi, %rbx
movq %r14, %rsi
callq 0x2848
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::mul(double const&)
Matrix Matrix::mul( const double& in ){
  Matrix result = *this;
  for( uint i = 0; i < _m; i++ ){
    for( uint j = 0; j < _n; j++ ){
      result._data[i][j] = result._data[i][j] * in;
    }
  }
  return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
callq 0x2848
movl 0x18(%r15), %eax
testq %rax, %rax
je 0x3741
movl 0x1c(%r15), %ecx
movq (%r14), %rdx
xorl %esi, %esi
testq %rcx, %rcx
je 0x3739
leaq (%rsi,%rsi,2), %rdi
movq (%rdx,%rdi,8), %rdi
xorl %r8d, %r8d
movsd (%rdi,%r8,8), %xmm0
mulsd (%rbx), %xmm0
movsd %xmm0, (%rdi,%r8,8)
incq %r8
cmpq %r8, %rcx
jne 0x3721
incq %rsi
cmpq %rax, %rsi
jne 0x3711
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::exp(int)
Matrix Matrix::exp( const int power ){
  if( _m == _n && power > 0){
    Matrix result = *this;
    for( int i = 1; i < power; i++ ){
      result *= *this;
    }
    return result;
  }
  else {
    if( power == -1 ){ //Special case: Return the inverse.
      //return ~*this;
      return *this;
    }
    else {
      _error = 1;
      return *this;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
jle 0x38b3
movl 0x1c(%r14), %eax
cmpl %eax, 0x18(%r14)
jne 0x38b3
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2848
cmpl $0x2, %ebp
jb 0x38c8
decl %ebp
movq %rbx, %rdi
movq %r14, %rsi
callq 0x374a
decl %ebp
jne 0x38a2
jmp 0x38c8
cmpl $-0x1, %ebp
je 0x38bd
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2848
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x410a
movq %r14, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::EXP(int)
Matrix& Matrix::EXP( const int power ){
  if( _m == _n && power > 0){
    Matrix result = *this;
    for( int i = 1; i < power; i++ ){
      *this *= result;
    }
    return *this;
  }
  else {
    if( power == -1 ){ //Special case: Return the inverse.
      //return !*this;
      return *this;
    }
    else {
      _error = 1;
      return *this;
    }
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movl %esi, %ebp
movq %rdi, %rbx
testl %esi, %esi
jle 0x3939
movl 0x1c(%rbx), %eax
cmpl %eax, 0x18(%rbx)
jne 0x3939
movq %rsp, %rdi
movq %rbx, %rsi
callq 0x2848
cmpl $0x2, %ebp
jb 0x392f
decl %ebp
movq %rsp, %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x374a
decl %ebp
jne 0x3920
movq %rsp, %rdi
callq 0x410a
jmp 0x3942
cmpl $-0x1, %ebp
je 0x3942
movb $0x1, 0x31(%rbx)
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x410a
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::trans()
Matrix Matrix::trans(){
  Matrix result( _n, _m );
  for( uint i = 0; i < _m; i++ ){
    for( uint j = 0; j < _n; j++ ){
      result._data[j][i] = _data[i][j];
    }
  }
  return result;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movl 0x18(%rsi), %edx
movl 0x1c(%rsi), %esi
callq 0x26dc
movl 0x18(%r14), %eax
testq %rax, %rax
je 0x3e58
movl 0x1c(%r14), %ecx
movq (%r14), %rdx
movq (%rbx), %rsi
xorl %edi, %edi
testq %rcx, %rcx
je 0x3e50
leaq (%rdi,%rdi,2), %r8
movq (%rdx,%r8,8), %r8
movq %rsi, %r9
xorl %r10d, %r10d
movsd (%r8,%r10,8), %xmm0
movq (%r9), %r11
movsd %xmm0, (%r11,%rdi,8)
incq %r10
addq $0x18, %r9
cmpq %r10, %rcx
jne 0x3e35
incq %rdi
cmpq %rax, %rdi
jne 0x3e22
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::det()
double Matrix::det(){
  if( _det_up_to_date )
    return _determinant;
  else {
    if( _m != _n ){
      return 0;
    }
    _det_up_to_date = true;
    _determinant = _det( *this );
    return _determinant;
  }
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
cmpb $0x1, 0x38(%rdi)
je 0x3f2a
movl 0x18(%rbx), %eax
xorpd %xmm0, %xmm0
cmpl 0x1c(%rbx), %eax
jne 0x3f32
movb $0x1, 0x38(%rbx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2848
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3f50
cvttsd2si %xmm0, %eax
movl %eax, 0x34(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x410a
xorps %xmm0, %xmm0
cvtsi2sdl 0x34(%rbx), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x410a
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/matrix.cpp
// Function: Matrix::_det(Matrix)
double Matrix::_det( Matrix in ){  
  uint rows = in._m;
  uint cols = in._n;
  if( rows == 2 ){
    return in._data[0][0]*in._data[1][1] - in._data[1][0]*in._data[0][1];
  }
  if( rows == 1 ){
    return in._data[0][0];
  }
  double sum = 0.0;
  int sign = 1;
  for( uint iter = 0; iter < in._m; iter++ ){
    Matrix out( rows - 1, cols - 1 );
    for( uint i = 1; i < in._m; i++ ){
      for( uint j = 0; j < in._n; j++ ){
	if( j != iter ){
	  out << in._data[i][j];
	}
      }
    }
    sum = sum + in._data[0][iter] * sign * _det( out );
    sign = sign * -1;
  }
  return sum;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rsi, %rbx
movq %rdi, 0x18(%rsp)
movl 0x18(%rsi), %esi
testl %esi, %esi
je 0x3fab
cmpl $0x1, %esi
je 0x3f9f
cmpl $0x2, %esi
jne 0x3fb9
movq (%rbx), %rax
movq (%rax), %rcx
movq 0x18(%rax), %rax
movsd (%rcx), %xmm0
movsd 0x8(%rcx), %xmm1
mulsd (%rax), %xmm1
mulsd 0x8(%rax), %xmm0
subsd %xmm1, %xmm0
jmp 0x40cd
movq (%rbx), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
jmp 0x3faf
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
jmp 0x40c8
movl 0x1c(%rbx), %eax
decl %esi
decl %eax
movl %eax, 0x10(%rsp)
xorpd %xmm0, %xmm0
movsd %xmm0, (%rsp)
movl $0x1, %ebp
xorl %r15d, %r15d
leaq 0x68(%rsp), %r12
leaq 0x28(%rsp), %r14
movl %esi, 0xc(%rsp)
movl %ebp, 0x14(%rsp)
movq %r12, %rdi
movl 0x10(%rsp), %edx
callq 0x26dc
movl 0x18(%rbx), %ecx
cmpl $0x2, %ecx
jb 0x4056
movl 0x1c(%rbx), %eax
movl $0x1, %ebp
movl %eax, %edx
testl %edx, %edx
je 0x404a
leaq (,%rbp,2), %r13
addq %rbp, %r13
xorl %r14d, %r14d
cmpq %r14, %r15
je 0x4034
movq (%rbx), %rax
movq (%rax,%r13,8), %rax
movsd (%rax,%r14,8), %xmm0
movq %r12, %rdi
callq 0x292a
movl 0x1c(%rbx), %eax
incq %r14
movl %eax, %ecx
cmpq %rcx, %r14
jb 0x4017
movl 0x18(%rbx), %ecx
movl %eax, %edx
leaq 0x28(%rsp), %r14
jmp 0x404c
xorl %edx, %edx
incq %rbp
movl %ecx, %esi
cmpq %rsi, %rbp
jb 0x4005
movq (%rbx), %rax
movq (%rax), %rax
movl 0x14(%rsp), %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2848
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3f50
movsd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd (%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rdi
callq 0x410a
negl %ebp
movq %r12, %rdi
callq 0x410a
incq %r15
movl 0x18(%rbx), %eax
cmpq %rax, %r15
movl 0xc(%rsp), %esi
jb 0x3fe3
movsd (%rsp), %xmm0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x410a
jmp 0x40f3
jmp 0x40f0
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x410a
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O3/hitc8494[P]Matrix/test.cpp
// Function: test(bool, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void test( bool pass, std::string message ){
  string s; s.assign( spaces, ' ' );
  cout << s;
  if( pass ){
    cout << "Passed - "; passed++;
  }
  else {
    cout << "FAILED - "; failed++;
  }
  cout << message << endl;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x10(%rsp), %r14
movq %r14, -0x10(%r14)
movq $0x0, -0x8(%r14)
movb $0x0, (%r14)
movslq 0x8266(%rip), %rcx      # 0xd130
movq %rsp, %rdi
xorl %esi, %esi
xorl %edx, %edx
movl $0x20, %r8d
callq 0x2210
movq (%rsp), %rsi
movq 0x8(%rsp), %rdx
movq 0x80ec(%rip), %rdi      # 0xcfd8
callq 0x2170
testb %bpl, %bpl
je 0x4f17
movq 0x80db(%rip), %rdi      # 0xcfd8
leaq 0x4284(%rip), %rsi      # 0x9188
movl $0x9, %edx
callq 0x2170
leaq 0x821f(%rip), %rax      # 0xd134
jmp 0x4f36
movq 0x80ba(%rip), %rdi      # 0xcfd8
leaq 0x426d(%rip), %rsi      # 0x9192
movl $0x9, %edx
callq 0x2170
leaq 0x8202(%rip), %rax      # 0xd138
incl (%rax)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
movq 0x8092(%rip), %rdi      # 0xcfd8
callq 0x2170
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2120
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20b0
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x4f8b
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2140
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r14, %rdi
je 0x4fad
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x2140
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: debug(int, char const*, ...)
void debug(int msgLevel, const char *fmt, ...)
{
    va_list args;

    if (msgLevel <= loggingLevel) {
        logLineStart("UltraVnc");

        va_start(args, fmt);
    
        vfprintf(stderr, fmt, args);
        va_end(args);
    }
}

// Assembly:
pushq %rbx
subq $0xd0, %rsp
movq %rdx, 0x30(%rsp)
movq %rcx, 0x38(%rsp)
movq %r8, 0x40(%rsp)
movq %r9, 0x48(%rsp)
testb %al, %al
je 0x3583
movaps %xmm0, 0x50(%rsp)
movaps %xmm1, 0x60(%rsp)
movaps %xmm2, 0x70(%rsp)
movaps %xmm3, 0x80(%rsp)
movaps %xmm4, 0x90(%rsp)
movaps %xmm5, 0xa0(%rsp)
movaps %xmm6, 0xb0(%rsp)
movaps %xmm7, 0xc0(%rsp)
leaq 0x94ba(%rip), %rax      # 0xca44
cmpl %edi, (%rax)
jge 0x3597
addq $0xd0, %rsp
popq %rbx
retq
movq %rsi, %rbx
leaq 0x3a63(%rip), %rdi      # 0x7004
callq 0x2380
leaq 0x20(%rsp), %rax
movq %rsp, %rdx
movq %rax, 0x10(%rdx)
leaq 0xe0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq 0x8a0e(%rip), %rax      # 0xbfe0
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x2290
jmp 0x358e
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: openConnectionToEventListener(char const*, unsigned short, char*, int)
int openConnectionToEventListener(const char *host, unsigned short port, char *listenerIp, int listenerIpSize)
{
    int s;
    struct sockaddr_in saddr;
    struct hostent *h;
        
    h = gethostbyname(host);
    if (NULL == h) {
        debug(LEVEL_2, "openConnectionToEventListener(): can't resolve hostname: %s\n", host);
        return -1;
    }
    saddr.sin_family = AF_INET;
    saddr.sin_port = htons(port);
    
    //Interesting;-) typecast / indirection thing copied from "Beej's Guide to network programming". 
    //See http://beej.us/guide/bgnet/ for more info
    saddr.sin_addr = *((struct in_addr *)h->h_addr);

    memset(&(saddr.sin_zero), '\0', 8); // zero the rest of the struct
    
    strlcpy(listenerIp, inet_ntoa(saddr.sin_addr), listenerIpSize);
    
    debug(LEVEL_3, "openConnectionToEventListener(): connecting to %s:%u\n", listenerIp, port);

    s = socket(AF_INET, SOCK_STREAM, 0);
    
    //Trying to connect with timeout
    if (connectWithTimeout(s, (struct sockaddr *) &saddr, sizeof(saddr), TIMEOUT_10SECS) != 0) {
        debug(LEVEL_2, "openConnectionToEventListener(): connectWithTimeout() failed.\n");
        close(s);
        strlcpy(listenerIp, "", listenerIpSize);
        return -1;
    }
    else
        return s;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r14d
movq %rdx, %rbx
movl %esi, %ebp
movq %rdi, %r15
callq 0x2220
testq %rax, %rax
je 0x36ab
leaq 0x8(%rsp), %r15
movw $0x2, (%r15)
movl %ebp, %ecx
rolw $0x8, %cx
movw %cx, 0x2(%r15)
movq 0x18(%rax), %rax
movq (%rax), %rax
movl (%rax), %edi
movl %edi, 0x4(%r15)
movq $0x0, 0x8(%r15)
callq 0x20e0
movslq %r14d, %r14
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x5804
movzwl %bp, %ecx
leaq 0x3a0c(%rip), %rsi      # 0x7059
movl $0x3, %edi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x352c
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2060
movl %eax, %ebp
movl %eax, %edi
movq %r15, %rsi
callq 0x36d3
testl %eax, %eax
je 0x36c6
leaq 0x3a0b(%rip), %rsi      # 0x708f
movl $0x2, %edi
xorl %eax, %eax
callq 0x352c
movl %ebp, %edi
callq 0x2360
leaq 0x4f3c(%rip), %rsi      # 0x85da
movq %rbx, %rdi
movq %r14, %rdx
callq 0x5804
jmp 0x36c1
leaq 0x396a(%rip), %rsi      # 0x701c
movl $0x2, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: writeExact(int, char*, int, int)
int writeExact(int sock, char *buf, int len, int timeOutSecs)
{
    int n;
    int timeOutCtr;

    debug(LEVEL_3, "writeExact(): start\n");
    timeOutCtr=0;
    while ((len > 0) && (timeOutCtr < timeOutSecs)) {
        n = send(sock, buf, len, MSG_DONTWAIT);

        if (n > 0) {
            buf += n;
            len -= n;
        }
        else if (n == 0) {
            debug(LEVEL_3, "writeExact(): send returned 0\n");
            return -1;
        }
        else {
            //send() returned -1 to indicate some error
            //Because we use non-blocking in send(), we have to 
            //handle EAGAIN by incrementing timeout counter
            if (errno == EAGAIN) {
                debug(LEVEL_3, "writeExact(): EAGAIN detected\n");
                sleep(1);
                timeOutCtr++;
            }
            else {
                debug(LEVEL_3, "writeExact(): send() returned error, errno = %d (%s)\n", errno, strerror(errno));
                return -1;
            }
        }
    }

    if (timeOutCtr <  timeOutSecs) {
        debug(LEVEL_3, "writeExact(): returning normally\n");
        return 1;
    }
    else {
        debug(LEVEL_3, "writeExact(): timeout error\n");
        return -2;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %ecx, %ebx
movl %edx, %ebp
movq %rsi, %r14
movl %edi, %r15d
leaq 0x375b(%rip), %rsi      # 0x70ce
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
testl %ebp, %ebp
setle %cl
testl %ebx, %ebx
setg %al
setle %dl
orb %cl, %dl
jne 0x39f7
xorl %r12d, %r12d
movl %ebp, %edx
movl %r15d, %edi
movq %r14, %rsi
movl $0x40, %ecx
callq 0x2100
testl %eax, %eax
jle 0x39b8
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r14
subl %eax, %ebp
jmp 0x39e8
je 0x3a2f
callq 0x2030
movl (%rax), %r13d
cmpl $0xb, %r13d
jne 0x3a44
movl $0x3, %edi
leaq 0x372e(%rip), %rsi      # 0x7102
xorl %eax, %eax
callq 0x352c
movl $0x1, %edi
callq 0x2160
incl %r12d
cmpl %ebx, %r12d
setl %al
testl %ebp, %ebp
jle 0x39f7
cmpl %ebx, %r12d
jl 0x3993
testb %al, %al
je 0x3a15
leaq 0x3755(%rip), %rsi      # 0x7157
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
movl $0x1, %eax
jmp 0x3a6a
leaq 0x375d(%rip), %rsi      # 0x7179
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
movl $0xfffffffe, %eax       # imm = 0xFFFFFFFE
jmp 0x3a6a
leaq 0x36ad(%rip), %rsi      # 0x70e3
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
jmp 0x3a65
movl %r13d, %edi
callq 0x20a0
leaq 0x36ce(%rip), %rsi      # 0x7121
movl $0x3, %edi
movl %r13d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isPeerDisconnected(int, int)
bool isPeerDisconnected(int socket, int connectionFrom)
{
    ssize_t n;

    char buf[SIZE_RFBPROTOCOLVERSIONMSG+1];
    buf[SIZE_RFBPROTOCOLVERSIONMSG] = '\0';
    
    n = recv(socket, buf, SIZE_RFBPROTOCOLVERSIONMSG, MSG_DONTWAIT);

    if (n == 0) {
        debug(LEVEL_3, "isPeerDisconnected: recv() returned 0 (peer has disconnected orderly)\n");
        return true;    //peer has disconnected orderly
    }
    else if (n == -1) {
        //recv() returned -1 to indicate some error
        if (errno == EAGAIN) {
            //Because we use non-blocking in recv(), EAGAIN is ok
            return false;
        }
        else {
            debug(LEVEL_2, "isPeerDisconnected: recv() returned error, errno = %d (%s)\n", errno, strerror(errno));
            return true;
        }
    }
    else if (n >= 1) {
        //peer has sent data OK
        debug(LEVEL_3, "isPeerDisconnected: recv() returned: %s\n", buf);
        return false;  
    }
    else {
        //unknown error
        debug(LEVEL_2, "isPeerDisconnected: recv() returned error, errno = %d (%s)\n", errno, strerror(errno));
        return true;
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
leaq 0x3(%rsp), %rsi
movb $0x0, 0xc(%rsi)
movl $0xc, %edx
movl $0x40, %ecx
callq 0x2090
cmpq $-0x1, %rax
je 0x3ad7
testq %rax, %rax
jne 0x3ae7
leaq 0x36cd(%rip), %rsi      # 0x7196
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
jmp 0x3b2b
callq 0x2030
movl (%rax), %ebx
cmpl $0xb, %ebx
jne 0x3b0c
xorl %ebx, %ebx
jmp 0x3b2d
jle 0x3b05
leaq 0x3729(%rip), %rsi      # 0x7219
xorl %ebx, %ebx
leaq 0x3(%rsp), %rdx
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
jmp 0x3b2d
callq 0x2030
movl (%rax), %ebx
movl %ebx, %edi
callq 0x20a0
leaq 0x36c3(%rip), %rsi      # 0x71dd
movl $0x2, %edi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x352c
movb $0x1, %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: readPeerHandShake(int, int)
void readPeerHandShake(int socket, int index)
{
    int len;
    
    //Make sure handshake is null-terminated
    handShakes[index] -> handShake[MAX_HANDSHAKE_LEN-1] ='\0';
    
    len = nonBlockingRead(socket, handShakes[index] -> handShake, MAX_HANDSHAKE_LEN - 1, TIMEOUT_5SECS);
    if (len < 0) {
       strlcpy(handShakes[index] -> handShake, "", MAX_HANDSHAKE_LEN);
       handShakes[index] -> handShakeLength = 0;
    }
    else {
        debug(LEVEL_3, "readPeerHandShake(): len = %d\n", len);
        handShakes[index] -> handShakeLength = len;
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq %esi, %r14
leaq 0x903c(%rip), %r15      # 0xcb80
movq (%r15,%r14,8), %rsi
movb $0x0, 0x63(%rsi)
movl $0x63, %edx
callq 0x3b97
testl %eax, %eax
js 0x3b73
movl %eax, %ebx
leaq 0x36df(%rip), %rsi      # 0x7242
movl $0x3, %edi
movl %eax, %edx
xorl %eax, %eax
callq 0x352c
jmp 0x3b8a
movq (%r15,%r14,8), %rdi
leaq 0x4a5c(%rip), %rsi      # 0x85da
movl $0x64, %edx
callq 0x5804
xorl %ebx, %ebx
movq (%r15,%r14,8), %rax
movl %ebx, 0x64(%rax)
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: nonBlockingAccept(int, sockaddr*, unsigned int*)
int nonBlockingAccept(int socket, struct sockaddr *sa, socklen_t *sockLen)
{
    long arg; 
    int socketToReturn;
    
    //First, set socket non-blocking 
    arg = fcntl(socket, F_GETFL, NULL);
    if (arg < 0) { 
        debug(LEVEL_2, "nonBlockingAccept(): error in fcntl(..., F_GETFL) (%s)\n", strerror(errno)); 
        return -1; 
    } 
    arg |= O_NONBLOCK; 
    if (fcntl(socket, F_SETFL, arg) < 0) { 
        debug(LEVEL_2, "nonBlockingAccept(): error in fcntl(..., F_SETFL) (%s)\n", strerror(errno)); 
        return -1; 
    }     
    
    //Accept connection 
    socketToReturn = accept(socket, sa, sockLen);

    //Set to blocking mode again... 
    if ((arg = fcntl(socket, F_GETFL, NULL)) < 0) { 
        debug(LEVEL_2, "nonBlockingAccept(): Error fcntl(..., F_GETFL) (%s)\n", strerror(errno)); 
        if (socketToReturn != -1)
            close(socketToReturn);
        return -1; 
    } 
    arg &= (~O_NONBLOCK); 
    if (fcntl(socket, F_SETFL, arg) < 0) { 
        debug(LEVEL_2, "nonBlockingAccept(): Error fcntl(..., F_SETFL) (%s)\n", strerror(errno)); 
        if (socketToReturn != -1)
            close(socketToReturn);
        return -1; 
    } 

    //At last, we are ready to return accept():ed socket ;-)
    return socketToReturn;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movl %edi, %ebp
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x3d34
orl $0x800, %eax            # imm = 0x800
movl %ebp, %edi
movl $0x4, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x3d49
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2080
movl %eax, %ebx
movl %ebp, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x3d77
andl $0x7ffff7ff, %eax       # imm = 0x7FFFF7FF
movl %ebp, %edi
movl $0x4, %esi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x3d8c
movl %ebx, %ebp
jmp 0x3d70
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x351a(%rip), %rsi      # 0x7261
jmp 0x3d5c
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x353d(%rip), %rsi      # 0x7299
movl $0x2, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x3547(%rip), %rsi      # 0x72d1
jmp 0x3d9f
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x3567(%rip), %rsi      # 0x7306
movl $0x2, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
cmpl $-0x1, %ebx
je 0x3d70
movl %ebx, %edi
callq 0x2360
jmp 0x3d70
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: startListeningOnPort(_listenPortInfo*)
static void startListeningOnPort(listenPortInfo * pInfo)
{
    int yes = 1;
    struct sockaddr_in name;
    
    pInfo->socket = socket(PF_INET, SOCK_STREAM, 0);

    if (pInfo->socket < 0)
        fatal("startListeningOnPort(): socket() failed, errno=%d (%s)\n", errno, strerror(errno));
    else
        debug(LEVEL_3, "startListeningOnPort(): socket() initialized\n");

    if (setsockopt(pInfo->socket, SOL_SOCKET, SO_REUSEADDR, &yes, sizeof(int)) == -1)
        fatal("startListeningOnPort(): setsockopt() failed, errno=%d (%s)\n", errno, strerror(errno));
    else
        debug(LEVEL_3, "startListeningOnPort(): setsockopt() success\n");

    name.sin_family = AF_INET;

    name.sin_port = htons(pInfo->port);

    name.sin_addr.s_addr = inet_addr(ownIpAddress);

    if (bind(pInfo->socket, (struct sockaddr *) &name, sizeof(name)) < 0)
        fatal("startListeningOnPort(): bind() to (ip: %s, port: %d) failed, errno=%d (%s)\n", 
            ownIpAddress, pInfo -> port, errno, strerror(errno));
    else
        debug(LEVEL_3, "startListeningOnPort(): bind() to (ip: %s, port: %d) succeeded\n", ownIpAddress, pInfo->port);

    if (listen(pInfo->socket, LISTEN_BACKLOG) < 0)
        fatal("startListeningOnPort(): listen() failed, errno=%d (%s)\n", errno, strerror(errno));
    else
        debug(LEVEL_3, "startListeningOnPort(): listen() succeeded\n");

}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movl $0x1, 0x4(%rsp)
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x2060
movl %eax, (%rbx)
testl %eax, %eax
js 0x3ec4
leaq 0x3d9e(%rip), %rsi      # 0x7b9b
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
movl (%rbx), %edi
leaq 0x4(%rsp), %rcx
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0x2330
cmpl $-0x1, %eax
je 0x3ece
leaq 0x3dd0(%rip), %rsi      # 0x7c05
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
leaq 0x8(%rsp), %r14
movw $0x2, (%r14)
movzwl 0x4(%rbx), %eax
rolw $0x8, %ax
movw %ax, 0x2(%r14)
leaq 0x84a0(%rip), %rdi      # 0xc300
callq 0x2200
movl %eax, 0x4(%r14)
movl (%rbx), %edi
movq %r14, %rsi
movl $0x10, %edx
callq 0x2050
movl 0x4(%rbx), %ecx
testl %eax, %eax
js 0x3ed8
leaq 0x3df9(%rip), %rsi      # 0x7c7f
leaq 0x8473(%rip), %rdx      # 0xc300
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
movl (%rbx), %edi
movl $0x5, %esi
callq 0x2210
testl %eax, %eax
js 0x3ee1
leaq 0x3e47(%rip), %rsi      # 0x7cf7
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
addq $0x18, %rsp
popq %rbx
popq %r14
retq
callq 0x3399
jmp 0x3e09
callq 0x33bc
jmp 0x3e41
movl %ecx, %edi
callq 0x33e0
jmp 0x3e99
callq 0x3416
jmp 0x3ebc
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: isCodeInIdList(long)
static bool isCodeInIdList(long code)
{
    int ii;
    
    for(ii = 0; ii < ID_LIST_SIZE; ii++) {
        if (code == idList[ii]) {
            debug(LEVEL_3, "isCodeInIdList(): ID code match found (%ld)\n", code);
            return true;
        }
    }

    return false;
}

// Assembly:
pushq %rbx
movq %rdi, %rdx
leaq 0x10750(%rip), %rax     # 0x15130
movslq (%rax), %rcx
movb $0x1, %bl
cmpq %rdi, %rcx
je 0x4a0b
movq $-0x1, %rcx
cmpq $0x62, %rcx
je 0x4a20
movslq 0x8(%rax,%rcx,4), %rsi
incq %rcx
cmpq %rdx, %rsi
jne 0x49f1
cmpq $0x63, %rcx
setb %bl
leaq 0x3cf8(%rip), %rsi      # 0x870a
movl $0x3, %edi
xorl %eax, %eax
callq 0x352c
jmp 0x4a22
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: addViewerList(int, long, char*)
static int addViewerList(int socket, long code, char *peerIp)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == 0) {
            debug(LEVEL_3, "addViewerList(): Viewer added to list: code = %ld, index = %d\n", code, i);
            viewers[i] -> code = code;
            viewers[i] -> socket = socket;
            viewers[i] -> peerIp = getAddrPartsFromString(peerIp);
            viewers[i] -> timeStamp = time(NULL);
            viewers[i] -> active = false;
            return i;
        }
    }

    debug(LEVEL_2, "addViewerList(): Warning, no table slots available\n");
    return -1;  //Not added
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x7cd9(%rip), %rax      # 0xca40
movslq (%rax), %rax
testq %rax, %rax
jle 0x4d97
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0xdc42(%rip), %r12      # 0x129c0
xorl %ebx, %ebx
movq (%r12), %rcx
cmpq $0x0, 0x8(%rcx)
je 0x4db1
incq %rbx
addq $0x8, %r12
cmpq %rbx, %rax
jne 0x4d80
leaq 0x3bd5(%rip), %rsi      # 0x8973
movl $0x2, %edi
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4dfa
leaq 0x3b7c(%rip), %rsi      # 0x8934
movl $0x3, %edi
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x352c
movq (%r12), %rax
movq %r15, 0x8(%rax)
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x66d4
movq (%r12), %rcx
movq %rax, 0x18(%rcx)
movq %rdx, 0x20(%rcx)
xorl %edi, %edi
callq 0x21c0
movq (%r12), %rcx
movq %rax, 0x10(%rcx)
movb $0x0, 0x28(%rcx)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: setViewerActive(long)
static void setViewerActive(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == code) {
            viewers[i] -> active = true;
            debug(LEVEL_3, "setViewerActive(): activated viewer at index %d, code = %ld\n", i, viewers[i] -> code);
            return;
        }
    }

    debug(LEVEL_2, "setViewerActive(): Warning, viewer not found (code = %ld)\n", code);
}

// Assembly:
movq %rdi, %rcx
leaq 0x7c31(%rip), %rax      # 0xca40
movslq (%rax), %rax
testq %rax, %rax
jle 0x4e35
leaq 0xdba2(%rip), %rsi      # 0x129c0
xorl %edx, %edx
movq (%rsi), %rdi
cmpq %rcx, 0x8(%rdi)
je 0x4e4b
incq %rdx
addq $0x8, %rsi
cmpq %rdx, %rax
jne 0x4e20
leaq 0x3ba8(%rip), %rsi      # 0x89e4
movl $0x2, %edi
movq %rcx, %rdx
xorl %eax, %eax
jmp 0x352c
movb $0x1, 0x28(%rdi)
leaq 0x3b51(%rip), %rsi      # 0x89a7
movl $0x3, %edi
xorl %eax, %eax
jmp 0x352c
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: addServerList(int, long, char*)
static int addServerList(int socket, long code, char *peerIp)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == 0) {
            debug(LEVEL_3, "addServerList(): Server added to list: code = %ld, index = %d\n", code, i);
            servers[i] -> code = code;
            servers[i] -> socket = socket;
            servers[i] -> peerIp = getAddrPartsFromString(peerIp);
            servers[i] -> timeStamp = time(NULL);  /* 1 second accuracy is enough ? */
            servers[i] -> active = false;
            return i;
        }
    }
    
    debug(LEVEL_2, "addServerList(): Warning, no table slots available\n"); 
    return -1;  //Not added
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
leaq 0x7bcf(%rip), %rax      # 0xca40
movslq (%rax), %rax
testq %rax, %rax
jle 0x4ea1
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0xbbf8(%rip), %r12      # 0x10a80
xorl %ebx, %ebx
movq (%r12), %rcx
cmpq $0x0, 0x8(%rcx)
je 0x4ebb
incq %rbx
addq $0x8, %r12
cmpq %rbx, %rax
jne 0x4e8a
leaq 0x3bb6(%rip), %rsi      # 0x8a5e
movl $0x2, %edi
xorl %eax, %eax
callq 0x352c
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x4f04
leaq 0x3b5d(%rip), %rsi      # 0x8a1f
movl $0x3, %edi
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x352c
movq (%r12), %rax
movq %r15, 0x8(%rax)
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x66d4
movq (%r12), %rcx
movq %rax, 0x18(%rcx)
movq %rdx, 0x20(%rcx)
xorl %edi, %edi
callq 0x21c0
movq (%r12), %rcx
movq %rax, 0x10(%rcx)
movb $0x0, 0x28(%rcx)
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: setServerActive(long)
static void setServerActive(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == code) {
            servers[i] -> active = true;
            debug(LEVEL_3, "setServerActive(): activated server at index = %d, code = %ld\n", i, servers[i] -> code);
            return;
        }
    }
    debug(LEVEL_2, "setServerActive(): server not found (code = %ld)\n", code);
}

// Assembly:
movq %rdi, %rcx
leaq 0x7b27(%rip), %rax      # 0xca40
movslq (%rax), %rax
testq %rax, %rax
jle 0x4f3f
leaq 0xbb58(%rip), %rsi      # 0x10a80
xorl %edx, %edx
movq (%rsi), %rdi
cmpq %rcx, 0x8(%rdi)
je 0x4f55
incq %rdx
addq $0x8, %rsi
cmpq %rdx, %rax
jne 0x4f2a
leaq 0x3b8b(%rip), %rsi      # 0x8ad1
movl $0x2, %edi
movq %rcx, %rdx
xorl %eax, %eax
jmp 0x352c
movb $0x1, 0x28(%rdi)
leaq 0x3b32(%rip), %rsi      # 0x8a92
movl $0x3, %edi
xorl %eax, %eax
jmp 0x352c