// File: bobverity[P]MavericK/Hungarian.cpp
// Function: hungarian(std::vector<std::vector<double, std::allocator<double>>, std::allocator<std::vector<double, std::allocator<double>>>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&, bool, std::basic_ofstream<char, std::char_traits<char>>&)
vector<int> hungarian(vector< vector<double> > &M, vector<int> &edgesLeft, vector<int> &edgesRight, vector<int> &blockedLeft, vector<int> &blockedRight, bool outputLog_on, ofstream &outputLog_fileStream) {
    int n = int(M.size());
    
    // define maximum number of reps in Hungarian algorithm before aborting
    int maxReps= int(1e6);
    
    // initialise assignment objects
    int numberAssigned;
    
    // search for solution until maxReps reached
    for (int rep=0; rep<maxReps; rep++) {
        
        // zero assignment objects
        for (int i=0; i<n; i++) {
            edgesLeft[i] = -1;
            edgesRight[i] = -1;
        }
        numberAssigned = 0;
        
        // subtract smallest element from all rows and columns
        double minRow;
		vector<double> minCol = M[0];
        for (int i=0; i<int(M.size()); i++) {
            minRow = *min_element(begin(M[i]),end(M[i]));
            for (int j=0; j<int(M[i].size()); j++) {
                M[i][j] -= minRow;
                if (M[i][j]<minCol[j])
                    minCol[j] = M[i][j];
            }
        }
        for (int i=0; i<int(M.size()); i++) {
            for (int j=0; j<int(M[i].size()); j++) {
                M[i][j] -= minCol[j];
            }
        }
        
        // generate an initial matching
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (M[i][j]==0 && edgesRight[j]<0) {
                    edgesLeft[i] = j;
                    edgesRight[j] = i;
                    numberAssigned++;
                    break;
                }
            }
        }
        
        // if this matching is perfect then we are done
        if (numberAssigned==n)
            return(edgesLeft);
        
        // continue augmenting paths until no more possible
        //vector<int> blockedLeft(n);
        //vector<int> blockedRight(n);
        bool continueAugmenting = true;
        while (continueAugmenting) {
            continueAugmenting = false;
            
            // search all unmatched nodes
            for (int i=0; i<n; i++) {
                if (edgesLeft[i]<0) {
                    
                    // attempt to find augmented path
                    blockedLeft = vector<int>(n);
                    blockedRight = vector<int>(n);
                    vector<int> path = augmentLeft(i, M, edgesRight, blockedLeft, blockedRight);
                    
                    // if successful then augment
                    if (path[0]>=0) {
                        continueAugmenting = true;
                        numberAssigned ++;
                        for (int j=0; j<int(path.size()/2); j++) {
                            edgesLeft[path[j*2+1]] = path[j*2];
                            edgesRight[path[j*2]] = path[j*2+1];
                        }
                        
                        // if best matching found then finish
                        if (numberAssigned==n) {
                            return(edgesLeft);
                        }
                    }
                }
            }
        }
        
        // find minimum value in cost matrix, looking at all elements in which neither the row or the column is part of the minimum vertex cover
        double minVal = -log(double(0));
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (blockedLeft[i]==1 && blockedRight[j]==0 && M[i][j]<minVal) {
                    minVal = M[i][j];
                }
            }
        }
        
        // add or subtract this value from cost matrix as required
        for (int i=0; i<n; i++) {
            for (int j=0; j<n; j++) {
                if (blockedLeft[i]==1 && blockedRight[j]==0) {
                    M[i][j] -= minVal;
                }
                if (blockedLeft[i]==0 && blockedRight[j]==1) {
                    M[i][j] += minVal;
                }
            }
        }
        
        // at this point we have a new cost matrix and can repeat the process from the top
        
    } // rep loop
    
    cerrAndLog("\nError: failed to solve label switching problem. Hungarian algorithm failed to find best assignment within " + to_string((long long)maxReps) + string(" iterations given the following cost matrix:\n"), outputLog_on, outputLog_fileStream);
    for (int i=0; i<n; i++) {
        for (int j=0; j<n; j++) {
            cerrAndLog(to_string((long long)M[i][j])+string(" "), outputLog_on, outputLog_fileStream);
        }
        cerrAndLog("\n", outputLog_on, outputLog_fileStream);
    }
    
    exit(1);
    
}

