// File: /workspace/github_c_makefile_star2_O1/stanfordnlp[P]GloVe/src/glove.c
// Function: main
int main(int argc, char **argv) {
    int i;
    FILE *fid;
    int result = 0;
    
    if (argc == 1) {
        printf("GloVe: Global Vectors for Word Representation, v0.2\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-write-header <int>\n");
        printf("\t\tIf 1, write vocab_size/vector_size as first line. Do nothing if 0 (default).\n");
        printf("\t-vector-size <int>\n");
        printf("\t\tDimension of word vector representations (excluding bias term); default 50\n");
        printf("\t-threads <int>\n");
        printf("\t\tNumber of threads; default 8\n");
        printf("\t-iter <int>\n");
        printf("\t\tNumber of training iterations; default 25\n");
        printf("\t-eta <float>\n");
        printf("\t\tInitial learning rate; default 0.05\n");
        printf("\t-alpha <float>\n");
        printf("\t\tParameter in exponent of weighting function; default 0.75\n");
        printf("\t-x-max <float>\n");
        printf("\t\tParameter specifying cutoff in weighting function; default 100.0\n");
        printf("\t-grad-clip\n");
        printf("\t\tGradient components clipping parameter. Values will be clipped to [-grad-clip, grad-clip] interval\n");
        printf("\t-binary <int>\n");
        printf("\t\tSave output in binary format (0: text, 1: binary, 2: both); default 0\n");
        printf("\t-model <int>\n");
        printf("\t\tModel for word vector output (for text output only); default 2\n");
        printf("\t\t   0: output all data, for both word and context word vectors, including bias terms\n");
        printf("\t\t   1: output word vectors, excluding bias terms\n");
        printf("\t\t   2: output word vectors + context word vectors, excluding bias terms\n");
        printf("\t\t   3: output word vectors and context word vectors, excluding bias terms; context word vectors are row-concatenated to the word vectors\n");
        printf("\t-input-file <file>\n");
        printf("\t\tBinary input file of shuffled cooccurrence data (produced by 'cooccur' and 'shuffle'); default cooccurrence.shuf.bin\n");
        printf("\t-vocab-file <file>\n");
        printf("\t\tFile containing vocabulary (truncated unigram counts, produced by 'vocab_count'); default vocab.txt\n");
        printf("\t-save-file <file>\n");
        printf("\t\tFilename, excluding extension, for word vector output; default vectors\n");
        printf("\t-gradsq-file <file>\n");
        printf("\t\tFilename, excluding extension, for squared gradient output; default gradsq\n");
        printf("\t-save-gradsq <int>\n");
        printf("\t\tSave accumulated squared gradients; default 0 (off); ignored if gradsq-file is specified\n");
        printf("\t-checkpoint-every <int>\n");
        printf("\t\tCheckpoint a  model every <int> iterations; default 0 (off)\n");
        printf("\t-load-init-param <int>\n");
        printf("\t\tLoad initial parameters from -init-param-file; default 0 (false)\n");
        printf("\t-save-init-param <int>\n");
        printf("\t\tSave initial parameters (i.e., checkpoint the model before any training); default 0 (false)\n");
        printf("\t-init-param-file <file>\n");
        printf("\t\tBinary initial parameters file to be loaded if -load-init-params is 1; (default is to look for vectors.000.bin)\n");
        printf("\t-load-init-gradsq <int>\n");
        printf("\t\tLoad initial squared gradients from -init-gradsq-file; default 0 (false)\n");
        printf("\t-init-gradsq-file <file>\n");
        printf("\t\tBinary initial squared gradients file to be loaded if -load-init-gradsq is 1; (default is to look for gradsq.000.bin)\n");
        printf("\t-seed <int>\n");
        printf("\t\tRandom seed to use.  If not set, will be randomized using current time.");
        printf("\nExample usage:\n");
        printf("./glove -input-file cooccurrence.shuf.bin -vocab-file vocab.txt -save-file vectors -gradsq-file gradsq -verbose 2 -vector-size 100 -threads 16 -alpha 0.75 -x-max 100.0 -eta 0.05 -binary 2 -model 2\n\n");
        result = 0;
    } else {
        if ((i = find_arg((char *)"-write-header", argc, argv)) > 0) write_header = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-verbose", argc, argv)) > 0) verbose = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-vector-size", argc, argv)) > 0) vector_size = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-iter", argc, argv)) > 0) num_iter = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-threads", argc, argv)) > 0) num_threads = atoi(argv[i + 1]);
        cost = malloc(sizeof(real) * num_threads);
        if ((i = find_arg((char *)"-alpha", argc, argv)) > 0) alpha = atof(argv[i + 1]);
        if ((i = find_arg((char *)"-x-max", argc, argv)) > 0) x_max = atof(argv[i + 1]);
        if ((i = find_arg((char *)"-eta", argc, argv)) > 0) eta = atof(argv[i + 1]);
        if ((i = find_arg((char *)"-grad-clip", argc, argv)) > 0) grad_clip_value = atof(argv[i + 1]);
        if ((i = find_arg((char *)"-binary", argc, argv)) > 0) use_binary = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-model", argc, argv)) > 0) model = atoi(argv[i + 1]);
        if (model != 0 && model != 1) model = 2;
        if ((i = find_arg((char *)"-save-gradsq", argc, argv)) > 0) save_gradsq = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-vocab-file", argc, argv)) > 0) strcpy(vocab_file, argv[i + 1]);
        else strcpy(vocab_file, (char *)"vocab.txt");
        if ((i = find_arg((char *)"-save-file", argc, argv)) > 0) strcpy(save_W_file, argv[i + 1]);
        else strcpy(save_W_file, (char *)"vectors");
        if ((i = find_arg((char *)"-gradsq-file", argc, argv)) > 0) {
            strcpy(save_gradsq_file, argv[i + 1]);
            save_gradsq = 1;
        }
        else if (save_gradsq > 0) strcpy(save_gradsq_file, (char *)"gradsq");
        if ((i = find_arg((char *)"-input-file", argc, argv)) > 0) strcpy(input_file, argv[i + 1]);
        else strcpy(input_file, (char *)"cooccurrence.shuf.bin");
        if ((i = find_arg((char *)"-checkpoint-every", argc, argv)) > 0) checkpoint_every = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-init-param-file", argc, argv)) > 0) strcpy(init_param_file, argv[i + 1]);
        else strcpy(init_param_file, (char *)"vectors.000.bin");
        if ((i = find_arg((char *)"-load-init-param", argc, argv)) > 0) load_init_param = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-save-init-param", argc, argv)) > 0) save_init_param = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-init-gradsq-file", argc, argv)) > 0) strcpy(init_gradsq_file, argv[i + 1]);
        else strcpy(init_gradsq_file, (char *)"gradsq.000.bin");
        if ((i = find_arg((char *)"-load-init-gradsq", argc, argv)) > 0) load_init_gradsq = atoi(argv[i + 1]);
        if ((i = find_arg((char *)"-seed", argc, argv)) > 0) seed = atoi(argv[i + 1]);
        
        vocab_size = 0;
        fid = fopen(vocab_file, "r");
        if (fid == NULL) {log_file_loading_error("vocab file", vocab_file); free(cost); return 1;}
        while ((i = getc(fid)) != EOF) if (i == '\n') vocab_size++; // Count number of entries in vocab_file
        fclose(fid);
        if (vocab_size == 0) {fprintf(stderr, "Unable to find any vocab entries in vocab file %s.\n", vocab_file); free(cost); return 1;}
        result = train_glove();
        free(cost);
    }
    free(W);
    free(gradsq);

    return result;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
