// File: /workspace/github_cpp_makefile_star2_O1/sharmaeklavya2[P]ddos-on-anycast/src/simulate.cpp
// Function: main
int main(int argc, char* argv[]) {

    if(argc == 2 && (strcmp(argv[1], "-h") == 0 || strcmp(argv[1], "--help") == 0)) {
        print_usage(stdout, argv[0]);
        printf("\n");
        print_help(stdout);
        return 0;
    }
    else if(argc != n_arg_list+1) {
        print_usage(stderr, argv[0]);
        return 2;
    }
    else {
        for(int i=0; i<n_arg_list; ++i) {
            arg_list[i].set_from_string(argv[i+1]);
            arg_name_to_index[arg_list[i].name] = i;
        }
    }

    GrowParams grow_params;

    int n_top = get_arg_i("n_top");
    int n_expand = get_arg_i("n_expand");
    double expand_degree = get_arg_f("expand_degree");
    double n_expand_sigma = get_arg_f("n_expand_sigma");
    grow_params.num_children = get_arg_i("n_down");
    grow_params.num_children_sigma = get_arg_f("n_down_sigma");
    grow_params.prob_multi_upstream = get_arg_f("p_upstream");
    grow_params.prob_self_multi_upstream = get_arg_f("p_self_upstream");
    grow_params.prob_side_peering = get_arg_f("p_peering");
    grow_params.prob_self_side_peering = get_arg_f("p_local_peering");
    int top_side_conns = get_arg_i("top_side_conns");
    int n_layers = get_arg_i("n_layers");
    ivec n_victims_list;
    strcpy(buffer, get_arg_s("n_victims").c_str());
    fill_ivec_from_str(buffer, n_victims_list, ",");
    int smart_distr = get_arg_i("smart_distr");
    int tries = get_arg_i("tries");
    int reps = get_arg_i("reps");
    int seed = get_arg_i("seed");
    if(seed == 0) {
        seed = int(time(NULL));
    }
    int prog_reps = get_arg_i("prog_reps");
    bool csvout = get_arg_i("csvout");

    CompleteGraphGen complete_gen(n_top);
    RandomConnectedGraphGen rcgen(n_expand, expand_degree);
    NormalOrderGraphGen explode_graph_gen(n_expand_sigma, rcgen);

    rng_t rng(seed);

    int n_n_victims = n_victims_list.size();
    vector<vector<double> > relcatches(n_n_victims), misdisfacts(n_n_victims);
    for(int i=0; i<n_n_victims; ++i) {
        relcatches[i].resize(reps, 0.0);
        misdisfacts[i].resize(reps, 0.0);
    }
    bool single_simulation = (reps == 1 && n_n_victims == 1 && (!csvout));

    for(int repi=0; repi < reps; ++repi) {
        if(reps > 1 && prog_reps > 0 && repi % prog_reps == 0) {
            fprintf(stderr, "reps: %d\r", repi);
        }
        Network network(complete_gen, rng(), false, top_side_conns);
        if(!network.long_sanity_check()) {
            puts("Network has inconsistencies!");
            return 1;
        }

        network.hgrow(explode_graph_gen, rng());

        for(int i=1; i<n_layers; ++i) {
            network.vgrow(grow_params, rng());
            network.hgrow(explode_graph_gen, rng());
        }

        int leaves = 0;
        for(int u: network.depthwise.back()) {
            if(!network.is_virtual(u)) {
                leaves++;
            }
        }
        if(single_simulation) {
            printf("Vertices: %d\n", network.num_vertices());
            printf("Edges: %d\n", network.num_edges());
            printf("Leaves: %d\n", leaves);
        }

        if(!network.long_sanity_check()) {
            puts("Network has inconsistencies!");
            network.print(stdout, false);
            return 1;
        }

        for(int i=0; i<n_n_victims; ++i) {
            int n_victims = n_victims_list[i];

            ivec victims, targets;
            if(smart_distr) {
                place_victims_using_toposort(network, n_victims, victims, seed, tries, 0.01);
            }
            else {
                place_victims_randomly(network, n_victims, victims, seed);
            }
            if(single_simulation) {
                printf("victims: %d\n\n", int(victims.size()));
            }
            attack(network, victims, targets, 1, 100);

            std::map<int, int> freq;
            for(int v: victims) {
                freq[v] = 0;
            }
            for(int u: network.depthwise.back()) {
                if(network.netsize[u] == 0) {
                    freq[targets[u]]++;
                }
            }
            vector<iipair> freq2(freq.begin(), freq.end());
            std::sort(freq2.begin(), freq2.end(), iipair_second_rcmp);
            double relcatch = double(freq2[0].second) / leaves;
            double misdisfact = double(freq2[0].second * victims.size()) / leaves;
            if(single_simulation) {
                if(victims.size() <= MAX_VICTIMS_TO_DISPLAY) {
                    printf("freqs (victim_id, attackers, relcatch, misdisfact):\n");
                    for(const iipair& p: freq2) {
                        double relcatch = double(p.second) / leaves;
                        double misdisfact = double(lli(p.second) * victims.size()) / leaves;
                        printf("  %5d: %4d: %lf: %lf\n", p.first, p.second, relcatch, misdisfact);
                    }
                }
                else {
                    printf("victim_id=%d, attackers=%d, relcatch=%lf, misdisfact=%lf\n",
                        freq2[0].first, freq2[0].second, relcatch, misdisfact);
                }
            }
            relcatches[i][repi] = relcatch;
            misdisfacts[i][repi] = misdisfact;
        }
    }

    if(!single_simulation) {
        if(reps > 1) {
            fprintf(stderr, "reps: %d\n", reps);
        }
        if(csvout) {
            printf("n_victims,r_mean,r_max,r_90p,r_75p,r_50p,r_stddev,r_iqd\n");
        }
        for(int i=0; i<n_n_victims; ++i) {
            int n_victims = n_victims_list[i];
            print_stats("relcatches", n_victims, relcatches[i], csvout);
        }
        if(!csvout) {
            for(int i=0; i<n_n_victims; ++i) {
                int n_victims = n_victims_list[i];
                print_stats("misdisfacts", n_victims, misdisfacts[i], csvout);
            }
        }
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x288, %rsp            # imm = 0x288
movq %rsi, %rbx
cmpl $0x14, %edi
je 0xc830
movl %edi, %ebp
cmpl $0x2, %edi
jne 0xd4a8
movq 0x8(%rbx), %r14
leaq 0x4349(%rip), %rsi      # 0x10b49
movq %r14, %rdi
callq 0x2240
testl %eax, %eax
je 0xd4c8
leaq 0x4335(%rip), %rsi      # 0x10b4c
movq %r14, %rdi
callq 0x2240
testl %eax, %eax
je 0xd4c8
cmpl $0x14, %ebp
jne 0xd4a8
leaq 0x9999(%rip), %r14      # 0x161d0
xorl %r12d, %r12d
leaq 0xa56f(%rip), %r15      # 0x16db0
leaq 0x1(%r12), %r13
movq 0x8(%rbx,%r12,8), %rsi
movq %r14, %rdi
callq 0xd8e6
movq %r15, %rdi
movq %r14, %rsi
callq 0xd982
movl %r12d, (%rax)
addq $0xa0, %r14
movq %r13, %r12
cmpq $0x13, %r13
jne 0xc841
leaq 0x3ee8(%rip), %rdi      # 0x10760
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq 0x9942(%rip), %r12      # 0x161d0
movl 0x50(%rax,%r12), %ebp
leaq 0x3ee8(%rip), %rdi      # 0x10782
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %r13d
leaq 0x3ef8(%rip), %rdi      # 0x107ad
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x68(%rsp)
leaq 0x3f08(%rip), %rdi      # 0x107e0
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x60(%rsp)
leaq 0x3ef8(%rip), %rdi      # 0x107f3
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0x240(%rsp)
leaq 0x3ef0(%rip), %rdi      # 0x1080d
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x248(%rsp)
leaq 0x3ed7(%rip), %rdi      # 0x1081a
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x250(%rsp)
leaq 0x3ef3(%rip), %rdi      # 0x1085c
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x258(%rsp)
leaq 0x3f26(%rip), %rdi      # 0x108b5
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x260(%rsp)
leaq 0x3f21(%rip), %rdi      # 0x108d6
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movsd 0x50(%rax,%r12), %xmm0
movsd %xmm0, 0x268(%rsp)
leaq 0x3f35(%rip), %rdi      # 0x10910
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0x94(%rsp)
leaq 0x3f59(%rip), %rdi      # 0x10956
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movq %rax, 0xb8(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x70(%rsp)
movq $0x0, 0x80(%rsp)
leaq 0x3f45(%rip), %rdi      # 0x1097b
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
leaq 0x190(%rsp), %r14
movq %r14, -0x10(%r14)
movq 0x58(%rax,%r12), %rsi
movq 0x60(%rax,%r12), %rdx
addq %rsi, %rdx
leaq 0x180(%rsp), %rdi
callq 0xde76
movq 0x180(%rsp), %rbx
leaq 0xa366(%rip), %rdi      # 0x16de0
movq %rbx, %rsi
callq 0x21a0
cmpq %r14, %rbx
je 0xca8f
movq %rbx, %rdi
callq 0x21b0
leaq 0xa34a(%rip), %rdi      # 0x16de0
leaq 0x40b6(%rip), %rsi      # 0x10b53
callq 0x22b0
testq %rax, %rax
je 0xcb00
leaq 0x70(%rsp), %rbx
leaq 0x180(%rsp), %r14
leaq 0x4098(%rip), %r15      # 0x10b53
movq %rax, %rdi
callq 0x22a0
movl %eax, 0x180(%rsp)
movq 0x78(%rsp), %rsi
cmpq 0x80(%rsp), %rsi
je 0xcae6
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, 0x78(%rsp)
jmp 0xcaf1
movq %rbx, %rdi
movq %r14, %rdx
callq 0x4520
xorl %edi, %edi
movq %r15, %rsi
callq 0x22b0
testq %rax, %rax
jne 0xcabb
leaq 0x3e9a(%rip), %rdi      # 0x109a1
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0x9c(%rsp)
leaq 0x3eb0(%rip), %rdi      # 0x109d9
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0x98(%rsp)
leaq 0x3f2d(%rip), %rdi      # 0x10a78
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movslq 0x50(%rax,%r12), %rbx
leaq 0x3ee7(%rip), %rdi      # 0x10a4d
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movq %rax, 0x58(%rsp)
testl %eax, %eax
jne 0xcb8f
xorl %edi, %edi
callq 0x2190
movq %rax, 0x58(%rsp)
leaq 0x3edd(%rip), %rdi      # 0x10a73
callq 0xc6bb
movq %rbx, 0x28(%rsp)
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0x3c(%rsp)
leaq 0x3ef2(%rip), %rdi      # 0x10aac
callq 0xc6bb
cltq
leaq (%rax,%rax,4), %rax
shlq $0x5, %rax
movl 0x50(%rax,%r12), %eax
movl %eax, 0xc(%rsp)
movl %ebp, 0x178(%rsp)
leaq 0x9120(%rip), %rax      # 0x15d00
movq %rax, 0x170(%rsp)
leaq 0x270(%rsp), %rax
movl %r13d, 0x8(%rax)
leaq 0x915d(%rip), %rcx      # 0x15d58
movq %rcx, (%rax)
movsd 0x68(%rsp), %xmm0
movsd %xmm0, 0x10(%rax)
movl %r13d, 0x158(%rsp)
leaq 0x9170(%rip), %rcx      # 0x15d88
movq %rcx, 0x150(%rsp)
movsd 0x60(%rsp), %xmm0
movsd %xmm0, 0x160(%rsp)
movq %rax, 0x168(%rsp)
movslq 0x58(%rsp), %rcx
movabsq $0x200000005, %rdx      # imm = 0x200000005
movq %rcx, %rax
mulq %rdx
movq %rcx, %r12
subq %rdx, %r12
shrq %r12
addq %rdx, %r12
shrq $0x1e, %r12
movq %r12, %rax
shlq $0x1f, %rax
subq %rax, %r12
leaq (%rcx,%r12), %rax
cmpq $0x1, %rax
adcq %rcx, %r12
movq 0x78(%rsp), %rax
subq 0x70(%rsp), %rax
shrq $0x2, %rax
movq %rax, 0x10(%rsp)
movslq %eax, %rbx
leaq 0xf8(%rsp), %rdi
leaq 0x180(%rsp), %rdx
movq %rbx, %rsi
callq 0xd9fe
leaq 0xe0(%rsp), %rdi
leaq 0x180(%rsp), %rdx
movq %rbx, %rsi
callq 0xd9fe
cmpl $0x0, 0x10(%rsp)
jle 0xcd27
movq 0x10(%rsp), %r14
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
leaq 0x180(%rsp), %rbx
movq 0x28(%rsp), %r13
movq 0xf8(%rsp), %rdi
addq %r15, %rdi
movq $0x0, 0x180(%rsp)
movq %r13, %rsi
movq %rbx, %rdx
callq 0xda86
movq 0xe0(%rsp), %rdi
addq %r15, %rdi
movq $0x0, 0x180(%rsp)
movq %r13, %rsi
movq %rbx, %rdx
callq 0xda86
addq $0x18, %r15
decq %r14
jne 0xccda
movq 0x28(%rsp), %rbx
movl %ebx, %eax
xorl $0x1, %eax
movq 0x10(%rsp), %rdx
movl %edx, %ecx
xorl $0x1, %ecx
orl %eax, %ecx
orl 0xc(%rsp), %ecx
setne 0x9(%rsp)
testl %ebx, %ebx
setle %cl
jle 0xd4c4
cmpl $0x1, %ebx
setne %al
cmpl $0x0, 0x3c(%rsp)
setg %sil
andb %al, %sil
movb %sil, 0xb(%rsp)
andl $0x7fffffff, %edx       # imm = 0x7FFFFFFF
movq %rdx, 0xd8(%rsp)
movq 0xb8(%rsp), %rax
decl %eax
movl %eax, 0x90(%rsp)
leaq 0x180(%rsp), %rdi
leaq 0xa0(%rsp), %r14
leaq 0x110(%rsp), %r15
movq $0x0, 0x30(%rsp)
movl $0x0, 0x1c(%rsp)
movb %cl, 0xa(%rsp)
cmpb $0x0, 0xb(%rsp)
je 0xcdce
movq 0x30(%rsp), %rax
xorl %edx, %edx
divl 0x3c(%rsp)
testl %edx, %edx
je 0xd47e
imulq $0xbc8f, %r12, %rcx     # imm = 0xBC8F
movq %rcx, %rax
movabsq $0x200000005, %rdx      # imm = 0x200000005
mulq %rdx
movq %rcx, %r12
subq %rdx, %r12
shrq %r12
addq %rdx, %r12
shrq $0x1e, %r12
movq %r12, %rax
shlq $0x1f, %rax
subq %rax, %r12
addq %rcx, %r12
leaq 0x170(%rsp), %rsi
movl %r12d, %edx
xorl %ecx, %ecx
movq %rdi, %r13
movl 0x94(%rsp), %r8d
callq 0xdaba
movq %r13, %rdi
callq 0x38ae
testb %al, %al
je 0xcf65
imulq $0xbc8f, %r12, %rcx     # imm = 0xBC8F
movq %rcx, %rax
movabsq $0x200000005, %rdx      # imm = 0x200000005
mulq %rdx
movq %rcx, %r12
subq %rdx, %r12
shrq %r12
addq %rdx, %r12
shrq $0x1e, %r12
movq %r12, %rax
shlq $0x1f, %rax
subq %rax, %r12
addq %rcx, %r12
leaq 0x180(%rsp), %rdi
leaq 0x150(%rsp), %rsi
movl %r12d, %edx
callq 0x546e
movl 0x90(%rsp), %ebx
cmpl $0x2, 0xb8(%rsp)
leaq 0x180(%rsp), %rbp
jl 0xcf24
imulq $0xbc8f, %r12, %rcx     # imm = 0xBC8F
movq %rcx, %rax
movabsq $0x200000005, %r13      # imm = 0x200000005
mulq %r13
movq %rcx, %r12
subq %rdx, %r12
shrq %r12
addq %rdx, %r12
shrq $0x1e, %r12
movq %r12, %rax
shlq $0x1f, %rax
subq %rax, %r12
addq %rcx, %r12
movq %rbp, %rdi
leaq 0x240(%rsp), %rsi
movl %r12d, %edx
callq 0x5574
imulq $0xbc8f, %r12, %rcx     # imm = 0xBC8F
movq %rcx, %rax
mulq %r13
movq %rcx, %r12
subq %rdx, %r12
shrq %r12
addq %rdx, %r12
shrq $0x1e, %r12
movq %r12, %rax
shlq $0x1f, %rax
subq %rax, %r12
addq %rcx, %r12
movq %rbp, %rdi
leaq 0x150(%rsp), %rsi
movl %r12d, %edx
callq 0x546e
decl %ebx
jne 0xce98
movq 0x230(%rsp), %rcx
movq -0x18(%rcx), %rax
movq -0x10(%rcx), %rcx
xorl %r13d, %r13d
cmpq %rcx, %rax
je 0xcf86
movq 0x198(%rsp), %rdx
movq 0x28(%rsp), %rbx
movslq (%rax), %rsi
xorl %r8d, %r8d
cmpl $0x0, (%rdx,%rsi,4)
setle %r8b
addl %r8d, %r13d
addq $0x4, %rax
cmpq %rcx, %rax
jne 0xcf49
jmp 0xcf8b
leaq 0x3bf3(%rip), %rdi      # 0x10b5f
callq 0x2280
movl $0x1, 0x1c(%rsp)
movl $0x0, 0x20(%rsp)
jmp 0xd3d6
movq 0x28(%rsp), %rbx
cmpb $0x0, 0x9(%rsp)
jne 0xcfe0
movq %rbp, %rdi
callq 0x31c2
leaq 0x3bdb(%rip), %rdi      # 0x10b7c
movl %eax, %esi
xorl %eax, %eax
callq 0x2050
leaq 0x180(%rsp), %rdi
callq 0x31de
leaq 0x3bcc(%rip), %rdi      # 0x10b8a
movl %eax, %esi
xorl %eax, %eax
callq 0x2050
leaq 0x3bc7(%rip), %rdi      # 0x10b95
movl %r13d, %esi
xorl %eax, %eax
callq 0x2050
leaq 0x180(%rsp), %rbp
movq %rbp, %rdi
callq 0x38ae
movl %eax, 0x20(%rsp)
cmpb $0x0, 0x20(%rsp)
je 0xd3a9
cmpl $0x0, 0x10(%rsp)
jle 0xd3d6
cvtsi2sd %r13d, %xmm0
movsd %xmm0, 0x68(%rsp)
xorl %ebx, %ebx
movq 0x70(%rsp), %rax
movl (%rax,%rbx,4), %esi
xorl %eax, %eax
movq %rax, 0x50(%rsp)
xorpd %xmm0, %xmm0
movapd %xmm0, 0x40(%rsp)
movq %rax, 0xd0(%rsp)
movapd %xmm0, 0xc0(%rsp)
cmpl $0x0, 0x9c(%rsp)
je 0xd06c
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq 0x58(%rsp), %rcx
movl 0x98(%rsp), %r8d
movsd 0x36eb(%rip), %xmm0     # 0x10750
callq 0x9ba6
jmp 0xd083
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rdx
movq 0x58(%rsp), %rcx
callq 0x9448
cmpb $0x0, 0x9(%rsp)
jne 0xd0a6
movq 0x48(%rsp), %rsi
subq 0x40(%rsp), %rsi
shrq $0x2, %rsi
leaq 0x3b02(%rip), %rdi      # 0x10ba1
xorl %eax, %eax
callq 0x2050
leaq 0x180(%rsp), %rdi
leaq 0x40(%rsp), %rsi
leaq 0xc0(%rsp), %rdx
movl $0x1, %ecx
movl $0x64, %r8d
callq 0x8350
movl $0x0, 0x118(%rsp)
xorl %ecx, %ecx
movq %rcx, 0x120(%rsp)
leaq 0x118(%rsp), %rax
movq %rax, 0x128(%rsp)
movq %rax, 0x130(%rsp)
movq %rcx, 0x138(%rsp)
movq 0x40(%rsp), %r13
movq 0x48(%rsp), %rbp
cmpq %rbp, %r13
je 0xd131
movl (%r13), %eax
movl %eax, 0xa0(%rsp)
movq %r15, %rdi
movq %r14, %rsi
callq 0xae9e
movl $0x0, (%rax)
addq $0x4, %r13
jmp 0xd10a
movq 0x230(%rsp), %rax
movq -0x18(%rax), %r13
movq -0x10(%rax), %rbp
cmpq %rbp, %r13
je 0xd174
movslq (%r13), %rsi
movq 0x198(%rsp), %rax
cmpl $0x0, (%rax,%rsi,4)
jne 0xd16e
shlq $0x2, %rsi
addq 0xc0(%rsp), %rsi
movq %r15, %rdi
callq 0xae9e
incl (%rax)
addq $0x4, %r13
jmp 0xd141
movq 0x128(%rsp), %rsi
movq %r14, %rdi
leaq 0x118(%rsp), %rdx
leaq 0x27(%rsp), %rcx
callq 0xdbd6
movq 0xa0(%rsp), %r13
movq 0xa8(%rsp), %rbp
cmpq %rbp, %r13
je 0xd1e1
movq %rbp, %rax
subq %r13, %rax
sarq $0x3, %rax
bsrq %rax, %rdx
xorl $0x3f, %edx
addl %edx, %edx
xorq $0x7e, %rdx
movq %r13, %rdi
movq %rbp, %rsi
leaq 0x5cb(%rip), %rcx       # 0xd795
callq 0xeb71
movq %r13, %rdi
movq %rbp, %rsi
leaq 0x5b9(%rip), %rdx       # 0xd795
callq 0xec3c
movq 0xa0(%rsp), %rax
movslq 0x4(%rax), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movq 0x48(%rsp), %rcx
subq 0x40(%rsp), %rcx
movsd 0x68(%rsp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, 0x60(%rsp)
sarq $0x2, %rcx
movq %rdx, %rsi
imulq %rcx, %rsi
movq %rsi, %xmm0
punpckldq 0x32ca(%rip), %xmm0 # xmm0 = xmm0[0],mem[0],xmm0[1],mem[1]
subpd 0x32d2(%rip), %xmm0     # 0x10500
movapd %xmm0, %xmm2
unpckhpd %xmm0, %xmm2            # xmm2 = xmm2[1],xmm0[1]
addsd %xmm0, %xmm2
divsd %xmm1, %xmm2
movapd %xmm2, 0x140(%rsp)
cmpb $0x0, 0x9(%rsp)
jne 0xd30c
cmpq $0x64, %rcx
ja 0xd2ed
leaq 0x3a43(%rip), %rdi      # 0x10ca6
callq 0x2280
movq 0xa0(%rsp), %r13
movq 0xa8(%rsp), %rbp
cmpq %rbp, %r13
leaq 0x392d(%rip), %r14      # 0x10baf
je 0xd30c
movslq 0x4(%r13), %rdx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
movsd 0x68(%rsp), %xmm3
divsd %xmm3, %xmm0
movq 0x48(%rsp), %rax
subq 0x40(%rsp), %rax
sarq $0x2, %rax
imulq %rdx, %rax
movq %rax, %xmm2
punpckldq 0x3234(%rip), %xmm2 # xmm2 = xmm2[0],mem[0],xmm2[1],mem[1]
subpd 0x323c(%rip), %xmm2     # 0x10500
movapd %xmm2, %xmm1
unpckhpd %xmm2, %xmm1            # xmm1 = xmm1[1],xmm2[1]
addsd %xmm2, %xmm1
divsd %xmm3, %xmm1
movl (%r13), %esi
movq %r14, %rdi
movb $0x2, %al
callq 0x2050
addq $0x8, %r13
cmpq %rbp, %r13
jne 0xd288
jmp 0xd30c
movl (%rax), %esi
leaq 0x38cf(%rip), %rdi      # 0x10bc5
movsd 0x60(%rsp), %xmm0
movapd 0x140(%rsp), %xmm1
movb $0x2, %al
callq 0x2050
movq 0xf8(%rsp), %rax
leaq (,%rbx,8), %rcx
leaq (%rcx,%rcx,2), %rcx
movq (%rax,%rcx), %rax
movq 0x30(%rsp), %rdx
movsd 0x60(%rsp), %xmm0
movsd %xmm0, (%rax,%rdx,8)
movq 0xe0(%rsp), %rax
movq (%rax,%rcx), %rax
movapd 0x140(%rsp), %xmm0
movsd %xmm0, (%rax,%rdx,8)
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xd360
callq 0x21b0
movq %r15, %rdi
callq 0xafca
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xd37a
callq 0x21b0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xd389
callq 0x21b0
incq %rbx
cmpq 0xd8(%rsp), %rbx
leaq 0xa0(%rsp), %r14
jne 0xd00f
movq 0x28(%rsp), %rbx
jmp 0xd3d6
leaq 0x37af(%rip), %rdi      # 0x10b5f
callq 0x2280
movq 0x8bfc(%rip), %rax      # 0x15fb8
movq (%rax), %rsi
movl $0x1, 0x1c(%rsp)
leaq 0x180(%rsp), %rdi
xorl %edx, %edx
callq 0x3544
leaq 0x228(%rsp), %rdi
callq 0xaf8a
leaq 0x210(%rsp), %rdi
callq 0xaf8a
leaq 0x1f8(%rsp), %rdi
callq 0xaf8a
leaq 0x1e0(%rsp), %rdi
callq 0xaf8a
leaq 0x1c8(%rsp), %rdi
callq 0xaf8a
movq 0x1b0(%rsp), %rdi
testq %rdi, %rdi
je 0xd429
callq 0x21b0
movq 0x198(%rsp), %rdi
testq %rdi, %rdi
je 0xd43b
callq 0x21b0
movq 0x180(%rsp), %rdi
testq %rdi, %rdi
je 0xd44d
callq 0x21b0
cmpb $0x0, 0x20(%rsp)
je 0xd52d
movq 0x30(%rsp), %rdx
incq %rdx
cmpq %rbx, %rdx
setae %cl
movq %rdx, 0x30(%rsp)
cmpq %rbx, %rdx
leaq 0x180(%rsp), %rdi
jne 0xcdb0
jmp 0xd4c4
movq 0x8b4b(%rip), %rax      # 0x15fd0
movq (%rax), %rdi
leaq 0x36c6(%rip), %rsi      # 0x10b55
movq 0x30(%rsp), %rdx
xorl %eax, %eax
callq 0x2250
leaq 0x180(%rsp), %rdi
jmp 0xcdce
movq 0x8b21(%rip), %rax      # 0x15fd0
movq (%rax), %rdi
movq (%rbx), %rsi
callq 0xd72a
movl $0x2, %ebp
jmp 0xd634
xorl %ebp, %ebp
jmp 0xd535
movq 0x8ae9(%rip), %r14      # 0x15fb8
movq (%r14), %rdi
movq (%rbx), %rsi
callq 0xd72a
movl $0xa, %edi
callq 0x2230
movq (%r14), %rbx
movl $0x80, %r15d
leaq 0x8cdc(%rip), %r12      # 0x161d0
leaq 0x3738(%rip), %r14      # 0x10c33
xorl %ebp, %ebp
movq -0x80(%r15,%r12), %rdx
movq -0x58(%r15,%r12), %rcx
movq (%r15,%r12), %r8
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2250
addq $0xa0, %r15
cmpq $0xc60, %r15            # imm = 0xC60
jne 0xd4fd
jmp 0xd634
movb 0xa(%rsp), %cl
movl 0x1c(%rsp), %ebp
movb 0x9(%rsp), %al
andb %cl, %al
cmpb $0x1, %al
movq 0x10(%rsp), %rbx
jne 0xd60b
movq 0x28(%rsp), %rdx
cmpl $0x2, %edx
jge 0xd648
cmpl $0x0, 0xc(%rsp)
je 0xd569
leaq 0x370a(%rip), %rdi      # 0x10c6e
callq 0x2280
testl %ebx, %ebx
jle 0xd5b8
movq 0x10(%rsp), %r14
andl $0x7fffffff, %r14d      # imm = 0x7FFFFFFF
xorl %r15d, %r15d
leaq 0x3686(%rip), %rbx      # 0x10c09
xorl %r12d, %r12d
xorl %ecx, %ecx
cmpl $0x0, 0xc(%rsp)
setne %cl
movq 0x70(%rsp), %rax
movl (%rax,%r12,4), %esi
movq 0xf8(%rsp), %rdx
addq %r15, %rdx
movq %rbx, %rdi
callq 0xc528
incq %r12
addq $0x18, %r15
cmpq %r12, %r14
jne 0xd586
xorl %ebp, %ebp
cmpl $0x0, 0xc(%rsp)
jne 0xd60b
movq 0x10(%rsp), %r12
testl %r12d, %r12d
jle 0xd60b
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
xorl %r14d, %r14d
leaq 0x3638(%rip), %rbx      # 0x10c14
xorl %r15d, %r15d
movq 0x70(%rsp), %rax
movl (%rax,%r15,4), %esi
movq 0xe0(%rsp), %rdx
addq %r14, %rdx
movq %rbx, %rdi
xorl %ecx, %ecx
callq 0xc528
incq %r15
addq $0x18, %r14
cmpq %r15, %r12
jne 0xd5df
xorl %ebp, %ebp
leaq 0xe0(%rsp), %rdi
callq 0xdc74
leaq 0xf8(%rsp), %rdi
callq 0xdc74
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xd634
callq 0x21b0
movl %ebp, %eax
addq $0x288, %rsp            # imm = 0x288
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x8981(%rip), %rax      # 0x15fd0
movq (%rax), %rdi
leaq 0x35a6(%rip), %rsi      # 0x10bff
xorl %eax, %eax
callq 0x2250
jmp 0xd556
movq %rax, %rbx
jmp 0xd706
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
jmp 0xd67d
movq %rax, %rbx
jmp 0xd713
jmp 0xd691
jmp 0xd691
jmp 0xd691
jmp 0xd6b4
jmp 0xd6b4
jmp 0xd691
movq %rax, %rbx
jmp 0xd6f9
jmp 0xd6bb
movq %rax, %rbx
movq 0xa0(%rsp), %rdi
testq %rdi, %rdi
je 0xd6be
callq 0x21b0
jmp 0xd6be
movq %rax, %rbx
jmp 0xd6cb
movq %rax, %rbx
jmp 0xd6ec
jmp 0xd6bb
movq %rax, %rbx
leaq 0x110(%rsp), %rdi
callq 0xafca
movq 0xc0(%rsp), %rdi
testq %rdi, %rdi
je 0xd6dd
callq 0x21b0
movq 0x40(%rsp), %rdi
testq %rdi, %rdi
je 0xd6ec
callq 0x21b0
leaq 0x180(%rsp), %rdi
callq 0xdc10
leaq 0xe0(%rsp), %rdi
callq 0xdc74
leaq 0xf8(%rsp), %rdi
callq 0xdc74
movq 0x70(%rsp), %rdi
testq %rdi, %rdi
je 0xd722
callq 0x21b0
movq %rbx, %rdi
callq 0x22f0