LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/search.cpp
// Function: Depth (anonymous namespace)::extension<((anonymous namespace)::NodeType)1>(Position const&, Move, bool, bool, bool*)
Depth extension(const Position& pos, Move m, bool captureOrPromotion,
                  bool moveIsCheck, bool* dangerous) {

    assert(m != MOVE_NONE);

    Depth result = DEPTH_ZERO;
    *dangerous = moveIsCheck;
    
    if (moveIsCheck && pos.see_sign(m) >= 0)
        result += CheckExtension[PvNode];

    if (pos.type_of_piece_on(move_from(m)) == PAWN)
    {
        Color c = pos.side_to_move();
        if (relative_rank(c, move_to(m)) == RANK_7)
        {
            result += PawnPushTo7thExtension[PvNode];
            *dangerous = true;
        }
        if (pos.pawn_is_passed(c, move_to(m)))
        {
            result += PassedPawnExtension[PvNode];
            *dangerous = true;
        }
    }

    if (   captureOrPromotion
        && pos.type_of_piece_on(move_to(m)) != PAWN
        && (  pos.non_pawn_material(WHITE) + pos.non_pawn_material(BLACK)
            - pos.midgame_value_of_piece_on(move_to(m)) == VALUE_ZERO)
        && !move_is_special(m))
    {
        result += PawnEndgameExtension[PvNode];
        *dangerous = true;
    }

    return Min(result, ONE_PLY);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %r8, %rbx
movl %edx, %r15d
movl %esi, %ebp
movq %rdi, %r14
movb %cl, (%r8)
xorl %edx, %edx
testl %ecx, %ecx
je 0x27023
movq %r14, %rdi
movl %ebp, %esi
callq 0x20bf8
xorl %edx, %edx
testl %eax, %eax
js 0x27023
movl 0x3954a1(%rip), %edx    # 0x3bc4c4
movl %ebp, %eax
shrl $0x4, %eax
andl $0xfc, %eax
movl (%r14,%rax), %eax
andl $0x7, %eax
cmpl $0x1, %eax
jne 0x27095
movl 0x1090(%r14), %eax
movl %ebp, %ecx
andl $0x3f, %ecx
movl %ecx, %esi
shrl $0x3, %esi
leal (,%rax,8), %edi
subl %eax, %edi
xorl %esi, %edi
cmpl $0x6, %edi
jne 0x27063
addl 0x395474(%rip), %edx    # 0x3bc4d4
movb $0x1, (%rbx)
movq %rax, %rsi
xorq $0x1, %rsi
movq 0x140(%r14,%rsi,8), %rsi
andq 0x108(%r14), %rsi
movl %ecx, %ecx
shlq $0x9, %rax
addq 0x15eba(%rip), %rax     # 0x3cf40
testq %rsi, (%rax,%rcx,8)
jne 0x27095
addl 0x39544a(%rip), %edx    # 0x3bc4dc
movb $0x1, (%rbx)
testb %r15b, %r15b
je 0x270d7
movl %ebp, %eax
andl $0x3f, %eax
movl (%r14,%rax,4), %eax
movl %eax, %ecx
andl $0x7, %ecx
cmpl $0x1, %ecx
je 0x270d7
testl $0xc000, %ebp           # imm = 0xC000
jne 0x270d7
movq 0x1938(%r14), %rcx
movl 0x2c(%rcx), %esi
addl 0x28(%rcx), %esi
leaq 0x395157(%rip), %rcx    # 0x3bc220
cmpl (%rcx,%rax,4), %esi
jne 0x270d7
addl 0x3953f8(%rip), %edx    # 0x3bc4cc
movb $0x1, (%rbx)
cmpl $0x2, %edx
movl $0x2, %eax
cmovll %edx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/search.cpp
// Function: (anonymous namespace)::update_history(Position const&, Move, Depth, Move*, int)
void update_history(const Position& pos, Move move, Depth depth,
                      Move movesSearched[], int moveCount) {
    Move m;
    Value bonus = Value(int(depth) * int(depth));

    H.update(pos.piece_on(move_from(move)), move_to(move), bonus);

    for (int i = 0; i < moveCount - 1; i++)
    {
        m = movesSearched[i];

        assert(m != move);

        H.update(pos.piece_on(move_from(m)), move_to(m), -bonus);
    }
  }

// Assembly:
imull %edx, %edx
movl %esi, %eax
shrl $0x4, %eax
andl $0xfc, %eax
movl (%rdi,%rax), %r9d
andl $0x3f, %esi
shlq $0x8, %r9
leaq 0x397a39(%rip), %rax    # 0x3bfa40
addq %rax, %r9
movl (%r9,%rsi,4), %r10d
addl %edx, %r10d
movl %r10d, %r11d
negl %r11d
cmovsl %r10d, %r11d
cmpl $0x7cf, %r11d           # imm = 0x7CF
ja 0x2802b
leaq (%r9,%rsi,4), %rsi
movl %r10d, (%rsi)
cmpl $0x2, %r8d
jl 0x28080
pushq %rbx
decl %r8d
xorl %esi, %esi
movl (%rcx,%rsi,4), %r9d
movl %r9d, %r10d
shrl $0x4, %r10d
andl $0xfc, %r10d
movl (%rdi,%r10), %r10d
andl $0x3f, %r9d
shlq $0x8, %r10
addq %rax, %r10
movl (%r10,%r9,4), %r11d
subl %edx, %r11d
movl %r11d, %ebx
negl %ebx
cmovsl %r11d, %ebx
cmpl $0x7cf, %ebx            # imm = 0x7CF
ja 0x28077
leaq (%r10,%r9,4), %r9
movl %r11d, (%r9)
incq %rsi
cmpq %rsi, %r8
jne 0x28037
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/search.cpp
// Function: (anonymous namespace)::connected_moves(Position const&, Move, Move)
bool connected_moves(const Position& pos, Move m1, Move m2) {

    Square f1, t1, f2, t2;
    Piece p;

    assert(m1 && move_is_ok(m1));
    assert(m2 && move_is_ok(m2));

    // Case 1: The moving piece is the same in both moves
    f2 = move_from(m2);
    t1 = move_to(m1);
    if (f2 == t1)
        return true;

    // Case 2: The destination square for m2 was vacated by m1
    t2 = move_to(m2);
    f1 = move_from(m1);
    if (t2 == f1)
        return true;

    // Case 3: Moving through the vacated square
    if (   piece_is_slider(pos.piece_on(f2))
        && bit_is_set(squares_between(f2, t2), f1))
      return true;

    // Case 4: The destination square for m2 is defended by the moving piece in m1
    p = pos.piece_on(t1);
    if (bit_is_set(pos.attacks_from(p, t1), t2))
        return true;

    // Case 5: Discovered check, checking piece is the piece moved in m1
    if (    piece_is_slider(p)
        &&  bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), f2)
        && !bit_is_set(squares_between(t1, pos.king_square(pos.side_to_move())), t2))
    {
        // discovered_check_candidates() works also if the Position's side to
        // move is the opposite of the checking piece.
        Color them = opposite_color(pos.side_to_move());
        Bitboard dcCandidates = pos.discovered_check_candidates(them);

        if (bit_is_set(dcCandidates, f2))
            return true;
    }
    return false;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %eax
