// File: /workspace/github_c_makefile_star2_O3/stanfordnlp[P]GloVe/src/shuffle.c
// Function: main
int main(int argc, char **argv) {
    int i;
    
    if (argc == 2 &&
        (!scmp(argv[1], "-h") || !scmp(argv[1], "-help") || !scmp(argv[1], "--help"))) {
        printf("Tool to shuffle entries of word-word cooccurrence files\n");
        printf("Author: Jeffrey Pennington (jpennin@stanford.edu)\n\n");
        printf("Usage options:\n");
        printf("\t-verbose <int>\n");
        printf("\t\tSet verbosity: 0, 1, or 2 (default)\n");
        printf("\t-memory <float>\n");
        printf("\t\tSoft limit for memory consumption, in GB; default 4.0\n");
        printf("\t-array-size <int>\n");
        printf("\t\tLimit to length <int> the buffer which stores chunks of data to shuffle before writing to disk. \n\t\tThis value overrides that which is automatically produced by '-memory'.\n");
        printf("\t-temp-file <file>\n");
        printf("\t\tFilename, excluding extension, for temporary files; default temp_shuffle\n");
        printf("\t-seed <int>\n");
        printf("\t\tRandom seed to use.  If not set, will be randomized using current time.");
        printf("\nExample usage: (assuming 'cooccurrence.bin' has been produced by 'coccur')\n");
        printf("./shuffle -verbose 2 -memory 8.0 < cooccurrence.bin > cooccurrence.shuf.bin\n");
        return 0;
    }

    file_head = malloc(sizeof(char) * MAX_STRING_LENGTH);
    if ((i = find_arg((char *)"-verbose", argc, argv)) > 0) verbose = atoi(argv[i + 1]);
    if ((i = find_arg((char *)"-temp-file", argc, argv)) > 0) strcpy(file_head, argv[i + 1]);
    else strcpy(file_head, (char *)"temp_shuffle");
    if ((i = find_arg((char *)"-memory", argc, argv)) > 0) memory_limit = atof(argv[i + 1]);
    array_size = (long long) (0.95 * (real)memory_limit * 1073741824/(sizeof(CREC)));
    if ((i = find_arg((char *)"-array-size", argc, argv)) > 0) array_size = atoll(argv[i + 1]);
    if ((i = find_arg((char *)"-seed", argc, argv)) > 0) seed = atoi(argv[i + 1]);
    const int returned_value = shuffle_by_chunks();
    free(file_head);
    return returned_value;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movl %edi, %ebp
cmpl $0x2, %edi
jne 0x1c8b
movq 0x8(%rbx), %rdi
leaq 0x5a3(%rip), %rsi       # 0x2136
callq 0x1ca4
testl %eax, %eax
je 0x1bc8
movq 0x8(%rbx), %rdi
leaq 0x593(%rip), %rsi       # 0x213a
callq 0x1ca4
testl %eax, %eax
je 0x1bc8
movq 0x8(%rbx), %rdi
leaq 0x57e(%rip), %rsi       # 0x2139
callq 0x1ca4
testl %eax, %eax
jne 0x1c8b
leaq 0x5e9(%rip), %rdi       # 0x21b8
callq 0x1070
leaq 0x615(%rip), %rdi       # 0x21f0
callq 0x1070
leaq 0x63c(%rip), %rdi       # 0x2223
callq 0x1070
leaq 0x63f(%rip), %rdi       # 0x2232
callq 0x1070
leaq 0x643(%rip), %rdi       # 0x2242
callq 0x1070
leaq 0x65d(%rip), %rdi       # 0x2268
callq 0x1070
leaq 0x662(%rip), %rdi       # 0x2279
callq 0x1070
leaq 0x68e(%rip), %rdi       # 0x22b1
callq 0x1070
leaq 0x695(%rip), %rdi       # 0x22c4
callq 0x1070
leaq 0x736(%rip), %rdi       # 0x2371
callq 0x1070
leaq 0x73d(%rip), %rdi       # 0x2384
callq 0x1070
leaq 0x77c(%rip), %rdi       # 0x23cf
callq 0x1070
leaq 0x4e1(%rip), %rdi       # 0x2140
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x10c0
leaq 0x76d(%rip), %rdi       # 0x23dc
callq 0x1070
leaq 0x7ad(%rip), %rdi       # 0x2428
callq 0x1070
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0xc(%rsp), %r14
movl %ebp, %edi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x1521
movl (%r14), %ebx
jmp 0x1c80
nop