// File: icemiliang[P]vot/demo/votx.cpp
// Function: main
int main(int argc, char* argv[]) {

    try {
        std::string appName = fs::basename(argv[0]); 
        std::string dmFile, emFile;
        int maxIterP, maxIterH; // Position of centroids & Minimizier H
        double thres, plotScale, learnRate;
        std::string outDir;
        bool verb, debug;

        // Define and parse the program options //
        po::options_description desc("Options");
        desc.add_options()
            ("dirac,d", po::value<std::string>(&dmFile)->required(), 
                "Particles associated with Dirac measures")
            ("empirical,e", po::value<std::string>(&emFile)->required(), 
                "Test points associated with Empirical measures")
            ("iterD,p", po::value<int>(&maxIterP)->default_value(5), 
                "Max iteration for updating Dirac positions. Default is 5.")
            ("iterH,h", po::value<int>(&maxIterH)->default_value(1000), 
                "Max iteration for updating diagram/'H', or size of cells. Default is 1000.")
            ("threshold,t", po::value<double>(&thres)->default_value(1.0e-06), 
                "Threshold for terminating the program. Default is 1e-06")
            ("scale,s", po::value<double>(&plotScale)->default_value(1), 
                "Scale of the output diagram. Default is 1.")
            ("rate,r", po::value<double>(&learnRate)->default_value(0.2), 
                "Learning rate. Setting this parameter means you want to use GD instead of Newton.")
            ("outdir,o", po::value<std::string>(&outDir), 
                "Output directory")
            ("verbose,v", po::value<bool>(&verb)->default_value(false), 
                "Verbose output (both console and files). Default is False.")
            ("debug,b", po::value<bool>(&debug)->default_value(false), 
                "Multiple-point check. Default is False.")
            ("help", "Print help messages");
        po::variables_map vm;
        
        try {
            po::store(po::parse_command_line(argc, argv, desc), vm); // can throw 

            //  --help option  //
            if (vm.count("help") || argc < 2) {
                print_welcome_message();
                std::cout << desc << std::endl;
                return SUCCESS;
            }

            po::notify(vm); // TODO: What does this line do?
        }
        catch(po::required_option& e) {
            std::cerr << "ERROR: " << e.what() << std::endl << std::endl; 
            return ERROR_IN_COMMAND_LINE; 
        }
        catch(po::error& e){
            std::cerr << "ERROR: " << e.what() << std::endl << std::endl;
            std::cerr << desc << std::endl;
            return ERROR_IN_COMMAND_LINE;
        }

        // Displaying paramters // 
        int slashD = dmFile.find_last_of("/\\");
        int slashE = emFile.find_last_of("/\\");
        std::string outPrefix = "D" 
                              + dmFile.substr(slashD + 1, dmFile.length() - 6 - slashD) 
                              + "_E" 
                              + emFile.substr(slashE + 1, emFile.length() - 6 - slashE);
                              
        if (!outDir.empty()) outPrefix = outDir + "/" + outPrefix;

        fs::path dir(outDir.c_str());
        if (!outDir.empty() && !fs::is_directory(outDir)) {
            std::cerr << "Directory not found: " << std::endl;
            std::cerr << "Creating: " << std::endl;
            if (fs::create_directory(dir)) { 
                std::cerr << "Directory created: " << outDir << std::endl; 
            }
            else {
                std::cerr << "Error during creating the directory. "
                          << "Write output in the current directory." << std::endl;  
                outDir.clear();
            }   
        }
        
        std::cout << "Dirac measure file: " << dmFile << std::endl;
        std::cout << "Empirical measure file: " << emFile << std::endl;
        std::cout << "Max iteration for updating centroid positions: " << maxIterP << std::endl;
        std::cout << "Max iteration for updating 'H': " << maxIterH << std::endl;
        std::cout << "Learning rate: " << learnRate << std::endl;
        std::cout << "Threshold for terminating the program: " << thres << std::endl;
        std::cout << "Scale of the output diagram: " << plotScale << std::endl;
        std::cout << "Output prefix: " << outPrefix << std::endl;
        std::cout << "Berbose flag: " << verb << std::endl;
        std::cout << "Debug flag: " << debug << std::endl;

        // ----------------------------//
        // ------- Start program ------//
        // ----------------------------//

        OTX *otx = new OTX();
        std::cout << std::endl;

        otx->import_data(dmFile, emFile);

        std::cout << "--> Setting up parameters... " << std::endl;
        otx->setup(maxIterP, maxIterH, thres, learnRate, verb, plotScale, outPrefix, debug);
        std::cout << std::endl;

        std::cout << "--> Running variational Wasserstein clustering..." << std::endl << std::endl;
        otx->cluster();

    }
    catch(std::exception& e){
        std::cerr << "Unhandled Exception reached the top of main: " 
                  << e.what() << ", application will now exit" << std::endl;
        return ERROR_UNHANDLED_EXCEPTION;
    }

    return SUCCESS;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x780, %rsp            # imm = 0x780
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq -0x50(%rbp), %rdi
callq 0xbc20
jmp 0x9f0b
leaq -0x30(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0xbba0
jmp 0x9f1a
leaq -0x50(%rbp), %rdi
callq 0xbc90
leaq -0x80(%rbp), %rdi
callq 0x9690
leaq -0xa0(%rbp), %rdi
callq 0x9690
leaq -0xe0(%rbp), %rdi
callq 0x9690
leaq -0x189(%rbp), %rdi
movq %rdi, -0x490(%rbp)
callq 0x98e0
movq -0x490(%rbp), %rdx
leaq 0x1b135(%rip), %rsi     # 0x2509a
leaq -0x188(%rbp), %rdi
callq 0xb490
jmp 0x9f73
movq 0x2cfd6(%rip), %rax     # 0x36f50
movl (%rax), %edx
movl %edx, %ecx
shrl %ecx
leaq -0x168(%rbp), %rdi
leaq -0x188(%rbp), %rsi
callq 0x9680
jmp 0x9f95
leaq -0x188(%rbp), %rdi
callq 0x9a08
leaq -0x189(%rbp), %rdi
callq 0x94f0
leaq -0x168(%rbp), %rdi
callq 0x9560
movq %rax, -0x498(%rbp)
jmp 0x9fc2
movq -0x498(%rbp), %rax
movq %rax, -0x198(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xbcb0
movq %rax, -0x4a0(%rbp)
jmp 0x9fe2
movq -0x4a0(%rbp), %rdi
callq 0xbd10
movq %rax, -0x4a8(%rbp)
jmp 0x9ff7
movq -0x4a8(%rbp), %rdx
leaq 0x1b09d(%rip), %rsi     # 0x250a2
leaq 0x1b09e(%rip), %rcx     # 0x250aa
leaq -0x198(%rbp), %rdi
callq 0x9980
movq %rax, -0x4b0(%rbp)
jmp 0xa021
leaq -0xa0(%rbp), %rdi
callq 0xbcb0
movq %rax, -0x4b8(%rbp)
jmp 0xa036
movq -0x4b8(%rbp), %rdi
callq 0xbd10
movq %rax, -0x4c0(%rbp)
jmp 0xa04b
movq -0x4c0(%rbp), %rdx
movq -0x4b0(%rbp), %rdi
leaq 0x1b073(%rip), %rsi     # 0x250d3
leaq 0x1b078(%rip), %rcx     # 0x250df
callq 0x9980
movq %rax, -0x4c8(%rbp)
jmp 0xa075
leaq -0xa4(%rbp), %rdi
callq 0xbd30
movq %rax, -0x4d0(%rbp)
jmp 0xa08a
movq -0x4d0(%rbp), %rdi
movl $0x5, -0x19c(%rbp)
leaq -0x19c(%rbp), %rsi
callq 0xbd90
movq %rax, -0x4d8(%rbp)
jmp 0xa0b0
movq -0x4d8(%rbp), %rdx
movq -0x4c8(%rbp), %rdi
leaq 0x1b049(%rip), %rsi     # 0x2510e
leaq 0x1b04a(%rip), %rcx     # 0x25116
callq 0x9980
movq %rax, -0x4e0(%rbp)
jmp 0xa0da
leaq -0xa8(%rbp), %rdi
callq 0xbd30
movq %rax, -0x4e8(%rbp)
jmp 0xa0ef
movq -0x4e8(%rbp), %rdi
movl $0x3e8, -0x1a0(%rbp)    # imm = 0x3E8
leaq -0x1a0(%rbp), %rsi
callq 0xbd90
movq %rax, -0x4f0(%rbp)
jmp 0xa115
movq -0x4f0(%rbp), %rdx
movq -0x4e0(%rbp), %rdi
leaq 0x1b026(%rip), %rsi     # 0x25150
leaq 0x1b027(%rip), %rcx     # 0x25158
callq 0x9980
movq %rax, -0x4f8(%rbp)
jmp 0xa13f
leaq -0xb0(%rbp), %rdi
callq 0xbe00
movq %rax, -0x500(%rbp)
jmp 0xa154
movq -0x500(%rbp), %rdi
movabsq $0x3eb0c6f7a0b5ed8d, %rax # imm = 0x3EB0C6F7A0B5ED8D
movq %rax, -0x1a8(%rbp)
leaq -0x1a8(%rbp), %rsi
callq 0xbe60
movq %rax, -0x508(%rbp)
jmp 0xa181
movq -0x508(%rbp), %rdx
movq -0x4f8(%rbp), %rdi
leaq 0x1b00d(%rip), %rsi     # 0x251a3
leaq 0x1b012(%rip), %rcx     # 0x251af
callq 0x9980
movq %rax, -0x510(%rbp)
jmp 0xa1ab
leaq -0xb8(%rbp), %rdi
callq 0xbe00
movq %rax, -0x518(%rbp)
jmp 0xa1c0
movq -0x518(%rbp), %rdi
movabsq $0x3ff0000000000000, %rax # imm = 0x3FF0000000000000
movq %rax, -0x1b0(%rbp)
leaq -0x1b0(%rbp), %rsi
callq 0xbe60
movq %rax, -0x520(%rbp)
jmp 0xa1ed
movq -0x520(%rbp), %rdx
movq -0x510(%rbp), %rdi
leaq 0x1afe5(%rip), %rsi     # 0x251e7
leaq 0x1afe6(%rip), %rcx     # 0x251ef
callq 0x9980
movq %rax, -0x528(%rbp)
jmp 0xa217
leaq -0xc0(%rbp), %rdi
callq 0xbe00
movq %rax, -0x530(%rbp)
jmp 0xa22c
movq -0x530(%rbp), %rdi
movabsq $0x3fc999999999999a, %rax # imm = 0x3FC999999999999A
movq %rax, -0x1b8(%rbp)
leaq -0x1b8(%rbp), %rsi
callq 0xbe60
movq %rax, -0x538(%rbp)
jmp 0xa259
movq -0x538(%rbp), %rdx
movq -0x528(%rbp), %rdi
leaq 0x1afac(%rip), %rsi     # 0x2521a
leaq 0x1afac(%rip), %rcx     # 0x25221
callq 0x9980
movq %rax, -0x540(%rbp)
jmp 0xa283
leaq -0xe0(%rbp), %rdi
callq 0xbcb0
movq %rax, -0x548(%rbp)
jmp 0xa298
movq -0x548(%rbp), %rdx
movq -0x540(%rbp), %rdi
leaq 0x1afc6(%rip), %rsi     # 0x25273
leaq 0x1afc8(%rip), %rcx     # 0x2527c
callq 0x9980
movq %rax, -0x550(%rbp)
jmp 0xa2c2
leaq -0xe1(%rbp), %rdi
callq 0xbed0
movq %rax, -0x558(%rbp)
jmp 0xa2d7
movq -0x558(%rbp), %rdi
movb $0x0, -0x1b9(%rbp)
leaq -0x1b9(%rbp), %rsi
callq 0xbf30
movq %rax, -0x560(%rbp)
jmp 0xa2fa
movq -0x560(%rbp), %rdx
movq -0x550(%rbp), %rdi
leaq 0x1af7e(%rip), %rsi     # 0x2528d
leaq 0x1af81(%rip), %rcx     # 0x25297
callq 0x9980
movq %rax, -0x568(%rbp)
jmp 0xa324
leaq -0xe2(%rbp), %rdi
callq 0xbed0
movq %rax, -0x570(%rbp)
jmp 0xa339
movq -0x570(%rbp), %rdi
movb $0x0, -0x1ba(%rbp)
leaq -0x1ba(%rbp), %rsi
callq 0xbf30
movq %rax, -0x578(%rbp)
jmp 0xa35c
movq -0x578(%rbp), %rdx
movq -0x568(%rbp), %rdi
leaq 0x1af61(%rip), %rsi     # 0x252d2
leaq 0x1af62(%rip), %rcx     # 0x252da
callq 0x9980
movq %rax, -0x580(%rbp)
jmp 0xa386
movq -0x580(%rbp), %rdi
leaq 0x1af6e(%rip), %rsi     # 0x25302
leaq 0x1af6c(%rip), %rdx     # 0x25307
callq 0x9920
jmp 0xa3a2
leaq -0x260(%rbp), %rdi
callq 0x91e0
jmp 0xa3b0
movl -0x8(%rbp), %eax
movl %eax, -0x58c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x588(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x2a0(%rbp)
movaps %xmm0, -0x2b0(%rbp)
leaq -0x2b0(%rbp), %rdi
callq 0xc0e0
jmp 0xa3e3
movq -0x588(%rbp), %rdx
movl -0x58c(%rbp), %esi
leaq -0x288(%rbp), %rdi
leaq -0x168(%rbp), %rcx
xorl %r8d, %r8d
leaq -0x2b0(%rbp), %r9
callq 0xbfa0
jmp 0xa40f
leaq -0x288(%rbp), %rdi
leaq -0x260(%rbp), %rsi
xorl %edx, %edx
callq 0x98b0
jmp 0xa426
leaq -0x288(%rbp), %rdi
callq 0xc100
leaq -0x2b0(%rbp), %rdi
callq 0xc120
leaq -0x250(%rbp), %rax
movq %rax, -0x5a0(%rbp)
leaq -0x2d1(%rbp), %rdi
movq %rdi, -0x598(%rbp)
callq 0x98e0
movq -0x598(%rbp), %rdx
leaq 0x1ae95(%rip), %rsi     # 0x25302
leaq -0x2d0(%rbp), %rdi
callq 0xb490
jmp 0xa47b
movq -0x5a0(%rbp), %rdi
leaq -0x2d0(%rbp), %rsi
callq 0xc150
movq %rax, -0x5a8(%rbp)
jmp 0xa497
movq -0x5a8(%rbp), %rcx
movb $0x1, %al
cmpq $0x0, %rcx
movb %al, -0x5a9(%rbp)
jne 0xa4b9
cmpl $0x2, -0x8(%rbp)
setl %al
movb %al, -0x5a9(%rbp)
movb -0x5a9(%rbp), %al
movb %al, -0x5aa(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x9a08
leaq -0x2d1(%rbp), %rdi
callq 0x94f0
movb -0x5aa(%rbp), %al
testb $0x1, %al
jne 0xa4ec
jmp 0xa7b8
callq 0x9ea0
jmp 0xa4f3
movq 0x2caae(%rip), %rdi     # 0x36fa8
leaq -0x168(%rbp), %rsi
callq 0x90e0
movq %rax, -0x5b8(%rbp)
jmp 0xa50f
movq -0x5b8(%rbp), %rdi
movq 0x2ca2b(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xa524
movl $0x0, -0x4(%rbp)
movl $0x1, -0x2d8(%rbp)
jmp 0xb1fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb31a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0xbc90
jmp 0xb31a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa58b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x9a08
leaq -0x189(%rbp), %rdi
callq 0x94f0
jmp 0xb2f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb2e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa621
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa5e1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x288(%rbp), %rdi
callq 0xc100
leaq -0x2b0(%rbp), %rdi
callq 0xc120
jmp 0xa621
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xa615
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x2d0(%rbp), %rdi
callq 0x9a08
leaq -0x2d1(%rbp), %rdi
callq 0x94f0
movl -0x5c(%rbp), %eax
movl %eax, -0x5bc(%rbp)
movl $0x3, %ecx
cmpl %ecx, %eax
jne 0xa6d7
movq -0x58(%rbp), %rdi
callq 0x91c0
movq %rax, -0x2e8(%rbp)
movq 0x2c992(%rip), %rdi     # 0x36fe0
leaq 0x1acc6(%rip), %rsi     # 0x2531b
callq 0x9480
movq %rax, -0x5c8(%rbp)
jmp 0xa663
movq -0x2e8(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x5c8(%rbp), %rdi
movq %rax, %rsi
callq 0x9480
movq %rax, -0x5d0(%rbp)
jmp 0xa68b
movq -0x5d0(%rbp), %rdi
movq 0x2c8af(%rip), %rsi     # 0x36f48
callq 0x94d0
movq %rax, -0x5d8(%rbp)
jmp 0xa6a7
movq -0x5d8(%rbp), %rdi
movq 0x2c893(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xa6bc
movl $0x1, -0x4(%rbp)
movl $0x1, -0x2d8(%rbp)
callq 0x9810
jmp 0xa809
movl -0x5bc(%rbp), %eax
movl $0x2, %ecx
cmpl %ecx, %eax
jne 0xb2d8
movq -0x58(%rbp), %rdi
callq 0x91c0
movq %rax, -0x2e0(%rbp)
movq 0x2c8df(%rip), %rdi     # 0x36fe0
leaq 0x1ac13(%rip), %rsi     # 0x2531b
callq 0x9480
movq %rax, -0x5e0(%rbp)
jmp 0xa716
movq -0x2e0(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x5e0(%rbp), %rdi
movq %rax, %rsi
callq 0x9480
movq %rax, -0x5e8(%rbp)
jmp 0xa73e
movq -0x5e8(%rbp), %rdi
movq 0x2c7fc(%rip), %rsi     # 0x36f48
callq 0x94d0
movq %rax, -0x5f0(%rbp)
jmp 0xa75a
movq -0x5f0(%rbp), %rdi
movq 0x2c7e0(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xa76f
movq 0x2c86a(%rip), %rdi     # 0x36fe0
leaq -0x168(%rbp), %rsi
callq 0x90e0
movq %rax, -0x5f8(%rbp)
jmp 0xa78b
movq -0x5f8(%rbp), %rdi
movq 0x2c7af(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xa7a0
movl $0x1, -0x4(%rbp)
movl $0x1, -0x2d8(%rbp)
callq 0x9810
jmp 0xa7db
leaq -0x260(%rbp), %rdi
callq 0x9290
jmp 0xa7c6
jmp 0xa813
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x9810
jmp 0xa7f1
jmp 0xb1fd
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb2d8
jmp 0xb2d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x9810
jmp 0xa80e
jmp 0xb1fd
jmp 0xb2d8
leaq 0x1ab09(%rip), %rsi     # 0x25323
movq %rsi, -0x618(%rbp)
leaq -0x80(%rbp), %rdi
movq %rdi, -0x608(%rbp)
movq $-0x1, %rdx
movq %rdx, -0x610(%rbp)
callq 0x9460
movq -0x618(%rbp), %rsi
movq -0x610(%rbp), %rdx
movl %eax, -0x2ec(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x9460
movq -0x608(%rbp), %rdi
movl %eax, -0x2f0(%rbp)
movl -0x2ec(%rbp), %eax
incl %eax
cltq
movq %rax, -0x600(%rbp)
callq 0x9740
movq -0x608(%rbp), %rsi
movq -0x600(%rbp), %rdx
movq %rax, %rcx
movslq -0x2ec(%rbp), %rax
subq %rax, %rcx
addq $-0x6, %rcx
leaq -0x370(%rbp), %rdi
callq 0x94b0
jmp 0xa8af
leaq 0x1aa70(%rip), %rsi     # 0x25326
leaq -0x350(%rbp), %rdi
leaq -0x370(%rbp), %rdx
callq 0xc2d0
jmp 0xa8cb
leaq 0x1aa56(%rip), %rdx     # 0x25328
leaq -0x330(%rbp), %rdi
leaq -0x350(%rbp), %rsi
callq 0xc280
jmp 0xa8e7
movl -0x2f0(%rbp), %eax
incl %eax
cltq
movq %rax, -0x620(%rbp)
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x628(%rbp)
callq 0x9740
movq -0x628(%rbp), %rsi
movq -0x620(%rbp), %rdx
movq %rax, %rcx
movslq -0x2f0(%rbp), %rax
subq %rax, %rcx
addq $-0x6, %rcx
leaq -0x390(%rbp), %rdi
callq 0x94b0
jmp 0xa938
leaq -0x310(%rbp), %rdi
leaq -0x330(%rbp), %rsi
leaq -0x390(%rbp), %rdx
callq 0xc1b0
jmp 0xa954
leaq -0x390(%rbp), %rdi
callq 0x9a08
leaq -0x330(%rbp), %rdi
callq 0x9a08
leaq -0x350(%rbp), %rdi
callq 0x9a08
leaq -0x370(%rbp), %rdi
callq 0x9a08
leaq -0xe0(%rbp), %rdi
callq 0x9830
testb $0x1, %al
jne 0xaa99
leaq 0x1a98c(%rip), %rdx     # 0x2532b
leaq -0x3d0(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xc370
jmp 0xa9b4
leaq -0x3b0(%rbp), %rdi
leaq -0x3d0(%rbp), %rsi
leaq -0x310(%rbp), %rdx
callq 0xc320
jmp 0xa9d0
leaq -0x310(%rbp), %rdi
leaq -0x3b0(%rbp), %rsi
callq 0x9580
leaq -0x3b0(%rbp), %rdi
callq 0x9a08
leaq -0x3d0(%rbp), %rdi
callq 0x9a08
jmp 0xaa99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xaa5a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xaa4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xaa42
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x390(%rbp), %rdi
callq 0x9a08
leaq -0x330(%rbp), %rdi
callq 0x9a08
leaq -0x350(%rbp), %rdi
callq 0x9a08
leaq -0x370(%rbp), %rdi
callq 0x9a08
jmp 0xb2d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb2cc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x3d0(%rbp), %rdi
callq 0x9a08
jmp 0xb2cc
leaq -0xe0(%rbp), %rdi
callq 0x91d0
movq %rax, %rsi
leaq -0x3f0(%rbp), %rdi
callq 0xc3f0
jmp 0xaab6
leaq -0xe0(%rbp), %rdi
callq 0x9830
movb %al, %cl
movb $0x0, -0x411(%rbp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x629(%rbp)
jne 0xab16
leaq -0x410(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0xc490
jmp 0xaaed
movb $0x1, -0x411(%rbp)
leaq -0x410(%rbp), %rdi
callq 0xc460
movb %al, -0x62a(%rbp)
jmp 0xab08
movb -0x62a(%rbp), %al
xorb $-0x1, %al
movb %al, -0x629(%rbp)
movb -0x629(%rbp), %al
movb %al, -0x62b(%rbp)
testb $0x1, -0x411(%rbp)
jne 0xab2d
jmp 0xab39
leaq -0x410(%rbp), %rdi
callq 0xbc90
movb -0x62b(%rbp), %al
testb $0x1, %al
jne 0xab48
jmp 0xacb3
movq 0x2c491(%rip), %rdi     # 0x36fe0
leaq 0x1a7d7(%rip), %rsi     # 0x2532d
callq 0x9480
movq %rax, -0x638(%rbp)
jmp 0xab64
movq -0x638(%rbp), %rdi
movq 0x2c3d6(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xab79
movq 0x2c460(%rip), %rdi     # 0x36fe0
leaq 0x1a7bc(%rip), %rsi     # 0x25343
callq 0x9480
movq %rax, -0x640(%rbp)
jmp 0xab95
movq -0x640(%rbp), %rdi
movq 0x2c3a5(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xabaa
leaq -0x3f0(%rbp), %rdi
callq 0xc4c0
movb %al, -0x641(%rbp)
jmp 0xabbe
movb -0x641(%rbp), %al
testb $0x1, %al
jne 0xabcd
jmp 0xac58
movq 0x2c40c(%rip), %rdi     # 0x36fe0
leaq 0x1a773(%rip), %rsi     # 0x2534e
callq 0x9480
movq %rax, -0x650(%rbp)
jmp 0xabe9
movq -0x650(%rbp), %rdi
leaq -0xe0(%rbp), %rsi
callq 0x9440
movq %rax, -0x658(%rbp)
jmp 0xac05
movq -0x658(%rbp), %rdi
movq 0x2c335(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xac1a
jmp 0xacb1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb2c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
testb $0x1, -0x411(%rbp)
jne 0xac47
jmp 0xac53
leaq -0x410(%rbp), %rdi
callq 0xbc90
jmp 0xb2c0
movq 0x2c381(%rip), %rdi     # 0x36fe0
leaq 0x1a6fc(%rip), %rsi     # 0x25362
callq 0x9480
movq %rax, -0x660(%rbp)
jmp 0xac74
movq -0x660(%rbp), %rdi
leaq 0x1a706(%rip), %rsi     # 0x25388
callq 0x9480
movq %rax, -0x668(%rbp)
jmp 0xac90
movq -0x668(%rbp), %rdi
movq 0x2c2aa(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xaca5
leaq -0xe0(%rbp), %rdi
callq 0x9620
jmp 0xacb3
movq 0x2c2ee(%rip), %rdi     # 0x36fa8
leaq 0x1a6ee(%rip), %rsi     # 0x253af
callq 0x9480
movq %rax, -0x670(%rbp)
jmp 0xaccf
movq -0x670(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x9440
movq %rax, -0x678(%rbp)
jmp 0xace8
movq -0x678(%rbp), %rdi
movq 0x2c252(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xacfd
movq 0x2c2a4(%rip), %rdi     # 0x36fa8
leaq 0x1a6b9(%rip), %rsi     # 0x253c4
callq 0x9480
movq %rax, -0x680(%rbp)
jmp 0xad19
movq -0x680(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x9440
movq %rax, -0x688(%rbp)
jmp 0xad35
movq -0x688(%rbp), %rdi
movq 0x2c205(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xad4a
movq 0x2c257(%rip), %rdi     # 0x36fa8
leaq 0x1a685(%rip), %rsi     # 0x253dd
callq 0x9480
movq %rax, -0x690(%rbp)
jmp 0xad66
movq -0x690(%rbp), %rdi
movl -0xa4(%rbp), %esi
callq 0x9890
movq %rax, -0x698(%rbp)
jmp 0xad81
movq -0x698(%rbp), %rdi
movq 0x2c1b9(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xad96
movq 0x2c20b(%rip), %rdi     # 0x36fa8
leaq 0x1a669(%rip), %rsi     # 0x2540d
callq 0x9480
movq %rax, -0x6a0(%rbp)
jmp 0xadb2
movq -0x6a0(%rbp), %rdi
movl -0xa8(%rbp), %esi
callq 0x9890
movq %rax, -0x6a8(%rbp)
jmp 0xadcd
movq -0x6a8(%rbp), %rdi
movq 0x2c16d(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xade2
movq 0x2c1bf(%rip), %rdi     # 0x36fa8
leaq 0x1a63e(%rip), %rsi     # 0x2542e
callq 0x9480
movq %rax, -0x6b0(%rbp)
jmp 0xadfe
movq -0x6b0(%rbp), %rdi
movsd -0xc0(%rbp), %xmm0
callq 0x9960
movq %rax, -0x6b8(%rbp)
jmp 0xae1b
movq -0x6b8(%rbp), %rdi
movq 0x2c11f(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xae30
movq 0x2c171(%rip), %rdi     # 0x36fa8
leaq 0x1a600(%rip), %rsi     # 0x2543e
callq 0x9480
movq %rax, -0x6c0(%rbp)
jmp 0xae4c
movq -0x6c0(%rbp), %rdi
movsd -0xb0(%rbp), %xmm0
callq 0x9960
movq %rax, -0x6c8(%rbp)
jmp 0xae69
movq -0x6c8(%rbp), %rdi
movq 0x2c0d1(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xae7e
movq 0x2c123(%rip), %rdi     # 0x36fa8
leaq 0x1a5da(%rip), %rsi     # 0x25466
callq 0x9480
movq %rax, -0x6d0(%rbp)
jmp 0xae9a
movq -0x6d0(%rbp), %rdi
movsd -0xb8(%rbp), %xmm0
callq 0x9960
movq %rax, -0x6d8(%rbp)
jmp 0xaeb7
movq -0x6d8(%rbp), %rdi
movq 0x2c083(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xaecc
movq 0x2c0d5(%rip), %rdi     # 0x36fa8
leaq 0x1a5aa(%rip), %rsi     # 0x25484
callq 0x9480
movq %rax, -0x6e0(%rbp)
jmp 0xaee8
movq -0x6e0(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x9440
movq %rax, -0x6e8(%rbp)
jmp 0xaf04
movq -0x6e8(%rbp), %rdi
movq 0x2c036(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xaf19
movq 0x2c088(%rip), %rdi     # 0x36fa8
leaq 0x1a56d(%rip), %rsi     # 0x25494
callq 0x9480
movq %rax, -0x6f0(%rbp)
jmp 0xaf35
movq -0x6f0(%rbp), %rdi
movzbl -0xe1(%rbp), %esi
andl $0x1, %esi
callq 0x98f0
movq %rax, -0x6f8(%rbp)
jmp 0xaf54
movq -0x6f8(%rbp), %rdi
movq 0x2bfe6(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xaf69
movq 0x2c038(%rip), %rdi     # 0x36fa8
leaq 0x1a52c(%rip), %rsi     # 0x254a3
callq 0x9480
movq %rax, -0x700(%rbp)
jmp 0xaf85
movq -0x700(%rbp), %rdi
movzbl -0xe2(%rbp), %esi
andl $0x1, %esi
callq 0x98f0
movq %rax, -0x708(%rbp)
jmp 0xafa4
movq -0x708(%rbp), %rdi
movq 0x2bf96(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xafb9
movl $0xa8, %edi
callq 0x9490
movq %rax, -0x710(%rbp)
jmp 0xafcc
movq -0x710(%rbp), %rdi
callq 0xc4f0
jmp 0xafda
movq -0x710(%rbp), %rax
movq %rax, -0x420(%rbp)
movq 0x2bfb9(%rip), %rdi     # 0x36fa8
movq 0x2bf52(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xaffd
movq -0x420(%rbp), %rax
movq %rax, -0x718(%rbp)
leaq -0x440(%rbp), %rdi
leaq -0x80(%rbp), %rsi
callq 0x91f0
jmp 0xb01d
leaq -0x460(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
callq 0x91f0
jmp 0xb032
movq -0x718(%rbp), %rdi
leaq -0x440(%rbp), %rsi
leaq -0x460(%rbp), %rdx
callq 0x1dc70
jmp 0xb04e
leaq -0x460(%rbp), %rdi
callq 0x9a08
leaq -0x440(%rbp), %rdi
callq 0x9a08
movq 0x2bf3b(%rip), %rdi     # 0x36fa8
leaq 0x1a43c(%rip), %rsi     # 0x254b0
callq 0x9480
movq %rax, -0x720(%rbp)
jmp 0xb082
movq -0x720(%rbp), %rdi
movq 0x2beb8(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xb097
movq -0x420(%rbp), %rax
movq %rax, -0x750(%rbp)
movl -0xa4(%rbp), %eax
movl %eax, -0x748(%rbp)
movl -0xa8(%rbp), %eax
movl %eax, -0x744(%rbp)
movsd -0xb0(%rbp), %xmm0
movsd %xmm0, -0x740(%rbp)
movsd -0xc0(%rbp), %xmm0
movsd %xmm0, -0x738(%rbp)
movb -0xe1(%rbp), %al
movb %al, -0x729(%rbp)
movsd -0xb8(%rbp), %xmm0
movsd %xmm0, -0x728(%rbp)
leaq -0x480(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x91f0
jmp 0xb10e
movsd -0x728(%rbp), %xmm2
movsd -0x738(%rbp), %xmm1
movsd -0x740(%rbp), %xmm0
movl -0x744(%rbp), %edx
movl -0x748(%rbp), %esi
movq -0x750(%rbp), %rdi
movb -0x729(%rbp), %al
movzbl -0xe2(%rbp), %r9d
andl $0x1, %r9d
movzbl %al, %ecx
andl $0x1, %ecx
leaq -0x480(%rbp), %r8
callq 0x1da60
jmp 0xb15f
leaq -0x480(%rbp), %rdi
callq 0x9a08
movq 0x2be36(%rip), %rdi     # 0x36fa8
movq 0x2bdcf(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xb180
movq 0x2be21(%rip), %rdi     # 0x36fa8
leaq 0x1a340(%rip), %rsi     # 0x254ce
callq 0x9480
movq %rax, -0x758(%rbp)
jmp 0xb19c
movq -0x758(%rbp), %rdi
movq 0x2bd9e(%rip), %rsi     # 0x36f48
callq 0x94d0
movq %rax, -0x760(%rbp)
jmp 0xb1b8
movq -0x760(%rbp), %rdi
movq 0x2bd82(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xb1cd
movq -0x420(%rbp), %rdi
callq 0x1ebc0
jmp 0xb1db
leaq -0x3f0(%rbp), %rdi
callq 0xbc90
leaq -0x310(%rbp), %rdi
callq 0x9a08
movl $0x0, -0x2d8(%rbp)
leaq -0x260(%rbp), %rdi
callq 0xc550
leaq -0x168(%rbp), %rdi
callq 0xc5b0
leaq -0xe0(%rbp), %rdi
callq 0x9a08
leaq -0xa0(%rbp), %rdi
callq 0x9a08
leaq -0x80(%rbp), %rdi
callq 0x9a08
leaq -0x30(%rbp), %rdi
callq 0x9a08
movl -0x2d8(%rbp), %eax
testl %eax, %eax
je 0xb250
jmp 0xb24b
jmp 0xb3e3
jmp 0xb3dc
movq -0x710(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
movl $0xa8, %esi
callq 0x94a0
jmp 0xb2c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0xb29a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x460(%rbp), %rdi
callq 0x9a08
leaq -0x440(%rbp), %rdi
callq 0x9a08
jmp 0xb2c0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x480(%rbp), %rdi
callq 0x9a08
leaq -0x3f0(%rbp), %rdi
callq 0xbc90
leaq -0x310(%rbp), %rdi
callq 0x9a08
leaq -0x260(%rbp), %rdi
callq 0xc550
leaq -0x168(%rbp), %rdi
callq 0xc5b0
leaq -0xe0(%rbp), %rdi
callq 0x9a08
leaq -0xa0(%rbp), %rdi
callq 0x9a08
leaq -0x80(%rbp), %rdi
callq 0x9a08
leaq -0x30(%rbp), %rdi
callq 0x9a08
movl -0x5c(%rbp), %eax
movl $0x1, %ecx
cmpl %ecx, %eax
jne 0xb3ef
movq -0x58(%rbp), %rdi
callq 0x91c0
movq %rax, -0x488(%rbp)
movq 0x2bc9f(%rip), %rdi     # 0x36fe0
leaq 0x1a1b8(%rip), %rsi     # 0x25500
callq 0x9480
movq %rax, -0x768(%rbp)
jmp 0xb356
movq -0x488(%rbp), %rdi
movq (%rdi), %rax
movq 0x10(%rax), %rax
callq *%rax
movq -0x768(%rbp), %rdi
movq %rax, %rsi
callq 0x9480
movq %rax, -0x770(%rbp)
jmp 0xb37e
movq -0x770(%rbp), %rdi
leaq 0x1a1a2(%rip), %rsi     # 0x2552e
callq 0x9480
movq %rax, -0x778(%rbp)
jmp 0xb39a
movq -0x778(%rbp), %rdi
movq 0x2bba0(%rip), %rsi     # 0x36f48
callq 0x94d0
jmp 0xb3af
movl $0x2, -0x4(%rbp)
movl $0x1, -0x2d8(%rbp)
callq 0x9810
jmp 0xb3e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
callq 0x9810
jmp 0xb3da
jmp 0xb3ef
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x780, %rsp            # imm = 0x780
popq %rbp
retq
movq -0x58(%rbp), %rdi
callq 0x98c0
movq %rax, %rdi
callq 0xb9c0