// File: /workspace/github_c_makefile_star2_O2/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 %rbx
pushq %rax
movq %rsi, %rbx
movl %edi, %ebp
cmpl $0x2, %edi
jne 0x1910
movq 0x8(%rbx), %rdi
leaq 0x85b(%rip), %rsi       # 0x2136
callq 0x1b14
testl %eax, %eax
je 0x1979
movq 0x8(%rbx), %rdi
leaq 0x847(%rip), %rsi       # 0x213a
callq 0x1b14
testl %eax, %eax
je 0x1979
movq 0x8(%rbx), %rdi
leaq 0x832(%rip), %rsi       # 0x2139
callq 0x1b14
testl %eax, %eax
je 0x1979
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x1140
movq %rax, 0x27f7(%rip)      # 0x4118
leaq 0x862(%rip), %rdi       # 0x218a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c58
testl %eax, %eax
jle 0x1948
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1170
movl %eax, 0x27a8(%rip)      # 0x40f0
leaq 0x844(%rip), %rdi       # 0x2193
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c58
movq 0x27b8(%rip), %rdi      # 0x4118
testl %eax, %eax
jle 0x1a36
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
callq 0x1060
jmp 0x1a51
leaq 0x838(%rip), %rdi       # 0x21b8
callq 0x1070
leaq 0x864(%rip), %rdi       # 0x21f0
callq 0x1070
leaq 0x88b(%rip), %rdi       # 0x2223
callq 0x1070
leaq 0x88e(%rip), %rdi       # 0x2232
callq 0x1070
leaq 0x892(%rip), %rdi       # 0x2242
callq 0x1070
leaq 0x8ac(%rip), %rdi       # 0x2268
callq 0x1070
leaq 0x8b1(%rip), %rdi       # 0x2279
callq 0x1070
leaq 0x8dd(%rip), %rdi       # 0x22b1
callq 0x1070
leaq 0x8e4(%rip), %rdi       # 0x22c4
callq 0x1070
leaq 0x985(%rip), %rdi       # 0x2371
callq 0x1070
leaq 0x98c(%rip), %rdi       # 0x2384
callq 0x1070
leaq 0x9cb(%rip), %rdi       # 0x23cf
callq 0x1070
leaq 0x730(%rip), %rdi       # 0x2140
xorl %eax, %eax
callq 0x10c0
leaq 0x9be(%rip), %rdi       # 0x23dc
callq 0x1070
leaq 0x9fe(%rip), %rdi       # 0x2428
callq 0x1070
xorl %eax, %eax
jmp 0x1b0c
movabsq $0x656c6666756873, %rax # imm = 0x656C6666756873
movq %rax, 0x5(%rdi)
movabsq $0x7568735f706d6574, %rax # imm = 0x7568735F706D6574
movq %rax, (%rdi)
leaq 0x746(%rip), %rdi       # 0x219e
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c58
testl %eax, %eax
jle 0x1a7c
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1090
movsd %xmm0, 0x2686(%rip)     # 0x4100
jmp 0x1a84
movsd 0x267c(%rip), %xmm0     # 0x4100
mulsd 0x57c(%rip), %xmm0      # 0x2008
mulsd 0x57c(%rip), %xmm0      # 0x2010
mulsd 0x57c(%rip), %xmm0      # 0x2018
cvttsd2si %xmm0, %rax
movq %rax, 0x2650(%rip)      # 0x40f8
leaq 0x6f7(%rip), %rdi       # 0x21a6
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c58
testl %eax, %eax
jle 0x1ad0
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1100
movq %rax, 0x2628(%rip)      # 0x40f8
leaq 0x6db(%rip), %rdi       # 0x21b2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x1c58
testl %eax, %eax
jle 0x1af7
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1170
movl %eax, 0x2619(%rip)      # 0x4110
callq 0x162b
movl %eax, %ebx
movq 0x2613(%rip), %rdi      # 0x4118
callq 0x1030
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop