// File: /workspace/github_cpp_makefile_star2_O2/brc7[P]DiversitySampling/targets/samplerace.cpp
// Function: main
int main(int argc, char **argv){

    if (argc < 4){
        std::clog<<"Usage: "<<std::endl; 
        std::clog<<"samplerace <tau> <format> <input> <output>"; 
        std::clog<<" [--range race_range] [--reps race_reps] [--hashes n_minhashes] [-k kmer_size]"<<std::endl; 
        std::clog<<"Positional arguments: "<<std::endl; 
        std::clog<<"tau: floating point RACE sampling threshold. Roughly determines how many samples you will store. You may specify this in scientific notation (i.e. 10e-6)"<<std::endl; 
        std::clog<<"format: Either PE, SE, or I for paired-end, single-end, and interleaved paired reads"<<std::endl; 
        std::clog<<"input: path to input data file (.fastq or .fasta extension). For PE format, specify two files."<<std::endl; 
        std::clog<<"output: path to output sample file (same extension as input). For PE format, specify two files."<<std::endl; 
        
        std::clog<<"Optional arguments: "<<std::endl; 
        std::clog<<"[--range race_range]: (Optional, default 10000) Hash range for each ACE (B)"<<std::endl;
        std::clog<<"[--reps race_reps]: (Optional, default 10) Number of ACE repetitions (R)"<<std::endl;
        std::clog<<"[--hashes n_minhashes]: (Optional, default 1) Number of MinHashes for each ACE (n)"<<std::endl;
        std::clog<<"[--k kmer_size]: (Optional, default 16) Size of each MinHash k-mer (k)"<<std::endl;

        std::clog<<std::endl<<"Example usage:"<<std::endl; 
        std::clog<<"samplerace 15.0 PE data/input-1.fastq data/input-2.fastq data/output-1.fastq data/output-2.fastq --range 100 --reps 50 --hashes 3 --k 5"<<std::endl; 
        std::clog<<"samplerace 10e-6 SE data/input.fastq data/output.fastq --range 100 --reps 5 --hashes 1 --k 33"<<std::endl; 
        std::clog<<"samplerace 0.1 SE data/input.fasta data/output.fasta --range 100000 --k 20"<<std::endl; 
        return -1; 
    }


    // POSITIONAL ARGUMENTS
    double tau = std::stod(argv[1]);
    int format; // ENUM: 1 = unpaired, 2 = interleaved, 3 = paired
    if (std::strcmp("SE",argv[2]) == 0){
        format = 1;
    } else if (std::strcmp("I",argv[2]) == 0){
        format = 2; 
    } else if (std::strcmp("PE",argv[2]) == 0){
        format = 3; 
        if (argc < 7){
            std::cerr<<"For paired-end reads, please specify the input and output files as:"<<std::endl; 
            std::cerr<<"input1.fastq input2.fastq output1.fastq output2.fastq"<<std::endl; 
            return -1; 
        }
    } else {
        std::cerr<<"Invalid format, please specify either SE, PE, or I"<<std::endl; 
        return -1;
    }

    // open the correct file streams given the format
    std::ifstream datastream1;
    std::ofstream samplestream1;
    std::ifstream datastream2;
    std::ofstream samplestream2;

    if (format != 3){
        datastream1.open(argv[3]);
        samplestream1.open(argv[4]);
    } else {
        datastream1.open(argv[3]);
        datastream2.open(argv[4]);
        samplestream1.open(argv[5]);
        samplestream2.open(argv[6]);
    }

    // determine file extension
    std::string filename(argv[3]); 
    std::string file_extension = "";
    size_t idx = filename.rfind('.',filename.length()); 
    if (file_extension == "fq"){
        file_extension = "fastq"; 
    }
    if (idx != std::string::npos){
        file_extension = filename.substr(idx+1, filename.length() - idx); 
    } else {
        std::cerr<<"Input file does not appear to have any file extension."<<std::endl; 
        return -1; 
    }
    if (file_extension != "fasta" && file_extension != "fastq"){
        std::cerr<<"Unknown file extension: "<<file_extension<<std::endl; 
        std::cerr<<"Please specify either a file with the .fasta or .fastq extension."<<std::endl; 
        return -1; 
    }

    // OPTIONAL ARGUMENTS
    int race_range = 10000;
    int race_repetitions = 10;
    int hash_power = 1;
    int kmer_k = 16;

    for (int i = 0; i < argc; ++i){
        if (std::strcmp("--range",argv[i]) == 0){
            if ((i+1) < argc){
                race_range = std::stoi(argv[i+1]);
            } else {
                std::cerr<<"Invalid argument for optional parameter --range"<<std::endl; 
                return -1;
            }
        }
        if (std::strcmp("--reps",argv[i]) == 0){
            if ((i+1) < argc){
                race_repetitions = std::stoi(argv[i+1]);
            } else {
                std::cerr<<"Invalid argument for optional parameter --reps"<<std::endl; 
                return -1;
            }
        }
        if (std::strcmp("--hashes",argv[i]) == 0){
            if ((i+1) < argc){
                hash_power = std::stoi(argv[i+1]);
            } else {
                std::cerr<<"Invalid argument for optional parameter --hashes"<<std::endl; 
                return -1;
            }
        }
        if (std::strcmp("--k",argv[i]) == 0){
            if ((i+1) < argc){
                kmer_k = std::stoi(argv[i+1]);
            } else {
                std::cerr<<"Invalid argument for optional parameter --k"<<std::endl; 
                return -1;
            }
        }
    }

    // Check if arguments are valid
    if (tau <= 0){ std::cerr<<"Invalid value for parameter <tau>"<<std::endl; return -1; }
    if (race_range <= 0){ std::cerr<<"Invalid value for optional parameter --range"<<std::endl; return -1; }
    if (race_repetitions <= 0){ std::cerr<<"Invalid value for optional parameter --reps"<<std::endl; return -1; }
    if (hash_power <= 0){ std::cerr<<"Invalid value for optional parameter --hashes"<<std::endl; return -1; }
    if (kmer_k <= 0){ std::cerr<<"Invalid value for optional parameter --k"<<std::endl; return -1; }

    // done parsing information. Begin RACE algorithm: 

    // buffer for sequences and fasta/fastq chunks
    std::string sequence;
    std::string chunk1;
    std::string chunk2;

    // set up the hash function that will be used to hash input sequences
    SequenceMinHash hash = SequenceMinHash(race_repetitions*hash_power);
    int* raw_hashes = new int[race_repetitions*hash_power]; 
    int* rehashes = new int[race_repetitions];

    RACE sketch = RACE(race_repetitions,race_range); 

    do{
        bool success = false; 
        int c = datastream1.peek(); 
        if (c == EOF) {
            if (datastream1.eof()){
                continue; 
            }
        }

        switch(format){
            case 1: // 1 = unpaired
            success = SequenceFeaturesSE(datastream1, sequence, chunk1, file_extension);
            break; 
            case 2: // 2 = interleaved
            success = SequenceFeaturesI(datastream1, sequence, chunk1, file_extension); 
            break; 
            case 3: // 3 = paired
            success = SequenceFeaturesPE(datastream1, datastream2, sequence, chunk1, chunk2, file_extension);
            break; 
        }
        if (!success) continue;

        hash.getHash(kmer_k, sequence, raw_hashes); 
        // now that we have the sequence and label
        // feed the sequence into the RACE structure
        // first rehash so that the arrays can fit into RACE
        rehash(raw_hashes, rehashes, race_repetitions, hash_power);
        // then simultaneously query and add 
        double KDE = sketch.query_and_add(rehashes); 
        // note: KDE is on a scale from [0,N] not the normalized interval [0,1]
        if (KDE < tau){
            // then keep this sample
            
            switch(format){
                case 1: // 1 = unpaired
                samplestream1 << chunk1; 
                break; 
                case 2: // 2 = interleaved
                samplestream1 << chunk1; 
                break; 
                case 3: // 3 = paired
                samplestream1 << chunk1; 
                samplestream2 << chunk2; 
                break; 
            }
        }
    }
    while(datastream1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x958, %rsp            # imm = 0x958
movl %edi, 0x8(%rsp)
cmpl $0x3, %edi
jg 0x3228
movq 0x3f07(%rip), %rbx      # 0x6fb0
leaq 0x1110(%rip), %rsi      # 0x41c0
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1101(%rip), %rsi      # 0x41c8
movq %rbx, %rdi
callq 0x2150
leaq 0x111d(%rip), %rsi      # 0x41f3
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1155(%rip), %rsi      # 0x4242
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1155(%rip), %rsi      # 0x4259
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x11d8(%rip), %rsi      # 0x42f3
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1216(%rip), %rsi      # 0x4348
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x125e(%rip), %rsi      # 0x43a7
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x12a7(%rip), %rsi      # 0x4407
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x12a5(%rip), %rsi      # 0x441c
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x12da(%rip), %rsi      # 0x4468
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x130c(%rip), %rsi      # 0x44b1
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1348(%rip), %rsi      # 0x4504
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x20c0
leaq 0x1370(%rip), %rsi      # 0x454b
movq %rax, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1368(%rip), %rsi      # 0x455a
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x13d9(%rip), %rsi      # 0x45e2
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0x1420(%rip), %rsi      # 0x4640
movq %rbx, %rdi
jmp 0x3359
movq %rsi, %r14
movq 0x8(%rsi), %rsi
leaq 0x148(%rsp), %rdi
leaq 0x550(%rsp), %rdx
callq 0x3afc
leaq 0x148(%rsp), %rdi
xorl %esi, %esi
callq 0x3ae2
movsd %xmm0, 0x20(%rsp)
leaq 0x148(%rsp), %rdi
callq 0x20b0
movq 0x10(%r14), %rcx
movzbl (%rcx), %eax
movl %eax, %edx
subl $0x53, %edx
jne 0x3281
movzbl 0x1(%rcx), %edx
subl $0x45, %edx
jne 0x3281
movzbl 0x2(%rcx), %edx
negl %edx
movb $0x1, %r12b
testl %edx, %edx
je 0x32a1
cmpl $0x49, %eax
jne 0x332f
cmpb $0x0, 0x1(%rcx)
jne 0x334b
pushq $0x2
jmp 0x32a3
pushq $0x1
popq %r13
xorl %ebp, %ebp
leaq 0x148(%rsp), %rdi
callq 0x2170
leaq 0x350(%rsp), %rbx
movq %rbx, %rdi
callq 0x2230
leaq 0x550(%rsp), %rdi
callq 0x2170
leaq 0x758(%rsp), %rdi
callq 0x2230
movq 0x18(%r14), %rsi
testb %bpl, %bpl
je 0x336e
leaq 0x148(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x20f0
movq 0x20(%r14), %rsi
leaq 0x550(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x20f0
movq 0x28(%r14), %rsi
leaq 0x350(%rsp), %rdi
pushq $0x10
popq %rdx
callq 0x2050
leaq 0x758(%rsp), %rbx
pushq $0x30
jmp 0x3380
subl $0x50, %eax
jne 0x3341
movzbl 0x1(%rcx), %eax
subl $0x45, %eax
jne 0x3341
movzbl 0x2(%rcx), %eax
negl %eax
testl %eax, %eax
je 0x389e
movq 0x3c9e(%rip), %rdi      # 0x6ff0
leaq 0x13ac(%rip), %rsi      # 0x4705
callq 0x2150
movq %rax, %rdi
callq 0x20c0
pushq $-0x1
popq %rbx
jmp 0x399a
leaq 0x148(%rsp), %rdi
pushq $0x8
popq %rdx
callq 0x20f0
pushq $0x20
popq %rax
movq (%r14,%rax), %rsi
pushq $0x10
popq %rbp
movq %rbx, %rdi
movl %ebp, %edx
callq 0x2050
movq 0x18(%r14), %rsi
leaq 0xa8(%rsp), %rdi
leaq 0x68(%rsp), %rdx
callq 0x3afc
leaq 0xd08(%rip), %rsi       # 0x40b7
leaq 0x68(%rsp), %rdi
leaq 0x48(%rsp), %rdx
callq 0x3afc
leaq 0xa8(%rsp), %rdi
movq 0x8(%rdi), %rdx
pushq $0x2e
popq %rsi
callq 0x22b0
movq %rax, %rbx
leaq 0x135c(%rip), %rsi      # 0x4738
leaq 0x68(%rsp), %rdi
callq 0x2aa1
testb %al, %al
je 0x33fb
leaq 0x130e(%rip), %rsi      # 0x46ff
leaq 0x68(%rsp), %rdi
callq 0x2280
cmpq $-0x1, %rbx
je 0x3613
leaq 0xa8(%rsp), %rsi
movq 0x8(%rsi), %rcx
subq %rbx, %rcx
incq %rbx
leaq 0x48(%rsp), %rdi
movq %rbx, %rdx
callq 0x2160
leaq 0x68(%rsp), %rbx
leaq 0x48(%rsp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x21a0
movq %r15, %rdi
callq 0x20b0
leaq 0xbbc(%rip), %rsi       # 0x4004
movq %rbx, %rdi
callq 0x3b37
testb %al, %al
je 0x349d
leaq 0x12a4(%rip), %rsi      # 0x46ff
leaq 0x68(%rsp), %rdi
callq 0x3b37
testb %al, %al
je 0x349d
movq 0x3b80(%rip), %rdi      # 0x6ff0
leaq 0x12fb(%rip), %rsi      # 0x4772
callq 0x2150
leaq 0x68(%rsp), %rsi
movq %rax, %rdi
callq 0x2140
movq %rax, %rdi
callq 0x20c0
leaq 0x12f3(%rip), %rsi      # 0x478b
jmp 0x361a
movl %ebp, 0x10(%rsp)
movl %r13d, 0x18(%rsp)
movl %r12d, 0x14(%rsp)
movl 0x8(%rsp), %r13d
pushq $0x1
popq %rax
movl %eax, 0x4(%rsp)
pushq $0xa
popq %rax
movl $0x2710, %ebx           # imm = 0x2710
xorl %ebp, %ebp
leaq 0x48(%rsp), %r12
movl %eax, (%rsp)
cmpq %rbp, %r13
je 0x3633
movq (%r14,%rbp,8), %r15
leaq 0x13f3(%rip), %rdi      # 0x48d0
movq %r15, %rsi
callq 0x21f0
testl %eax, %eax
jne 0x3523
leal 0x1(%rbp), %eax
cmpl 0x8(%rsp), %eax
jge 0x38e7
movq 0x8(%r14,%rbp,8), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rdx
callq 0x3afc
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x3b41
movl %eax, %ebx
movq %r12, %rdi
callq 0x20b0
movq (%r14,%rbp,8), %r15
leaq 0x13d3(%rip), %rdi      # 0x48fd
movq %r15, %rsi
callq 0x21f0
testl %eax, %eax
jne 0x3571
leal 0x1(%rbp), %eax
cmpl 0x8(%rsp), %eax
jge 0x38f0
movq 0x8(%r14,%rbp,8), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rdx
callq 0x3afc
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x3b41
movl %eax, (%rsp)
movq %r12, %rdi
callq 0x20b0
movq (%r14,%rbp,8), %r15
leaq 0x13b1(%rip), %rdi      # 0x4929
movq %r15, %rsi
callq 0x21f0
testl %eax, %eax
jne 0x35c0
leal 0x1(%rbp), %eax
cmpl 0x8(%rsp), %eax
jge 0x38f9
movq 0x8(%r14,%rbp,8), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rdx
callq 0x3afc
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x3b41
movl %eax, 0x4(%rsp)
movq %r12, %rdi
callq 0x20b0
movq (%r14,%rbp,8), %r15
leaq 0x1390(%rip), %rdi      # 0x4957
movq %r15, %rsi
callq 0x21f0
incq %rbp
testl %eax, %eax
jne 0x34c9
cmpl 0x8(%rsp), %ebp
jge 0x39ae
movq (%r14,%rbp,8), %rsi
movq %r12, %rdi
leaq 0x28(%rsp), %rdx
callq 0x3afc
movq %r12, %rdi
xorl %esi, %esi
pushq $0xa
popq %rdx
callq 0x3b41
movl %eax, 0x10(%rsp)
movq %r12, %rdi
callq 0x20b0
jmp 0x34c9
leaq 0x1121(%rip), %rsi      # 0x473b
movq 0x39cf(%rip), %rdi      # 0x6ff0
callq 0x2150
movq %rax, %rdi
callq 0x20c0
jmp 0x394c
xorpd %xmm0, %xmm0
ucomisd 0x20(%rsp), %xmm0
jae 0x38cf
testl %ebx, %ebx
jle 0x3916
cmpl $0x0, (%rsp)
jle 0x391f
cmpl $0x0, 0x4(%rsp)
jle 0x3928
cmpl $0x0, 0x10(%rsp)
jle 0x3931
leaq 0x58(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
leaq 0x98(%rsp), %rdx
movq %rdx, -0x10(%rdx)
andq $0x0, -0x8(%rdx)
movb %cl, (%rax)
movb %cl, (%rdx)
movl 0x4(%rsp), %ebp
imull (%rsp), %ebp
leaq 0x1c(%rsp), %rdi
movl %ebp, %esi
callq 0x248c
movl %ebp, %edi
shlq $0x2, %rdi
callq 0x2030
movq %rax, %r14
movl (%rsp), %r12d
leaq (,%r12,4), %rdi
callq 0x2030
movl 0x10(%rsp), %ebp
movq %rax, %r15
movl %ebx, %edx
leaq 0xc8(%rsp), %rdi
movq %r12, %rsi
callq 0x2b70
movl %ebp, %eax
movq %rax, 0x8(%rsp)
leaq 0x148(%rsp), %r12
leaq 0x48(%rsp), %rbp
movq %r12, %rdi
callq 0x2090
cmpl $-0x1, %eax
jne 0x3727
movq 0x148(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x168(%rsp,%rax)
jne 0x384f
movl 0x18(%rsp), %eax
cmpl $0x3, %eax
je 0x3764
cmpl $0x2, %eax
jne 0x37a3
leaq 0x108(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x21e0
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x28(%rsp), %rdx
leaq 0x108(%rsp), %r13
movq %r13, %rcx
callq 0x2999
jmp 0x37d0
leaq 0xe8(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x21e0
movq %r12, %rdi
leaq 0x550(%rsp), %rsi
movq %rbp, %rdx
leaq 0x28(%rsp), %rcx
leaq 0x88(%rsp), %r8
leaq 0xe8(%rsp), %r13
movq %r13, %r9
callq 0x28ae
jmp 0x37d0
leaq 0x128(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x21e0
movq %r12, %rdi
movq %rbp, %rsi
leaq 0x28(%rsp), %rdx
leaq 0x128(%rsp), %r13
movq %r13, %rcx
callq 0x284a
movl %eax, %ebx
movq %r13, %rdi
callq 0x20b0
testb %bl, %bl
je 0x384f
leaq 0x1c(%rsp), %rdi
movq 0x8(%rsp), %rsi
movq %rbp, %rdx
movq %r14, %rcx
callq 0x2490
movq %r14, %rdi
movq %r15, %rsi
movl (%rsp), %edx
movl 0x4(%rsp), %ecx
callq 0x2b1c
leaq 0xc8(%rsp), %rdi
movq %r15, %rsi
callq 0x2c02
movsd 0x20(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x384f
leaq 0x350(%rsp), %rdi
leaq 0x28(%rsp), %rsi
cmpb $0x0, 0x14(%rsp)
jne 0x384a
callq 0x2140
leaq 0x758(%rsp), %rdi
leaq 0x88(%rsp), %rsi
callq 0x2140
movq 0x148(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x168(%rsp,%rax)
je 0x3700
leaq 0xc8(%rsp), %rdi
callq 0x2bc4
leaq 0x88(%rsp), %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x20b0
leaq 0x48(%rsp), %rdi
callq 0x20b0
xorl %ebx, %ebx
jmp 0x394f
cmpl $0x6, 0x8(%rsp)
ja 0x38d8
movq 0x3744(%rip), %rbx      # 0x6ff0
leaq 0xdd8(%rip), %rsi       # 0x468b
movq %rbx, %rdi
callq 0x2150
movq %rax, %rdi
callq 0x20c0
leaq 0xe05(%rip), %rsi       # 0x46cf
jmp 0x3220
leaq 0xfb3(%rip), %rsi       # 0x4889
jmp 0x3938
pushq $0x3
popq %r13
movb $0x1, %bpl
xorl %r12d, %r12d
jmp 0x32a7
leaq 0xedf(%rip), %rsi       # 0x47cd
jmp 0x3900
leaq 0xf06(%rip), %rsi       # 0x47fd
jmp 0x3900
leaq 0xf2c(%rip), %rsi       # 0x482c
movq 0x36e9(%rip), %rdi      # 0x6ff0
callq 0x2150
movq %rax, %rdi
callq 0x20c0
jmp 0x394c
leaq 0xf8e(%rip), %rsi       # 0x48ab
jmp 0x3938
leaq 0xfb2(%rip), %rsi       # 0x48d8
jmp 0x3938
leaq 0xfd5(%rip), %rsi       # 0x4904
jmp 0x3938
leaq 0xffa(%rip), %rsi       # 0x4932
movq 0x36b1(%rip), %rdi      # 0x6ff0
callq 0x2150
movq %rax, %rdi
callq 0x20c0
pushq $-0x1
popq %rbx
leaq 0x68(%rsp), %rdi
callq 0x20b0
leaq 0xa8(%rsp), %rdi
callq 0x20b0
leaq 0x758(%rsp), %rdi
callq 0x2210
leaq 0x550(%rsp), %rdi
callq 0x2070
leaq 0x350(%rsp), %rdi
callq 0x2210
leaq 0x148(%rsp), %rdi
callq 0x2070
movl %ebx, %eax
addq $0x958, %rsp            # imm = 0x958
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xea8(%rip), %rsi       # 0x485d
jmp 0x3900
jmp 0x39c0
jmp 0x39c0
jmp 0x39c0
movq %rax, %rbx
jmp 0x3a3e
movq %rax, %rbx
leaq 0xe8(%rsp), %rdi
jmp 0x39ea
movq %rax, %rbx
leaq 0x108(%rsp), %rdi
jmp 0x39ea
movq %rax, %rbx
leaq 0x128(%rsp), %rdi
callq 0x20b0
jmp 0x3a31
jmp 0x3a78
jmp 0x3a87
jmp 0x3a2e
jmp 0x3a87
jmp 0x3a87
jmp 0x3a87
movq %rax, %rbx
jmp 0x3a94
jmp 0x3add
movq %rax, %rbx
jmp 0x3aae
movq %rax, %rbx
jmp 0x3abb
movq %rax, %rbx
jmp 0x3ac8
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x2bc4
leaq 0x88(%rsp), %rdi
callq 0x20b0
leaq 0x28(%rsp), %rdi
callq 0x20b0
jmp 0x3a7b
movq %rax, %rbx
leaq 0x148(%rsp), %rdi
callq 0x20b0
jmp 0x3ad5
movq %rax, %rbx
jmp 0x3ad5
jmp 0x3a87
jmp 0x3a78
jmp 0x3a87
jmp 0x3a78
jmp 0x3a87
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x20b0
jmp 0x3a8a
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x20b0
leaq 0xa8(%rsp), %rdi
callq 0x20b0
leaq 0x758(%rsp), %rdi
callq 0x2210
leaq 0x550(%rsp), %rdi
callq 0x2070
leaq 0x350(%rsp), %rdi
callq 0x2210
leaq 0x148(%rsp), %rdi
callq 0x2070
movq %rbx, %rdi
callq 0x2250
movq %rax, %rbx
jmp 0x3aa1