// File: /workspace/github_c_makefile_star2_O0/nh13[P]ksw/src/parasail/tests/test_gcups.c
// Function: main
int main(int argc, char **argv)
{
    unsigned long i = 0;
    size_t seq_count = 10;
    size_t limit = 0;
    parasail_sequences_t *sequences = NULL;
    char *filename = NULL;
    int c = 0;
    int distribution = 0;

    while ((c = getopt(argc, argv, "f:d")) != -1) {
        switch (c) {
            case 'd':
                distribution = 1;
                break;
            case 'f':
                filename = optarg;
                break;
            case '?':
                if (optopt == 'f' || optopt == 'n') {
                    fprintf(stderr,
                            "Option -%c requires an argument.\n",
                            optopt);
                }
                else if (isprint(optopt)) {
                    fprintf(stderr, "Unknown option `-%c'.\n",
                            optopt);
                }
                else {
                    fprintf(stderr,
                            "Unknown option character `\\x%x'.\n",
                            optopt);
                }
                exit(1);
            default:
                fprintf(stderr, "default case in getopt\n");
                exit(1);
        }
    }

    if (filename) {
        sequences = parasail_sequences_from_file(filename);
        seq_count = sequences->l;
    }
    else {
        fprintf(stderr, "missing filename\n");
        exit(1);
    }

    if (distribution) {
        for (i=0; i<seq_count; ++i) {
            printf("%lu\n", (unsigned long)sequences->seqs[i].seq.l);
        }
    }
    else {
        limit = binomial_coefficient(seq_count, 2);
        printf("%lu choose 2 is %lu\n",
                (unsigned long)seq_count, (unsigned long)limit);

        {
            unsigned long a=0;
            unsigned long b=1;
            unsigned long work=0;
            unsigned long columns=0;
            for (i=0; i<limit; ++i) {
                k_combination2(i, &a, &b);
                work += sequences->seqs[a].seq.l*sequences->seqs[b].seq.l;
                columns += sequences->seqs[b].seq.l;
            }
            printf("work=%lu\n", work);
            printf("columns=%lu\n", columns);
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
movq $0xa, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x38(%rbp)
movl $0x0, -0x3c(%rbp)
movl $0x0, -0x40(%rbp)
movl -0x8(%rbp), %edi
movq -0x10(%rbp), %rsi
leaq 0x1d76(%rip), %rdx      # 0x3040
callq 0x1130
movl %eax, -0x3c(%rbp)
cmpl $-0x1, %eax
je 0x13f0
movl -0x3c(%rbp), %eax
movl %eax, -0x64(%rbp)
subl $0x3f, %eax
je 0x131e
jmp 0x12e8
movl -0x64(%rbp), %eax
subl $0x64, %eax
je 0x12ff
jmp 0x12f2
movl -0x64(%rbp), %eax
subl $0x66, %eax
je 0x130b
jmp 0x13c9
movl $0x1, -0x40(%rbp)
jmp 0x13eb
movq 0x3cbe(%rip), %rax      # 0x4fd0
movq (%rax), %rax
movq %rax, -0x38(%rbp)
jmp 0x13eb
movq 0x3cbb(%rip), %rax      # 0x4fe0
cmpl $0x66, (%rax)
je 0x1336
movq 0x3caf(%rip), %rax      # 0x4fe0
cmpl $0x6e, (%rax)
jne 0x1359
movq 0x3cbb(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3c99(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1cf4(%rip), %rsi      # 0x3044
movb $0x0, %al
callq 0x10b0
jmp 0x13bf
callq 0x1160
movq (%rax), %rax
movq 0x3c78(%rip), %rcx      # 0x4fe0
movslq (%rcx), %rcx
movzwl (%rax,%rcx,2), %eax
andl $0x4000, %eax           # imm = 0x4000
cmpl $0x0, %eax
je 0x139c
movq 0x3c78(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3c56(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1cd3(%rip), %rsi      # 0x3066
movb $0x0, %al
callq 0x10b0
jmp 0x13bd
movq 0x3c55(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
movq 0x3c33(%rip), %rax      # 0x4fe0
movl (%rax), %edx
leaq 0x1cc7(%rip), %rsi      # 0x307d
movb $0x0, %al
callq 0x10b0
jmp 0x13bf
movl $0x1, %edi
callq 0x1140
movq 0x3c28(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1cc5(%rip), %rsi      # 0x309f
movb $0x0, %al
callq 0x10b0
movl $0x1, %edi
callq 0x1140
jmp 0x12bc
cmpq $0x0, -0x38(%rbp)
je 0x1412
movq -0x38(%rbp), %rdi
callq 0x1790
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x8(%rax), %rax
movq %rax, -0x20(%rbp)
jmp 0x1434
movq 0x3bdf(%rip), %rax      # 0x4ff8
movq (%rax), %rdi
leaq 0x1c94(%rip), %rsi      # 0x30b7
movb $0x0, %al
callq 0x10b0
movl $0x1, %edi
callq 0x1140
cmpl $0x0, -0x40(%rbp)
je 0x1483
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0x147e
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x18(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rsi
leaq 0x1c70(%rip), %rdi      # 0x30d9
movb $0x0, %al
callq 0x1080
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x1442
jmp 0x1573
movq -0x20(%rbp), %rdi
movl $0x2, %esi
callq 0x1580
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rsi
movq -0x28(%rbp), %rdx
leaq 0x1c25(%rip), %rdi      # 0x30c9
movb $0x0, %al
callq 0x1080
movq $0x0, -0x48(%rbp)
movq $0x1, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
movq $0x0, -0x60(%rbp)
movq $0x0, -0x18(%rbp)
movq -0x18(%rbp), %rax
cmpq -0x28(%rbp), %rax
jae 0x154f
movq -0x18(%rbp), %rdi
leaq -0x48(%rbp), %rsi
leaq -0x50(%rbp), %rdx
callq 0x1600
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x48(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
movq -0x30(%rbp), %rcx
movq (%rcx), %rcx
movq -0x50(%rbp), %rdx
shlq $0x6, %rdx
addq %rdx, %rcx
imulq 0x20(%rcx), %rax
addq -0x58(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movq -0x50(%rbp), %rcx
shlq $0x6, %rcx
addq %rcx, %rax
movq 0x20(%rax), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x18(%rbp)
jmp 0x14d3
movq -0x58(%rbp), %rsi
leaq 0x1b84(%rip), %rdi      # 0x30de
movb $0x0, %al
callq 0x1080
movq -0x60(%rbp), %rsi
leaq 0x1b7c(%rip), %rdi      # 0x30e8
movb $0x0, %al
callq 0x1080
xorl %eax, %eax
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax,%rax)