// File: /workspace/github_cpp_makefile_star2_O3/GAStudyGroup[P]GPX2/src/cross/AntColony/Constants.cpp
// Function: AntMap::updatePheromoneMap(std::vector<int, std::allocator<int>> const&)
void AntMap::updatePheromoneMap(const vector<int>& path){
    for(unsigned i=1;i<=Globals::TOUR_SIZE;i++){
        for(unsigned j=1;j<=Globals::TOUR_SIZE;j++){
            if(i!=j){
                double decay{((1-AntConstants::rho)*AntMap::getPheromoneLevel(i,j))},
                    add{(constainsEdge(path,i,j)?(AntConstants::Q/getFitness(path)):(0.0))},
                    max{maxPheromoneLevel()},
                    min{minPheromoneLevel()},
                    newValue{decay+add};
                
                if(min>max){
                    min = max;
                }
                
                if(newValue > max){
                    newValue = max;
                }else if(newValue < min){
                    newValue = min;
                }
                // cout<<"maxPheromoneLevel: "<<max<<" minPheromoneLevel: "<<min<<endl;
                AntMap::setPheromoneLevel(i,j,newValue);
                //because assymetric TSP
                AntMap::setPheromoneLevel(j,i,newValue);
            }
            
        }   
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
leaq 0x21305(%rip), %r15     # 0x43c78
movl (%r15), %ecx
testl %ecx, %ecx
je 0x22b19
movq %rdi, %rbx
movl $0x1, 0x4(%rsp)
xorl %r12d, %r12d
movl $0x0, %eax
testl %ecx, %ecx
je 0x22b02
movslq 0x4(%rsp), %r13
movl $0x1, %r14d
movl %ecx, %eax
leal (%r12,%r14), %edx
cmpl $0x1, %edx
je 0x22af6
movsd 0xe95d(%rip), %xmm0     # 0x31318
subsd 0x1fe25(%rip), %xmm0    # 0x427e8
movq 0x212be(%rip), %rax     # 0x43c88
movq -0x8(%rax,%r13,8), %rax
movslq %r14d, %rbp
mulsd -0x8(%rax,%rbp,8), %xmm0
movsd %xmm0, 0x20(%rsp)
movl %r13d, 0x14(%rsp)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq 0x14(%rsp), %rdx
callq 0x22e74
movq (%rbx), %rsi
subq %rsi, %rax
sarq $0x2, %rax
incq %rax
movl (%r15), %ecx
cqto
idivq %rcx
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
cmpl (%rsi,%rdx,4), %ebp
jne 0x22a48
movsd 0x1fdc0(%rip), %xmm0    # 0x427e0
movsd %xmm0, 0x8(%rsp)
movq %rbx, %rdi
callq 0xf1cc
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
movsd %xmm1, 0x8(%rsp)
movl (%r15), %ecx
xorps %xmm2, %xmm2
cvtsi2sdl 0x2123d(%rip), %xmm2 # 0x43c90
mulsd 0x1fd8d(%rip), %xmm2    # 0x427e8
movsd 0x1fd7d(%rip), %xmm3    # 0x427e0
movsd 0x1fd85(%rip), %xmm0    # 0x427f0
movsd 0xe8a5(%rip), %xmm1     # 0x31318
cmpl $0x1, %ecx
je 0x22a7c
xorpd %xmm1, %xmm1
divsd %xmm2, %xmm3
movsd %xmm3, 0x18(%rsp)
callq 0x5650
movsd 0x18(%rsp), %xmm3
movl (%r15), %eax
movsd 0x20(%rsp), %xmm2
addsd 0x8(%rsp), %xmm2
ucomisd %xmm3, %xmm2
ja 0x22ad2
movsd 0xe86a(%rip), %xmm1     # 0x31318
subsd %xmm0, %xmm1
mulsd %xmm3, %xmm1
movl %eax, %ecx
shrl %ecx
decl %ecx
xorps %xmm0, %xmm0
cvtsi2sd %rcx, %xmm0
divsd %xmm0, %xmm1
minsd %xmm1, %xmm3
ucomisd %xmm2, %xmm3
jbe 0x22ad6
movapd %xmm3, %xmm2
movq 0x211ab(%rip), %rcx     # 0x43c88
movq -0x8(%rcx,%r13,8), %rdx
movsd %xmm2, -0x8(%rdx,%rbp,8)
movq -0x8(%rcx,%rbp,8), %rcx
movsd %xmm2, -0x8(%rcx,%r13,8)
movl %eax, %ecx
incl %r14d
cmpl %ecx, %r14d
jbe 0x229a6
movl 0x4(%rsp), %edx
incl %edx
decl %r12d
movl %eax, %ecx
movl %edx, 0x4(%rsp)
cmpl %eax, %edx
jbe 0x2298c
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq