LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2708
decl %r15d
imulq $0x18, %r15, %r15
movq (%rbx), %rsi
addq %r15, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3e92
decl %r14d
movq (%rbx), %rax
imulq $0x18, %r14, %r14
leaq (%rax,%r14), %rsi
addq %rax, %r15
movq %r15, %rdi
callq 0x3cc8
addq (%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3cc8
leaq 0x8(%rsp), %rdi
callq 0x426e
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
jmp 0x2bc6
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x426e
movq %rbx, %rdi
callq 0x3bc8
movq %r14, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O2/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
imulq $0x18, %rsi, %r15
movq (%rdi), %rsi
addq %r15, %rsi
leaq 0x8(%rsp), %rdi
callq 0x3e92
decl %r14d
movq (%rbx), %rdi
imulq $0x18, %r14, %r14
leaq (%rdi,%r14), %rsi
addq %r15, %rdi
callq 0x3cc8
addq (%rbx), %r14
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x3cc8
leaq 0x8(%rsp), %rdi
callq 0x426e
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x426e
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2ca6
movq %rbx, %rdi
movq %r14, %rsi
movsd %xmm0, 0x8(%rsp)
callq 0x2708
movsd 0x8(%rsp), %xmm1
movl 0x1c(%r14), %eax
movl %ebp, %ecx
imulq $0x18, %rcx, %rcx
addq (%rbx), %rcx
xorl %edx, %edx
cmpq %rdx, %rax
je 0x2cb6
movq (%rcx), %rsi
movsd (%rsi,%rdx,8), %xmm0
mulsd %xmm1, %xmm0
movsd %xmm0, (%rsi,%rdx,8)
incq %rdx
jmp 0x2c8b
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2708
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2cf5
movl 0x1c(%rax), %ecx
movl %esi, %edx
imulq $0x18, %rdx, %rdx
addq (%rax), %rdx
xorl %esi, %esi
cmpq %rsi, %rcx
je 0x2cf9
movq (%rdx), %rdi
movsd (%rdi,%rsi,8), %xmm1
mulsd %xmm0, %xmm1
movsd %xmm1, (%rdi,%rsi,8)
incq %rsi
jmp 0x2cda
movb $0x1, 0x31(%rax)
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2fc5
movb $0x1, 0x31(%rbp)
movq %rbx, %rdi
movq %rbp, %rsi
callq 0x2708
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r9d, %r12d
testl %r9d, %r9d
je 0x2fa4
testl %r13d, %r13d
je 0x2fa4
movl %ecx, %r14d
leal (%r14,%r12), %eax
decl %eax
cmpl 0x1c(%rbp), %eax
ja 0x2fa4
decl %r15d
movq %rbx, %rdi
movl %r13d, %esi
movl %r12d, %edx
callq 0x25b2
movq (%rbp), %rax
movq (%rbx), %rcx
movl %r13d, %edx
movl %r12d, %esi
decl %r14d
xorl %edi, %edi
cmpq %rdx, %rdi
je 0x2fb3
leal (%r15,%rdi), %r8d
imulq $0x18, %r8, %r8
movq (%rax,%r8), %r8
imulq $0x18, %rdi, %r9
movq (%rcx,%r9), %r9
xorl %r10d, %r10d
cmpq %r10, %rsi
je 0x3039
leal (%r14,%r10), %r11d
movsd (%r8,%r11,8), %xmm0
movsd %xmm0, (%r9,%r10,8)
incq %r10
jmp 0x301f
incq %rdi
jmp 0x3003
// File: /workspace/github_cpp_makefile_star2_O2/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, %r15
movq %rdi, %rbx
movl 0x18(%rsi), %eax
cmpl 0x18(%rdx), %eax
jne 0x3108
movq %rdx, %r14
movl 0x1c(%r15), %eax
cmpl 0x1c(%rdx), %eax
jne 0x3108
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2708
movl 0x18(%r15), %eax
movl 0x1c(%r15), %ecx
xorl %edx, %edx
cmpq %rax, %rdx
je 0x3118
imulq $0x18, %rdx, %rsi
movq (%rbx), %rdi
addq %rsi, %rdi
addq (%r14), %rsi
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x3103
movq (%rdi), %r9
movsd (%r9,%r8,8), %xmm0
movq (%rsi), %r10
addsd (%r10,%r8,8), %xmm0
movsd %xmm0, (%r9,%r8,8)
incq %r8
jmp 0x30e1
incq %rdx
jmp 0x30cc
movb $0x1, 0x31(%r15)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x2708
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdi, %rbx
movl 0x1c(%rsi), %eax
cmpl 0x18(%rdx), %eax
jne 0x330f
movq %rdx, %r15
movl 0x18(%r14), %esi
movl 0x1c(%rdx), %edx
movq %rbx, %rdi
callq 0x25b2
movl 0x18(%r14), %eax
movl 0x1c(%r15), %ecx
xorl %edx, %edx
cmpq %rax, %rdx
je 0x331f
movl 0x1c(%r14), %esi
imulq $0x18, %rdx, %rdi
movq (%rbx), %r8
addq %rdi, %r8
xorl %r9d, %r9d
cmpq %rcx, %r9
je 0x330a
movq (%r14), %r10
addq %rdi, %r10
movq (%r15), %r11
xorl %r12d, %r12d
xorl %ebp, %ebp
cvtsi2sd %ebp, %xmm0
cmpq %r12, %rsi
je 0x32fc
movq (%r10), %r13
movsd (%r13,%r12,8), %xmm1
movq (%r11), %r13
mulsd (%r13,%r9,8), %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %ebp
incq %r12
addq $0x18, %r11
jmp 0x32ce
movq (%r8), %r10
movsd %xmm0, (%r10,%r9,8)
incq %r9
jmp 0x32bb
incq %rdx
jmp 0x32a5
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2708
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2708
movl 0x18(%r15), %eax
movl 0x1c(%r15), %ecx
xorl %edx, %edx
cmpq %rax, %rdx
je 0x338d
imulq $0x18, %rdx, %rsi
addq (%r14), %rsi
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x3388
movq (%rsi), %r8
movsd (%r8,%rdi,8), %xmm0
mulsd (%rbx), %xmm0
movsd %xmm0, (%r8,%rdi,8)
incq %rdi
jmp 0x336b
incq %rdx
jmp 0x335d
movq %r14, %rax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x34cf
movl 0x1c(%r14), %eax
cmpl %eax, 0x18(%r14)
jne 0x34cf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2708
decl %ebp
subl $0x1, %ebp
jb 0x34e4
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3396
jmp 0x34bd
cmpl $-0x1, %ebp
je 0x34d9
movb $0x1, 0x31(%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2708
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x3bc8
movq %r14, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3549
movl 0x1c(%rbx), %eax
cmpl %eax, 0x18(%rbx)
jne 0x3549
movq %rsp, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2708
decl %ebp
subl $0x1, %ebp
jb 0x3554
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3396
jmp 0x3537
cmpl $-0x1, %ebp
je 0x355c
movb $0x1, 0x31(%rbx)
jmp 0x355c
movq %rsp, %rdi
callq 0x3bc8
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x3bc8
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x25b2
movl 0x18(%r14), %eax
movl 0x1c(%r14), %ecx
xorl %edx, %edx
cmpq %rax, %rdx
je 0x3968
imulq $0x18, %rdx, %rsi
addq (%r14), %rsi
movq (%rbx), %rdi
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x3963
movq (%rsi), %r9
movsd (%r9,%r8,8), %xmm0
movq (%rdi), %r9
movsd %xmm0, (%r9,%rdx,8)
incq %r8
addq $0x18, %rdi
jmp 0x3943
incq %rdx
jmp 0x3931
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x3a24
movl 0x18(%rbx), %eax
xorpd %xmm0, %xmm0
cmpl 0x1c(%rbx), %eax
jne 0x3a29
movb $0x1, 0x38(%rbx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2708
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3a46
cvttsd2si %xmm0, %eax
movl %eax, 0x34(%rbx)
leaq 0x8(%rsp), %rdi
callq 0x3bc8
cvtsi2sdl 0x34(%rbx), %xmm0
addq $0x48, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x3bc8
movq %rbx, %rdi
callq 0x21f0
// File: /workspace/github_cpp_makefile_star2_O2/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), %eax
cmpl $0x1, %eax
je 0x3a8e
cmpl $0x2, %eax
jne 0x3aaa
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 0x3a98
movq (%rbx), %rax
movq (%rax), %rax
movsd (%rax), %xmm0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl 0x1c(%rbx), %ecx
leal -0x1(%rax), %edx
movl %edx, 0xc(%rsp)
decl %ecx
movl %ecx, 0x10(%rsp)
pushq $0x1
popq %rbp
xorpd %xmm0, %xmm0
xorl %r15d, %r15d
leaq 0x68(%rsp), %r12
leaq 0x28(%rsp), %r14
movl %eax, %eax
cmpq %rax, %r15
jae 0x3a98
movl %ebp, 0x14(%rsp)
movsd %xmm0, (%rsp)
movq %r12, %rdi
movl 0xc(%rsp), %esi
movl 0x10(%rsp), %edx
callq 0x25b2
pushq $0x1
popq %rbp
movl 0x18(%rbx), %eax
cmpq %rax, %rbp
jae 0x3b31
imulq $0x18, %rbp, %r13
xorl %r14d, %r14d
movl 0x1c(%rbx), %eax
cmpq %rax, %r14
jae 0x3b27
cmpq %r14, %r15
je 0x3b22
movq (%rbx), %rax
movq (%rax,%r13), %rax
movsd (%rax,%r14,8), %xmm0
movq %r12, %rdi
callq 0x27be
incq %r14
jmp 0x3b00
incq %rbp
leaq 0x28(%rsp), %r14
jmp 0x3af1
movq (%rbx), %rax
movq (%rax), %rax
movl 0x14(%rsp), %ebp
cvtsi2sd %ebp, %xmm0
mulsd (%rax,%r15,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0x2708
movq 0x18(%rsp), %rdi
movq %r14, %rsi
callq 0x3a46
movsd 0x20(%rsp), %xmm1
mulsd %xmm0, %xmm1
movsd (%rsp), %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rsp)
movq %r14, %rdi
callq 0x3bc8
negl %ebp
movq %r12, %rdi
callq 0x3bc8
movsd (%rsp), %xmm0
incq %r15
movl 0x18(%rbx), %eax
jmp 0x3ace
jmp 0x3bae
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x3bc8
jmp 0x3bb1
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x3bc8
movq %rbx, %rdi
callq 0x21f0
nop
// File: /workspace/github_cpp_makefile_star2_O2/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 0x24d3
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 0xa56a(%rip), %rax      # 0xca44
cmpl %edi, (%rax)
jge 0x24e7
addq $0xd0, %rsp
popq %rbx
retq
movq %rsi, %rbx
leaq 0x4b13(%rip), %rdi      # 0x7004
callq 0x252f
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 0x9abe(%rip), %rax      # 0xbfe0
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x22a0
jmp 0x24de
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: logLineStart(char const*)
static void logLineStart(const char *prefix)
{
    time_t errTime;
    char buf[MY_TMP_BUF_LEN];
    char *lf;

    errTime = time(NULL);

    //ctime() adds '\n' to line end, change that to space
    strlcpy(buf, ((errTime != -1) ? ctime(&errTime) : ""), MY_TMP_BUF_LEN);
    lf = strchr(buf, '\n');
    if (NULL != lf)
        *lf = ' ';

    fprintf(stderr, "%s %s> ", prefix, buf);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
xorl %edi, %edi
callq 0x21c0
movq %rax, 0x8(%rsp)
cmpq $-0x1, %rax
jne 0x2557
leaq 0x6085(%rip), %rsi      # 0x85da
jmp 0x2564
leaq 0x8(%rsp), %rdi
callq 0x20c0
movq %rax, %rsi
leaq 0x10(%rsp), %r14
movl $0xff, %edx
movq %r14, %rdi
callq 0x553a
pushq $0xa
popq %rsi
movq %r14, %rdi
callq 0x20b0
testq %rax, %rax
je 0x2589
movb $0x20, (%rax)
movq 0x9a50(%rip), %rax      # 0xbfe0
movq (%rax), %rdi
leaq 0x4e7f(%rip), %rsi      # 0x7419
leaq 0x10(%rsp), %rcx
movq %rbx, %rdx
xorl %eax, %eax
callq 0x22d0
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: fatal(char const*, ...)
void fatal(const char *fmt, ...)
{
    va_list args;

    logLineStart("UltraVnc FATAL");
    
    va_start(args, fmt);
   
    vfprintf(stderr, fmt, args);
    va_end(args);
 
    //Close program down cleanly (as if user just pressed ctrl+c, of course 
    //log file will show FATAL message in case program shuts down)
    stopped = true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xd8, %rsp
movq %rdi, %rbx
leaq 0x20(%rsp), %r14
movq %rsi, 0x8(%r14)
movq %rdx, 0x10(%r14)
movq %rcx, 0x18(%r14)
movq %r8, 0x20(%r14)
movq %r9, 0x28(%r14)
testb %al, %al
je 0x2615
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 0x49f1(%rip), %rdi      # 0x700d
callq 0x252f
movq %rsp, %rdx
movq %r14, 0x10(%rdx)
leaq 0xf0(%rsp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000008, %rax     # imm = 0x3000000008
movq %rax, (%rdx)
movq 0x9998(%rip), %rax      # 0xbfe0
movq (%rax), %rdi
movq %rbx, %rsi
callq 0x22a0
movb $0x1, 0xa516(%rip)      # 0xcb70
addq $0xd8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0x2230
testq %rax, %rax
je 0x2726
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)
andq $0x0, 0x8(%r15)
callq 0x20e0
movslq %r14d, %r14
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x553a
movzwl %bp, %ecx
leaq 0x4989(%rip), %rsi      # 0x7059
pushq $0x3
popq %rdi
movq %rbx, %rdx
xorl %eax, %eax
callq 0x247c
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x2060
movl %eax, %ebp
movl %eax, %edi
movq %r15, %rsi
callq 0x274a
testl %eax, %eax
je 0x273d
leaq 0x498e(%rip), %rsi      # 0x708f
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x247c
movl %ebp, %edi
callq 0x2370
leaq 0x5ec1(%rip), %rsi      # 0x85da
movq %rbx, %rdi
movq %r14, %rdx
callq 0x553a
jmp 0x273a
leaq 0x48ef(%rip), %rsi      # 0x701c
pushq $0x2
popq %rdi
movq %r15, %rdx
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbp
movl %ebp, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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, %ebp
movl %edx, %r14d
movq %rsi, %r15
movl %edi, 0x4(%rsp)
leaq 0x4737(%rip), %rsi      # 0x70ce
xorl %ebx, %ebx
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
pushq $0x1
popq %r12
movl %r14d, %r14d
testl %r14d, %r14d
jle 0x2a06
cmpl %ebp, %ebx
jge 0x2a06
movl 0x4(%rsp), %edi
movq %r15, %rsi
movq %r14, %rdx
pushq $0x40
popq %rcx
callq 0x2100
testl %eax, %eax
jg 0x29f6
je 0x2a1d
callq 0x2030
movl (%rax), %r13d
cmpl $0xb, %r13d
jne 0x2a30
pushq $0x3
popq %rdi
leaq 0x471f(%rip), %rsi      # 0x7102
xorl %eax, %eax
callq 0x247c
movl %r12d, %edi
callq 0x2160
incl %ebx
jmp 0x29aa
movl %eax, %ecx
andl $0x7fffffff, %ecx       # imm = 0x7FFFFFFF
addq %rcx, %r15
subl %eax, %r14d
jmp 0x29a7
cmpl %ebp, %ebx
jge 0x2a53
leaq 0x4746(%rip), %rsi      # 0x7157
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
jmp 0x2a68
leaq 0x46bf(%rip), %rsi      # 0x70e3
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
jmp 0x2a4f
movl %r13d, %edi
callq 0x20a0
leaq 0x46e2(%rip), %rsi      # 0x7121
pushq $0x3
popq %rdi
movl %r13d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x247c
pushq $-0x1
jmp 0x2a66
leaq 0x471f(%rip), %rsi      # 0x7179
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
pushq $-0x2
popq %r12
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/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)
pushq $0xc
popq %rdx
pushq $0x40
popq %rcx
callq 0x2090
cmpq $-0x1, %rax
je 0x2ad2
testq %rax, %rax
jne 0x2ae2
leaq 0x46d0(%rip), %rsi      # 0x7196
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
jmp 0x2b22
callq 0x2030
movl (%rax), %ebx
cmpl $0xb, %ebx
jne 0x2b05
xorl %ebx, %ebx
jmp 0x2b24
jle 0x2afe
leaq 0x472e(%rip), %rsi      # 0x7219
xorl %ebx, %ebx
pushq $0x3
popq %rdi
leaq 0x3(%rsp), %rdx
xorl %eax, %eax
callq 0x247c
jmp 0x2b24
callq 0x2030
movl (%rax), %ebx
movl %ebx, %edi
callq 0x20a0
leaq 0x46ca(%rip), %rsi      # 0x71dd
pushq $0x2
popq %rdi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x247c
movb $0x1, %bl
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/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 0xa045(%rip), %r15      # 0xcb80
movq (%r15,%r14,8), %rsi
movb $0x0, 0x63(%rsi)
pushq $0x63
popq %rdx
callq 0x2b88
testl %eax, %eax
js 0x2b66
movl %eax, %ebx
leaq 0x46ea(%rip), %rsi      # 0x7242
pushq $0x3
popq %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x247c
jmp 0x2b7b
movq (%r15,%r14,8), %rdi
leaq 0x5a69(%rip), %rsi      # 0x85da
pushq $0x64
popq %rdx
callq 0x553a
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_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: nonBlockingRead(int, char*, int, int)
static int nonBlockingRead(int sock, char *buf, int len, int timeOut)
{
    int n;
    int timeOutCtr;
    int numRead = 0;
    
    debug(LEVEL_3, "nonBlockingRead(): start\n");
    timeOutCtr=0;
    while ((len > 0) && (timeOutCtr < timeOut)) {
        n = recv(sock, buf, len, MSG_DONTWAIT);

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

    if (timeOutCtr < timeOut) {
        debug(LEVEL_3, "nonBlockingRead(): returning normally\n");
        return numRead;
    }
    else {
        //In case of timeout, return number of bytes received if > 0, 
        //otherwise return -2 to indicate timeout
        if (numRead > 0) {
            debug(LEVEL_3, "nonBlockingRead(): returning %d bytes\n", numRead);
            return numRead;
        }
        else {
            debug(LEVEL_3, "nonBlockingRead(): timeout error\n");
            return -2;
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %r15
movl %edi, %ebp
leaq 0x4a98(%rip), %rsi      # 0x763a
xorl %ebx, %ebx
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
movl $0x0, (%rsp)
movl %r14d, %r14d
testl %r14d, %r14d
setg %al
movl %ebx, 0x4(%rsp)
cmpl $0x5, %ebx
setl %r12b
andb %al, %r12b
testb %r12b, %r12b
je 0x2c23
movl %ebp, %edi
movq %r15, %rsi
movq %r14, %rdx
pushq $0x40
popq %rcx
callq 0x2090
movq %rax, %r13
testl %r13d, %r13d
jg 0x2c0b
callq 0x2030
movl (%rax), %ebx
cmpl $-0x1, %r13d
jne 0x2c40
cmpl $0xb, %ebx
jne 0x2bcc
pushq $0x1
popq %rdi
callq 0x2160
movl 0x4(%rsp), %ebx
incl %ebx
jmp 0x2bb8
movl %r13d, %eax
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
addq %rax, %r15
subl %r13d, %r14d
addl %r13d, (%rsp)
movl 0x4(%rsp), %ebx
jmp 0x2bb5
cmpl $0x4, 0x4(%rsp)
jg 0x2c62
leaq 0x4a5d(%rip), %rsi      # 0x768e
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
movl (%rsp), %ebx
jmp 0x2c7c
movl %ebx, %edi
callq 0x20a0
leaq 0x4a06(%rip), %rsi      # 0x7654
pushq $0x2
popq %rdi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbx
jmp 0x2c7c
movl (%rsp), %ebx
testl %ebx, %ebx
je 0x2c8d
leaq 0x4a45(%rip), %rsi      # 0x76b5
pushq $0x3
popq %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x247c
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x4a48(%rip), %rsi      # 0x76dc
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
pushq $-0x2
jmp 0x2c5f
// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x3
popq %rsi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x2d13
orl $0x800, %eax            # imm = 0x800
pushq $0x4
popq %rsi
movl %ebp, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x2d28
movl %ebp, %edi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x2080
movl %eax, %ebx
pushq $0x3
popq %rsi
movl %ebp, %edi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x2d52
andl $0x7ffff7ff, %eax       # imm = 0x7FFFF7FF
pushq $0x4
popq %rsi
movl %ebp, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x2120
testl %eax, %eax
js 0x2d67
movl %ebx, %ebp
jmp 0x2d4b
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x453b(%rip), %rsi      # 0x7261
jmp 0x2d3b
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x455e(%rip), %rsi      # 0x7299
pushq $0x2
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x456c(%rip), %rsi      # 0x72d1
jmp 0x2d7a
callq 0x2030
movl (%rax), %edi
callq 0x20a0
leaq 0x458c(%rip), %rsi      # 0x7306
pushq $0x2
popq %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbp
cmpl $-0x1, %ebx
je 0x2d4b
movl %ebx, %edi
callq 0x2370
jmp 0x2d4b
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0x7ecc(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
leaq 0xde3c(%rip), %r12      # 0x129c0
cmpq %rbx, %rax
je 0x4b9d
movq (%r12), %rcx
cmpq $0x0, 0x8(%rcx)
je 0x4bb3
incq %rbx
addq $0x8, %r12
jmp 0x4b84
leaq 0x3dcf(%rip), %rsi      # 0x8973
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbx
jmp 0x4bfa
leaq 0x3d7a(%rip), %rsi      # 0x8934
pushq $0x3
popq %rdi
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x247c
movq (%r12), %rax
movq %r15, 0x8(%rax)
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x6378
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_O2/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 0x7e31(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
leaq 0xdda1(%rip), %rsi      # 0x129c0
cmpq %rdx, %rax
je 0x4c36
movq (%rsi), %rdi
cmpq %rcx, 0x8(%rdi)
je 0x4c4a
incq %rdx
addq $0x8, %rsi
jmp 0x4c1f
leaq 0x3da7(%rip), %rsi      # 0x89e4
pushq $0x2
popq %rdi
movq %rcx, %rdx
xorl %eax, %eax
jmp 0x247c
movb $0x1, 0x28(%rdi)
leaq 0x3d52(%rip), %rsi      # 0x89a7
pushq $0x3
popq %rdi
xorl %eax, %eax
jmp 0x247c
// File: /workspace/github_cpp_makefile_star2_O2/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
movq %rdx, %r14
movq %rsi, %r15
movl %edi, %ebp
leaq 0x7dca(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
leaq 0xbdfa(%rip), %r12      # 0x10a80
cmpq %rbx, %rax
je 0x4c9f
movq (%r12), %rcx
cmpq $0x0, 0x8(%rcx)
je 0x4cb5
incq %rbx
addq $0x8, %r12
jmp 0x4c86
leaq 0x3db8(%rip), %rsi      # 0x8a5e
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x247c
pushq $-0x1
popq %rbx
jmp 0x4cfc
leaq 0x3d63(%rip), %rsi      # 0x8a1f
pushq $0x3
popq %rdi
movq %r15, %rdx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x247c
movq (%r12), %rax
movq %r15, 0x8(%rax)
movl %ebp, (%rax)
movq %r14, %rdi
callq 0x6378
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_O2/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 0x7d2f(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
leaq 0xbd5f(%rip), %rsi      # 0x10a80
cmpq %rdx, %rax
je 0x4d38
movq (%rsi), %rdi
cmpq %rcx, 0x8(%rdi)
je 0x4d4c
incq %rdx
addq $0x8, %rsi
jmp 0x4d21
leaq 0x3d92(%rip), %rsi      # 0x8ad1
pushq $0x2
popq %rdi
movq %rcx, %rdx
xorl %eax, %eax
jmp 0x247c
movb $0x1, 0x28(%rdi)
leaq 0x3d3b(%rip), %rsi      # 0x8a92
pushq $0x3
popq %rdi
xorl %eax, %eax
jmp 0x247c
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: forkRepeater(int, int, long)
static void forkRepeater(int serverSocket, int viewerSocket, long idCode)
{
    pid_t pid;

    //fork repeater
    pid = fork();
    if (-1 == pid) {
        //fork failed. This is so unfair. Exit and blame Linus ;-)
        fatal(LEVEL_0, "forkRepeater(): fork() failed. Linus, this is *so* unfair.\n");
    }
    else if (0 == pid) {
        //child code
        debug(LEVEL_3, "forkRepeater(): in child process, starting doRepeater(%d, %d)\n", serverSocket, viewerSocket);
        exit(doRepeater(serverSocket, viewerSocket));
    }
    else {
        //parent code
        //Add necessary information of child to repeaterProcs list so we can
        //properly clean up after child has exited
        addRepeaterProcList(idCode, pid);
        
        //Close (parents copies of) repeater sockets right away here,
        //so we don't need to close them in cleanUpAfterRepeaterProcExit()
        close(serverSocket);
        close(viewerSocket);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r14
movl %esi, %ebx
movl %edi, %ebp
callq 0x2070
cmpl $-0x1, %eax
je 0x4db4
movl %eax, %r15d
testl %eax, %eax
je 0x4e17
leaq 0x7cb4(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %edx, %edx
testl %eax, %eax
cmovlel %edx, %eax
leaq 0x9da4(%rip), %r12      # 0xeb40
cmpq %rdx, %rax
je 0x4dcc
movq (%r12), %rcx
cmpq $0x0, (%rcx)
je 0x4ddf
incq %rdx
addq $0x8, %r12
jmp 0x4d9c
leaq 0x3d48(%rip), %rsi      # 0x8b03
xorl %edi, %edi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x25b4
leaq 0x3dec(%rip), %rsi      # 0x8bbf
pushq $0x2
popq %rdi
xorl %eax, %eax
callq 0x247c
jmp 0x4e01
leaq 0x3d98(%rip), %rsi      # 0x8b7e
pushq $0x3
popq %rdi
movl %r15d, %ecx
movq %r14, %r8
xorl %eax, %eax
callq 0x247c
movq (%r12), %rax
movq %r14, (%rax)
movl %r15d, 0x8(%rax)
movl %ebp, %edi
callq 0x2370
movl %ebx, %edi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x2370
leaq 0x3d21(%rip), %rsi      # 0x8b3f
pushq $0x3
popq %rdi
movl %ebp, %edx
movl %ebx, %ecx
xorl %eax, %eax
callq 0x247c
movl %ebp, %edi
movl %ebx, %esi
callq 0x5154
movl %eax, %edi
callq 0x2260
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findServerList(long)
static int findServerList(long code)
{
    int i;

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

    debug(LEVEL_2, "findServerList(): server not found (code = %ld)\n", code);
    return UNKNOWN_REPINFO_IND;
}

// Assembly:
pushq %rbx
movq %rdi, %rcx
leaq 0x7bf9(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
leaq 0xbc29(%rip), %rdx      # 0x10a80
cmpq %rbx, %rax
je 0x4e6e
movq (%rdx), %rsi
cmpq %rcx, 0x8(%rsi)
je 0x4e89
incq %rbx
addq $0x8, %rdx
jmp 0x4e57
leaq 0x3dbf(%rip), %rsi      # 0x8c34
pushq $0x2
popq %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x247c
movl $0xf423f, %ebx          # imm = 0xF423F
jmp 0x4e9c
leaq 0x3d6c(%rip), %rsi      # 0x8bfc
pushq $0x3
popq %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x247c
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: findViewerList(long)
static int findViewerList(long code)
{
    int i;

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

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

// Assembly:
pushq %rbx
movq %rdi, %rcx
leaq 0x7b95(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ebx, %ebx
testl %eax, %eax
cmovlel %ebx, %eax
leaq 0xdb05(%rip), %rdx      # 0x129c0
cmpq %rbx, %rax
je 0x4ed2
movq (%rdx), %rsi
cmpq %rcx, 0x8(%rsi)
je 0x4eed
incq %rbx
addq $0x8, %rdx
jmp 0x4ebb
leaq 0x3dc4(%rip), %rsi      # 0x8c9d
pushq $0x2
popq %rdi
movq %rcx, %rdx
xorl %eax, %eax
callq 0x247c
movl $0xf423f, %ebx          # imm = 0xF423F
jmp 0x4f00
leaq 0x3d71(%rip), %rsi      # 0x8c65
pushq $0x3
popq %rdi
movl %ebx, %edx
xorl %eax, %eax
callq 0x247c
movl %ebx, %eax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeViewerList(long)
static void removeViewerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (viewers[i] -> code == code) {
            debug(LEVEL_3, "removeViewerList(): Viewer removed from list: code = %ld, index = %d\n", code, i);
            viewers[i] -> code = 0;
            viewers[i] -> active = false;
            return;
        }
    }

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

// Assembly:
pushq %rbx
movq %rdi, %rdx
leaq 0x79a9(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
leaq 0xd919(%rip), %rbx      # 0x129c0
cmpq %rcx, %rax
je 0x50be
movq (%rbx), %rsi
cmpq %rdx, 0x8(%rsi)
je 0x50d0
incq %rcx
addq $0x8, %rbx
jmp 0x50a7
leaq 0x3cef(%rip), %rsi      # 0x8db4
pushq $0x2
popq %rdi
xorl %eax, %eax
popq %rbx
jmp 0x247c
leaq 0x3c97(%rip), %rsi      # 0x8d6e
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
movq (%rbx), %rax
andq $0x0, 0x8(%rax)
movb $0x0, 0x28(%rax)
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/repeater.cpp
// Function: removeServerList(long)
static void removeServerList(long code)
{
    int i;

    for (i = 0; i < maxSessions; i++) {
        if (servers[i] -> code == code) {
            debug(LEVEL_3, "removeServerList(): Server Removed from list: code = %ld, index = %d\n", code, i);
            servers[i] -> code = 0;
            servers[i] -> active = false;
            return;
        }
    }
    debug(LEVEL_2, "removeServerList(): Warning, server not found (code = %ld)\n", code);
}

// Assembly:
pushq %rbx
movq %rdi, %rdx
leaq 0x7946(%rip), %rax      # 0xca40
movl (%rax), %eax
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
leaq 0xb976(%rip), %rbx      # 0x10a80
cmpq %rcx, %rax
je 0x5121
movq (%rbx), %rsi
cmpq %rdx, 0x8(%rsi)
je 0x5133
incq %rcx
addq $0x8, %rbx
jmp 0x510a
leaq 0x3d0e(%rip), %rsi      # 0x8e36
pushq $0x2
popq %rdi
xorl %eax, %eax
popq %rbx
jmp 0x247c
leaq 0x3cb6(%rip), %rsi      # 0x8df0
pushq $0x3
popq %rdi
xorl %eax, %eax
callq 0x247c
movq (%rbx), %rax
andq $0x0, 0x8(%rax)
movb $0x0, 0x28(%rax)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/openbsd_stringfuncs.cpp
// Function: strlcat(char*, char const*, unsigned long)
size_t strlcat(char *dst, const char *src, size_t siz)
{
	char *d = dst;
	const char *s = src;
	size_t n = siz;
	size_t dlen;

	/* Find the end of dst and adjust bytes left but don't go past end */
	while (n-- != 0 && *d != '\0')
		d++;
	dlen = d - dst;
	n = siz - dlen;

	if (n == 0)
		return(dlen + strlen(s));
	while (*s != '\0') {
		if (n != 1) {
			*d++ = *s;
			n--;
		}
		s++;
	}
	*d = '\0';

	return(dlen + (s - src));	/* count does not include NUL */
}

// Assembly:
pushq %rbx
leaq (%rdi,%rdx), %rcx
movq %rdi, %rax
movq %rdx, %r8
subq $0x1, %r8
jb 0x54f6
cmpb $0x0, (%rax)
je 0x54f3
incq %rax
jmp 0x54e3
movq %rax, %rcx
movq %rcx, %rbx
subq %rdi, %rbx
subq %rbx, %rdx
je 0x552d
xorl %eax, %eax
pushq $0x1
popq %rdi
movb (%rsi,%rax), %r8b
testb %r8b, %r8b
je 0x5528
cmpq $0x1, %rdx
jne 0x551a
movq %rdi, %rdx
jmp 0x5523
movb %r8b, (%rcx)
incq %rcx
decq %rdx
incq %rax
jmp 0x5506
movb $0x0, (%rcx)
jmp 0x5535
movq %rsi, %rdi
callq 0x20d0
addq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/openbsd_stringfuncs.cpp
// Function: strlcpy(char*, char const*, unsigned long)
size_t strlcpy(char *dst, const char *src, size_t siz)
{
	char *d = dst;
	const char *s = src;
	size_t n = siz;

	/* Copy as many bytes as will fit */
	if (n != 0 && --n != 0) {
		do {
			if ((*d++ = *s++) == 0)
				break;
		} while (--n != 0);
	}

	/* Not enough room in dst, add NUL and traverse rest of src */
	if (n == 0) {
		if (siz != 0)
			*d = '\0';		/* NUL-terminate dst */
		while (*s++)
			;
	}

	return(s - src - 1);	/* count does not include NUL */
}

// Assembly:
movq %rsi, %rax
cmpq $0x2, %rdx
jae 0x5548
movq %rax, %rcx
jmp 0x5565
leaq -0x1(%rdx), %rsi
movq %rax, %rcx
movb (%rcx), %r8b
incq %rcx
movb %r8b, (%rdi)
testb %r8b, %r8b
je 0x557b
incq %rdi
decq %rsi
jne 0x554f
testq %rdx, %rdx
je 0x556d
movb $0x0, (%rdi)
leaq 0x1(%rcx), %rdx
cmpb $0x0, (%rcx)
movq %rdx, %rcx
jne 0x556d
jmp 0x557e
movq %rcx, %rdx
notq %rax
addq %rdx, %rax
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/qian-jiahong[P]uvncrep017-ws/iniparser.cpp
// Function: iniparser_getnsec
int iniparser_getnsec(dictionary * d)
{
    int i ;
    int nsec ;

    if (d==NULL) return -1 ;
    nsec=0 ;
    for (i=0 ; i<d->size ; i++) {
        if (d->key[i]==NULL)
            continue ;
        if (strchr(d->key[i], ':')==NULL) {
            nsec ++ ;
        }
    }
    return nsec ;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x55d2
movq %rdi, %rbx
movl 0x4(%rdi), %r15d
xorl %r12d, %r12d
testl %r15d, %r15d
cmovlel %r12d, %r15d
pushq $0x3a
popq %r14
xorl %ebp, %ebp
cmpq %r12, %r15
je 0x55d5
movq 0x10(%rbx), %rax
movq (%rax,%r12,8), %rdi
testq %rdi, %rdi
je 0x55cd
movl %r14d, %esi
callq 0x20b0
cmpq $0x1, %rax
adcl $0x0, %ebp
incq %r12
jmp 0x55ac
pushq $-0x1
popq %rbp
movl %ebp, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq