// File: /workspace/github_cpp_makefile_star2_O2/monikakushwaha28[P]Fiduccia_Matthesys-using-c-/Fiduccia_Mattheyses_v1.0.cpp
// Function: re_cal_DS()
void re_cal_DS()
{
	//erasing entire net card map
	net_card.erase(net_card.begin(), net_card.end());

	l = 0;
	cell = 0;
	count1 = 0;
	countn1 = 0;

	//reverting back the changes
	for (l = max_gain_pos; l < fixed_cell_list.size(); l++)
	{
		cell = fixed_cell_list[l];
		node_map[cell][1] = -1 * (node_map[cell][1]);
	}

	//unfix all fix nodes
	for (nodeiter r = node_map.begin(); r != node_map.end(); r++)
	{
		node_map[r->first][2] = 0;
	}

	//re building net card
	for (netnodeiter t = net_node_map.begin(); t != net_node_map.end(); t++)
	{
		count1 = 0;
		countn1 = 0;
		newnetname = t->first;
		for (int y = 0; y < t->second.size(); y++)
		{
			if (node_map[net_node_map[newnetname][y]][1] == 1)
			{
				count1 = count1 + 1;
			}
			if (node_map[net_node_map[newnetname][y]][1] == -1)
			{
				countn1 = countn1 + 1;
			}
		}
		net_card[newnetname].push_back(count1);
		net_card[newnetname].push_back(countn1);
	}

	//re building gain bucket
	for (int i = 0; i < free_nodes.size(); i++)
	{
		int current_node = free_nodes.at(i);
		gain = 0;
		for (int var = 0; var < node_net_map[current_node].size(); var++)
		{
			current_net = node_net_map[current_node].at(var);
			net_count1 = net_card[current_net].at(0);
			net_countn1 = net_card[current_net].at(1);
			current_wgt = node_map[current_node].at(0);
			current_part = node_map[current_node].at(1);
			if (current_part == 1)
			{
				if (net_count1 == 1)
				{
					gain = gain + 1;
				}
				else if (net_countn1 == 0)
				{
					gain = gain - 1;
				}
			}
			else
			{
				if (net_count1 == 0)
				{
					gain = gain - 1;
				}
				else if (net_countn1 == 1)
				{
					gain = gain + 1;
				}
			}
		}
		gain_bucket[gain].push_back(current_node);
		node_map[current_node][3] = gain;
	}

	//reinitializing fix bucket
	fixed_cell_list.clear();

	//Realizing the FM Algorithm
	//Variables
	gain_cell = 0;
	wp1 = wp1_mincut;
	wpn1 = wpn1_mincut;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq 0x835d(%rip), %rsi      # 0xac80
leaq 0x833e(%rip), %rdi      # 0xac68
leaq 0x833f(%rip), %rdx      # 0xac70
callq 0x5586
andl $0x0, 0x81af(%rip)      # 0xaaec
andl $0x0, 0x819c(%rip)      # 0xaae0
andl $0x0, 0x8199(%rip)      # 0xaae4
movl 0x821b(%rip), %eax      # 0xab6c
leaq 0x8194(%rip), %rbx      # 0xaaec
leaq 0x8249(%rip), %r14      # 0xaba8
movl %eax, 0x8183(%rip)      # 0xaae8
cltq
movq 0x834a(%rip), %rdx      # 0xacb8
movq 0x833b(%rip), %rcx      # 0xacb0
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x29bb
movl (%rcx,%rax,4), %eax
movl %eax, 0x8162(%rip)      # 0xaaec
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4fa0
movq (%rax), %rax
xorl %r15d, %r15d
subl 0x4(%rax), %r15d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x4fa0
movq (%rax), %rax
movl %r15d, 0x4(%rax)
movl 0x8131(%rip), %eax      # 0xaae8
incl %eax
jmp 0x295f
movq 0x81fe(%rip), %r14      # 0xabc0
leaq 0x81e7(%rip), %r15      # 0xabb0
leaq 0x81d8(%rip), %rbx      # 0xaba8
cmpq %r15, %r14
je 0x29f5
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x4fa0
movq (%rax), %rax
andl $0x0, 0x8(%rax)
movq %r14, %rdi
callq 0x2150
movq %rax, %r14
jmp 0x29d0
movq 0x8224(%rip), %r14      # 0xac20
leaq 0x80ad(%rip), %rbx      # 0xaab0
leaq 0x819e(%rip), %r12      # 0xaba8
leaq 0x81ff(%rip), %rax      # 0xac10
cmpq %rax, %r14
je 0x2af7
andl $0x0, 0x80bf(%rip)      # 0xaae0
andl $0x0, 0x80bc(%rip)      # 0xaae4
leaq 0x20(%r14), %rsi
movq %rbx, %rdi
callq 0x2100
xorl %r13d, %r13d
xorl %r15d, %r15d
movq 0x48(%r14), %rax
subq 0x40(%r14), %rax
sarq $0x2, %rax
cmpq %r15, %rax
jbe 0x2aac
leaq 0x81b6(%rip), %rdi      # 0xac08
movq %rbx, %rsi
callq 0x4ff2
movq (%rax), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x4fa0
movq (%rax), %rax
cmpl $0x1, 0x4(%rax)
jne 0x2a77
incl 0x8069(%rip)            # 0xaae0
leaq 0x818a(%rip), %rdi      # 0xac08
movq %rbx, %rsi
callq 0x4ff2
movq (%rax), %rsi
addq %r13, %rsi
movq %r12, %rdi
callq 0x4fa0
movq (%rax), %rax
cmpl $-0x1, 0x4(%rax)
jne 0x2aa3
incl 0x8041(%rip)            # 0xaae4
incq %r15
addq $0x4, %r13
jmp 0x2a3a
leaq 0x81b5(%rip), %r15      # 0xac68
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4ff2
movq %rax, %rdi
leaq 0x8018(%rip), %rsi      # 0xaae0
callq 0x505c
movq %r15, %rdi
movq %rbx, %rsi
callq 0x4ff2
movq %rax, %rdi
leaq 0x8002(%rip), %rsi      # 0xaae4
callq 0x505c
movq %r14, %rdi
callq 0x2150
movq %rax, %r14
jmp 0x2a0a
xorl %esi, %esi
leaq -0x2c(%rbp), %r12
leaq 0x7f6c(%rip), %r13      # 0xaa70
leaq 0x809d(%rip), %r14      # 0xaba8
movq 0x818e(%rip), %rax      # 0xaca0
subq 0x817f(%rip), %rax      # 0xac98
sarq $0x2, %rax
cmpq %rsi, %rax
jbe 0x2c8e
leaq 0x816b(%rip), %rdi      # 0xac98
movq %rsi, -0x38(%rbp)
callq 0x5082
movl (%rax), %eax
movl %eax, -0x2c(%rbp)
andl $0x0, 0x7fda(%rip)      # 0xab1c
xorl %r15d, %r15d
leaq 0x808c(%rip), %rdi      # 0xabd8
movq %rdi, %rbx
movq %r12, %rsi
callq 0x50a4
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x5, %rcx
cmpq %r15, %rcx
jbe 0x2c4b
movq %rbx, %rdi
movq %r12, %rsi
callq 0x50a4
movq %rax, %rdi
movq %r15, %rsi
callq 0x50f6
movq %r13, %rdi
movq %rax, %rsi
callq 0x2100
leaq 0x80d5(%rip), %rbx      # 0xac68
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4ff2
movq %rax, %rdi
xorl %esi, %esi
callq 0x5082
movl (%rax), %eax
movl %eax, 0x7f64(%rip)      # 0xab14
movq %rbx, %rdi
movq %r13, %rsi
callq 0x4ff2
movq %rax, %rdi
pushq $0x1
popq %rbx
movq %rbx, %rsi
callq 0x5082
movl (%rax), %eax
movl %eax, 0x7f47(%rip)      # 0xab18
movq %r14, %rdi
movq %r12, %rsi
callq 0x4fa0
movq %rax, %rdi
xorl %esi, %esi
callq 0x5082
movl (%rax), %eax
movl %eax, 0x7f1e(%rip)      # 0xab0c
movq %r14, %rdi
movq %r12, %rsi
callq 0x4fa0
movq %rax, %rdi
movq %rbx, %rsi
callq 0x5082
movl (%rax), %eax
movl %eax, 0x7f04(%rip)      # 0xab10
movl 0x7f02(%rip), %ecx      # 0xab14
cmpl $0x1, %eax
jne 0x2c2a
pushq $0x1
popq %rax
cmpl $0x1, %ecx
je 0x2c3d
cmpl $0x0, 0x7ef2(%rip)      # 0xab18
pushq $-0x1
jmp 0x2c3a
pushq $-0x1
popq %rax
testl %ecx, %ecx
je 0x2c3d
cmpl $0x1, 0x7ee0(%rip)      # 0xab18
pushq $0x1
popq %rax
jne 0x2c43
addl %eax, 0x7ed9(%rip)      # 0xab1c
incq %r15
jmp 0x2b45
leaq 0x7fe6(%rip), %rdi      # 0xac38
leaq 0x7ec3(%rip), %rsi      # 0xab1c
callq 0x4fa0
movq %rax, %rdi
movq %r12, %rsi
callq 0x505c
movl 0x7eac(%rip), %r15d     # 0xab1c
movq %r14, %rdi
movq %r12, %rsi
callq 0x4fa0
movq (%rax), %rax
movl %r15d, 0xc(%rax)
movq -0x38(%rbp), %rsi
incq %rsi
jmp 0x2b0b
movq 0x801b(%rip), %rax      # 0xacb0
cmpq %rax, 0x801c(%rip)      # 0xacb8
je 0x2ca5
movq %rax, 0x8013(%rip)      # 0xacb8
andl $0x0, 0x7e98(%rip)      # 0xab44
movss 0x7e4c(%rip), %xmm0     # 0xab00
movss %xmm0, 0x7e3c(%rip)     # 0xaaf8
movss 0x7e40(%rip), %xmm0     # 0xab04
movss %xmm0, 0x7e30(%rip)     # 0xaafc
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq