// File: /workspace/github_c_makefile_star2_O2/debbiemarkslab[P]plmc/src/main.c
// Function: main
int main(int argc, char **argv) {
    char *alignFile = NULL;
    char *outputFile = NULL;
    char *couplingsFile = NULL;
    char *weightsFile = NULL;
    char *weightsOutputFile = NULL;
    options_t *options = default_options();

    /* Print usage if no arguments */
    if (argc == 1) {
        fprintf(stderr, "%s", usage);
        exit(1);
    }

    /* Parse command line arguments */
    for (int arg = 1; arg < argc; arg++) {
        if ((arg < argc-1) && (strcmp(argv[arg], "--output") == 0
                    || strcmp(argv[arg], "-o") == 0)) {
            outputFile = argv[++arg];
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--alphabet") == 0
                    || strcmp(argv[arg], "-a") == 0)) {
            options->alphabet = argv[++arg];
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--couplings") == 0
                    || strcmp(argv[arg], "-c") == 0)) {
            couplingsFile = argv[++arg];
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--lambdah") == 0
                    || strcmp(argv[arg], "-lh") == 0)) {
            options->lambdaH = atof(argv[++arg]);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--lambdae") == 0
                    || strcmp(argv[arg], "-le") == 0)) {
            options->lambdaE = atof(argv[++arg]);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--lambdag") == 0
                    || strcmp(argv[arg], "-lg") == 0)) {
            options->lambdaGroup = atof(argv[++arg]);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--theta") == 0
                    || strcmp(argv[arg], "-t") == 0)) {
            options->theta = atof(argv[++arg]);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--scale") == 0
                    || strcmp(argv[arg], "-s") == 0)) {
            options->scale = atof(argv[++arg]);
        } else if ((arg < argc-1)  && (strcmp(argv[arg], "--maxiter") == 0
                    || strcmp(argv[arg], "-m") == 0)) {
            options->maxIter = atoi(argv[++arg]);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--independent") == 0
                    || strcmp(argv[arg], "-i") == 0)) {
            options->usePairs = 0;
            fprintf(stderr, "Independent model not yet implemented\n");
            exit(0);
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--gapreduce") == 0
                    || strcmp(argv[arg], "-g") == 0)) {
            options->estimatorMAP = INFER_MAP_PLM_GAPREDUCE;
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--estimatele") == 0
                    || strcmp(argv[arg], "-ee") == 0)) {
            options->zeroAPC = 1;
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--focus") == 0
                    || strcmp(argv[arg], "-f") == 0)) {
            options->target = argv[++arg];
        } else if ((arg < argc-1) && strcmp(argv[arg], "--fast") == 0) {
            options->sgd = 1;
            options->fastWeights = 100;
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--weights") == 0
                    || strcmp(argv[arg], "-w") == 0)) {
            weightsFile = argv[++arg];
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--save-weights") == 0)) {
            weightsOutputFile = argv[++arg];
        } else if ((arg < argc-1) && (strcmp(argv[arg], "--ncores") == 0
                    || strcmp(argv[arg], "-n") == 0)) {
            #if defined(_OPENMP)
                if (strcmp(argv[arg + 1], "max") == 0) {
                    int maxThreads = omp_get_max_threads();
                    /* Redundant, but serves as sanity check */
                    omp_set_num_threads(maxThreads);
                    fprintf(stderr, "OpenMP: Using %d of %d threads\n",
                        maxThreads, maxThreads);
                } else {
                    int numThreads = atoi(argv[arg + 1]);
                    int maxThreads = omp_get_max_threads();
                    if (numThreads >= 1 && numThreads <= maxThreads) {
                        omp_set_num_threads(numThreads);
                        fprintf(stderr, "OpenMP: Using %d of %d threads\n",
                            numThreads, maxThreads);
                    } else if (numThreads > maxThreads) {
                        omp_set_num_threads(maxThreads);
                        fprintf(stderr, "OpenMP: More threads requested than "
                            "available. Using %d of %d threads instead.\n",
                            maxThreads, maxThreads);
                    } else {
                        omp_set_num_threads(1);
                        fprintf(stderr, "OpenMP: Using 1 of %d threads\n",
                            maxThreads);
                    }
                }
                arg++;
            #else
                fprintf(stderr, "Error (-n/--ncores) only available when "
                    "compiled with OpenMP\n");
                exit(1);
            #endif
        } else if (strcmp(argv[arg], "--help") == 0
                    || strcmp(argv[arg], "-h") == 0) {
            fprintf(stderr, "%s", usage);
            exit(1);
        }
    }
    alignFile = argv[argc - 1];

    run_plmc(alignFile, outputFile, couplingsFile, weightsFile, weightsOutputFile, options);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
movl %edi, %r15d
xorl %eax, %eax
callq 0x37bc
movq %rax, 0x8(%rsp)
cmpl $0x1, %r15d
je 0xb253
leal -0x1(%r15), %eax
movl %eax, 0x14(%rsp)
pushq $0x1
popq %rbp
movq $0x0, 0x30(%rsp)
movq $0x0, 0x28(%rsp)
movq $0x0, 0x20(%rsp)
movq $0x0, 0x18(%rsp)
cmpl %r15d, %ebp
jge 0xb21c
movslq %ebp, %r12
movq (%r14,%r12,8), %r13
cmpl 0x14(%rsp), %ebp
jge 0xb0ab
movq %r13, %rdi
leaq 0x23bd(%rip), %rsi      # 0xd18e
callq 0x1160
testl %eax, %eax
je 0xb0e8
movb (%r13), %bl
cmpb $0x2d, %bl
jne 0xadf9
cmpb $0x6f, 0x1(%r13)
jne 0xadf9
cmpb $0x0, 0x2(%r13)
je 0xb0e8
movq %r13, %rdi
leaq 0x2394(%rip), %rsi      # 0xd197
callq 0x1160
testl %eax, %eax
je 0xb0f9
cmpb $0x2d, %bl
jne 0xae27
cmpb $0x61, 0x1(%r13)
jne 0xae27
cmpb $0x0, 0x2(%r13)
je 0xb0f9
movq %r13, %rdi
leaq 0x2371(%rip), %rsi      # 0xd1a2
callq 0x1160
testl %eax, %eax
je 0xb10e
cmpb $0x2d, %bl
jne 0xae55
cmpb $0x63, 0x1(%r13)
jne 0xae55
cmpb $0x0, 0x2(%r13)
je 0xb10e
movq %r13, %rdi
leaq 0x234f(%rip), %rsi      # 0xd1ae
callq 0x1160
testl %eax, %eax
je 0xb11f
movq %r13, %rdi
leaq 0x2342(%rip), %rsi      # 0xd1b8
callq 0x1160
testl %eax, %eax
je 0xb11f
movq %r13, %rdi
leaq 0x232f(%rip), %rsi      # 0xd1bc
callq 0x1160
testl %eax, %eax
je 0xb13a
movq %r13, %rdi
leaq 0x2322(%rip), %rsi      # 0xd1c6
callq 0x1160
testl %eax, %eax
je 0xb13a
movq %r13, %rdi
leaq 0x230f(%rip), %rsi      # 0xd1ca
callq 0x1160
testl %eax, %eax
je 0xb155
movq %r13, %rdi
leaq 0x2302(%rip), %rsi      # 0xd1d4
callq 0x1160
testl %eax, %eax
je 0xb155
movq %r13, %rdi
leaq 0x22ef(%rip), %rsi      # 0xd1d8
callq 0x1160
testl %eax, %eax
je 0xb170
cmpb $0x2d, %bl
jne 0xaf0d
cmpb $0x74, 0x1(%r13)
jne 0xaf0d
cmpb $0x0, 0x2(%r13)
je 0xb170
movq %r13, %rdi
leaq 0x22c9(%rip), %rsi      # 0xd1e0
callq 0x1160
testl %eax, %eax
je 0xb18b
cmpb $0x2d, %bl
jne 0xaf3b
cmpb $0x73, 0x1(%r13)
jne 0xaf3b
cmpb $0x0, 0x2(%r13)
je 0xb18b
movq %r13, %rdi
leaq 0x22a3(%rip), %rsi      # 0xd1e8
callq 0x1160
testl %eax, %eax
je 0xb1a3
cmpb $0x2d, %bl
jne 0xaf69
cmpb $0x6d, 0x1(%r13)
jne 0xaf69
cmpb $0x0, 0x2(%r13)
je 0xb1a3
movq %r13, %rdi
leaq 0x227f(%rip), %rsi      # 0xd1f2
callq 0x1160
testl %eax, %eax
je 0xb271
cmpb $0x2d, %bl
jne 0xaf97
cmpb $0x69, 0x1(%r13)
jne 0xaf97
cmpb $0x0, 0x2(%r13)
je 0xb271
movq %r13, %rdi
leaq 0x2286(%rip), %rsi      # 0xd227
callq 0x1160
testl %eax, %eax
je 0xb1b9
cmpb $0x2d, %bl
jne 0xafc5
cmpb $0x67, 0x1(%r13)
jne 0xafc5
cmpb $0x0, 0x2(%r13)
je 0xb1b9
movq %r13, %rdi
leaq 0x2264(%rip), %rsi      # 0xd233
callq 0x1160
testl %eax, %eax
je 0xb1c7
movq %r13, %rdi
leaq 0x225a(%rip), %rsi      # 0xd240
callq 0x1160
testl %eax, %eax
je 0xb1c7
movq %r13, %rdi
leaq 0x2247(%rip), %rsi      # 0xd244
callq 0x1160
testl %eax, %eax
je 0xb1d5
cmpb $0x2d, %bl
jne 0xb021
cmpb $0x66, 0x1(%r13)
jne 0xb021
cmpb $0x0, 0x2(%r13)
je 0xb1d5
movq %r13, %rdi
leaq 0x2221(%rip), %rsi      # 0xd24c
callq 0x1160
testl %eax, %eax
je 0xb1e6
movq %r13, %rdi
leaq 0x2211(%rip), %rsi      # 0xd253
callq 0x1160
testl %eax, %eax
je 0xb1fb
cmpb $0x2d, %bl
jne 0xb066
cmpb $0x77, 0x1(%r13)
jne 0xb066
cmpb $0x0, 0x2(%r13)
je 0xb1fb
movq %r13, %rdi
leaq 0x21ed(%rip), %rsi      # 0xd25d
callq 0x1160
testl %eax, %eax
je 0xb209
movq %r13, %rdi
leaq 0x21e5(%rip), %rsi      # 0xd26c
callq 0x1160
testl %eax, %eax
je 0xb29d
cmpb $0x2d, %bl
jne 0xb0ab
cmpb $0x6e, 0x1(%r13)
jne 0xb0ab
cmpb $0x0, 0x2(%r13)
je 0xb29d
movq %r13, %rdi
leaq 0x21fe(%rip), %rsi      # 0xd2b3
callq 0x1160
testl %eax, %eax
je 0xb253
cmpb $0x2d, (%r13)
jne 0xb215
cmpb $0x68, 0x1(%r13)
jne 0xb215
cmpb $0x0, 0x2(%r13)
jne 0xb215
jmp 0xb253
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq %rax, 0x30(%rsp)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, 0x8(%rcx)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq %rax, 0x28(%rsp)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movsd %xmm0, 0x40(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movsd %xmm0, 0x48(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movsd %xmm0, 0x50(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movsd %xmm0, 0x30(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x1090
movq 0x8(%rsp), %rax
movsd %xmm0, 0x38(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rdi
callq 0x11d0
movq 0x8(%rsp), %rcx
movl %eax, 0x1c(%rcx)
jmp 0xb215
movq 0x8(%rsp), %rax
movl $0x1, 0x18(%rax)
jmp 0xb215
movq 0x8(%rsp), %rax
movl $0x1, 0x58(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
jmp 0xb215
movq 0x8(%rsp), %rax
movl $0x1, 0x20(%rax)
movl $0x64, 0x28(%rax)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq %rax, 0x20(%rsp)
jmp 0xb215
incl %ebp
movq 0x8(%r14,%r12,8), %rax
movq %rax, 0x18(%rsp)
incl %ebp
jmp 0xadad
movslq %r15d, %rax
movq -0x8(%r14,%rax,8), %rdi
movq 0x30(%rsp), %rsi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
movq 0x18(%rsp), %r8
movq 0x8(%rsp), %r9
callq 0x3813
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x4d9e(%rip), %rax      # 0xfff8
movq (%rax), %rsi
movq 0x4efc(%rip), %rdi      # 0x10160
callq 0x1100
pushq $0x1
popq %rdi
callq 0x11f0
movq 0x8(%rsp), %rax
andl $0x0, 0x10(%rax)
movq 0x4d77(%rip), %rax      # 0xfff8
movq (%rax), %rcx
leaq 0x1f75(%rip), %rdi      # 0xd200
pushq $0x26
popq %rsi
pushq $0x1
popq %rdx
callq 0x1200
xorl %edi, %edi
callq 0x11f0
movq 0x4d54(%rip), %rax      # 0xfff8
movq (%rax), %rcx
leaq 0x1fc7(%rip), %rdi      # 0xd275
pushq $0x3d
popq %rsi
pushq $0x1
popq %rdx
callq 0x1200
jmp 0xb269