// File: /workspace/github_cpp_makefile_star2_O2/flastest[P]HeterogeneousParallelDijkstra/dijkstra_cond_var.cc
// Function: relax_vertex(unsigned long, unsigned long, float, std::priority_queue<std::pair<unsigned long, float>, std::vector<std::pair<unsigned long, float>, std::allocator<std::pair<unsigned long, float>>>, Offer_Comparator>&, std::map<unsigned long, std::shared_ptr<std::mutex>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<std::mutex>>>>, std::map<unsigned long, float, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, float>>>&, std::map<unsigned long, std::shared_ptr<std::mutex>, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, std::shared_ptr<std::mutex>>>>&, std::map<unsigned long, unsigned long, std::less<unsigned long>, std::allocator<std::pair<unsigned long const, unsigned long>>>&, int)
void relax_vertex(vertex_descriptor neighbor, 
			vertex_descriptor origin,
		   float vd,
		   offer_pqueue_t& offer_pq, 
		   mutex_map_t distance_mutexes,
		   distance_map_t& distances,
		   mutex_map_t& predecessor_mutexes,
		   predecessor_map_t& predecessors,
		   int thread_id )
{
	std::lock_guard<std::mutex> guard(*distance_mutexes[neighbor]);
	if (vd < distances[neighbor]) 
	{

		{
			//condition variable now gets to release a thread!
			
			
			//if (DEBUG_THREAD) print_thread_debug(thread_id, "ADDING AN OFFER TO " + std::to_string(neighbor) + "!!! distnace is " + std::to_string(vd) , debug_file_stream);
			std::scoped_lock<std::mutex> guard2(pq_mutex);
			offer_pq.push(offer_t(neighbor,vd));
			
			//if (DEBUG_THREAD) print_thread_debug(thread_id, "updating "+ std::to_string(neighbor) +"'s predecessor", debug_file_stream);
			std::scoped_lock<std::mutex> guard(*predecessor_mutexes[neighbor]);
			//now update this node's predecessor 
			predecessors[neighbor] = origin;
			//if(DEBUG_THREAD) print_thread_debug(thread_id, "now done relaxing!", debug_file_stream);
			cond_var_offer_pq.notify_all();
		}
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r9, %r15
movq %r8, %r13
movq %rdx, %r12
movss %xmm0, 0xc(%rsp)
movq %rsi, %r14
leaq 0x10(%rsp), %rbp
movq %rdi, (%rbp)
movq %rcx, %rdi
movq %rbp, %rsi
callq 0xbcea
movq (%rax), %rbx
movq %rbx, %rdi
callq 0xc1ea
movq %r13, %rdi
movq %rbp, %rsi
callq 0xbd3a
movss (%rax), %xmm0
ucomiss 0xc(%rsp), %xmm0
jbe 0xb5c7
leaq 0xbd68(%rip), %rdi      # 0x172c0
callq 0xc1ea
movq 0x10(%rsp), %rax
leaq 0x18(%rsp), %rsi
movq %rax, (%rsi)
movss 0xc(%rsp), %xmm0
movss %xmm0, 0x8(%rsi)
movq %r12, %rdi
callq 0xbd8a
leaq 0x10(%rsp), %rsi
movq %r15, %rdi
callq 0xbcea
movq (%rax), %r15
movq %r15, %rdi
callq 0xc1ea
movq 0x60(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xbda0
movq %r14, (%rax)
leaq 0xbd8a(%rip), %rdi      # 0x17338
callq 0x4430
movq %r15, %rdi
callq 0x4210
leaq 0xbcfe(%rip), %rdi      # 0x172c0
callq 0x4210
movq %rbx, %rdi
callq 0x4210
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
movq %r15, %rdi
callq 0x4210
jmp 0xb5f2
jmp 0xb5ef
jmp 0xb600
movq %rax, %r14
leaq 0xbcc7(%rip), %rdi      # 0x172c0
callq 0x4210
jmp 0xb603
movq %rax, %r14
movq %rbx, %rdi
callq 0x4210
movq %r14, %rdi
callq 0x4470