// Assembly:
subq $0x338, %rsp            # imm = 0x338
movq %rdi, 0xd8(%rsp)
movq %rdi, %rax
movq %rax, 0xe0(%rsp)
movq 0x348(%rsp), %rax
movb 0x340(%rsp), %al
movq %rdi, 0x330(%rsp)
movq %rsi, 0x328(%rsp)
movq %rdx, 0x320(%rsp)
movq %rcx, 0x318(%rsp)
movq %r8, 0x310(%rsp)
movq %r9, 0x308(%rsp)
andb $0x1, %al
movb %al, 0x307(%rsp)
movq 0x328(%rsp), %rdi
callq 0xc680
movl %eax, 0x300(%rsp)
movl $0xf4240, 0x2fc(%rsp) # imm = 0xF4240
movl $0x0, 0x2f4(%rsp)
movl 0x2f4(%rsp), %eax
cmpl 0x2fc(%rsp), %eax
jge 0xc1c9
movl $0x0, 0x2f0(%rsp)
movl 0x2f0(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xb644
movq 0x320(%rsp), %rdi
movslq 0x2f0(%rsp), %rsi
callq 0x8ba0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x318(%rsp), %rdi
movslq 0x2f0(%rsp), %rsi
callq 0x8ba0
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movl 0x2f0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f0(%rsp)
jmp 0xb5eb
movl $0x0, 0x2f8(%rsp)
movq 0x328(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8bc0
movq %rax, %rsi
leaq 0x2d0(%rsp), %rdi
callq 0x9a80
movl $0x0, 0x2cc(%rsp)
movl 0x2cc(%rsp), %eax
movl %eax, 0xd4(%rsp)
movq 0x328(%rsp), %rdi
callq 0xc680
movq %rax, %rcx
movl 0xd4(%rsp), %eax
cmpl %ecx, %eax
jge 0xb8ec
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0xc880
movq %rax, 0xc8(%rsp)
jmp 0xb6cf
movq 0xc8(%rsp), %rax
movq %rax, 0x2b8(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0xc8b0
movq %rax, 0xc0(%rsp)
jmp 0xb706
movq 0xc0(%rsp), %rax
movq %rax, 0x2a0(%rsp)
movq 0x2b8(%rsp), %rdi
movq 0x2a0(%rsp), %rsi
callq 0xc830
movq %rax, 0xb8(%rsp)
jmp 0xb735
movq 0xb8(%rsp), %rax
movq %rax, 0x2c0(%rsp)
leaq 0x2c0(%rsp), %rdi
callq 0xc8e0
movsd (%rax), %xmm0
movsd %xmm0, 0x2e8(%rsp)
movl $0x0, 0x29c(%rsp)
movl 0x29c(%rsp), %eax
movl %eax, 0xb4(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x9b80
movq %rax, %rcx
movl 0xb4(%rsp), %eax
cmpl %ecx, %eax
jge 0xb8d4
movsd 0x2e8(%rsp), %xmm0
movsd %xmm0, 0xa0(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x29c(%rsp), %rsi
callq 0x8c20
movsd 0xa0(%rsp), %xmm1
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x29c(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
movslq 0x29c(%rsp), %rsi
leaq 0x2d0(%rsp), %rdi
callq 0x8c20
movsd 0xa8(%rsp), %xmm1
movsd (%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xb8bc
movq 0x328(%rsp), %rdi
movslq 0x2cc(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x29c(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x98(%rsp)
movslq 0x29c(%rsp), %rsi
leaq 0x2d0(%rsp), %rdi
callq 0x8c20
movsd 0x98(%rsp), %xmm0
movsd %xmm0, (%rax)
jmp 0xb8bc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc1b7
jmp 0xb8be
movl 0x29c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x29c(%rsp)
jmp 0xb76a
jmp 0xb8d6
movl 0x2cc(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2cc(%rsp)
jmp 0xb67b
movl $0x0, 0x298(%rsp)
movl 0x298(%rsp), %eax
movl %eax, 0x94(%rsp)
movq 0x328(%rsp), %rdi
callq 0xc680
movq %rax, %rcx
movl 0x94(%rsp), %eax
cmpl %ecx, %eax
jge 0xb9f2
movl $0x0, 0x294(%rsp)
movl 0x294(%rsp), %eax
movl %eax, 0x90(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x298(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
callq 0x9b80
movq %rax, %rcx
movl 0x90(%rsp), %eax
cmpl %ecx, %eax
jge 0xb9da
movslq 0x294(%rsp), %rsi
leaq 0x2d0(%rsp), %rdi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x88(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x298(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x294(%rsp), %rsi
callq 0x8c20
movsd 0x88(%rsp), %xmm1
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movl 0x294(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x294(%rsp)
jmp 0xb92f
jmp 0xb9dc
movl 0x298(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x298(%rsp)
jmp 0xb8f7
movl $0x0, 0x290(%rsp)
movl 0x290(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xbb21
movl $0x0, 0x28c(%rsp)
movl 0x28c(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xbb09
movq 0x328(%rsp), %rdi
movslq 0x290(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x28c(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0xbaf1
jp 0xbaf1
movq 0x318(%rsp), %rdi
movslq 0x28c(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
jge 0xbaf1
movl 0x28c(%rsp), %eax
movl %eax, 0x80(%rsp)
movq 0x320(%rsp), %rdi
movslq 0x290(%rsp), %rsi
callq 0x8ba0
movl 0x80(%rsp), %ecx
movl %ecx, (%rax)
movl 0x290(%rsp), %eax
movl %eax, 0x84(%rsp)
movq 0x318(%rsp), %rdi
movslq 0x28c(%rsp), %rsi
callq 0x8ba0
movl 0x84(%rsp), %ecx
movl %ecx, (%rax)
movl 0x2f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f8(%rsp)
jmp 0xbb09
jmp 0xbaf3
movl 0x28c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x28c(%rsp)
jmp 0xba1c
jmp 0xbb0b
movl 0x290(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x290(%rsp)
jmp 0xb9fd
movl 0x2f8(%rsp), %eax
cmpl 0x300(%rsp), %eax
jne 0xbb58
movq 0xd8(%rsp), %rdi
movq 0x320(%rsp), %rsi
callq 0xc8f0
jmp 0xbb48
movl $0x1, 0x288(%rsp)
jmp 0xc180
movb $0x1, 0x287(%rsp)
testb $0x1, 0x287(%rsp)
je 0xbedf
movb $0x0, 0x287(%rsp)
movl $0x0, 0x280(%rsp)
movl 0x280(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xbeda
movq 0x320(%rsp), %rdi
movslq 0x280(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
jge 0xbec2
movslq 0x300(%rsp), %rax
movq %rax, 0x70(%rsp)
leaq 0x267(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0xc5e0
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rdx
leaq 0x268(%rsp), %rdi
callq 0xc7b0
jmp 0xbbeb
movq 0x310(%rsp), %rdi
leaq 0x268(%rsp), %rsi
movq %rsi, 0x58(%rsp)
callq 0xc6a0
movq 0x58(%rsp), %rdi
callq 0xc6e0
leaq 0x267(%rsp), %rdi
callq 0xc670
movslq 0x300(%rsp), %rax
movq %rax, 0x60(%rsp)
leaq 0x247(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0xc5e0
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rdx
leaq 0x248(%rsp), %rdi
callq 0xc7b0
jmp 0xbc54
movq 0x308(%rsp), %rdi
leaq 0x248(%rsp), %rsi
movq %rsi, 0x50(%rsp)
callq 0xc6a0
movq 0x50(%rsp), %rdi
callq 0xc6e0
leaq 0x247(%rsp), %rdi
callq 0xc670
movl 0x280(%rsp), %esi
movq 0x328(%rsp), %rdx
movq 0x318(%rsp), %rcx
movq 0x310(%rsp), %r8
movq 0x308(%rsp), %r9
leaq 0x228(%rsp), %rdi
callq 0xb170
jmp 0xbcbb
leaq 0x228(%rsp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0x8ba0
cmpl $0x0, (%rax)
jl 0xbe97
movb $0x1, 0x287(%rsp)
movl 0x2f8(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f8(%rsp)
movl $0x0, 0x224(%rsp)
movl 0x224(%rsp), %eax
movl %eax, 0x4c(%rsp)
leaq 0x228(%rsp), %rdi
callq 0xb030
movq %rax, %rcx
movl 0x4c(%rsp), %eax
shrq %rcx
cmpl %ecx, %eax
jge 0xbe3b
movl 0x224(%rsp), %eax
shll %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
movl %eax, 0x3c(%rsp)
movq 0x320(%rsp), %rax
movq %rax, 0x30(%rsp)
movl 0x224(%rsp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8ba0
movq 0x30(%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ba0
movl 0x3c(%rsp), %ecx
movl %ecx, (%rax)
movl 0x224(%rsp), %eax
shll %eax
addl $0x1, %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8ba0
movl (%rax), %eax
movl %eax, 0x48(%rsp)
movq 0x318(%rsp), %rax
movq %rax, 0x40(%rsp)
movl 0x224(%rsp), %eax
shll %eax
movslq %eax, %rsi
leaq 0x228(%rsp), %rdi
callq 0x8ba0
movq 0x40(%rsp), %rdi
movslq (%rax), %rsi
callq 0x8ba0
movl 0x48(%rsp), %ecx
movl %ecx, (%rax)
movl 0x224(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x224(%rsp)
jmp 0xbcf9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x267(%rsp), %rdi
callq 0xc670
jmp 0xc1b7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x247(%rsp), %rdi
callq 0xc670
jmp 0xc1b7
movl 0x2f8(%rsp), %eax
cmpl 0x300(%rsp), %eax
jne 0xbe95
movq 0xd8(%rsp), %rdi
movq 0x320(%rsp), %rsi
callq 0xc8f0
jmp 0xbe62
movl $0x1, 0x288(%rsp)
jmp 0xbea2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x228(%rsp), %rdi
callq 0xc6e0
jmp 0xc1b7
jmp 0xbe97
movl $0x0, 0x288(%rsp)
leaq 0x228(%rsp), %rdi
callq 0xc6e0
movl 0x288(%rsp), %eax
testl %eax, %eax
jne 0xc180
jmp 0xbec0
jmp 0xbec2
jmp 0xbec4
movl 0x280(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x280(%rsp)
jmp 0xbb81
jmp 0xbb60
xorps %xmm0, %xmm0
callq 0x4390
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
movsd %xmm0, 0x218(%rsp)
movl $0x0, 0x214(%rsp)
movl 0x214(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xc017
movl $0x0, 0x210(%rsp)
movl 0x210(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xbfff
movq 0x310(%rsp), %rdi
movslq 0x214(%rsp), %rsi
callq 0x8ba0
cmpl $0x1, (%rax)
jne 0xbfe7
movq 0x308(%rsp), %rdi
movslq 0x210(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
jne 0xbfe7
movq 0x328(%rsp), %rdi
movslq 0x214(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x210(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm1
movsd 0x218(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0xbfe7
movq 0x328(%rsp), %rdi
movslq 0x214(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x210(%rsp), %rsi
callq 0x8c20
movsd (%rax), %xmm0
movsd %xmm0, 0x218(%rsp)
jmp 0xbfe9
movl 0x210(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x210(%rsp)
jmp 0xbf31
jmp 0xc001
movl 0x214(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x214(%rsp)
jmp 0xbf12
movl $0x0, 0x20c(%rsp)
movl 0x20c(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xc175
movl $0x0, 0x208(%rsp)
movl 0x208(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xc15d
movq 0x310(%rsp), %rdi
movslq 0x20c(%rsp), %rsi
callq 0x8ba0
cmpl $0x1, (%rax)
jne 0xc0cf
movq 0x308(%rsp), %rdi
movslq 0x208(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
jne 0xc0cf
movsd 0x218(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x20c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x208(%rsp), %rsi
callq 0x8c20
movsd 0x28(%rsp), %xmm1
movsd (%rax), %xmm0
subsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movq 0x310(%rsp), %rdi
movslq 0x20c(%rsp), %rsi
callq 0x8ba0
cmpl $0x0, (%rax)
jne 0xc145
movq 0x308(%rsp), %rdi
movslq 0x208(%rsp), %rsi
callq 0x8ba0
cmpl $0x1, (%rax)
jne 0xc145
movsd 0x218(%rsp), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x328(%rsp), %rdi
movslq 0x20c(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x208(%rsp), %rsi
callq 0x8c20
movsd 0x20(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
jmp 0xc147
movl 0x208(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x208(%rsp)
jmp 0xc041
jmp 0xc15f
movl 0x20c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x20c(%rsp)
jmp 0xc022
movl $0x0, 0x288(%rsp)
leaq 0x2d0(%rsp), %rdi
callq 0x88b0
movl 0x288(%rsp), %eax
testl %eax, %eax
je 0xc19f
jmp 0xc19a
jmp 0xc5bc
jmp 0xc1a1
movl 0x2f4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2f4(%rsp)
jmp 0xb5cc
leaq 0x2d0(%rsp), %rdi
callq 0x88b0
jmp 0xc5cc
movslq 0x2fc(%rsp), %rsi
leaq 0x1a8(%rsp), %rdi
movq %rdi, 0x18(%rsp)
callq 0xcb30
movq 0x18(%rsp), %rdx
leaq 0x4fe82(%rip), %rsi     # 0x5c071
leaq 0x1c8(%rsp), %rdi
callq 0xcae0
jmp 0xc1fe
leaq 0x187(%rsp), %rdi
movq %rdi, 0x10(%rsp)
callq 0x4740
movq 0x10(%rsp), %rdx
leaq 0x4fec1(%rip), %rsi     # 0x5c0dd
leaq 0x188(%rsp), %rdi
callq 0x4580
jmp 0xc22b
leaq 0x1e8(%rsp), %rdi
leaq 0x1c8(%rsp), %rsi
leaq 0x188(%rsp), %rdx
callq 0xc9f0
jmp 0xc24a
movq 0x348(%rsp), %rdx
movzbl 0x307(%rsp), %esi
andl $0x1, %esi
leaq 0x1e8(%rsp), %rdi
callq 0x3a1b0
jmp 0xc26c
leaq 0x1e8(%rsp), %rdi
callq 0x4270
leaq 0x188(%rsp), %rdi
callq 0x4270
leaq 0x187(%rsp), %rdi
callq 0x4490
leaq 0x1c8(%rsp), %rdi
callq 0x4270
leaq 0x1a8(%rsp), %rdi
callq 0x4270
movl $0x0, 0x180(%rsp)
movl 0x180(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xc5b2
movl $0x0, 0x17c(%rsp)
movl 0x17c(%rsp), %eax
cmpl 0x300(%rsp), %eax
jge 0xc4ef
movq 0x328(%rsp), %rdi
movslq 0x180(%rsp), %rsi
callq 0x8bc0
movq %rax, %rdi
movslq 0x17c(%rsp), %rsi
callq 0x8c20
cvttsd2si (%rax), %rsi
leaq 0x138(%rsp), %rdi
callq 0xcb30
leaq 0x117(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x4740
movq 0x8(%rsp), %rdx
leaq 0x526bb(%rip), %rsi     # 0x5e9fb
leaq 0x118(%rsp), %rdi
callq 0x4580
jmp 0xc34f
leaq 0x158(%rsp), %rdi
leaq 0x138(%rsp), %rsi
leaq 0x118(%rsp), %rdx
callq 0xc9f0
jmp 0xc36e
movq 0x348(%rsp), %rdx
movzbl 0x307(%rsp), %esi
andl $0x1, %esi
leaq 0x158(%rsp), %rdi
callq 0x3a1b0
jmp 0xc390
leaq 0x158(%rsp), %rdi
callq 0x4270
leaq 0x118(%rsp), %rdi
callq 0x4270
leaq 0x117(%rsp), %rdi
callq 0x4490
leaq 0x138(%rsp), %rdi
callq 0x4270
movl 0x17c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x17c(%rsp)
jmp 0xc2d7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc464
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc44a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc43d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x1e8(%rsp), %rdi
callq 0x4270
leaq 0x188(%rsp), %rdi
callq 0x4270
leaq 0x187(%rsp), %rdi
callq 0x4490
leaq 0x1c8(%rsp), %rdi
callq 0x4270
leaq 0x1a8(%rsp), %rdi
callq 0x4270
jmp 0xc5cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc4d0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc4c3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0x158(%rsp), %rdi
callq 0x4270
leaq 0x118(%rsp), %rdi
callq 0x4270
leaq 0x117(%rsp), %rdi
callq 0x4490
leaq 0x138(%rsp), %rdi
callq 0x4270
jmp 0xc5cc
leaq 0xef(%rsp), %rdi
movq %rdi, (%rsp)
callq 0x4740
movq (%rsp), %rdx
leaq 0x50387(%rip), %rsi     # 0x5c892
leaq 0xf0(%rsp), %rdi
callq 0x4580
jmp 0xc51a
movq 0x348(%rsp), %rdx
movzbl 0x307(%rsp), %esi
andl $0x1, %esi
leaq 0xf0(%rsp), %rdi
callq 0x3a1b0
jmp 0xc53c
leaq 0xf0(%rsp), %rdi
callq 0x4270
leaq 0xef(%rsp), %rdi
callq 0x4490
movl 0x180(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x180(%rsp)
jmp 0xc2b8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
jmp 0xc5a3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x2b0(%rsp)
movl %eax, 0x2ac(%rsp)
leaq 0xf0(%rsp), %rdi
callq 0x4270
leaq 0xef(%rsp), %rdi
callq 0x4490
jmp 0xc5cc
movl $0x1, %edi
callq 0x44f0
movq 0xe0(%rsp), %rax
addq $0x338, %rsp            # imm = 0x338
retq
movq 0x2b0(%rsp), %rdi
callq 0x4730
nopl (%rax)