// File: sharmaeklavya2[P]ddos-on-anycast/src/lib/place_victims.cpp
// Function: place_victims_using_toposort(Network const&, int, std::vector<int, std::allocator<int>>&, int, int, double)
void place_victims_using_toposort(const Network& network, int n_victims, ivec& victim_list, int seed, int tries, double max_noise) {
    int n = network.size();
    Graph graph(0);
    make_network_dag(network, graph);
    ivec rtopolist;
    rtoposort(graph, rtopolist);
    ivec sources, sinks;
    graph.get_sources_and_sinks(sources, sinks);
    // cerr << "rtopolist: " << rtopolist << endl;

    // compute score
    vector<double> score(n, 0.0);
    for(int u: rtopolist) {
        if(graph.succs(u).empty()) {
            // u is a leaf
            score[u] = 1;
        }
        int m = graph.preds(u).size();
        for(int v: graph.preds(u)) {
            score[v] += score[u] / m;
        }
    }

    // cerr << "score: " << score << endl;
    rng_t rng(seed);
    ivec victims(n, 0);

    // divide victims among sources
    vector<double> weights;
    ivec xvec, best_xvec;
    weights.reserve(sources.size());
    for(int u: sources) {
        weights.push_back(score[u]);
    }
    noisy_normalize(weights, n_victims, max_noise, rng);
    distribute(weights, n_victims, xvec, rng);
    int s = sources.size();
    for(int i=0; i<s; ++i) {
        int u = sources[i];
        victims[u] = xvec[i];
    }
    weights.clear();
    xvec.clear();

    // divide victims
    int dijkstra_calls = 0;
    std::reverse(rtopolist.begin(), rtopolist.end());
    for(int u: rtopolist) {
        if(victims[u] > 0) {
            const ivec& succs = graph.succs(u);
            int s = succs.size();
            if(s > 0) {
                weights.reserve(s);
                for(int v: succs) {
                    weights.push_back(score[v] / graph.preds(v).size());
                }
                noisy_normalize(weights, victims[u], max_noise, rng);
                if(!network.is_virtual(u) || victims[u] == 1 || tries == 1) {
                    distribute(weights, victims[u], best_xvec, rng);
                }
                else {
                    double minmaxload = 1e50;
                    for(int i=0; i<tries; ++i) {
                        distribute(weights, victims[u], xvec, rng);
                        bool found_zero=false, found_one=false;
                        for(int x: xvec) {
                            if(x == 0) {found_zero = true;}
                            else if(x == 1) {found_one = true;}
                        }
                        bool best = !(found_one && found_zero);
                        if(!best) {
                            std::map<int, int> local_id;
                            for(int i=0; i<s; ++i) {
                                local_id[succs[i]] = i;
                            }
                            // cerr << "local_id" << local_id << endl;
                            vector<ivec> adj(s);
                            PQ pq;
                            ivec target(s, -1), target_dist(s, -1);
                            vector<bool> visited(s, false);
                            for(int i=0; i<s; ++i) {
                                int v = succs[i];
                                adj[i].reserve(network.in_nbrs[v].size());
                                for(int v2: network.in_nbrs[v]) {
                                    adj[i].push_back(local_id[v2]);
                                }
                                if(xvec[i] > 0) {
                                    pq.emplace(0, i);
                                    target[i] = i;
                                    target_dist[i] = 0;
                                }
                            }
                            dijkstra(adj, pq, target, target_dist, visited);
                            dijkstra_calls++;
                            vector<double> load(s, 0.0);
                            for(int i=0; i<s; ++i) {
                                load[target[i]] += weights[i];
                            }
                            double maxload = 0;
                            for(int i=0; i<s; ++i) {
                                if(xvec[i] > 0) {
                                    load[i] /= xvec[i];
                                    maxload = std::max(maxload, load[i]);
                                }
                                else if(load[i] != 0.0) {
                                    fprintf(stderr, "xvec[%d] = 0 but load[%d] = %lf\n", i, i, load[i]);
                                }
                            }
                            /*
                            print_icont(stderr, xvec, ", ", "xvec: [", "]\n");
                            cerr << "target: " << target << endl;
                            fprintf(stderr, "maxload: %lf\n", maxload);
                            */
                            if(maxload < minmaxload) {
                                best = true;
                                minmaxload = maxload;
                            }
                        }
                        if(best) {
                            std::swap(xvec, best_xvec);
                        }
                        xvec.clear();
                    }
                }
                for(int i=0; i<s; ++i) {
                    int v = succs[i];
                    victims[v] += best_xvec[i];
                }
                weights.clear();
                best_xvec.clear();
            }
        }
    }

    // fprintf(stderr, "dijkstra was called %d times\n", dijkstra_calls);
    victim_list.reserve(n_victims);
    for(int u: network.depthwise.back()) {
        if(victims[u] > 0 && !network.is_virtual(u)) {
            victim_list.push_back(u);
        }
    }
}

// Assembly:
subq $0x528, %rsp            # imm = 0x528
movq %rdi, 0x520(%rsp)
movl %esi, 0x51c(%rsp)
movq %rdx, 0x510(%rsp)
movl %ecx, 0x50c(%rsp)
movl %r8d, 0x508(%rsp)
movsd %xmm0, 0x500(%rsp)
movq 0x520(%rsp), %rdi
callq 0x4950
movl %eax, 0x4fc(%rsp)
leaq 0x4c0(%rsp), %rdi
movq %rdi, 0x150(%rsp)
xorl %esi, %esi
callq 0x1a0c0
movq 0x150(%rsp), %rsi
movq 0x520(%rsp), %rdi
callq 0x17bb0
jmp 0x18718
leaq 0x498(%rsp), %rdi
movq %rdi, 0x148(%rsp)
callq 0x6950
movq 0x148(%rsp), %rsi
leaq 0x4c0(%rsp), %rdi
callq 0x1fc90
jmp 0x18744
leaq 0x480(%rsp), %rdi
movq %rdi, 0x138(%rsp)
callq 0x6950
leaq 0x468(%rsp), %rdi
movq %rdi, 0x140(%rsp)
callq 0x6950
movq 0x138(%rsp), %rsi
movq 0x140(%rsp), %rdx
leaq 0x4c0(%rsp), %rdi
callq 0x1f9d0
jmp 0x1878d
movslq 0x4fc(%rsp), %rax
movq %rax, 0x128(%rsp)
movq $0x0, 0x448(%rsp)
leaq 0x447(%rsp), %rdi
movq %rdi, 0x130(%rsp)
callq 0xcf10
movq 0x128(%rsp), %rsi
movq 0x130(%rsp), %rcx
leaq 0x450(%rsp), %rdi
leaq 0x448(%rsp), %rdx
callq 0xcf20
jmp 0x187e5
leaq 0x447(%rsp), %rdi
callq 0xcfa0
leaq 0x498(%rsp), %rax
movq %rax, 0x438(%rsp)
movq 0x438(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x430(%rsp)
movq 0x438(%rsp), %rdi
callq 0x5a70
movq %rax, 0x428(%rsp)
leaq 0x430(%rsp), %rdi
leaq 0x428(%rsp), %rsi
callq 0x9fe0
testb $0x1, %al
jne 0x1884a
jmp 0x18a7a
leaq 0x430(%rsp), %rdi
callq 0xa020
movl (%rax), %eax
movl %eax, 0x424(%rsp)
movl 0x424(%rsp), %esi
leaq 0x4c0(%rsp), %rdi
callq 0x1aa00
movq %rax, 0x120(%rsp)
jmp 0x1887e
movq 0x120(%rsp), %rdi
callq 0x86a0
testb $0x1, %al
jne 0x18894
jmp 0x18944
movslq 0x424(%rsp), %rsi
leaq 0x450(%rsp), %rdi
callq 0xcfb0
movsd 0x8bd7(%rip), %xmm0     # 0x21488
movsd %xmm0, (%rax)
jmp 0x18944
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19d22
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19d15
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19cfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x447(%rsp), %rdi
callq 0xcfa0
jmp 0x19cfb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19cee
movl 0x424(%rsp), %esi
leaq 0x4c0(%rsp), %rdi
callq 0x1aa30
movq %rax, 0x118(%rsp)
jmp 0x18962
movq 0x118(%rsp), %rdi
callq 0x4f00
movl %eax, 0x420(%rsp)
movl 0x424(%rsp), %esi
leaq 0x4c0(%rsp), %rdi
callq 0x1aa30
movq %rax, 0x110(%rsp)
jmp 0x18994
movq 0x110(%rsp), %rax
movq %rax, 0x418(%rsp)
movq 0x418(%rsp), %rdi
callq 0x4880
movq %rax, 0x410(%rsp)
movq 0x418(%rsp), %rdi
callq 0x48b0
movq %rax, 0x408(%rsp)
leaq 0x410(%rsp), %rdi
leaq 0x408(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x189e9
jmp 0x18a66
leaq 0x410(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0x404(%rsp)
movslq 0x424(%rsp), %rsi
leaq 0x450(%rsp), %rdi
callq 0xcfb0
movsd (%rax), %xmm0
cvtsi2sdl 0x420(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x108(%rsp)
movslq 0x404(%rsp), %rsi
leaq 0x450(%rsp), %rdi
callq 0xcfb0
movsd 0x108(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
leaq 0x410(%rsp), %rdi
callq 0x4930
jmp 0x189ce
jmp 0x18a68
leaq 0x430(%rsp), %rdi
callq 0xa0b0
jmp 0x1882c
movslq 0x50c(%rsp), %rsi
leaq 0x3f8(%rsp), %rdi
callq 0x9f10
jmp 0x18a91
movslq 0x4fc(%rsp), %rax
movq %rax, 0xf8(%rsp)
movl $0x0, 0x3dc(%rsp)
leaq 0x3db(%rsp), %rdi
movq %rdi, 0x100(%rsp)
callq 0x4f40
movq 0xf8(%rsp), %rsi
movq 0x100(%rsp), %rcx
leaq 0x3e0(%rsp), %rdi
leaq 0x3dc(%rsp), %rdx
callq 0x4f50
jmp 0x18ae8
leaq 0x3db(%rsp), %rdi
callq 0x4fd0
leaq 0x3c0(%rsp), %rdi
movq %rdi, 0xf0(%rsp)
callq 0xd2c0
leaq 0x3a8(%rsp), %rdi
callq 0x6950
leaq 0x390(%rsp), %rdi
callq 0x6950
leaq 0x480(%rsp), %rdi
callq 0x4f00
movq 0xf0(%rsp), %rdi
movq %rax, %rsi
callq 0xd400
jmp 0x18b43
leaq 0x480(%rsp), %rax
movq %rax, 0x388(%rsp)
movq 0x388(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x380(%rsp)
movq 0x388(%rsp), %rdi
callq 0x5a70
movq %rax, 0x378(%rsp)
leaq 0x380(%rsp), %rdi
leaq 0x378(%rsp), %rsi
callq 0x9fe0
testb $0x1, %al
jne 0x18b9b
jmp 0x18c28
leaq 0x380(%rsp), %rdi
callq 0xa020
movl (%rax), %eax
movl %eax, 0x374(%rsp)
movslq 0x374(%rsp), %rsi
leaq 0x450(%rsp), %rdi
callq 0xcfb0
movq %rax, %rsi
leaq 0x3c0(%rsp), %rdi
callq 0xd670
jmp 0x18bd8
jmp 0x18bda
leaq 0x380(%rsp), %rdi
callq 0xa0b0
jmp 0x18b7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x3db(%rsp), %rdi
callq 0x4fd0
jmp 0x19cee
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19cba
movl 0x51c(%rsp), %esi
movsd 0x500(%rsp), %xmm0
leaq 0x3c0(%rsp), %rdi
leaq 0x3f8(%rsp), %rdx
callq 0x17dc0
jmp 0x18c4f
movl 0x51c(%rsp), %esi
leaq 0x3c0(%rsp), %rdi
leaq 0x3a8(%rsp), %rdx
leaq 0x3f8(%rsp), %rcx
callq 0x17fc0
jmp 0x18c75
leaq 0x480(%rsp), %rdi
callq 0x4f00
movl %eax, 0x370(%rsp)
movl $0x0, 0x36c(%rsp)
movl 0x36c(%rsp), %eax
cmpl 0x370(%rsp), %eax
jge 0x18d11
movslq 0x36c(%rsp), %rsi
leaq 0x480(%rsp), %rdi
callq 0x4860
movl (%rax), %eax
movl %eax, 0x368(%rsp)
movslq 0x36c(%rsp), %rsi
leaq 0x3a8(%rsp), %rdi
callq 0x4860
movl (%rax), %eax
movl %eax, 0xec(%rsp)
movslq 0x368(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
movl 0xec(%rsp), %ecx
movl %ecx, (%rax)
movl 0x36c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x36c(%rsp)
jmp 0x18c94
leaq 0x3c0(%rsp), %rdi
callq 0x1aa60
leaq 0x3a8(%rsp), %rdi
callq 0x1aa80
movl $0x0, 0x364(%rsp)
leaq 0x498(%rsp), %rdi
movq %rdi, 0xe0(%rsp)
callq 0x5bf0
movq 0xe0(%rsp), %rdi
movq %rax, 0x358(%rsp)
callq 0x5a70
movq %rax, 0x350(%rsp)
movq 0x358(%rsp), %rdi
movq 0x350(%rsp), %rsi
callq 0x1aaa0
jmp 0x18d7f
leaq 0x498(%rsp), %rax
movq %rax, 0x348(%rsp)
movq 0x348(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x340(%rsp)
movq 0x348(%rsp), %rdi
callq 0x5a70
movq %rax, 0x338(%rsp)
leaq 0x340(%rsp), %rdi
leaq 0x338(%rsp), %rsi
callq 0x9fe0
testb $0x1, %al
jne 0x18dd7
jmp 0x19b41
leaq 0x340(%rsp), %rdi
callq 0xa020
movl (%rax), %eax
movl %eax, 0x334(%rsp)
movslq 0x334(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
cmpl $0x0, (%rax)
jle 0x19b2d
movl 0x334(%rsp), %esi
leaq 0x4c0(%rsp), %rdi
callq 0x1aa00
movq %rax, 0xd8(%rsp)
jmp 0x18e29
movq 0xd8(%rsp), %rax
movq %rax, 0x328(%rsp)
movq 0x328(%rsp), %rdi
callq 0x4f00
movl %eax, 0x324(%rsp)
cmpl $0x0, 0x324(%rsp)
jle 0x19b2b
movslq 0x324(%rsp), %rsi
leaq 0x3c0(%rsp), %rdi
callq 0xd400
jmp 0x18e72
movq 0x328(%rsp), %rax
movq %rax, 0x318(%rsp)
movq 0x318(%rsp), %rdi
callq 0x4880
movq %rax, 0x310(%rsp)
movq 0x318(%rsp), %rdi
callq 0x48b0
movq %rax, 0x308(%rsp)
leaq 0x310(%rsp), %rdi
leaq 0x308(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x18eca
jmp 0x18f95
leaq 0x310(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0x304(%rsp)
movslq 0x304(%rsp), %rsi
leaq 0x450(%rsp), %rdi
callq 0xcfb0
movsd (%rax), %xmm0
movsd %xmm0, 0xc8(%rsp)
movl 0x304(%rsp), %esi
leaq 0x4c0(%rsp), %rdi
callq 0x1aa30
movq %rax, 0xd0(%rsp)
jmp 0x18f20
movq 0xd0(%rsp), %rdi
callq 0x4f00
movsd 0xc8(%rsp), %xmm0
movq %rax, %xmm1
movaps 0x856e(%rip), %xmm2     # 0x214b0
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0x8572(%rip), %xmm2     # 0x214c0
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x2f8(%rsp)
leaq 0x3c0(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x1aae0
jmp 0x18f81
jmp 0x18f83
leaq 0x310(%rsp), %rdi
callq 0x4930
jmp 0x18eac
movslq 0x334(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
movl (%rax), %esi
movsd 0x500(%rsp), %xmm0
leaq 0x3c0(%rsp), %rdi
leaq 0x3f8(%rsp), %rdx
callq 0x17dc0
jmp 0x18fcc
movq 0x520(%rsp), %rdi
movl 0x334(%rsp), %esi
callq 0x4830
movb %al, 0xc7(%rsp)
jmp 0x18fe9
movb 0xc7(%rsp), %al
testb $0x1, %al
jne 0x18ff6
jmp 0x1901a
movslq 0x334(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
cmpl $0x1, (%rax)
je 0x1901a
cmpl $0x1, 0x508(%rsp)
jne 0x19055
movslq 0x334(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
movl (%rax), %esi
leaq 0x3c0(%rsp), %rdi
leaq 0x390(%rsp), %rdx
leaq 0x3f8(%rsp), %rcx
callq 0x17fc0
jmp 0x19050
jmp 0x19a8d
movsd 0x8633(%rip), %xmm0     # 0x21690
movsd %xmm0, 0x2f0(%rsp)
movl $0x0, 0x2ec(%rsp)
movl 0x2ec(%rsp), %eax
cmpl 0x508(%rsp), %eax
jge 0x19a8b
movslq 0x334(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
movl (%rax), %esi
leaq 0x3c0(%rsp), %rdi
leaq 0x3a8(%rsp), %rdx
leaq 0x3f8(%rsp), %rcx
callq 0x17fc0
jmp 0x190bb
movb $0x0, 0x2eb(%rsp)
movb $0x0, 0x2ea(%rsp)
leaq 0x3a8(%rsp), %rax
movq %rax, 0x2e0(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0x5bf0
movq %rax, 0x2d8(%rsp)
movq 0x2e0(%rsp), %rdi
callq 0x5a70
movq %rax, 0x2d0(%rsp)
leaq 0x2d8(%rsp), %rdi
leaq 0x2d0(%rsp), %rsi
callq 0x9fe0
testb $0x1, %al
jne 0x19120
jmp 0x1916f
leaq 0x2d8(%rsp), %rdi
callq 0xa020
movl (%rax), %eax
movl %eax, 0x2cc(%rsp)
cmpl $0x0, 0x2cc(%rsp)
jne 0x1914a
movb $0x1, 0x2eb(%rsp)
jmp 0x1915e
cmpl $0x1, 0x2cc(%rsp)
jne 0x1915c
movb $0x1, 0x2ea(%rsp)
jmp 0x1915e
jmp 0x19160
leaq 0x2d8(%rsp), %rdi
callq 0xa0b0
jmp 0x19105
xorl %eax, %eax
testb $0x1, 0x2ea(%rsp)
movb %al, 0xc6(%rsp)
je 0x19190
movb 0x2eb(%rsp), %al
movb %al, 0xc6(%rsp)
movb 0xc6(%rsp), %al
xorb $-0x1, %al
andb $0x1, %al
movb %al, 0x2cb(%rsp)
testb $0x1, 0x2cb(%rsp)
jne 0x19a49
leaq 0x298(%rsp), %rdi
callq 0x1ab10
movl $0x0, 0x294(%rsp)
movl 0x294(%rsp), %eax
cmpl 0x324(%rsp), %eax
jge 0x1924d
movl 0x294(%rsp), %eax
movl %eax, 0xb4(%rsp)
movq 0x328(%rsp), %rdi
movslq %eax, %rsi
callq 0x4970
movq %rax, %rsi
leaq 0x298(%rsp), %rdi
callq 0x1ab20
movq %rax, 0xb8(%rsp)
jmp 0x19210
movq 0xb8(%rsp), %rax
movl 0xb4(%rsp), %ecx
movl %ecx, (%rax)
movl 0x294(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x294(%rsp)
jmp 0x191c8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19a37
movslq 0x324(%rsp), %rax
movq %rax, 0xa0(%rsp)
leaq 0x277(%rsp), %rdi
movq %rdi, 0xa8(%rsp)
callq 0x1ac10
movq 0xa0(%rsp), %rsi
movq 0xa8(%rsp), %rdx
leaq 0x278(%rsp), %rdi
callq 0x1ac20
jmp 0x19291
leaq 0x277(%rsp), %rdi
callq 0x1aca0
leaq 0x250(%rsp), %rdi
callq 0x138e0
jmp 0x192ad
movslq 0x324(%rsp), %rax
movq %rax, 0x90(%rsp)
movl $0xffffffff, 0x234(%rsp) # imm = 0xFFFFFFFF
leaq 0x233(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x4f40
movq 0x90(%rsp), %rsi
movq 0x98(%rsp), %rcx
leaq 0x238(%rsp), %rdi
leaq 0x234(%rsp), %rdx
callq 0x4f50
jmp 0x19304
leaq 0x233(%rsp), %rdi
callq 0x4fd0
movslq 0x324(%rsp), %rax
movq %rax, 0x80(%rsp)
movl $0xffffffff, 0x214(%rsp) # imm = 0xFFFFFFFF
leaq 0x213(%rsp), %rdi
movq %rdi, 0x88(%rsp)
callq 0x4f40
movq 0x80(%rsp), %rsi
movq 0x88(%rsp), %rcx
leaq 0x218(%rsp), %rdi
leaq 0x214(%rsp), %rdx
callq 0x4f50
jmp 0x19368
leaq 0x213(%rsp), %rdi
callq 0x4fd0
movslq 0x324(%rsp), %rax
movq %rax, 0x70(%rsp)
movb $0x0, 0x1e7(%rsp)
leaq 0x1e6(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x13840
movq 0x70(%rsp), %rsi
movq 0x78(%rsp), %rcx
leaq 0x1e8(%rsp), %rdi
leaq 0x1e7(%rsp), %rdx
callq 0x13850
jmp 0x193bd
leaq 0x1e6(%rsp), %rdi
callq 0x138d0
movl $0x0, 0x1e0(%rsp)
movl 0x1e0(%rsp), %eax
cmpl 0x324(%rsp), %eax
jge 0x19692
movq 0x328(%rsp), %rdi
movslq 0x1e0(%rsp), %rsi
callq 0x4970
movl (%rax), %eax
movl %eax, 0x1dc(%rsp)
movslq 0x1e0(%rsp), %rsi
leaq 0x278(%rsp), %rdi
callq 0x46a0
movq %rax, 0x68(%rsp)
movq 0x520(%rsp), %rdi
addq $0x48, %rdi
movslq 0x1dc(%rsp), %rsi
callq 0x4a60
movq %rax, %rdi
callq 0x4f00
movq 0x68(%rsp), %rdi
movq %rax, %rsi
callq 0xa200
jmp 0x19451
movq 0x520(%rsp), %rdi
addq $0x48, %rdi
movslq 0x1dc(%rsp), %rsi
callq 0x4a60
movq %rax, 0x1d0(%rsp)
movq 0x1d0(%rsp), %rdi
callq 0x4880
movq %rax, 0x1c8(%rsp)
movq 0x1d0(%rsp), %rdi
callq 0x48b0
movq %rax, 0x1c0(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x1c0(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x194ba
jmp 0x195f5
leaq 0x1c8(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0x1bc(%rsp)
movslq 0x1e0(%rsp), %rsi
leaq 0x278(%rsp), %rdi
callq 0x46a0
movq %rax, 0x58(%rsp)
leaq 0x298(%rsp), %rdi
leaq 0x1bc(%rsp), %rsi
callq 0x1ab20
movq %rax, 0x60(%rsp)
jmp 0x19506
movq 0x60(%rsp), %rsi
movq 0x58(%rsp), %rdi
callq 0x46f0
jmp 0x19517
jmp 0x19519
leaq 0x1c8(%rsp), %rdi
callq 0x4930
jmp 0x1949c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x277(%rsp), %rdi
callq 0x1aca0
jmp 0x19a37
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x19a2a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x233(%rsp), %rdi
callq 0x4fd0
jmp 0x19a1d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x213(%rsp), %rdi
callq 0x4fd0
jmp 0x19a10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x1e6(%rsp), %rdi
callq 0x138d0
jmp 0x19a03
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
jmp 0x199f6
movslq 0x1e0(%rsp), %rsi
leaq 0x3a8(%rsp), %rdi
callq 0x4860
cmpl $0x0, (%rax)
jle 0x1967a
movl $0x0, 0x1b8(%rsp)
leaq 0x250(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
leaq 0x1e0(%rsp), %rdx
callq 0x137e0
jmp 0x19639
movl 0x1e0(%rsp), %eax
movl %eax, 0x54(%rsp)
movslq 0x1e0(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x4860
movl 0x54(%rsp), %ecx
movl %ecx, (%rax)
movslq 0x1e0(%rsp), %rsi
leaq 0x218(%rsp), %rdi
callq 0x4860
movl $0x0, (%rax)
jmp 0x1967c
movl 0x1e0(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1e0(%rsp)
jmp 0x193d5
leaq 0x278(%rsp), %rdi
leaq 0x250(%rsp), %rsi
leaq 0x238(%rsp), %rdx
leaq 0x218(%rsp), %rcx
leaq 0x1e8(%rsp), %r8
callq 0x18370
jmp 0x196c1
movl 0x364(%rsp), %eax
incl %eax
movl %eax, 0x364(%rsp)
movslq 0x324(%rsp), %rax
movq %rax, 0x40(%rsp)
movq $0x0, 0x198(%rsp)
leaq 0x197(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0xcf10
movq 0x40(%rsp), %rsi
movq 0x48(%rsp), %rcx
leaq 0x1a0(%rsp), %rdi
leaq 0x198(%rsp), %rdx
callq 0xcf20
jmp 0x1971d
leaq 0x197(%rsp), %rdi
callq 0xcfa0
movl $0x0, 0x190(%rsp)
movl 0x190(%rsp), %eax
cmpl 0x324(%rsp), %eax
jge 0x197d4
movslq 0x190(%rsp), %rsi
leaq 0x3c0(%rsp), %rdi
callq 0xcfb0
movsd (%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq 0x190(%rsp), %rsi
leaq 0x238(%rsp), %rdi
callq 0x4860
movslq (%rax), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0xcfb0
movsd 0x38(%rsp), %xmm0
addsd (%rax), %xmm0
movsd %xmm0, (%rax)
movl 0x190(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x190(%rsp)
jmp 0x19735
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x197(%rsp), %rdi
callq 0xcfa0
jmp 0x199f6
xorps %xmm0, %xmm0
movsd %xmm0, 0x188(%rsp)
movl $0x0, 0x184(%rsp)
movl 0x184(%rsp), %eax
cmpl 0x324(%rsp), %eax
jge 0x19967
movslq 0x184(%rsp), %rsi
leaq 0x3a8(%rsp), %rdi
callq 0x4860
cmpl $0x0, (%rax)
jle 0x198ce
movslq 0x184(%rsp), %rsi
leaq 0x3a8(%rsp), %rdi
callq 0x4860
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movslq 0x184(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0xcfb0
movsd 0x20(%rsp), %xmm1
movq 0x28(%rsp), %rdi
movsd (%rax), %xmm0
divsd %xmm1, %xmm0
movsd %xmm0, (%rax)
movslq 0x184(%rsp), %rsi
callq 0xcfb0
movq %rax, %rsi
leaq 0x188(%rsp), %rdi
callq 0x1acb0
movq %rax, 0x30(%rsp)
jmp 0x19891
movq 0x30(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0x188(%rsp)
jmp 0x1994f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x4b8(%rsp)
movl %eax, 0x4b4(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0xd870
jmp 0x199f6
movslq 0x184(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0xcfb0
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x198f4
jp 0x198f4
jmp 0x1994d
movq 0x136cd(%rip), %rax     # 0x2cfc8
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movl 0x184(%rsp), %eax
movl %eax, 0x18(%rsp)
movl 0x184(%rsp), %eax
movl %eax, 0x1c(%rsp)
movslq 0x184(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
callq 0xcfb0
movq 0x10(%rsp), %rdi
movl 0x18(%rsp), %edx
movl 0x1c(%rsp), %ecx
movsd (%rax), %xmm0
leaq 0x7d52(%rip), %rsi      # 0x21698
movb $0x1, %al
callq 0x2180
jmp 0x1994f
jmp 0x19951
movl 0x184(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x184(%rsp)
jmp 0x197eb
movsd 0x188(%rsp), %xmm1
movsd 0x2f0(%rsp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x19999
movb $0x1, 0x2cb(%rsp)
movsd 0x188(%rsp), %xmm0
movsd %xmm0, 0x2f0(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0xd870
leaq 0x1e8(%rsp), %rdi
callq 0x13d70
leaq 0x218(%rsp), %rdi
callq 0x5020
leaq 0x238(%rsp), %rdi
callq 0x5020
leaq 0x250(%rsp), %rdi
callq 0x13a50
leaq 0x278(%rsp), %rdi
callq 0x1acf0
leaq 0x298(%rsp), %rdi
callq 0x1ad50
jmp 0x19a49
leaq 0x1e8(%rsp), %rdi
callq 0x13d70
leaq 0x218(%rsp), %rdi
callq 0x5020
leaq 0x238(%rsp), %rdi
callq 0x5020
leaq 0x250(%rsp), %rdi
callq 0x13a50
leaq 0x278(%rsp), %rdi
callq 0x1acf0
leaq 0x298(%rsp), %rdi
callq 0x1ad50
jmp 0x19cba
testb $0x1, 0x2cb(%rsp)
je 0x19a68
leaq 0x3a8(%rsp), %rdi
leaq 0x390(%rsp), %rsi
callq 0x1ad60
leaq 0x3a8(%rsp), %rdi
callq 0x1aa80
movl 0x2ec(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2ec(%rsp)
jmp 0x19071
jmp 0x19a8d
movl $0x0, 0x180(%rsp)
movl 0x180(%rsp), %eax
cmpl 0x324(%rsp), %eax
jge 0x19b11
movq 0x328(%rsp), %rdi
movslq 0x180(%rsp), %rsi
callq 0x4970
movl (%rax), %eax
movl %eax, 0x17c(%rsp)
movslq 0x180(%rsp), %rsi
leaq 0x390(%rsp), %rdi
callq 0x4860
movl (%rax), %eax
movl %eax, 0xc(%rsp)
movslq 0x17c(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
movl 0xc(%rsp), %ecx
addl (%rax), %ecx
movl %ecx, (%rax)
movl 0x180(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x180(%rsp)
jmp 0x19a98
leaq 0x3c0(%rsp), %rdi
callq 0x1aa60
leaq 0x390(%rsp), %rdi
callq 0x1aa80
jmp 0x19b2d
jmp 0x19b2f
leaq 0x340(%rsp), %rdi
callq 0xa0b0
jmp 0x18db9
movq 0x510(%rsp), %rdi
movslq 0x51c(%rsp), %rsi
callq 0xa200
jmp 0x19b58
movq 0x520(%rsp), %rdi
addq $0xa8, %rdi
callq 0x19d40
movq %rax, 0x170(%rsp)
movq 0x170(%rsp), %rdi
callq 0x4880
movq %rax, 0x168(%rsp)
movq 0x170(%rsp), %rdi
callq 0x48b0
movq %rax, 0x160(%rsp)
leaq 0x168(%rsp), %rdi
leaq 0x160(%rsp), %rsi
callq 0x48e0
testb $0x1, %al
jne 0x19bbc
jmp 0x19c3d
leaq 0x168(%rsp), %rdi
callq 0x4920
movl (%rax), %eax
movl %eax, 0x15c(%rsp)
movslq 0x15c(%rsp), %rsi
leaq 0x3e0(%rsp), %rdi
callq 0x4860
cmpl $0x0, (%rax)
jle 0x19c29
movq 0x520(%rsp), %rdi
movl 0x15c(%rsp), %esi
callq 0x4830
movb %al, 0xb(%rsp)
jmp 0x19c06
movb 0xb(%rsp), %al
testb $0x1, %al
jne 0x19c29
jmp 0x19c10
movq 0x510(%rsp), %rdi
leaq 0x15c(%rsp), %rsi
callq 0x46f0
jmp 0x19c27
jmp 0x19c29
jmp 0x19c2b
leaq 0x168(%rsp), %rdi
callq 0x4930
jmp 0x19b9e
leaq 0x390(%rsp), %rdi
callq 0x5020
leaq 0x3a8(%rsp), %rdi
callq 0x5020
leaq 0x3c0(%rsp), %rdi
callq 0xd870
leaq 0x3e0(%rsp), %rdi
callq 0x5020
leaq 0x450(%rsp), %rdi
callq 0xd870
leaq 0x468(%rsp), %rdi
callq 0x5020
leaq 0x480(%rsp), %rdi
callq 0x5020
leaq 0x498(%rsp), %rdi
callq 0x5020
leaq 0x4c0(%rsp), %rdi
callq 0x1a270
addq $0x528, %rsp            # imm = 0x528
retq
leaq 0x390(%rsp), %rdi
callq 0x5020
leaq 0x3a8(%rsp), %rdi
callq 0x5020
leaq 0x3c0(%rsp), %rdi
callq 0xd870
leaq 0x3e0(%rsp), %rdi
callq 0x5020
leaq 0x450(%rsp), %rdi
callq 0xd870
leaq 0x468(%rsp), %rdi
callq 0x5020
leaq 0x480(%rsp), %rdi
callq 0x5020
leaq 0x498(%rsp), %rdi
callq 0x5020
leaq 0x4c0(%rsp), %rdi
callq 0x1a270
movq 0x4b8(%rsp), %rdi
callq 0x21f0
nopl (%rax)