// File: /workspace/github_c_makefile_star2_O0/stanfordnlp[P]GloVe/src/cooccur.c
// Function: get_cooccurrence
int get_cooccurrence(void) {
    int flag, x, y, fidcounter = 1;
    long long a, j = 0, k, id, counter = 0, ind = 0, vocab_size, w1, w2, *lookup = NULL, *history = NULL;
    char format[20], filename[200], str[MAX_STRING_LENGTH + 1];
    FILE *fid, *foverflow;
    real *bigram_table = NULL, r;
    HASHREC *htmp, **vocab_hash = inithashtable();
    CREC *cr = malloc(sizeof(CREC) * (overflow_length + 1));
    history = malloc(sizeof(long long) * window_size);
    
    fprintf(stderr, "COUNTING COOCCURRENCES\n");
    if (verbose > 0) {
        fprintf(stderr, "window size: %d\n", window_size);
        if (symmetric == 0) fprintf(stderr, "context: asymmetric\n");
        else fprintf(stderr, "context: symmetric\n");
    }
    if (verbose > 1) fprintf(stderr, "max product: %lld\n", max_product);
    if (verbose > 1) fprintf(stderr, "overflow length: %lld\n", overflow_length);
    sprintf(format,"%%%ds %%lld", MAX_STRING_LENGTH); // Format to read from vocab file, which has (irrelevant) frequency data
    if (verbose > 1) fprintf(stderr, "Reading vocab from file \"%s\"...", vocab_file);
    fid = fopen(vocab_file,"r");
    if (fid == NULL) { 
        log_file_loading_error("vocab file", vocab_file);
        free_resources(vocab_hash, cr, lookup, history, bigram_table);
        return 1;
    }
    while (fscanf(fid, format, str, &id) != EOF) hashinsert(vocab_hash, str, ++j); // Here id is not used: inserting vocab words into hash table with their frequency rank, j
    fclose(fid);
    vocab_size = j;
    j = 0;
    if (verbose > 1) fprintf(stderr, "loaded %lld words.\nBuilding lookup table...", vocab_size);
    
    /* Build auxiliary lookup table used to index into bigram_table */
    lookup = (long long *)calloc( vocab_size + 1, sizeof(long long) );
    if (lookup == NULL) {
        fprintf(stderr, "Couldn't allocate memory!");
        free_resources(vocab_hash, cr, lookup, history, bigram_table);
        return 1;
    }
    lookup[0] = 1;
    for (a = 1; a <= vocab_size; a++) {
        if ((lookup[a] = max_product / a) < vocab_size) lookup[a] += lookup[a-1];
        else lookup[a] = lookup[a-1] + vocab_size;
    }
    if (verbose > 1) fprintf(stderr, "table contains %lld elements.\n",lookup[a-1]);
    
    /* Allocate memory for full array which will store all cooccurrence counts for words whose product of frequency ranks is less than max_product */
    bigram_table = (real *)calloc( lookup[a-1] , sizeof(real) );
    if (bigram_table == NULL) {
        fprintf(stderr, "Couldn't allocate memory!");
        free_resources(vocab_hash, cr, lookup, history, bigram_table);
        return 1;
    }
    
    fid = stdin;
    // sprintf(format,"%%%ds",MAX_STRING_LENGTH);
    sprintf(filename,"%s_%04d.bin", file_head, fidcounter);
    foverflow = fopen(filename,"wb");
    if (verbose > 1) fprintf(stderr,"Processing token: 0");

    // if symmetric > 0, we can increment ind twice per iteration,
    // meaning up to 2x window_size in one loop
    long long const overflow_threshold = symmetric == 0 ? overflow_length - window_size : overflow_length - 2 * window_size;
    
    /* For each token in input stream, calculate a weighted cooccurrence sum within window_size */
    while (1) {
        if (ind >= overflow_threshold) {
            // If overflow buffer is (almost) full, sort it and write it to temporary file
            qsort(cr, ind, sizeof(CREC), compare_crec);
            write_chunk(cr,ind,foverflow);
            fclose(foverflow);
            fidcounter++;
            sprintf(filename,"%s_%04d.bin",file_head,fidcounter);
            foverflow = fopen(filename,"wb");
            ind = 0;
        }
        flag = get_word(str, fid);
        if (verbose > 2) fprintf(stderr, "Maybe processing token: %s\n", str);
        if (flag == 1) {
            // Newline, reset line index (j); maybe eof.
            if (feof(fid)) {
                if (verbose > 2) fprintf(stderr, "Not getting coocurs as at eof\n");
                break;
            }
            j = 0;
            if (verbose > 2) fprintf(stderr, "Not getting coocurs as at newline\n");
            continue;
        }
        counter++;
        if ((counter%100000) == 0) if (verbose > 1) fprintf(stderr,"\033[19G%lld",counter);
        htmp = hashsearch(vocab_hash, str);
        if (htmp == NULL) {
            if (verbose > 2) fprintf(stderr, "Not getting coocurs as word not in vocab\n");
            continue; // Skip out-of-vocabulary words
        }
        w2 = htmp->num; // Target word (frequency rank)
        for (k = j - 1; k >= ( (j > window_size) ? j - window_size : 0 ); k--) { // Iterate over all words to the left of target word, but not past beginning of line
            w1 = history[k % window_size]; // Context word (frequency rank)
            if (verbose > 2) fprintf(stderr, "Adding cooccur between words %lld and %lld.\n", w1, w2);
            if ( w1 < max_product/w2 ) { // Product is small enough to store in a full array
                bigram_table[lookup[w1-1] + w2 - 2] += distance_weighting ? 1.0/((real)(j-k)) : 1.0; // Weight by inverse of distance between words if needed
                if (symmetric > 0) bigram_table[lookup[w2-1] + w1 - 2] += distance_weighting ? 1.0/((real)(j-k)) : 1.0; // If symmetric context is used, exchange roles of w2 and w1 (ie look at right context too)
            }
            else { // Product is too big, data is likely to be sparse. Store these entries in a temporary buffer to be sorted, merged (accumulated), and written to file when it gets full.
                cr[ind].word1 = w1;
                cr[ind].word2 = w2;
                cr[ind].val = distance_weighting ? 1.0/((real)(j-k)) : 1.0;
                ind++; // Keep track of how full temporary buffer is
                if (symmetric > 0) { // Symmetric context
                    cr[ind].word1 = w2;
                    cr[ind].word2 = w1;
                    cr[ind].val = distance_weighting ? 1.0/((real)(j-k)) : 1.0;
                    ind++;
                }
            }
        }
        history[j % window_size] = w2; // Target word is stored in circular buffer to become context word in the future
        j++;
    }
    
    /* Write out temp buffer for the final time (it may not be full) */
    if (verbose > 1) fprintf(stderr,"\033[0GProcessed %lld tokens.\n",counter);
    qsort(cr, ind, sizeof(CREC), compare_crec);
    write_chunk(cr,ind,foverflow);
    sprintf(filename,"%s_0000.bin",file_head);
    
    /* Write out full bigram_table, skipping zeros */
    if (verbose > 1) fprintf(stderr, "Writing cooccurrences to disk");
    fid = fopen(filename,"wb");
    j = 1e6;
    for (x = 1; x <= vocab_size; x++) {
        if ( (long long) (0.75*log(vocab_size / x)) < j) {
            j = (long long) (0.75*log(vocab_size / x));
            if (verbose > 1) fprintf(stderr,".");
        } // log's to make it look (sort of) pretty
        for (y = 1; y <= (lookup[x] - lookup[x-1]); y++) {
            if ((r = bigram_table[lookup[x-1] - 2 + y]) != 0) {
                fwrite(&x, sizeof(int), 1, fid);
                fwrite(&y, sizeof(int), 1, fid);
                fwrite(&r, sizeof(real), 1, fid);
            }
        }
    }
    
    if (verbose > 1) fprintf(stderr,"%d files in total.\n",fidcounter + 1);
    fclose(fid);
    fclose(foverflow);
    free_resources(vocab_hash, cr, lookup, history, bigram_table);
    return merge_files(fidcounter + 1); // Merge the sorted temporary files
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x5e0, %rsp            # imm = 0x5E0
movl $0x1, -0x14(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x40(%rbp)
movq $0x0, -0x48(%rbp)
movq $0x0, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x568(%rbp)
callq 0x3190
movq %rax, -0x580(%rbp)
movq 0x51c8(%rip), %rdi      # 0x7120
addq $0x1, %rdi
shlq $0x4, %rdi
callq 0x1150
movq %rax, -0x588(%rbp)
movslq 0x5181(%rip), %rdi      # 0x70f4
shlq $0x3, %rdi
callq 0x1150
movq %rax, -0x70(%rbp)
movq 0x5071(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x217a(%rip), %rsi      # 0x410b
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5151(%rip)      # 0x70f0
jle 0x1ffc
movq 0x5050(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movl 0x5143(%rip), %edx      # 0x70f4
leaq 0x216b(%rip), %rsi      # 0x4123
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x5132(%rip)      # 0x70f8
jne 0x1fe2
movq 0x5029(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x215b(%rip), %rsi      # 0x4134
movb $0x0, %al
callq 0x1130
jmp 0x1ffa
movq 0x500f(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2156(%rip), %rsi      # 0x4149
movb $0x0, %al
callq 0x1130
jmp 0x1ffc
cmpl $0x1, 0x50ed(%rip)      # 0x70f0
jle 0x2024
movq 0x4fec(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq 0x5112(%rip), %rdx      # 0x7128
leaq 0x2140(%rip), %rsi      # 0x415d
movb $0x0, %al
callq 0x1130
cmpl $0x1, 0x50c5(%rip)      # 0x70f0
jle 0x204c
movq 0x4fc4(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq 0x50e2(%rip), %rdx      # 0x7120
leaq 0x212b(%rip), %rsi      # 0x4170
movb $0x0, %al
callq 0x1130
leaq -0x90(%rbp), %rdi
leaq 0x212d(%rip), %rsi      # 0x4187
movl $0x3e8, %edx            # imm = 0x3E8
movb $0x0, %al
callq 0x1190
cmpl $0x1, 0x5083(%rip)      # 0x70f0
jle 0x208e
movq 0x4f82(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq 0x50b0(%rip), %rdx      # 0x7130
leaq 0x210c(%rip), %rsi      # 0x4193
movb $0x0, %al
callq 0x1130
movq 0x509b(%rip), %rdi      # 0x7130
leaq 0x2117(%rip), %rsi      # 0x41b3
callq 0x1170
movq %rax, -0x558(%rbp)
cmpq $0x0, -0x558(%rbp)
jne 0x20f3
movq 0x5077(%rip), %rsi      # 0x7130
leaq 0x20f5(%rip), %rdi      # 0x41b5
callq 0x3500
movq -0x580(%rbp), %rdi
movq -0x588(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x568(%rbp), %r8
callq 0x1eb0
movl $0x1, -0x4(%rbp)
jmp 0x2baa
jmp 0x20f5
movq -0x558(%rbp), %rdi
leaq -0x90(%rbp), %rsi
leaq -0x550(%rbp), %rdx
leaq -0x38(%rbp), %rcx
movb $0x0, %al
callq 0x1070
cmpl $-0x1, %eax
je 0x213b
movq -0x580(%rbp), %rdi
leaq -0x550(%rbp), %rsi
movq -0x28(%rbp), %rdx
addq $0x1, %rdx
movq %rdx, -0x28(%rbp)
callq 0x1390
jmp 0x20f5
movq -0x558(%rbp), %rdi
callq 0x10c0
movq -0x28(%rbp), %rax
movq %rax, -0x50(%rbp)
movq $0x0, -0x28(%rbp)
cmpl $0x1, 0x4f92(%rip)      # 0x70f0
jle 0x217c
movq 0x4e91(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq -0x50(%rbp), %rdx
leaq 0x204b(%rip), %rsi      # 0x41c0
movb $0x0, %al
callq 0x1130
movq -0x50(%rbp), %rdi
addq $0x1, %rdi
movl $0x8, %esi
callq 0x1110
movq %rax, -0x68(%rbp)
cmpq $0x0, -0x68(%rbp)
jne 0x21df
movq 0x4e58(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x2042(%rip), %rsi      # 0x41ec
movb $0x0, %al
callq 0x1130
movq -0x580(%rbp), %rdi
movq -0x588(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x568(%rbp), %r8
callq 0x1eb0
movl $0x1, -0x4(%rbp)
jmp 0x2baa
movq -0x68(%rbp), %rax
movq $0x1, (%rax)
movq $0x1, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x50(%rbp), %rax
jg 0x226d
movq 0x4f25(%rip), %rax      # 0x7128
cqto
idivq -0x20(%rbp)
movq -0x68(%rbp), %rcx
movq -0x20(%rbp), %rdx
movq %rax, (%rcx,%rdx,8)
cmpq -0x50(%rbp), %rax
jge 0x223d
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
addq (%rax,%rcx,8), %rdx
movq %rdx, (%rax,%rcx,8)
jmp 0x225d
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
addq -0x50(%rbp), %rdx
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x225f
movq -0x20(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x20(%rbp)
jmp 0x21f2
cmpl $0x1, 0x4e7c(%rip)      # 0x70f0
jle 0x229e
movq 0x4d7b(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x1f6f(%rip), %rsi      # 0x4206
movb $0x0, %al
callq 0x1130
movq -0x68(%rbp), %rax
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
movq (%rax,%rcx,8), %rdi
movl $0x8, %esi
callq 0x1110
movq %rax, -0x568(%rbp)
cmpq $0x0, -0x568(%rbp)
jne 0x230f
movq 0x4d28(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1f12(%rip), %rsi      # 0x41ec
movb $0x0, %al
callq 0x1130
movq -0x580(%rbp), %rdi
movq -0x588(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x568(%rbp), %r8
callq 0x1eb0
movl $0x1, -0x4(%rbp)
jmp 0x2baa
movq 0x4cc2(%rip), %rax      # 0x6fd8
movq (%rax), %rax
movq %rax, -0x558(%rbp)
leaq -0x160(%rbp), %rdi
movq 0x4dea(%rip), %rdx      # 0x7118
movl -0x14(%rbp), %ecx
leaq 0x1d7c(%rip), %rsi      # 0x40b4
movb $0x0, %al
callq 0x1190
leaq -0x160(%rbp), %rdi
leaq 0x1ed8(%rip), %rsi      # 0x4225
callq 0x1170
movq %rax, -0x560(%rbp)
cmpl $0x1, 0x4d90(%rip)      # 0x70f0
jle 0x237a
movq 0x4c8f(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1eb5(%rip), %rsi      # 0x4228
movb $0x0, %al
callq 0x1130
cmpl $0x0, 0x4d77(%rip)      # 0x70f8
jne 0x239d
movq 0x4d96(%rip), %rax      # 0x7120
movslq 0x4d63(%rip), %rcx      # 0x70f4
subq %rcx, %rax
movq %rax, -0x598(%rbp)
jmp 0x23b9
movq 0x4d7c(%rip), %rax      # 0x7120
movl 0x4d4a(%rip), %ecx      # 0x70f4
shll %ecx
movslq %ecx, %rcx
subq %rcx, %rax
movq %rax, -0x598(%rbp)
movq -0x598(%rbp), %rax
movq %rax, -0x590(%rbp)
movq -0x48(%rbp), %rax
cmpq -0x590(%rbp), %rax
jl 0x2461
movq -0x588(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl $0x10, %edx
leaq -0xe0f(%rip), %rcx      # 0x15e0
callq 0x1080
movq -0x588(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x560(%rbp), %rdx
callq 0x14c0
movq -0x560(%rbp), %rdi
callq 0x10c0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
leaq -0x160(%rbp), %rdi
movq 0x4cea(%rip), %rdx      # 0x7118
movl -0x14(%rbp), %ecx
leaq 0x1c7c(%rip), %rsi      # 0x40b4
movb $0x0, %al
callq 0x1190
leaq -0x160(%rbp), %rdi
leaq 0x1dd8(%rip), %rsi      # 0x4225
callq 0x1170
movq %rax, -0x560(%rbp)
movq $0x0, -0x48(%rbp)
leaq -0x550(%rbp), %rdi
movq -0x558(%rbp), %rsi
callq 0x31e0
movl %eax, -0x8(%rbp)
cmpl $0x2, 0x4c72(%rip)      # 0x70f0
jle 0x249f
movq 0x4b71(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq -0x550(%rbp), %rdx
leaq 0x1da4(%rip), %rsi      # 0x423c
movb $0x0, %al
callq 0x1130
cmpl $0x1, -0x8(%rbp)
jne 0x250a
movq -0x558(%rbp), %rdi
callq 0x1140
cmpl $0x0, %eax
je 0x24dc
cmpl $0x2, 0x4c33(%rip)      # 0x70f0
jle 0x24d7
movq 0x4b32(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1d88(%rip), %rsi      # 0x4258
movb $0x0, %al
callq 0x1130
jmp 0x290d
movq $0x0, -0x28(%rbp)
cmpl $0x2, 0x4c05(%rip)      # 0x70f0
jle 0x2505
movq 0x4b04(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1d79(%rip), %rsi      # 0x4277
movb $0x0, %al
callq 0x1130
jmp 0x23c7
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movl $0x186a0, %ecx          # imm = 0x186A0
cqto
idivq %rcx
cmpq $0x0, %rdx
jne 0x2551
cmpl $0x1, 0x4bbf(%rip)      # 0x70f0
jle 0x254f
movq 0x4abe(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0x1d52(%rip), %rsi      # 0x429a
movb $0x0, %al
callq 0x1130
jmp 0x2551
movq -0x580(%rbp), %rdi
leaq -0x550(%rbp), %rsi
callq 0x12c0
movq %rax, -0x578(%rbp)
cmpq $0x0, -0x578(%rbp)
jne 0x259b
cmpl $0x2, 0x4b74(%rip)      # 0x70f0
jle 0x2596
movq 0x4a73(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1d15(%rip), %rsi      # 0x42a4
movb $0x0, %al
callq 0x1130
jmp 0x23c7
movq -0x578(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x5a0(%rbp)
movq -0x28(%rbp), %rax
movslq 0x4b28(%rip), %rcx      # 0x70f4
cmpq %rcx, %rax
jle 0x25e8
movq -0x28(%rbp), %rax
movslq 0x4b18(%rip), %rcx      # 0x70f4
subq %rcx, %rax
movq %rax, -0x5a8(%rbp)
jmp 0x25f3
xorl %eax, %eax
movq %rax, -0x5a8(%rbp)
jmp 0x25f3
movq -0x5a0(%rbp), %rax
movq -0x5a8(%rbp), %rcx
cmpq %rcx, %rax
jl 0x28d2
movq -0x70(%rbp), %rax
movq %rax, -0x5b0(%rbp)
movq -0x30(%rbp), %rax
movslq 0x4ad4(%rip), %rcx      # 0x70f4
cqto
idivq %rcx
movq -0x5b0(%rbp), %rax
movq (%rax,%rdx,8), %rax
movq %rax, -0x58(%rbp)
cmpl $0x2, 0x4ab5(%rip)      # 0x70f0
jle 0x265d
movq 0x49b4(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
leaq 0x1c78(%rip), %rsi      # 0x42ce
movb $0x0, %al
callq 0x1130
movq -0x58(%rbp), %rax
movq %rax, -0x5b8(%rbp)
movq 0x4ab9(%rip), %rax      # 0x7128
cqto
idivq -0x60(%rbp)
movq %rax, %rcx
movq -0x5b8(%rbp), %rax
cmpq %rcx, %rax
jge 0x2774
cmpl $0x0, 0x4a79(%rip)      # 0x7108
je 0x26b4
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
cvtsi2sd %rax, %xmm1
movsd 0x1962(%rip), %xmm0     # 0x4008
divsd %xmm1, %xmm0
movsd %xmm0, -0x5c0(%rbp)
jmp 0x26c6
movsd 0x194c(%rip), %xmm0     # 0x4008
movsd %xmm0, -0x5c0(%rbp)
jmp 0x26c6
movsd -0x5c0(%rbp), %xmm0
movq -0x568(%rbp), %rax
movq -0x68(%rbp), %rcx
movq -0x58(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq -0x60(%rbp), %rcx
subq $0x2, %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
cmpl $0x0, 0x49fa(%rip)      # 0x70f8
jle 0x276f
cmpl $0x0, 0x4a01(%rip)      # 0x7108
je 0x272c
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
cvtsi2sd %rax, %xmm1
movsd 0x18ea(%rip), %xmm0     # 0x4008
divsd %xmm1, %xmm0
movsd %xmm0, -0x5c8(%rbp)
jmp 0x273e
movsd 0x18d4(%rip), %xmm0     # 0x4008
movsd %xmm0, -0x5c8(%rbp)
jmp 0x273e
movsd -0x5c8(%rbp), %xmm0
movq -0x568(%rbp), %rax
movq -0x68(%rbp), %rcx
movq -0x60(%rbp), %rdx
subq $0x1, %rdx
movq (%rcx,%rdx,8), %rcx
addq -0x58(%rbp), %rcx
subq $0x2, %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
jmp 0x28bf
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
cmpl $0x0, 0x4958(%rip)      # 0x7108
je 0x27d5
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
cvtsi2sd %rax, %xmm1
movsd 0x1841(%rip), %xmm0     # 0x4008
divsd %xmm1, %xmm0
movsd %xmm0, -0x5d0(%rbp)
jmp 0x27e7
movsd 0x182b(%rip), %xmm0     # 0x4008
movsd %xmm0, -0x5d0(%rbp)
jmp 0x27e7
movsd -0x5d0(%rbp), %xmm0
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
cmpl $0x0, 0x48df(%rip)      # 0x70f8
jle 0x28bd
movq -0x60(%rbp), %rax
movl %eax, %ecx
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, (%rax)
movq -0x58(%rbp), %rax
movl %eax, %ecx
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rdx
shlq $0x4, %rdx
addq %rdx, %rax
movl %ecx, 0x4(%rax)
cmpl $0x0, 0x48ad(%rip)      # 0x7108
je 0x2880
movq -0x28(%rbp), %rax
subq -0x30(%rbp), %rax
cvtsi2sd %rax, %xmm1
movsd 0x1796(%rip), %xmm0     # 0x4008
divsd %xmm1, %xmm0
movsd %xmm0, -0x5d8(%rbp)
jmp 0x2892
movsd 0x1780(%rip), %xmm0     # 0x4008
movsd %xmm0, -0x5d8(%rbp)
jmp 0x2892
movsd -0x5d8(%rbp), %xmm0
movq -0x588(%rbp), %rax
movq -0x48(%rbp), %rcx
shlq $0x4, %rcx
addq %rcx, %rax
movsd %xmm0, 0x8(%rax)
movq -0x48(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x48(%rbp)
jmp 0x28bf
jmp 0x28c1
movq -0x30(%rbp), %rax
addq $-0x1, %rax
movq %rax, -0x30(%rbp)
jmp 0x25b6
movq -0x60(%rbp), %rcx
movq -0x70(%rbp), %rax
movq %rax, -0x5e0(%rbp)
movq -0x28(%rbp), %rax
movslq 0x4808(%rip), %rsi      # 0x70f4
cqto
idivq %rsi
movq -0x5e0(%rbp), %rax
movq %rcx, (%rax,%rdx,8)
movq -0x28(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x28(%rbp)
jmp 0x23c7
cmpl $0x1, 0x47dc(%rip)      # 0x70f0
jle 0x2932
movq 0x46db(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movq -0x40(%rbp), %rdx
leaq 0x19d0(%rip), %rsi      # 0x42fb
movb $0x0, %al
callq 0x1130
movq -0x588(%rbp), %rdi
movq -0x48(%rbp), %rsi
movl $0x10, %edx
leaq -0x1369(%rip), %rcx     # 0x15e0
callq 0x1080
movq -0x588(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x560(%rbp), %rdx
callq 0x14c0
leaq -0x160(%rbp), %rdi
movq 0x47a5(%rip), %rdx      # 0x7118
leaq 0x199d(%rip), %rsi      # 0x4317
movb $0x0, %al
callq 0x1190
cmpl $0x1, 0x4768(%rip)      # 0x70f0
jle 0x29a2
movq 0x4667(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x1988(%rip), %rsi      # 0x4323
movb $0x0, %al
callq 0x1130
leaq -0x160(%rbp), %rdi
leaq 0x1875(%rip), %rsi      # 0x4225
callq 0x1170
movq %rax, -0x558(%rbp)
movq $0xf4240, -0x28(%rbp)   # imm = 0xF4240
movl $0x1, -0xc(%rbp)
movslq -0xc(%rbp), %rax
cmpq -0x50(%rbp), %rax
jg 0x2b3b
movq -0x50(%rbp), %rax
movslq -0xc(%rbp), %rcx
cqto
idivq %rcx
cvtsi2sd %rax, %xmm0
callq 0x1100
movaps %xmm0, %xmm1
movsd 0x1615(%rip), %xmm0     # 0x4010
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
cmpq -0x28(%rbp), %rax
jge 0x2a5c
movq -0x50(%rbp), %rax
movslq -0xc(%rbp), %rcx
cqto
idivq %rcx
cvtsi2sd %rax, %xmm0
callq 0x1100
movaps %xmm0, %xmm1
movsd 0x15e4(%rip), %xmm0     # 0x4010
mulsd %xmm1, %xmm0
cvttsd2si %xmm0, %rax
movq %rax, -0x28(%rbp)
cmpl $0x1, 0x46b0(%rip)      # 0x70f0
jle 0x2a5a
movq 0x45af(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
leaq 0x175e(%rip), %rsi      # 0x41b1
movb $0x0, %al
callq 0x1130
jmp 0x2a5c
movl $0x1, -0x10(%rbp)
movslq -0x10(%rbp), %rax
movq -0x68(%rbp), %rcx
movslq -0xc(%rbp), %rdx
movq (%rcx,%rdx,8), %rcx
movq -0x68(%rbp), %rdx
movl -0xc(%rbp), %esi
subl $0x1, %esi
movslq %esi, %rsi
subq (%rdx,%rsi,8), %rcx
cmpq %rcx, %rax
jg 0x2b2b
movq -0x568(%rbp), %rax
movq -0x68(%rbp), %rcx
movl -0xc(%rbp), %edx
subl $0x1, %edx
movslq %edx, %rdx
movq (%rcx,%rdx,8), %rcx
subq $0x2, %rcx
movslq -0x10(%rbp), %rdx
addq %rdx, %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x570(%rbp)
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x2aca
jp 0x2aca
jmp 0x2b1b
movq -0x558(%rbp), %rcx
leaq -0xc(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11b0
movq -0x558(%rbp), %rcx
leaq -0x10(%rbp), %rdi
movl $0x4, %esi
movl $0x1, %edx
callq 0x11b0
movq -0x558(%rbp), %rcx
leaq -0x570(%rbp), %rdi
movl $0x8, %esi
movl $0x1, %edx
callq 0x11b0
jmp 0x2b1d
movl -0x10(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x10(%rbp)
jmp 0x2a63
jmp 0x2b2d
movl -0xc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xc(%rbp)
jmp 0x29cb
cmpl $0x1, 0x45ae(%rip)      # 0x70f0
jle 0x2b62
movq 0x44ad(%rip), %rax      # 0x6ff8
movq (%rax), %rdi
movl -0x14(%rbp), %edx
addl $0x1, %edx
leaq 0x17e6(%rip), %rsi      # 0x4341
movb $0x0, %al
callq 0x1130
movq -0x558(%rbp), %rdi
callq 0x10c0
movq -0x560(%rbp), %rdi
callq 0x10c0
movq -0x580(%rbp), %rdi
movq -0x588(%rbp), %rsi
movq -0x68(%rbp), %rdx
movq -0x70(%rbp), %rcx
movq -0x568(%rbp), %r8
callq 0x1eb0
movl -0x14(%rbp), %edi
addl $0x1, %edi
callq 0x1ac0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x5e0, %rsp            # imm = 0x5E0
popq %rbp
retq
nopw %cs:(%rax,%rax)