cmpl $0x1, %edi
jne 0x2e9d
leaq 0x1892(%rip), %rdi      # 0x4486
callq 0x1090
leaq 0x18ba(%rip), %rdi      # 0x44ba
callq 0x1090
leaq 0x18e1(%rip), %rdi      # 0x44ed
callq 0x1090
leaq 0x18e4(%rip), %rdi      # 0x44fc
callq 0x1090
leaq 0x18e8(%rip), %rdi      # 0x450c
callq 0x1090
leaq 0x1902(%rip), %rdi      # 0x4532
callq 0x1090
leaq 0x190b(%rip), %rdi      # 0x4547
callq 0x1090
leaq 0x194e(%rip), %rdi      # 0x4596
callq 0x1090
leaq 0x1956(%rip), %rdi      # 0x45aa
callq 0x1090
leaq 0x1997(%rip), %rdi      # 0x45f7
callq 0x1090
leaq 0x199b(%rip), %rdi      # 0x4607
callq 0x1090
leaq 0x19ae(%rip), %rdi      # 0x4626
callq 0x1090
leaq 0x19af(%rip), %rdi      # 0x4633
callq 0x1090
leaq 0x19cf(%rip), %rdi      # 0x465f
callq 0x1090
leaq 0x19d1(%rip), %rdi      # 0x466d
callq 0x1090
leaq 0x19eb(%rip), %rdi      # 0x4693
callq 0x1090
leaq 0x19ef(%rip), %rdi      # 0x46a3
callq 0x1090
leaq 0x1a1f(%rip), %rdi      # 0x46df
callq 0x1090
leaq 0x1a23(%rip), %rdi      # 0x46ef
callq 0x1090
leaq 0x1a5a(%rip), %rdi      # 0x4732
callq 0x1090
leaq 0x1a5a(%rip), %rdi      # 0x473e
callq 0x1090
leaq 0x1ab3(%rip), %rdi      # 0x47a3
callq 0x1090
leaq 0x1ab6(%rip), %rdi      # 0x47b2
callq 0x1090
leaq 0x1af2(%rip), %rdi      # 0x47fa
callq 0x1090
leaq 0x1af4(%rip), %rdi      # 0x4808
callq 0x1090
leaq 0x1b29(%rip), %rdi      # 0x4849
callq 0x1090
leaq 0x1b73(%rip), %rdi      # 0x489f
callq 0x1090
leaq 0x1b99(%rip), %rdi      # 0x48d1
callq 0x1090
leaq 0x1bd6(%rip), %rdi      # 0x491a
callq 0x1090
leaq 0x1c54(%rip), %rdi      # 0x49a4
callq 0x1090
leaq 0x1c5c(%rip), %rdi      # 0x49b8
callq 0x1090
leaq 0x1cc7(%rip), %rdi      # 0x4a2f
callq 0x1090
leaq 0x1ccf(%rip), %rdi      # 0x4a43
callq 0x1090
leaq 0x1d29(%rip), %rdi      # 0x4aa9
callq 0x1090
leaq 0x1d30(%rip), %rdi      # 0x4abc
callq 0x1090
leaq 0x1d6d(%rip), %rdi      # 0x4b05
callq 0x1090
leaq 0x1d76(%rip), %rdi      # 0x4b1a
callq 0x1090
leaq 0x1db7(%rip), %rdi      # 0x4b67
callq 0x1090
leaq 0x1dbf(%rip), %rdi      # 0x4b7b
callq 0x1090
leaq 0x1e0e(%rip), %rdi      # 0x4bd6
callq 0x1090
leaq 0x1e1b(%rip), %rdi      # 0x4bef
callq 0x1090
leaq 0x1e4d(%rip), %rdi      # 0x4c2d
callq 0x1090
leaq 0x1e59(%rip), %rdi      # 0x4c45
callq 0x1090
leaq 0x1e90(%rip), %rdi      # 0x4c88
callq 0x1090
leaq 0x1e9c(%rip), %rdi      # 0x4ca0
callq 0x1090
leaq 0x1eee(%rip), %rdi      # 0x4cfe
callq 0x1090
leaq 0x1efb(%rip), %rdi      # 0x4d17
callq 0x1090
leaq 0x1f61(%rip), %rdi      # 0x4d89
callq 0x1090
leaq 0x1f6e(%rip), %rdi      # 0x4da2
callq 0x1090
leaq 0x1fad(%rip), %rdi      # 0x4ded
callq 0x1090
leaq 0x1fbb(%rip), %rdi      # 0x4e07
callq 0x1090
leaq 0x2027(%rip), %rdi      # 0x4e7f
callq 0x1090
leaq 0x147b(%rip), %rdi      # 0x42df
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x10f0
leaq 0x2018(%rip), %rdi      # 0x4e8c
callq 0x1090
leaq 0x201c(%rip), %rdi      # 0x4e9c
callq 0x1090
movq 0x434c(%rip), %rdi      # 0x71d8
callq 0x1030
leaq 0x4348(%rip), %rax      # 0x71e0
jmp 0x334a
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x1480(%rip), %rdi      # 0x4329
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2ec9
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x42e7(%rip)      # 0x71b0
leaq 0x1467(%rip), %rdi      # 0x4337
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2ef0
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x4278(%rip)      # 0x7168
leaq 0x1449(%rip), %rdi      # 0x4340
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2f17
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x4261(%rip)      # 0x7178
leaq 0x142f(%rip), %rdi      # 0x434d
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2f3e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x4236(%rip)      # 0x7174
leaq 0x140e(%rip), %rdi      # 0x4353
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2f65
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x420b(%rip)      # 0x7170
movslq 0x4204(%rip), %rdi      # 0x7170
shlq $0x3, %rdi
callq 0x11c0
movq %rax, 0x4e44(%rip)      # 0x7dc0
leaq 0x13d9(%rip), %rdi      # 0x435c
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2fa5
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x10b0
movsd %xmm0, 0x41e3(%rip)     # 0x7188
leaq 0x13b7(%rip), %rdi      # 0x4363
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2fce
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x10b0
movsd %xmm0, 0x41c2(%rip)     # 0x7190
leaq 0x1395(%rip), %rdi      # 0x436a
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x2ff7
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x10b0
movsd %xmm0, 0x4189(%rip)     # 0x7180
leaq 0x1735(%rip), %rdi      # 0x4733
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3020
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x10b0
movsd %xmm0, 0x4178(%rip)     # 0x7198
leaq 0x1348(%rip), %rdi      # 0x436f
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3047
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x4175(%rip)      # 0x71bc
leaq 0x1329(%rip), %rdi      # 0x4377
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x306e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x410e(%rip)      # 0x717c
cmpl $0x2, 0x4107(%rip)      # 0x717c
jb 0x3081
movl $0x2, 0x40fb(%rip)      # 0x717c
leaq 0x12f6(%rip), %rdi      # 0x437e
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x30a8
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x4110(%rip)      # 0x71b8
leaq 0x12dc(%rip), %rdi      # 0x438b
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x30d2
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x54e5(%rip), %rdi      # 0x85b0
callq 0x1060
jmp 0x30ec
movabsq $0x78742e6261636f76, %rax # imm = 0x78742E6261636F76
movq %rax, 0x54cd(%rip)      # 0x85b0
movw $0x74, 0x54cc(%rip)     # 0x85b8
leaq 0x12a4(%rip), %rdi      # 0x4397
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3116
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x4cc1(%rip), %rdi      # 0x7dd0
callq 0x1060
jmp 0x3127
movabsq $0x73726f74636576, %rax # imm = 0x73726F74636576
movq %rax, 0x4ca9(%rip)      # 0x7dd0
leaq 0x12da(%rip), %rdi      # 0x4408
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x315b
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x5076(%rip), %rdi      # 0x81c0
callq 0x1060
movl $0x1, 0x405f(%rip)      # 0x71b8
jmp 0x3178
cmpl $0x0, 0x4056(%rip)      # 0x71b8
jle 0x3178
movl $0x717364, 0x5055(%rip) # imm = 0x717364
movl $0x64617267, 0x5048(%rip) # imm = 0x64617267
leaq 0x1223(%rip), %rdi      # 0x43a2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x31a2
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x4835(%rip), %rdi      # 0x79d0
callq 0x1060
jmp 0x31c1
movups 0x1870(%rip), %xmm0     # 0x4a19
movaps %xmm0, 0x4820(%rip)     # 0x79d0
movabsq $0x6e69622e667568, %rax # imm = 0x6E69622E667568
movq %rax, 0x481d(%rip)      # 0x79de
leaq 0x11e6(%rip), %rdi      # 0x43ae
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x31e8
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x3fd8(%rip)      # 0x71c0
leaq 0x11d1(%rip), %rdi      # 0x43c0
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3212
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x3fe5(%rip), %rdi      # 0x71f0
callq 0x1060
jmp 0x3220
movups 0x11b8(%rip), %xmm0     # 0x43d1
movaps %xmm0, 0x3fd0(%rip)     # 0x71f0
leaq 0x11ba(%rip), %rdi      # 0x43e1
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3247
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x3f7d(%rip)      # 0x71c4
leaq 0x11a4(%rip), %rdi      # 0x43f2
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x326e
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x3f5a(%rip)      # 0x71c8
leaq 0x118e(%rip), %rdi      # 0x4403
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3298
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rsi
leaq 0x434f(%rip), %rdi      # 0x75e0
callq 0x1060
jmp 0x32ba
movabsq $0x6e69622e303030, %rax # imm = 0x6E69622E303030
movq %rax, 0x433e(%rip)      # 0x75e7
movabsq $0x302e717364617267, %rax # imm = 0x302E717364617267
movq %rax, 0x4326(%rip)      # 0x75e0
leaq 0x1163(%rip), %rdi      # 0x4424
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x32e1
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x3eeb(%rip)      # 0x71cc
leaq 0x114e(%rip), %rdi      # 0x4436
movl %ebp, %esi
movq %rbx, %rdx
callq 0x34f8
testl %eax, %eax
jle 0x3308
movl %eax, %eax
movq 0x8(%rbx,%rax,8), %rdi
callq 0x1220
movl %eax, 0x3eac(%rip)      # 0x71b4
movq $0x0, 0x3ebd(%rip) # 0x71d0
leaq 0x5296(%rip), %rdi      # 0x85b0
leaq 0x1014(%rip), %rsi      # 0x4335
callq 0x1210
testq %rax, %rax
jne 0x335b
leaq 0xe80(%rip), %rdi       # 0x41b2
leaq 0x5277(%rip), %rsi      # 0x85b0
callq 0x1904
movl $0x1, %ebx
leaq 0x4a76(%rip), %rax      # 0x7dc0
movq (%rax), %rdi
callq 0x1030
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
movq %rbx, %rdi
callq 0x1290
cmpl $0xa, %eax
je 0x3372
cmpl $-0x1, %eax
jne 0x335e
jmp 0x337b
incq 0x3e57(%rip)            # 0x71d0
jmp 0x335e
movq %rbx, %rdi
callq 0x10e0
cmpq $0x0, 0x3e45(%rip)      # 0x71d0
jne 0x3394
callq 0x18e5
jmp 0x333e
callq 0x149b
movl %eax, %ebx
movq 0x4a1e(%rip), %rdi      # 0x7dc0
callq 0x1030
jmp 0x2e85