// File: /workspace/github_cpp_makefile_star2_O1/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 0x92d9(%rip), %rsi      # 0xbca8
leaq 0x92ba(%rip), %rdi      # 0xbc90
leaq 0x92bb(%rip), %rdx      # 0xbc98
callq 0x6528
xorl %eax, %eax
movl %eax, 0x912a(%rip)      # 0xbb14
movl %eax, 0x9118(%rip)      # 0xbb08
movl %eax, 0x9116(%rip)      # 0xbb0c
movslq 0x9197(%rip), %rax      # 0xbb94
movl %eax, 0x910d(%rip)      # 0xbb10
movq 0x92d6(%rip), %rdx      # 0xbce0
movq 0x92c7(%rip), %rcx      # 0xbcd8
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
jbe 0x2a85
leaq 0x90f0(%rip), %rbx      # 0xbb14
leaq 0x91a5(%rip), %r14      # 0xbbd0
movl (%rcx,%rax,4), %eax
movl %eax, 0x90e0(%rip)      # 0xbb14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5f42
movq (%rax), %rax
xorl %r15d, %r15d
subl 0x4(%rax), %r15d
movq %r14, %rdi
movq %rbx, %rsi
callq 0x5f42
movq (%rax), %rax
movl %r15d, 0x4(%rax)
movslq 0x90ae(%rip), %rax      # 0xbb10
incq %rax
movl %eax, 0x90a5(%rip)      # 0xbb10
movq 0x926e(%rip), %rdx      # 0xbce0
movq 0x925f(%rip), %rcx      # 0xbcd8
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq %rax, %rdx
ja 0x2a2b
movq 0x915c(%rip), %rbx      # 0xbbe8
leaq 0x9145(%rip), %r15      # 0xbbd8
cmpq %r15, %rbx
je 0x2ac5
leaq 0x9131(%rip), %r14      # 0xbbd0
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x5f42
movq (%rax), %rax
movl $0x0, 0x8(%rax)
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
cmpq %r15, %rax
jne 0x2a9f
movq 0x917c(%rip), %rbx      # 0xbc48
leaq 0x9165(%rip), %rax      # 0xbc38
cmpq %rax, %rbx
je 0x2c12
leaq 0x8ff5(%rip), %r14      # 0xbad8
leaq 0x90e6(%rip), %r13      # 0xbbd0
xorl %eax, %eax
movl %eax, 0x9016(%rip)      # 0xbb08
movl %eax, 0x9014(%rip)      # 0xbb0c
leaq 0x20(%rbx), %rsi
movq %r14, %rdi
callq 0x2100
movq 0x48(%rbx), %rax
cmpq 0x40(%rbx), %rax
je 0x2b84
xorl %r15d, %r15d
xorl %r12d, %r12d
leaq 0x9115(%rip), %rdi      # 0xbc30
movq %r14, %rsi
callq 0x5faa
movq (%rax), %rsi
addq %r15, %rsi
movq %r13, %rdi
callq 0x5f42
movq (%rax), %rax
cmpl $0x1, 0x4(%rax)
jne 0x2b40
incl 0x8fc8(%rip)            # 0xbb08
leaq 0x90e9(%rip), %rdi      # 0xbc30
movq %r14, %rsi
callq 0x5faa
movq (%rax), %rsi
addq %r15, %rsi
movq %r13, %rdi
callq 0x5f42
movq (%rax), %rax
cmpl $-0x1, 0x4(%rax)
jne 0x2b6c
incl 0x8fa0(%rip)            # 0xbb0c
movq 0x48(%rbx), %rax
subq 0x40(%rbx), %rax
incq %r12
sarq $0x2, %rax
addq $0x4, %r15
cmpq %r12, %rax
ja 0x2b14
leaq 0x9105(%rip), %r15      # 0xbc90
movq %r15, %rdi
movq %r14, %rsi
callq 0x5faa
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x2bb2
movl 0x8f62(%rip), %ecx      # 0xbb08
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x2bc1
movq %rax, %rdi
leaq 0x8f4c(%rip), %rdx      # 0xbb08
callq 0x6bbc
movq %r15, %rdi
movq %r14, %rsi
callq 0x5faa
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x2be8
movl 0x8f30(%rip), %ecx      # 0xbb0c
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x2bf7
movq %rax, %rdi
leaq 0x8f1a(%rip), %rdx      # 0xbb0c
callq 0x6bbc
movq %rbx, %rdi
callq 0x2160
movq %rax, %rbx
leaq 0x902f(%rip), %rax      # 0xbc38
cmpq %rax, %rbx
jne 0x2aea
movq 0x90a7(%rip), %rax      # 0xbcc0
cmpq %rax, 0x90a8(%rip)      # 0xbcc8
je 0x2e3b
xorl %edx, %edx
leaq 0x8fd1(%rip), %rdi      # 0xbc00
leaq -0x2c(%rbp), %r14
leaq 0x8e5e(%rip), %r15      # 0xba98
movq %rdx, -0x38(%rbp)
movl (%rax,%rdx,4), %eax
movl %eax, -0x2c(%rbp)
movl $0x0, 0x8ef6(%rip)      # 0xbb44
movq %r14, %rsi
movq %rdi, %r13
callq 0x602a
movq 0x8(%rax), %rcx
cmpq (%rax), %rcx
je 0x2dbd
xorl %ebx, %ebx
xorl %r12d, %r12d
movq %r13, %rdi
movq %r14, %rsi
callq 0x602a
movq (%rax), %rsi
movq 0x8(%rax), %rdx
subq %rsi, %rdx
sarq $0x5, %rdx
cmpq %r12, %rdx
jbe 0x2ea6
addq %rbx, %rsi
movq %r15, %rdi
callq 0x2100
leaq 0x8ff1(%rip), %r13      # 0xbc90
movq %r13, %rdi
movq %r15, %rsi
callq 0x5faa
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x2e8b
movl (%rcx), %eax
movl %eax, 0x8e7d(%rip)      # 0xbb3c
movq %r13, %rdi
movq %r15, %rsi
callq 0x5faa
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq $0x1, %rdx
jbe 0x2e98
movl 0x4(%rcx), %eax
movl %eax, 0x8e55(%rip)      # 0xbb40
leaq 0x8ede(%rip), %r13      # 0xbbd0
movq %r13, %rdi
movq %r14, %rsi
callq 0x5f42
movq (%rax), %rcx
cmpq %rcx, 0x8(%rax)
je 0x2e8b
movl (%rcx), %eax
movl %eax, 0x8e22(%rip)      # 0xbb34
movq %r13, %rdi
movq %r14, %rsi
callq 0x5f42
movq (%rax), %rcx
movq 0x8(%rax), %rdx
subq %rcx, %rdx
sarq $0x2, %rdx
cmpq $0x1, %rdx
jbe 0x2e98
movl 0x4(%rcx), %eax
movl %eax, 0x8dfa(%rip)      # 0xbb38
movl 0x8df8(%rip), %ecx      # 0xbb3c
cmpl $0x1, %eax
jne 0x2d6a
movl $0x1, %eax
cmpl $0x1, %ecx
leaq 0x8ea8(%rip), %rdi      # 0xbc00
je 0x2d91
cmpl $0x0, 0x8ddf(%rip)      # 0xbb40
jne 0x2d97
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x2d91
testl %ecx, %ecx
je 0x2d85
movl $0x1, %eax
cmpl $0x1, 0x8dc6(%rip)      # 0xbb40
leaq 0x8e7f(%rip), %rdi      # 0xbc00
je 0x2d91
jmp 0x2d97
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x8e6f(%rip), %rdi      # 0xbc00
addl %eax, 0x8dad(%rip)      # 0xbb44
incq %r12
movq %r14, %rsi
movq %rdi, %r13
callq 0x602a
movq 0x8(%rax), %rcx
subq (%rax), %rcx
sarq $0x5, %rcx
addq $0x20, %rbx
cmpq %r12, %rcx
ja 0x2c6b
leaq 0x8e9c(%rip), %rdi      # 0xbc60
leaq 0x8d79(%rip), %rsi      # 0xbb44
callq 0x5f42
movq 0x8(%rax), %rsi
cmpq 0x10(%rax), %rsi
je 0x2de9
movl -0x2c(%rbp), %ecx
movl %ecx, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x8(%rax)
jmp 0x2df4
movq %rax, %rdi
movq %r14, %rdx
callq 0x6bbc
leaq 0x8dd5(%rip), %rdi      # 0xbbd0
movl 0x8d43(%rip), %ebx      # 0xbb44
movq %r14, %rsi
callq 0x5f42
movq (%rax), %rax
movl %ebx, 0xc(%rax)
movq -0x38(%rbp), %rdx
incq %rdx
movq 0x8eab(%rip), %rcx      # 0xbcc8
movq 0x8e9c(%rip), %rax      # 0xbcc0
subq %rax, %rcx
sarq $0x2, %rcx
cmpq %rdx, %rcx
leaq 0x8dcb(%rip), %rdi      # 0xbc00
ja 0x2c3a
movq 0x8e96(%rip), %rax      # 0xbcd8
cmpq %rax, 0x8e97(%rip)      # 0xbce0
je 0x2e52
movq %rax, 0x8e8e(%rip)      # 0xbce0
movl $0x0, 0x8d10(%rip)      # 0xbb6c
movss 0x8cc4(%rip), %xmm0     # 0xbb28
movss %xmm0, 0x8cb4(%rip)     # 0xbb20
movss 0x8cb8(%rip), %xmm0     # 0xbb2c
movss %xmm0, 0x8ca8(%rip)     # 0xbb24
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x543b(%rip), %rdi      # 0x82cd
xorl %esi, %esi
xorl %edx, %edx
jmp 0x2eb0
leaq 0x542e(%rip), %rdi      # 0x82cd
movl $0x1, %esi
jmp 0x2eb0
leaq 0x5420(%rip), %rdi      # 0x82cd
movq %r12, %rsi
xorl %eax, %eax
callq 0x2290