movl %edx, %ecx
shrl $0x6, %ecx
andl $0x3f, %ecx
movl %esi, %edx
andl $0x3f, %edx
movb $0x1, %bl
cmpl %edx, %ecx
je 0x28ca2
andl $0x3f, %eax
shrl $0x6, %esi
andl $0x3f, %esi
cmpl %esi, %eax
je 0x28ca2
movq %rdi, %r14
movl %ecx, %r12d
movl (%rdi,%r12,4), %ecx
leaq 0xa91d(%rip), %rdi      # 0x33520
movl %eax, %ebp
cmpb $0x1, (%rcx,%rdi)
jne 0x28c2b
movl %r12d, %eax
shll $0x9, %eax
addq 0x14390(%rip), %rax     # 0x3cfa8
movl %esi, %ecx
leaq 0xf057f(%rip), %rsi     # 0x1191a0
movq (%rsi,%rcx,8), %rcx
testq %rcx, (%rax,%rbp,8)
jne 0x28ca2
movl %edx, %r13d
movl (%r14,%r13,4), %r15d
movq %r14, %rdi
movl %r15d, %esi
callq 0x1e4b4
leaq 0xf055c(%rip), %rdx     # 0x1191a0
movq (%rdx,%rbp,8), %rcx
testq %rax, %rcx
jne 0x28ca2
leaq 0xa8cc(%rip), %rax      # 0x33520
cmpb $0x1, (%r15,%rax)
jne 0x28ca0
movl 0x1090(%r14), %esi
movq %rsi, %rax
shlq $0x9, %rax
movslq 0x310(%r14,%rax), %rax
shll $0x9, %r13d
addq 0x1432c(%rip), %r13     # 0x3cfa8
movq (%r13,%rax,8), %rax
testq %rcx, %rax
jne 0x28ca0
andq (%rdx,%r12,8), %rax
je 0x28ca0
xorl $0x1, %esi
movq %r14, %rdi
movq %rdx, %r14
callq 0x1cc5c
testq %rax, (%r14,%r12,8)
jne 0x28ca2
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/simple_search.cpp
// Function: test_search(Position&, int, int, int)
int test_search(Position &pos, int alpha, int beta, int depth) {
	
	if(depth == 0) return test_eval(pos);
	bool bSearchPv = true;
	int score;
	
	MoveStack mlist[MAX_MOVES];
	StateInfo st;
	Move m;

	// Generate all legal moves
	MoveStack* last = generate<MV_LEGAL>(pos, mlist);
	
	if (mlist == last) {
		return -100000;
	}
	
	for (MoveStack* cur = mlist; cur != last; cur++) {
		m = cur->move;
		pos.do_move(m, st);
		if (bSearchPv) {
			score = -test_search(pos, -beta, -alpha, depth - 1);
		} else {
			score = -test_search(pos, -alpha-1, -alpha, depth - 1);
			if (score > alpha) // in fail-soft ... && score < beta ) is common
				score = -test_search(pos, -beta, -alpha, depth - 1); // re-search
		}
		pos.undo_move(m);
		if(score >= beta)
			return beta;   // fail-hard beta-cutoff
		if(score > alpha) {
			alpha = score; // alpha acts like max in MiniMax
		}
		bSearchPv = false;
	}
	
	
	
	return alpha; // fail-hard
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x8c8, %rsp            # imm = 0x8C8
movl %edx, 0xc(%rsp)
movq %rdi, %r15
movl %ecx, 0x10(%rsp)
testl %ecx, %ecx
je 0x290f4
movl %esi, %r13d
leaq 0xc0(%rsp), %r12
movq %r15, %rdi
movq %r12, %rsi
callq 0x1a5c0
movq %rax, 0x18(%rsp)
cmpq %rax, %r12
je 0x2910d
decl 0x10(%rsp)
movl 0xc(%rsp), %eax
negl %eax
movl %eax, 0x14(%rsp)
movb $0x1, %r14b
movl (%r12), %ebp
movq %r15, %rdi
movl %ebp, %esi
leaq 0x20(%rsp), %rdx
callq 0x1f3d6
movl %r13d, %ebx
negl %ebx
testb $0x1, %r14b
jne 0x290b4
movl %r13d, %esi
notl %esi
movq %r15, %rdi
movl %ebx, %edx
movl 0x10(%rsp), %ecx
callq 0x2901f
movl %eax, %r14d
negl %r14d
cmpl %r14d, %r13d
jge 0x290cc
movq %r15, %rdi
movl 0x14(%rsp), %esi
movl %ebx, %edx
movl 0x10(%rsp), %ecx
callq 0x2901f
movl %eax, %r14d
negl %r14d
movq %r15, %rdi
movl %ebp, %esi
callq 0x2051a
cmpl 0xc(%rsp), %r14d
jge 0x29115
cmpl %r13d, %r14d
cmovgl %r14d, %r13d
addq $0x8, %r12
xorl %r14d, %r14d
cmpq 0x18(%rsp), %r12
jne 0x29078
jmp 0x2911a
movq %r15, %rdi
addq $0x8c8, %rsp            # imm = 0x8C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2912f
movl $0xfffe7960, %r13d      # imm = 0xFFFE7960
jmp 0x2911a
movl 0xc(%rsp), %r13d
movl %r13d, %eax
addq $0x8c8, %rsp            # imm = 0x8C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/thread.cpp
// Function: ThreadsManager::read_uci_options()
void ThreadsManager::read_uci_options() {
  maxThreadsPerSplitPoint = Options["Maximum Number of Threads per Split Point"].value<int>();
  minimumSplitDepth       = Options["Minimum Split Depth"].value<int>() * ONE_PLY;
  useSleepingThreads      = Options["Use Sleeping Threads"].value<bool>();
  activeThreads           = Options["Threads"].value<int>();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0xa2d0(%rip), %rsi      # 0x33532
leaq 0xa2f2(%rip), %rdx      # 0x3355b
leaq 0x8(%rsp), %rdi
callq 0xad16
leaq 0x3a4dfe(%rip), %rdi    # 0x3ce078
leaq 0x8(%rsp), %rsi
callq 0x15a9c
movq 0x20(%rax), %rdi
callq 0x5660
movl %eax, 0x2c(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x292a7
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5400
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0xa2a6(%rip), %rsi      # 0x3355c
leaq 0xa2b2(%rip), %rdx      # 0x3356f
callq 0xad16
leaq 0x3a4daf(%rip), %rdi    # 0x3ce078
leaq 0x8(%rsp), %rsi
callq 0x15a9c
movq 0x20(%rax), %rdi
callq 0x5660
addl %eax, %eax
movl %eax, 0x28(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x292f8
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5400
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0xa269(%rip), %rsi      # 0x33570
leaq 0xa276(%rip), %rdx      # 0x33584
callq 0xad16
leaq 0x3a4d5e(%rip), %rdi    # 0x3ce078
leaq 0x8(%rsp), %rsi
callq 0x15a9c
addq $0x20, %rax
leaq 0x8ee8(%rip), %rsi      # 0x32217
movq %rax, %rdi
callq 0x5120
testl %eax, %eax
sete 0x30(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x29354
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5400
leaq 0x8(%rsp), %rdi
movq %r14, (%rdi)
leaq 0xa21a(%rip), %rsi      # 0x3357d
leaq 0xa21a(%rip), %rdx      # 0x33584
callq 0xad16
leaq 0x3a4d02(%rip), %rdi    # 0x3ce078
leaq 0x8(%rsp), %rsi
callq 0x15a9c
movq 0x20(%rax), %rdi
callq 0x5660
movl %eax, 0x34(%rbx)
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x293a3
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5400
addq $0x28, %rsp
popq %rbx
popq %r14
retq
jmp 0x293b7
jmp 0x293d3
jmp 0x293b7
jmp 0x293d3
jmp 0x293b7
jmp 0x293d3
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r14, %rdi
je 0x293d6
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x5400
jmp 0x293d6
movq %rax, %rbx
movq %rbx, %rdi
callq 0x5790
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/thread.cpp
// Function: ThreadsManager::init()
void ThreadsManager::init() {

  int threadID[MAX_THREADS];

  // This flag is needed to properly end the threads when program exits
  allThreadsShouldExit = false;

  // Threads will sent to sleep as soon as created, only main thread is kept alive
  activeThreads = 1;
  threads[0].state = Thread::SEARCHING;

  // Allocate pawn and material hash tables for main thread
  init_hash_tables();

  lock_init(&mpLock);

  // Initialize thread and split point locks
  for (int i = 0; i < MAX_THREADS; i++)
  {
      lock_init(&threads[i].sleepLock);
      cond_init(&threads[i].sleepCond);

      for (int j = 0; j < MAX_ACTIVE_SPLIT_POINTS; j++)
          lock_init(&(threads[i].splitPoints[j].lock));
  }

  // Create and startup all the threads but the main that is already running
  for (int i = 1; i < MAX_THREADS; i++)
  {
      threads[i].state = Thread::INITIALIZING;
      threadID[i] = i;

#if defined(_MSC_VER)
      bool ok = (CreateThread(NULL, 0, start_routine, (LPVOID)&threadID[i], 0, NULL) != NULL);
#else
      pthread_t pthreadID;
      bool ok = (pthread_create(&pthreadID, NULL, start_routine, (void*)&threadID[i]) == 0);
      pthread_detach(pthreadID);
#endif
      if (!ok)
      {
          std::cout << "Failed to create thread number " << i << std::endl;
          ::exit(EXIT_FAILURE);
      }

      // Wait until the thread has finished launching and is gone to sleep
      while (threads[i].state == Thread::INITIALIZING) {}
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rdi, %rbx
movb $0x0, 0x38(%rdi)
movl $0x1, %eax
movl %eax, 0x34(%rdi)
leaq 0x40(%rdi), %r12
movl %eax, 0xc8(%rdi)
callq 0x29514
xorl %r14d, %r14d
movq %rbx, %rdi
xorl %esi, %esi
callq 0x5600
imulq $0x560, %r14, %r15      # imm = 0x560
leaq (%r12,%r15), %rdi
addq $0x30, %rdi
xorl %esi, %esi
callq 0x5600
leaq (%r12,%r15), %rdi
addq $0x58, %rdi
xorl %esi, %esi
callq 0x54d0
movl $0x118, %r15d           # imm = 0x118
leaq (%rbx,%r15), %rdi
xorl %esi, %esi
callq 0x5600
addq $0x98, %r15
cmpq $0x5d8, %r15            # imm = 0x5D8
jne 0x29445
incq %r14
addq $0x560, %rbx            # imm = 0x560
cmpq $0x20, %r14
jne 0x2941a
movl $0x1, %ebx
leaq -0x2c8(%rip), %r14      # 0x291b4
leaq 0x8(%rsp), %r15
imulq $0x560, %rbx, %r13      # imm = 0x560
movl $0x0, 0x88(%r12,%r13)
leaq (%rsp,%rbx,4), %rcx
addq $0x10, %rcx
movl %ebx, (%rcx)
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rdx
callq 0x57d0
movl %eax, %ebp
movq 0x8(%rsp), %rdi
callq 0x52b0
testl %ebp, %ebp
jne 0x294e5
leaq (%r12,%r13), %rax
addq $0x88, %rax
cmpl $0x0, (%rax)
je 0x294c5
incq %rbx
cmpq $0x20, %rbx
jne 0x29481
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x13ab4(%rip), %rdi     # 0x3cfa0
leaq 0xa092(%rip), %rsi      # 0x33585
callq 0x53d0
movq %rax, %rdi
movl %ebx, %esi
callq 0x5760
movq %rax, %rdi
callq 0x51c0
movl $0x1, %edi
callq 0x54e0
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/thread.cpp
// Function: ThreadsManager::exit()
void ThreadsManager::exit() {

  // Force the woken up threads to exit idle_loop() and hence terminate
  allThreadsShouldExit = true;

  for (int i = 0; i < MAX_THREADS; i++)
  {
      // Wake up all the threads and waits for termination
      if (i != 0)
      {
          threads[i].wake_up();
          while (threads[i].state != Thread::TERMINATED) {}
      }

      // Now we can safely destroy the locks and wait conditions
      lock_destroy(&threads[i].sleepLock);
      cond_destroy(&threads[i].sleepCond);

      for (int j = 0; j < MAX_ACTIVE_SPLIT_POINTS; j++)
          lock_destroy(&(threads[i].splitPoints[j].lock));
  }

  lock_destroy(&mpLock);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movb $0x1, 0x38(%rdi)
leaq 0x40(%rdi), %r15
movq %rdi, (%rsp)
leaq 0x118(%rdi), %r12
xorl %r13d, %r13d
testq %r13, %r13
je 0x295c1
imulq $0x560, %r13, %rbx      # imm = 0x560
leaq (%r15,%rbx), %rbp
leaq (%r15,%rbx), %r14
addq $0x30, %r14
movq %r14, %rdi
callq 0x55f0
leaq (%r15,%rbx), %rdi
addq $0x58, %rdi
callq 0x5030
movq %r14, %rdi
callq 0x52e0
movl 0x88(%rbp), %eax
cmpl $0x5, %eax
jne 0x295b6
imulq $0x560, %r13, %rbx      # imm = 0x560
leaq (%r15,%rbx), %rdi
addq $0x30, %rdi
callq 0x5490
leaq (%r15,%rbx), %rdi
addq $0x58, %rdi
callq 0x5830
xorl %r14d, %r14d
leaq (%r12,%r14), %rdi
callq 0x5490
addq $0x98, %r14
cmpq $0x4c0, %r14            # imm = 0x4C0
jne 0x295e5
incq %r13
addq $0x560, %r12            # imm = 0x560
cmpq $0x20, %r13
jne 0x29581
movq (%rsp), %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5490
nop
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/thread.cpp
// Function: ThreadsManager::available_slave_exists(int) const
bool ThreadsManager::available_slave_exists(int master) const {

  assert(master >= 0 && master < activeThreads);

  for (int i = 0; i < activeThreads; i++)
      if (i != master && threads[i].is_available_to(master))
          return true;

  return false;
}

// Assembly:
movslq 0x34(%rdi), %rcx
testq %rcx, %rcx
jle 0x2969d
movslq %esi, %rdx
movl %edx, %esi
negq %rsi
addq $0xc8, %rdi
movq %rcx, %r8
negq %r8
movb $0x1, %al
movl $0x1, %r9d
leaq (%rsi,%r9), %r10
cmpq $0x1, %r10
je 0x2967e
movl (%rdi), %r10d
cmpl $0x2, %r10d
jne 0x2967e
movslq 0x10(%rdi), %r10
testq %r10, %r10
je 0x2969f
imulq $0x98, %r10, %r10
addq %rdx, %r10
cmpb $0x0, -0xb(%rdi,%r10)
jne 0x2969f
cmpq %rcx, %r9
setb %al
addq $0x560, %rdi            # imm = 0x560
leaq (%r8,%r9), %r10
incq %r10
incq %r9
cmpq $0x1, %r10
jne 0x29650
jmp 0x2969f
xorl %eax, %eax
andb $0x1, %al
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/tt.cpp
// Function: TranspositionTable::set_size(unsigned long)
void TranspositionTable::set_size(size_t mbSize) {

  size_t newSize = 1024;

  // Transposition table consists of clusters and each cluster consists
  // of ClusterSize number of TTEntries. Each non-empty entry contains
  // information of exactly one position and newSize is the number of
  // clusters we are going to allocate.
  while (2ULL * newSize * sizeof(TTCluster) <= (mbSize << 20))
      newSize *= 2;

  if (newSize == size)
      return;

  generation = 0;
  size = newSize;
  delete [] entries;
  entries = new (std::nothrow) TTCluster[size];
  if (!entries)
  {
      std::cerr << "Failed to allocate " << mbSize
                << " MB for transposition table." << std::endl;
      exit(EXIT_FAILURE);
  }
  clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rax
shlq $0x14, %rax
movl $0x400, %ecx            # imm = 0x400
movq %rcx, %r15
movq %rcx, %rdx
shlq $0x7, %rdx
addq %rcx, %rcx
cmpq %rax, %rdx
jbe 0x2a145
cmpq (%r14), %r15
jne 0x2a162
popq %rbx
popq %r14
popq %r15
retq
movb $0x0, 0x10(%r14)
movq %r15, (%r14)
movq 0x8(%r14), %rdi
testq %rdi, %rdi
je 0x2a17b
callq 0x5520
movq (%r14), %r15
movq %r15, %rax
shrq $0x3a, %rax
shlq $0x6, %r15
xorl %edi, %edi
negq %rax
sbbq %rdi, %rdi
orq %r15, %rdi
movq 0x12d90(%rip), %rsi     # 0x3cf28
callq 0x5700
movq %rax, 0x8(%r14)
testq %rax, %rax
je 0x2a1bd
movb $0x0, 0x10(%r14)
movq %rax, %rdi
xorl %esi, %esi
movq %r15, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x5210
movq 0x12e2c(%rip), %rdi     # 0x3cff0
leaq 0x845a(%rip), %rsi      # 0x32625
callq 0x53d0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x50f0
leaq 0x9c5e(%rip), %rsi      # 0x33e40
movq %rax, %rdi
callq 0x53d0
movq %rax, %rdi
callq 0x51c0
movl $0x1, %edi
callq 0x54e0
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/tt.cpp
// Function: TranspositionTable::store(unsigned long, Value, ValueType, Depth, Move, Value, Value)
void TranspositionTable::store(const Key posKey, Value v, ValueType t, Depth d, Move m, Value statV, Value kingD) {

  int c1, c2, c3;
  TTEntry *tte, *replace;
  uint32_t posKey32 = posKey >> 32; // Use the high 32 bits as key inside the cluster

  tte = replace = first_entry(posKey);

  for (int i = 0; i < ClusterSize; i++, tte++)
  {
      if (!tte->key() || tte->key() == posKey32) // Empty or overwrite old
      {
          // Preserve any existing ttMove
          if (m == MOVE_NONE)
              m = tte->move();

          tte->save(posKey32, v, t, d, m, generation, statV, kingD);
          return;
      }

      // Implement replace strategy
      c1 = (replace->generation() == generation ?  2 : 0);
      c2 = (tte->generation() == generation || tte->type() == VALUE_TYPE_EXACT ? -2 : 0);
      c3 = (tte->depth() < replace->depth() ?  1 : 0);

      if (c1 + c2 + c3 > 0)
          replace = tte;
  }
  replace->save(posKey32, v, t, d, m, generation, statV, kingD);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movl 0x40(%rsp), %eax
movl 0x38(%rsp), %r10d
movl (%rdi), %ebx
decl %ebx
andl %esi, %ebx
shlq $0x6, %rbx
addq 0x8(%rdi), %rbx
shrq $0x20, %rsi
movb 0x10(%rdi), %r11b
xorl %r14d, %r14d
movq %rbx, %rdi
movl (%rbx,%r14), %ebp
testl %ebp, %ebp
je 0x2a2a8
cmpl %esi, %ebp
je 0x2a2a8
xorl %ebp, %ebp
cmpb %r11b, 0x7(%rdi)
sete %r12b
movl $0xfffffffe, %r15d      # imm = 0xFFFFFFFE
cmpb %r11b, 0x7(%rbx,%r14)
je 0x2a279
xorl %r15d, %r15d
cmpb $0x3, 0x6(%rbx,%r14)
setne %r15b
leal -0x2(,%r15,2), %r15d
movb %r12b, %bpl
addl %ebp, %ebp
movzwl 0xa(%rbx,%r14), %r12d
xorl %r13d, %r13d
cmpw 0xa(%rdi), %r12w
setl %r13b
addl %r15d, %ebp
orl %r13d, %ebp
jle 0x2a29c
leaq (%rbx,%r14), %rdi
addq $0x10, %r14
cmpl $0x40, %r14d
jne 0x2a241
jmp 0x2a2b7
leaq (%rbx,%r14), %rdi
testl %r9d, %r9d
jne 0x2a2b7
movzwl 0x4(%rbx,%r14), %r9d
movl %esi, (%rdi)
movw %r9w, 0x4(%rdi)
movb %cl, 0x6(%rdi)
movb %r11b, 0x7(%rdi)
movw %dx, 0x8(%rdi)
movw %r8w, 0xa(%rdi)
movw %r10w, 0xc(%rdi)
movw %ax, 0xe(%rdi)
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/./rkiss.h
// Function: VarTuning::rand_double()
uint64_t rand64() {

    const uint64_t
      e = s.a - rotate(s.b,  7);
    s.a = s.b ^ rotate(s.c, 13);
    s.b = s.c + rotate(s.d, 37);
    s.c = s.d + e;
    return s.d = e + s.a;
  }

// Assembly:
movq 0x29cd0(%rdi), %rax
movq 0x29cd8(%rdi), %rcx
movq %rcx, %rdx
rolq $0xd, %rdx
xorq %rax, %rdx
rolq $0x7, %rax
movq 0x29cc8(%rdi), %rsi
subq %rax, %rsi
movq %rdx, 0x29cc8(%rdi)
movq 0x29ce0(%rdi), %rax
movq %rax, %r8
rolq $0x25, %r8
addq %rcx, %r8
movq %r8, 0x29cd0(%rdi)
addq %rsi, %rax
movq %rax, 0x29cd8(%rdi)
addq %rsi, %rdx
movq %rdx, 0x29ce0(%rdi)
andl $0xffffff, %edx         # imm = 0xFFFFFF
cvtsi2sd %edx, %xmm0
mulsd 0x9a85(%rip), %xmm0     # 0x33e60
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/tuning.cpp
// Function: VarTuning::rand_unit_vector(double*, int)
void VarTuning::rand_unit_vector(tune_t* vector, int size) {
	
	double norm;
	int64_t s = 0;
	int64_t ran;
	
	for (int k = 0; k < size; ++k) {
		ran = rkiss.rand<unsigned>() % 16777216;
		ran *= (rkiss.rand<unsigned>() % 2 ? 1 : -1);
		vector[k] = tune_t(ran);
		s += (ran * ran);
	}
	
	norm = sqrt(s);

	for (int k = 0; k < size; ++k) {
		vector[k] /= norm;
		cout << vector[k] << endl;
	}
}

// Assembly:
testl %edx, %edx
jle 0x2a524
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq 0x29cc8(%rdi), %r9
movq 0x29cd0(%rdi), %r8
movq 0x29cd8(%rdi), %r10
movq 0x29ce0(%rdi), %rax
movl %edx, %r12d
xorl %esi, %esi
xorl %ecx, %ecx
movq %r10, %r11
rolq $0xd, %r11
xorq %r8, %r11
rolq $0x7, %r8
subq %r8, %r9
movq %rax, %r14
rolq $0x25, %r14
addq %r10, %r14
addq %r9, %rax
movq %r9, %r8
addq %r11, %r8
movl %r8d, %r15d
andl $0xffffff, %r15d        # imm = 0xFFFFFF
movq %rax, %r9
rolq $0xd, %r9
xorq %r14, %r9
rolq $0x7, %r14
subq %r14, %r11
leaq (%r11,%r8), %r10
rolq $0x25, %r8
addq %rax, %r8
movq %r11, %rax
addq %r9, %rax
movq %r15, %r11
negq %r11
testb $0x1, %al
cmovneq %r15, %r11
xorps %xmm0, %xmm0
cvtsi2sd %r11d, %xmm0
movsd %xmm0, (%rbx,%rsi,8)
imulq %r11, %r11
addq %r11, %rcx
incq %rsi
cmpq %rsi, %r12
jne 0x2a417
movq %r9, 0x29cc8(%rdi)
movq %r8, 0x29cd0(%rdi)
movq %r10, 0x29cd8(%rdi)
movq %rax, 0x29ce0(%rdi)
testl %edx, %edx
jle 0x2a517
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
sqrtsd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
xorl %r13d, %r13d
movq 0x12ad5(%rip), %r14     # 0x3cfa0
movsd (%rbx,%r13,8), %xmm0
divsd 0x8(%rsp), %xmm0
movsd %xmm0, (%rbx,%r13,8)
movq %r14, %rdi
callq 0x56b0
movq %rax, %r15
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r15, %rdi
movl $0xa, %esi
callq 0x53c0
movsbl %al, %esi
movq %r15, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x5270
incq %r13
cmpq %r13, %r12
jne 0x2a4cb
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/tuning.cpp
// Function: VarTuning::prepare_deltas()
void VarTuning::prepare_deltas() {
	double norm;
	int64_t s = 0;
	int64_t ran;
	
	for (int k = 0; k < size; ++k) {
		ran = rkiss.rand<unsigned>() % 16777216;
		ran *= (rkiss.rand<unsigned>() % 2 ? 1 : -1);
		var[k].delta = tune_t(ran);
		s += (ran * ran);
	}
	
	norm = sqrt(s);
	
	// normalize
	for (int k = 0; k < size; ++k) {
		var[k].delta *= (var[k].startvalue * var[k].deltaAxisFactor / norm);
	}
}

// Assembly:
movslq 0x29cc0(%rdi), %rcx
testq %rcx, %rcx
jle 0x2a872
pushq %r15
pushq %r14
pushq %rbx
movq 0x29cc8(%rdi), %r10
movq 0x29cd0(%rdi), %r9
movq 0x29cd8(%rdi), %r11
movq 0x29ce0(%rdi), %rdx
imulq $0x6b0, %rcx, %rax      # imm = 0x6B0
xorl %r8d, %r8d
xorl %esi, %esi
movq %r11, %rbx
rolq $0xd, %rbx
xorq %r9, %rbx
rolq $0x7, %r9
subq %r9, %r10
movq %rdx, %r14
rolq $0x25, %r14
addq %r11, %r14
addq %r10, %rdx
movq %r10, %r9
addq %rbx, %r9
movl %r9d, %r15d
andl $0xffffff, %r15d        # imm = 0xFFFFFF
movq %rdx, %r10
rolq $0xd, %r10
xorq %r14, %r10
rolq $0x7, %r14
subq %r14, %rbx
leaq (%rbx,%r9), %r11
rolq $0x25, %r9
addq %rdx, %r9
movq %rbx, %rdx
addq %r10, %rdx
movq %r15, %rbx
negq %rbx
testb $0x1, %dl
cmovneq %r15, %rbx
xorps %xmm0, %xmm0
cvtsi2sd %ebx, %xmm0
movsd %xmm0, 0x18(%rdi,%r8)
imulq %rbx, %rbx
addq %rbx, %rsi
addq $0x6b0, %r8             # imm = 0x6B0
cmpq %r8, %rax
jne 0x2a799
movq %r10, 0x29cc8(%rdi)
movq %r9, 0x29cd0(%rdi)
movq %r11, 0x29cd8(%rdi)
movq %rdx, 0x29ce0(%rdi)
testl %ecx, %ecx
popq %rbx
popq %r14
popq %r15
jle 0x2a872
xorps %xmm0, %xmm0
cvtsi2sd %rsi, %xmm0
sqrtsd %xmm0, %xmm0
xorl %ecx, %ecx
movsd 0x10(%rdi,%rcx), %xmm1
mulsd 0x28(%rdi,%rcx), %xmm1
divsd %xmm0, %xmm1
mulsd 0x18(%rdi,%rcx), %xmm1
movsd %xmm1, 0x18(%rdi,%rcx)
addq $0x6b0, %rcx            # imm = 0x6B0
cmpq %rcx, %rax
jne 0x2a84a
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/uci.cpp
// Function: (anonymous namespace)::perft(Position&, std::__cxx11::basic_istringstream<char, std::char_traits<char>, std::allocator<char>>&)
void perft(Position& pos, UCIParser& up) {

    int depth, time;
    int64_t n;

    if (!(up >> depth))
        return;

    time = get_system_time();

    n = perft(pos, depth * ONE_PLY);

    time = get_system_time() - time;

    std::cout << "\nNodes " << n
              << "\nTime (ms) " << time
              << "\nNodes/second " << int(n / (time / 1000.0)) << std::endl;
  }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xc(%rsp), %rsi
callq 0x5220
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x2babd
callq 0x173f0
movq %rax, %r15
movl 0xc(%rsp), %esi
addl %esi, %esi
leaq 0x3a0d29(%rip), %rdi    # 0x3cc728
callq 0x21dda
movq %rax, %rbx
callq 0x173f0
movq %rax, %r14
subl %r15d, %r14d
movq 0x11587(%rip), %r15     # 0x3cfa0
leaq 0x8592(%rip), %rsi      # 0x33fb2
movl $0x7, %edx
movq %r15, %rdi
callq 0x5460
movq %r15, %rdi
movq %rbx, %rsi
callq 0x5390
movq %rax, %r15
leaq 0x8578(%rip), %rsi      # 0x33fba
movl $0xb, %edx
movq %rax, %rdi
callq 0x5460
movq %r15, %rdi
movl %r14d, %esi
callq 0x5760
movq %rax, %r15
leaq 0x8562(%rip), %rsi      # 0x33fc6
movl $0xe, %edx
movq %rax, %rdi
callq 0x5460
cvtsi2sd %rbx, %xmm0
cvtsi2sd %r14d, %xmm1
divsd 0x8415(%rip), %xmm1     # 0x33e98
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
movq %r15, %rdi
callq 0x5760
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x53c0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5050
movq %rax, %rdi
callq 0x5270
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/ucioption.cpp
// Function: CaseInsensitiveLess::operator()(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&) const
bool CaseInsensitiveLess::operator() (const string& s1, const string& s2) const {

  int c1, c2;
  size_t i = 0;

  while (i < s1.size() && i < s2.size())
  {
      c1 = tolower(s1[i]);
      c2 = tolower(s2[i++]);

      if (c1 != c2)
          return c1 < c2;
  }
  return s1.size() < s2.size();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq (%rsi), %r15
movq 0x8(%rsi), %rax
movq (%rdx), %r13
movq 0x8(%rdx), %r12
cmpq %r12, %rax
movq %r12, %rbp
movq %rax, (%rsp)
cmovbq %rax, %rbp
xorl %r14d, %r14d
cmpq %r14, %rbp
je 0x2bb86
movsbl (%r15,%r14), %edi
callq 0x55d0
movl %eax, %ebx
movsbl (%r13,%r14), %edi
incq %r14
callq 0x55d0
cmpl %eax, %ebx
je 0x2bb5e
setl %al
jmp 0x2bb8d
cmpq %r12, (%rsp)
setb %al
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/ATOMIC-LICHESS[P]ATOMKRAFT/ucioption.cpp
// Function: OptionsMap::print_all[abi:cxx11]() const
string OptionsMap::print_all() const {

  std::stringstream s;

  for (size_t i = 0; i <= size(); i++)
      for (OptionsMap::const_iterator it = begin(); it != end(); ++it)
          if (it->second.idx == i)
          {
              const UCIOption& o = it->second;
              s << "\noption name " << it->first << " type " << o.type;

              if (o.type != "button")
                  s << " default " << o.defaultValue;

              if (o.type == "spin")
                  s << " min " << o.minValue << " max " << o.maxValue;

              break;
          }
  return s.str();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movq %rsi, %r14
movq %rdi, 0x8(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x5290
leaq 0x8(%r14), %rbp
leaq 0x20(%rsp), %r15
xorl %ebx, %ebx
movq 0x18(%r14), %r12
cmpq %rbp, %r12
je 0x2dc30
cmpq %rbx, 0xa8(%r12)
je 0x2db3c
movq %r12, %rdi
callq 0x5470
movq %rax, %r12
cmpq %rbp, %rax
jne 0x2db1d
jmp 0x2dc30
movl $0xd, %edx
movq %r15, %rdi
leaq 0x64a5(%rip), %rsi      # 0x33ff0
callq 0x5460
movq 0x20(%r12), %rsi
movq 0x28(%r12), %rdx
movq %r15, %rdi
callq 0x5460
movq %rax, %r13
movl $0x6, %edx
movq %rax, %rdi
leaq 0x648a(%rip), %rsi      # 0x33ffe
callq 0x5460
movq 0x80(%r12), %rsi
movq 0x88(%r12), %rdx
movq %r13, %rdi
callq 0x5460
leaq 0x80(%r12), %r13
movq %r13, %rdi
leaq 0x6446(%rip), %rsi      # 0x33fe9
callq 0x5120
testl %eax, %eax
je 0x2dbd2
movl $0x9, %edx
movq %r15, %rdi
leaq 0x644a(%rip), %rsi      # 0x34005
callq 0x5460
movq 0x40(%r12), %rsi
movq 0x48(%r12), %rdx
movq %r15, %rdi
callq 0x5460
movq %r13, %rdi
leaq 0x6433(%rip), %rsi      # 0x3400f
callq 0x5120
testl %eax, %eax
jne 0x2dc30
movl $0x5, %edx
movq %r15, %rdi
leaq 0x6420(%rip), %rsi      # 0x34014
callq 0x5460
movl 0xa0(%r12), %esi
movq %r15, %rdi
callq 0x5760
movq %rax, %r13
movl $0x5, %edx
movq %rax, %rdi
leaq 0x63ff(%rip), %rsi      # 0x3401a
callq 0x5460
movl 0xa4(%r12), %esi
movq %r13, %rdi
callq 0x5760
incq %rbx
cmpq 0x28(%r14), %rbx
jbe 0x2db10
leaq 0x28(%rsp), %rsi
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0x5690
movq 0xf2e2(%rip), %rsi      # 0x3cf38
leaq 0x10(%rsp), %rdi
callq 0x52c0
leaq 0x90(%rsp), %rdi
callq 0x5140
movq %rbx, %rax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2dc84
movq %rax, %rbx
movq 0xf2aa(%rip), %rsi      # 0x3cf38
leaq 0x10(%rsp), %rdi
callq 0x52c0
leaq 0x90(%rsp), %rdi
callq 0x5140
movq %rbx, %rdi
callq 0x5790
nop
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunParseAtrAddress(char*, unsigned int, StunAtrAddress4&)
static bool 
stunParseAtrAddress( char* body, unsigned int hdrLen,  StunAtrAddress4& result )
{
   if ( hdrLen != 8 )
   {
      clog << "hdrLen wrong for Address" <<endl;
      return false;
   }
   result.pad = *body++;
   result.family = *body++;
   if (result.family == IPv4Family)
   {
      UInt16 nport;
      memcpy(&nport, body, 2); body+=2;
      result.ipv4.port = ntohs(nport);
		
      UInt32 naddr;
      memcpy(&naddr, body, 4); body+=4;
      result.ipv4.addr = ntohl(naddr);
      return true;
   }
   else if (result.family == IPv6Family)
   {
      clog << "ipv6 not supported" << endl;
   }
   else
   {
      clog << "bad address family: " << result.family << endl;
   }
	
   return false;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
cmpl $0x8, %esi
jne 0x3d20
movq %rdx, %rbx
movb (%rdi), %al
movb %al, (%rdx)
movzbl 0x1(%rdi), %eax
movb %al, 0x1(%rdx)
cmpl $0x2, %eax
je 0x3d35
cmpl $0x1, %eax
jne 0x3d81
movzwl 0x2(%rdi), %eax
rolw $0x8, %ax
movw %ax, 0x4(%rbx)
movl 0x4(%rdi), %eax
bswapl %eax
movl %eax, 0x8(%rbx)
movb $0x1, %al
jmp 0x3d79
movq 0x9291(%rip), %rbx      # 0xcfb8
leaq 0x6482(%rip), %rsi      # 0xa1b0
movl $0x18, %edx
jmp 0x3d48
movq 0x927c(%rip), %rbx      # 0xcfb8
leaq 0x6486(%rip), %rsi      # 0xa1c9
movl $0x12, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x9230(%rip), %r14      # 0xcfb8
leaq 0x644d(%rip), %rsi      # 0xa1dc
movl $0x14, %edx
movq %r14, %rdi
callq 0x21f0
movb 0x1(%rbx), %al
leaq 0x7(%rsp), %rsi
movb %al, (%rsi)
movl $0x1, %edx
movq %r14, %rdi
callq 0x21f0
movq %rax, %rbx
movq (%rax), %rax
jmp 0x3d53
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: operator<<(std::ostream&, StunAddress4 const&)
ostream& 
operator<<( ostream& strm, const StunAddress4& addr)
{
   UInt32 ip = addr.addr;
   strm << ((int)(ip>>24)&0xFF) << ".";
   strm << ((int)(ip>>16)&0xFF) << ".";
   strm << ((int)(ip>> 8)&0xFF) << ".";
   strm << ((int)(ip>> 0)&0xFF) ;
	
   strm << ":" << addr.port;
	
   return strm;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %r14
movq %rdi, %rbx
movl 0x4(%rsi), %ebp
movl %ebp, %esi
shrl $0x18, %esi
callq 0x2290
leaq 0x5ea4(%rip), %r15      # 0x9c81
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21f0
movl %ebp, %esi
shrl $0x10, %esi
movl $0xff, %r12d
andl %r12d, %esi
movq %rbx, %rdi
callq 0x2290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21f0
movl %ebp, %esi
shrl $0x8, %esi
andl %r12d, %esi
movq %rbx, %rdi
callq 0x2290
movl $0x1, %edx
movq %rax, %rdi
movq %r15, %rsi
callq 0x21f0
andl %r12d, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x2290
leaq 0x5e4c(%rip), %rsi      # 0x9c93
movl $0x1, %edx
movq %rbx, %rdi
callq 0x21f0
movzwl (%r14), %esi
movq %rbx, %rdi
callq 0x2130
movq %rbx, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunParseAtrString(char*, unsigned int, StunAtrString&)
static bool 
stunParseAtrString( char* body, unsigned int hdrLen,  StunAtrString& result )
{
   if ( hdrLen >= STUN_MAX_STRING )
   {
      clog << "String is too large" << endl;
      return false;
   }
   else
   {
      if (hdrLen % 4 != 0)
      {
         clog << "Bad length string " << hdrLen << endl;
         return false;
      }
		
      result.sizeValue = hdrLen;
      memcpy(&result.value, body, hdrLen);
      result.value[hdrLen] = 0;
      return true;
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebx
cmpl $0x100, %esi            # imm = 0x100
jb 0x3e9a
movq 0x9137(%rip), %rbx      # 0xcfb8
leaq 0x63a4(%rip), %rsi      # 0xa22c
movl $0x13, %edx
movq %rbx, %rdi
callq 0x21f0
movq (%rbx), %rax
jmp 0x3eca
testb $0x3, %bl
je 0x3ef8
movq 0x9112(%rip), %r14      # 0xcfb8
leaq 0x6393(%rip), %rsi      # 0xa240
movl $0x12, %edx
movq %r14, %rdi
callq 0x21f0
movl %ebx, %esi
movq %r14, %rdi
callq 0x2130
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x21b0
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2140
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rdx, %r14
movq %rdi, %rsi
movw %bx, 0x100(%rdx)
movl %ebx, %ebx
movq %rdx, %rdi
movq %rbx, %rdx
callq 0x2170
movb $0x0, (%r14,%rbx)
movb $0x1, %al
jmp 0x3ef0
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: encodeAtrString(char*, unsigned short, StunAtrString const&)
static char* 
encodeAtrString(char* ptr, UInt16 type, const StunAtrString& atr)
{
   assert(atr.sizeValue % 4 == 0);
	
   ptr = encode16(ptr, type);
   ptr = encode16(ptr, atr.sizeValue);
   ptr = encode(ptr, atr.value, atr.sizeValue);
   return ptr;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testb $0x3, 0x100(%rdx)
jne 0x4b09
movq %rdi, %rbx
rolw $0x8, %si
movw %si, (%rdi)
movzwl 0x100(%rdx), %eax
rolw $0x8, %ax
movw %ax, 0x2(%rdi)
addq $0x4, %rdi
movzwl 0x100(%rdx), %r14d
movq %rdx, %rsi
movq %r14, %rdx
callq 0x2170
leaq (%rbx,%r14), %rax
addq $0x4, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x577d(%rip), %rdi      # 0xa28d
leaq 0x4c36(%rip), %rsi      # 0x974d
leaq 0x5786(%rip), %rcx      # 0xa2a4
movl $0x20b, %edx            # imm = 0x20B
callq 0x2120
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunCreatePassword(StunAtrString const&, StunAtrString*)
void
stunCreatePassword(const StunAtrString& username, StunAtrString* password)
{
   char hmac[20];
   char key[] = "Fluffy";
   //char buffer[STUN_MAX_STRING];
   computeHmac(hmac, username.value, strlen(username.value), key, strlen(key));
   toHex(hmac, 20, password->value);
   password->sizeValue = 40;
   password->value[40]=0;
	
   //clog << "password=" << password->value << endl;
}

// Assembly:
xorl %eax, %eax
leaq 0x561f(%rip), %rcx      # 0xa370
leaq 0x5638(%rip), %rdx      # 0xa390
movzbl (%rax,%rcx), %edi
movl %edi, %r8d
shrl $0x4, %r8d
andl $0xf, %edi
movb (%r8,%rdx), %r8b
movb %r8b, (%rsi,%rax,2)
movb (%rdi,%rdx), %dil
movb %dil, 0x1(%rsi,%rax,2)
incq %rax
cmpl $0x14, %eax
jne 0x4d58
xorl %ecx, %ecx
movb %cl, (%rsi,%rax,2)
movw $0x28, 0x100(%rsi)
movb %cl, 0x28(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: operator<<(std::ostream&, UInt128 const&)
ostream& operator<< ( ostream& strm, const UInt128& r )
{
   strm << int(r.octet[0]);
   for ( int i=1; i<16; i++ )
   {
      strm << ':' << int(r.octet[i]);
   }
    
   return strm;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movzbl (%rsi), %esi
callq 0x2290
movl $0x1, %r12d
leaq 0x7(%rsp), %r15
movb $0x3a, 0x7(%rsp)
movl $0x1, %edx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21f0
movzbl (%r14,%r12), %esi
movq %rax, %rdi
callq 0x2290
incq %r12
cmpq $0x10, %r12
jne 0x4db2
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunParseServerName(char*, StunAddress4&)
bool
stunParseServerName( char* name, StunAddress4& addr)
{
   assert(name);
	
   // TODO - put in DNS SRV stuff.
	
   bool ret = stunParseHostName( name, addr.addr, addr.port, 3478); 
   if ( ret != true ) 
   {
       addr.port=0xFFFF;
   }	
   return ret;
}

// Assembly:
pushq %rbx
testq %rdi, %rdi
je 0x4f3d
movq %rsi, %rbx
addq $0x4, %rsi
movq %rbx, %rdx
movl $0xd96, %ecx            # imm = 0xD96
callq 0x4dec
testb %al, %al
jne 0x4f3b
movw $0xffff, (%rbx)         # imm = 0xFFFF
popq %rbx
retq
leaq 0x4679(%rip), %rdi      # 0x95bd
leaq 0x4802(%rip), %rsi      # 0x974d
leaq 0x4ac7(%rip), %rcx      # 0x9a19
movl $0x3c5, %edx            # imm = 0x3C5
callq 0x2120
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunStopServer(StunServerInfo&)
void
stunStopServer(StunServerInfo& info)
{
   if (info.myFd > 0) closesocket(info.myFd);
   if (info.altPortFd > 0) closesocket(info.altPortFd);
   if (info.altIpFd > 0) closesocket(info.altIpFd);
   if (info.altIpPortFd > 0) closesocket(info.altIpPortFd);
   
   if (info.relay)
   {
      for (int i=0; i<MAX_MEDIA_RELAYS; ++i)
      {
         StunMediaRelay* relay = &info.relays[i];
         if (relay->fd)
         {
            closesocket(relay->fd);
            relay->fd = 0;
         }
      }
   }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x10(%rdi), %edi
testl %edi, %edi
jle 0x5c06
callq 0x22b0
movl 0x14(%rbx), %edi
testl %edi, %edi
jle 0x5c12
callq 0x22b0
movl 0x18(%rbx), %edi
testl %edi, %edi
jle 0x5c1e
callq 0x22b0
movl 0x1c(%rbx), %edi
testl %edi, %edi
jle 0x5c2a
callq 0x22b0
cmpb $0x1, 0x20(%rbx)
jne 0x5c58
movl $0x2c, %r14d
movl (%rbx,%r14), %edi
testl %edi, %edi
je 0x5c4b
callq 0x22b0
movl $0x0, (%rbx,%r14)
addq $0x18, %r14
cmpq $0x2f0c, %r14           # imm = 0x2F0C
jne 0x5c36
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunFindLocalInterfaces(unsigned int*, int)
int 
stunFindLocalInterfaces(UInt32* addresses,int maxRet)
{
#if defined(WIN32) || defined(__sparc__)
   return 0;
#else
   struct ifconf ifc;
	
   int s = socket( AF_INET, SOCK_DGRAM, 0 );
   int len = 100 * sizeof(struct ifreq);
	
   char buf[ len ];
	
   ifc.ifc_len = len;
   ifc.ifc_buf = buf;
	
   int e = ioctl(s,SIOCGIFCONF,&ifc);
   char *ptr = buf;
   int tl = ifc.ifc_len;
   int count=0;
	
   while ( (tl > 0) && ( count < maxRet) )
   {
      struct ifreq* ifr = (struct ifreq *)ptr;
		
      int si = sizeof(ifr->ifr_name) + sizeof(struct sockaddr);
      tl -= si;
      ptr += si;
      //char* name = ifr->ifr_ifrn.ifrn_name;
      //cerr << "name = " << name << endl;
		
      struct ifreq ifr2;
      ifr2 = *ifr;
		
      e = ioctl(s,SIOCGIFADDR,&ifr2);
      if ( e == -1 )
      {
         break;
      }
		
      //cerr << "ioctl addr e = " << e << endl;
		
      struct sockaddr a = ifr2.ifr_addr;
      struct sockaddr_in* addr = (struct sockaddr_in*) &a;
		
      UInt32 ai = ntohl( addr->sin_addr.s_addr );
      if (int((ai>>24)&0xFF) != 127)
      {
         addresses[count++] = ai;
      }
		
#if 0
      cerr << "Detected interface "
           << int((ai>>24)&0xFF) << "." 
           << int((ai>>16)&0xFF) << "." 
           << int((ai>> 8)&0xFF) << "." 
           << int((ai    )&0xFF) << endl;
#endif
   }
	
   closesocket(s);
	
   return count;
#endif
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xff8, %rsp            # imm = 0xFF8
movl %esi, %ebp
movq %rdi, 0x8(%rsp)
xorl %ebx, %ebx
movl $0x2, %edi
movl $0x2, %esi
xorl %edx, %edx
callq 0x2090
movl %eax, %r14d
movq %rsp, (%rsp)
leaq 0x40(%rsp), %r12
movl $0xfa0, (%r12)          # imm = 0xFA0
leaq 0x50(%rsp), %r13
movq %r13, 0x8(%r12)
movl $0x8912, %esi           # imm = 0x8912
movl %eax, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2220
movl (%r12), %r15d
testl %r15d, %r15d
setle %al
testl %ebp, %ebp
setle %cl
orb %al, %cl
jne 0x66be
leaq 0x10(%rsp), %r12
xorl %ebx, %ebx
movq 0x20(%r13), %rax
movq %rax, 0x30(%rsp)
movups (%r13), %xmm0
movups 0x10(%r13), %xmm1
movaps %xmm1, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movl $0x8915, %esi           # imm = 0x8915
movl %r14d, %edi
movq %r12, %rdx
xorl %eax, %eax
callq 0x2220
cmpl $-0x1, %eax
je 0x66be
movl 0x24(%rsp), %eax
bswapl %eax
movl %eax, %ecx
andl $0xff000000, %ecx       # imm = 0xFF000000
cmpl $0x7f000000, %ecx       # imm = 0x7F000000
je 0x66ac
movslq %ebx, %rcx
incl %ebx
movq 0x8(%rsp), %rdx
movl %eax, (%rdx,%rcx,4)
cmpl $0x21, %r15d
jb 0x66be
addq $0x20, %r13
addl $-0x20, %r15d
cmpl %ebp, %ebx
jl 0x6655
movl %r14d, %edi
callq 0x22b0
movq (%rsp), %rsp
movl %ebx, %eax
addq $0xff8, %rsp            # imm = 0xFF8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunBuildReqSimple(StunMessage*, StunAtrString const&, bool, bool, unsigned int)
void
stunBuildReqSimple( StunMessage* msg,
                    const StunAtrString& username,
                    bool changePort, bool changeIp, unsigned int id )
{
   assert( msg );
   memset( msg , 0 , sizeof(*msg) );
	
   msg->msgHdr.msgType = BindRequestMsg;
	
   for ( int i=0; i<16; i=i+4 )
   {
      assert(i+3<16);
      int r = stunRand();
      msg->msgHdr.id.octet[i+0]= r>>0;
      msg->msgHdr.id.octet[i+1]= r>>8;
      msg->msgHdr.id.octet[i+2]= r>>16;
      msg->msgHdr.id.octet[i+3]= r>>24;
   }
	
   if ( id != 0 )
   {
      msg->msgHdr.id.octet[0] = id; 
   }
	
   msg->hasChangeRequest = true;
   msg->changeRequest.value =(changeIp?ChangeIpFlag:0) | 
      (changePort?ChangePortFlag:0);
	
   if ( username.sizeValue > 0 )
   {
      msg->hasUsername = true;
      msg->username = username;
   }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x678c
movl %r8d, %r12d
movl %ecx, %r15d
movl %edx, %ebp
movq %rsi, %rbx
movq %rdi, %r14
movl $0x4c8, %edx            # imm = 0x4C8
xorl %esi, %esi
callq 0x2110
movw $0x1, (%r14)
movq $-0x4, %r13
callq 0x4b28
movl %eax, 0x8(%r14,%r13)
addq $0x4, %r13
cmpq $0xc, %r13
jb 0x6719
testl %r12d, %r12d
je 0x6736
movb %r12b, 0x4(%r14)
movb $0x1, 0x34(%r14)
movzbl %r15b, %eax
movzbl %bpl, %ecx
addl %ecx, %ecx
leal (%rcx,%rax,4), %eax
movl %eax, 0x38(%r14)
cmpw $0x0, 0x100(%rbx)
je 0x677d
movb $0x1, 0x5c(%r14)
addq $0x5e, %r14
movl $0x102, %edx            # imm = 0x102
movq %r14, %rdi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x3751(%rip), %rdi      # 0x9ee4
leaq 0x2fb3(%rip), %rsi      # 0x974d
leaq 0x3747(%rip), %rcx      # 0x9ee8
movl $0x6a4, %edx            # imm = 0x6A4
callq 0x2120
// File: /workspace/github_cpp_makefile_star2_O3/Distrotech[P]stund/stun.cxx
// Function: stunGetUserNameAndPassword(StunAddress4 const&, StunAtrString*, StunAtrString*)
void 
stunGetUserNameAndPassword(  const StunAddress4& dest, 
                             StunAtrString* username,
                             StunAtrString* password)
{ 
   // !cj! This is totally bogus - need to make TLS connection to dest and get a
   // username and password to use 
   stunCreateUserName(dest, username);
   stunCreatePassword(*username, password);
}

// Assembly:
pushq %rbx
movq %rdx, %rbx
callq 0x4b91
xorl %eax, %eax
leaq 0x3bb3(%rip), %rcx      # 0xa370
leaq 0x3bcc(%rip), %rdx      # 0xa390
movzbl (%rax,%rcx), %esi
movl %esi, %edi
shrl $0x4, %edi
andl $0xf, %esi
movb (%rdi,%rdx), %dil
movb %dil, (%rbx,%rax,2)
movb (%rsi,%rdx), %sil
movb %sil, 0x1(%rbx,%rax,2)
incq %rax
cmpl $0x14, %eax
jne 0x67c4
xorl %ecx, %ecx
movb %cl, (%rbx,%rax,2)
movw $0x28, 0x100(%rbx)
movb %cl, 0x28(%rbx)
popq %rbx
retq