// File: /workspace/github_c_makefile_star2_O0/richarddurbin[P]hash10x/moshmap.c
// Function: main
int main (int argc, char *argv[])
{
  --argc ; ++argv ;		/* eat program name */

  outFile = stdout ;
  
  timeUpdate (stdout) ;		/* initialise timer */
#ifdef OMP
  numThreads = omp_get_max_threads () ;
  omp_set_num_threads (numThreads) ;
#endif

  /* command line parameters */
  params.k = 19 ;
  params.w = 31 ;
  params.s = 17 ;
  params.B = 28 ;

  if (!argc) usage () ;

  int i ;			/* generically useful variables */
  FILE *f ;

  Reference *ref = 0 ;

  while (argc) {
    if (**argv != '-')
      die ("option/command %s does not start with '-': run without arguments for usage", *argv) ;
    fprintf (stderr, "COMMAND %s", *argv) ;
    for (i = 1 ; i < argc && *argv[i] != '-' ; ++i) fprintf (stderr, " %s", argv[i]) ;
    fputc ('\n', stderr) ;
    
#define ARGMATCH(x,y,n)	((!strcmp (*argv, x) || (!strcmp (*argv,y))) && argc >= n && (argc -= n, argv += n))
    if (ARGMATCH("-K","--kmer",2)) params.k = atoi(argv[-1]) ;
    else if (ARGMATCH("-W","--window",2)) params.w = atoi(argv[-1]) ;
    else if (ARGMATCH("-S","--seed",2)) params.s = atoi(argv[-1]) ;
    else if (ARGMATCH("-B","--tableBits",2)) params.B = atoi(argv[-1]) ;
    else if (ARGMATCH("-t","--threads",2))
      {
#ifdef OMP
	numThreads = atoi(argv[-1]) ;
	if (numThreads > omp_get_max_threads ()) numThreads = omp_get_max_threads () ;
	omp_set_num_threads (numThreads) ;
#else
	fprintf (stderr, "  can't set thread number - not compiled with OMP\n") ;
#endif
      }
    else if (ARGMATCH("-v","--verbose",1)) isVerbose = !isVerbose ;
    else if (ARGMATCH("-o","--output",2))
      { if (!strcmp (argv[-1], "-"))
	  outFile = stdout ;
	else if (!(outFile = fopen (argv[-1], "w")))
	  { fprintf (stderr, "can't open output file %s - resetting to stdout\n", argv[-1]) ;
	    outFile = stdout ;
	  }
      }
    else if (ARGMATCH("-f","--referenceFasta",2))
      { if (!(f = fopen (argv[-1], "r"))) die ("failed to open fasta file %s", argv[-1]) ;
	srandom (params.s) ;
	if (params.k <= 0 || params.w <= 0) die ("k %d, w %d must be > 0", params.k, params.w) ;
	Seqhash *hasher = seqhashCreate (params.k, params.w) ;
	fprintf (outFile, "  moshmap initialised with k = %d, w = %d, random seed = %d\n",
		 params.k, params.w, params.s) ;
	Moshset *ms = moshsetCreate (hasher, params.B, 0) ;
	ref = referenceCreate (ms, 1 << 26) ;
	referenceFastaRead (ref, f, TRUE) ;
      }
    else if (ARGMATCH("-q","--query",2))
      { if (!ref) die ("need to read a reference before processing query sequences") ;
	if (!(f = fopen (argv[-1], "r"))) die ("failed to open query file %s", argv[-1]) ;
	queryProcess (ref, f) ;
      }
    else if (ARGMATCH("-r","--referenceRead",2))
      { if (ref) referenceDestroy (ref) ;
	ref = referenceRead (argv[-1]) ;
      }
    else if (ARGMATCH("-w","--referenceWrite",2))
      referenceWrite (ref, argv[-1]) ;
    else die ("unkown command %s - run without arguments for usage", *argv) ;

    timeUpdate (outFile) ;
  }

  fprintf (outFile, "total resources used: ") ; timeTotal (outFile) ;
  if (outFile != stdout) { printf ("total resources used: ") ; timeTotal (stdout) ; }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
movl $0x0, -0x4(%rbp)
movl %edi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl -0x8(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
movq 0xb126(%rip), %rax      # 0xdfd8
movq (%rax), %rax
movq %rax, 0xc48c(%rip)      # 0xf348
movq 0xb115(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
callq 0x90b0
movl $0x13, 0xc47b(%rip)     # 0xf350
movl $0x1f, 0xc475(%rip)     # 0xf354
movl $0x11, 0xc46f(%rip)     # 0xf358
movl $0x1c, 0xc469(%rip)     # 0xf35c
cmpl $0x0, -0x8(%rbp)
jne 0x2efe
callq 0x2d20
movq $0x0, -0x28(%rbp)
cmpl $0x0, -0x8(%rbp)
je 0x362d
movq -0x10(%rbp), %rax
movq (%rax), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
je 0x2f34
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x76cb(%rip), %rdi      # 0xa5f8
movb $0x0, %al
callq 0x8ca0
movq 0xb0bd(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq (%rax), %rdx
leaq 0x76f7(%rip), %rsi      # 0xa643
movb $0x0, %al
callq 0x1120
movl $0x1, -0x14(%rbp)
movl -0x14(%rbp), %ecx
xorl %eax, %eax
cmpl -0x8(%rbp), %ecx
movb %al, -0x39(%rbp)
jge 0x2f7f
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsbl (%rax), %eax
cmpl $0x2d, %eax
setne %al
movb %al, -0x39(%rbp)
movb -0x39(%rbp), %al
testb $0x1, %al
jne 0x2f88
jmp 0x2fb7
movq 0xb069(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq (%rax,%rcx,8), %rdx
leaq 0x76a5(%rip), %rsi      # 0xa64a
movb $0x0, %al
callq 0x1120
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x2f5a
movq 0xb03a(%rip), %rax      # 0xdff8
movq (%rax), %rsi
movl $0xa, %edi
callq 0x10e0
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7675(%rip), %rsi      # 0xa64e
callq 0x1110
cmpl $0x0, %eax
je 0x2ffb
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7660(%rip), %rsi      # 0xa651
callq 0x1110
cmpl $0x0, %eax
jne 0x3034
cmpl $0x2, -0x8(%rbp)
jl 0x3034
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x3034
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
callq 0x11c0
movl %eax, 0xc321(%rip)      # 0xf350
jmp 0x361c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7616(%rip), %rsi      # 0xa658
callq 0x1110
cmpl $0x0, %eax
je 0x3064
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7601(%rip), %rsi      # 0xa65b
callq 0x1110
cmpl $0x0, %eax
jne 0x309d
cmpl $0x2, -0x8(%rbp)
jl 0x309d
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x309d
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
callq 0x11c0
movl %eax, 0xc2bc(%rip)      # 0xf354
jmp 0x361a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x75b9(%rip), %rsi      # 0xa664
callq 0x1110
cmpl $0x0, %eax
je 0x30cd
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x75a4(%rip), %rsi      # 0xa667
callq 0x1110
cmpl $0x0, %eax
jne 0x3106
cmpl $0x2, -0x8(%rbp)
jl 0x3106
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x3106
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
callq 0x11c0
movl %eax, 0xc257(%rip)      # 0xf358
jmp 0x3618
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x755a(%rip), %rsi      # 0xa66e
callq 0x1110
cmpl $0x0, %eax
je 0x3136
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7545(%rip), %rsi      # 0xa671
callq 0x1110
cmpl $0x0, %eax
jne 0x316f
cmpl $0x2, -0x8(%rbp)
jl 0x316f
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x316f
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
callq 0x11c0
movl %eax, 0xc1f2(%rip)      # 0xf35c
jmp 0x3616
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7500(%rip), %rsi      # 0xa67d
callq 0x1110
cmpl $0x0, %eax
je 0x319f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x74eb(%rip), %rsi      # 0xa680
callq 0x1110
cmpl $0x0, %eax
jne 0x31dd
cmpl $0x2, -0x8(%rbp)
jl 0x31dd
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x31dd
movq 0xae31(%rip), %rax      # 0xdff8
movq (%rax), %rdi
leaq 0x74b9(%rip), %rsi      # 0xa68a
movb $0x0, %al
callq 0x1120
jmp 0x3614
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x74d2(%rip), %rsi      # 0xa6bd
callq 0x1110
cmpl $0x0, %eax
je 0x320d
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x74bd(%rip), %rsi      # 0xa6c0
callq 0x1110
cmpl $0x0, %eax
jne 0x324a
cmpl $0x1, -0x8(%rbp)
jl 0x324a
movl -0x8(%rbp), %eax
subl $0x1, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x8, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x324a
cmpb $0x0, 0xc10b(%rip)      # 0xf340
setne %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
movb %al, 0xc0fb(%rip)       # 0xf340
jmp 0x3612
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7472(%rip), %rsi      # 0xa6ca
callq 0x1110
cmpl $0x0, %eax
je 0x327e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x745d(%rip), %rsi      # 0xa6cd
callq 0x1110
cmpl $0x0, %eax
jne 0x332c
cmpl $0x2, -0x8(%rbp)
jl 0x332c
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x332c
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
leaq 0x7420(%rip), %rsi      # 0xa6d6
callq 0x1110
cmpl $0x0, %eax
jne 0x32d3
movq 0xad11(%rip), %rax      # 0xdfd8
movq (%rax), %rax
movq %rax, 0xc077(%rip)      # 0xf348
jmp 0x3327
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
leaq 0x7523(%rip), %rsi      # 0xa805
callq 0x1190
movq %rax, 0xc05a(%rip)      # 0xf348
cmpq $0x0, %rax
jne 0x3325
movq 0xacfd(%rip), %rax      # 0xdff8
movq (%rax), %rdi
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdx
leaq 0x73cb(%rip), %rsi      # 0xa6d8
movb $0x0, %al
callq 0x1120
movq 0xacbd(%rip), %rax      # 0xdfd8
movq (%rax), %rax
movq %rax, 0xc023(%rip)      # 0xf348
jmp 0x3327
jmp 0x3610
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x73cf(%rip), %rsi      # 0xa709
callq 0x1110
cmpl $0x0, %eax
je 0x3360
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x73ba(%rip), %rsi      # 0xa70c
callq 0x1110
cmpl $0x0, %eax
jne 0x346f
cmpl $0x2, -0x8(%rbp)
jl 0x346f
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x346f
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
leaq 0x745a(%rip), %rsi      # 0xa7f2
callq 0x1190
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x33bd
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rsi
leaq 0x7367(%rip), %rdi      # 0xa71d
movb $0x0, %al
callq 0x8ca0
movl 0xbf95(%rip), %edi      # 0xf358
callq 0x1050
cmpl $0x0, 0xbf81(%rip)      # 0xf350
jle 0x33da
cmpl $0x0, 0xbf7c(%rip)      # 0xf354
jg 0x33f4
movl 0xbf70(%rip), %esi      # 0xf350
movl 0xbf6e(%rip), %edx      # 0xf354
leaq 0x734d(%rip), %rdi      # 0xa73a
movb $0x0, %al
callq 0x8ca0
movl 0xbf56(%rip), %edi      # 0xf350
movl 0xbf54(%rip), %esi      # 0xf354
callq 0x4e70
movq %rax, -0x30(%rbp)
movq 0xbf38(%rip), %rdi      # 0xf348
movl 0xbf3a(%rip), %edx      # 0xf350
movl 0xbf38(%rip), %ecx      # 0xf354
movl 0xbf35(%rip), %r8d      # 0xf358
leaq 0x7327(%rip), %rsi      # 0xa751
movb $0x0, %al
callq 0x1120
movq -0x30(%rbp), %rdi
movl 0xbf21(%rip), %esi      # 0xf35c
xorl %edx, %edx
callq 0x5b50
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rdi
movl $0x4000000, %esi        # imm = 0x4000000
callq 0x1320
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
movl $0x1, %edx
callq 0x1880
jmp 0x360e
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7311(%rip), %rsi      # 0xa78e
callq 0x1110
cmpl $0x0, %eax
je 0x349f
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x72fc(%rip), %rsi      # 0xa791
callq 0x1110
cmpl $0x0, %eax
jne 0x351b
cmpl $0x2, -0x8(%rbp)
jl 0x351b
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x351b
cmpq $0x0, -0x28(%rbp)
jne 0x34d5
leaq 0x72cb(%rip), %rdi      # 0xa799
movb $0x0, %al
callq 0x8ca0
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
leaq 0x730e(%rip), %rsi      # 0xa7f2
callq 0x1190
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x3509
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rsi
leaq 0x72d2(%rip), %rdi      # 0xa7d4
movb $0x0, %al
callq 0x8ca0
movq -0x28(%rbp), %rdi
movq -0x20(%rbp), %rsi
callq 0x2280
jmp 0x360c
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x72c8(%rip), %rsi      # 0xa7f1
callq 0x1110
cmpl $0x0, %eax
je 0x354b
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x72b3(%rip), %rsi      # 0xa7f4
callq 0x1110
cmpl $0x0, %eax
jne 0x358f
cmpl $0x2, -0x8(%rbp)
jl 0x358f
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x358f
cmpq $0x0, -0x28(%rbp)
je 0x357c
movq -0x28(%rbp), %rdi
callq 0x1460
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rdi
callq 0x1f30
movq %rax, -0x28(%rbp)
jmp 0x360a
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7267(%rip), %rsi      # 0xa804
callq 0x1110
cmpl $0x0, %eax
je 0x35bf
movq -0x10(%rbp), %rax
movq (%rax), %rdi
leaq 0x7252(%rip), %rsi      # 0xa807
callq 0x1110
cmpl $0x0, %eax
jne 0x35f3
cmpl $0x2, -0x8(%rbp)
jl 0x35f3
movl -0x8(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x8(%rbp)
movq -0x10(%rbp), %rax
addq $0x10, %rax
movq %rax, -0x10(%rbp)
cmpq $0x0, %rax
je 0x35f3
movq -0x28(%rbp), %rdi
movq -0x10(%rbp), %rax
movq -0x8(%rax), %rsi
callq 0x1c60
jmp 0x3608
movq -0x10(%rbp), %rax
movq (%rax), %rsi
leaq 0x7217(%rip), %rdi      # 0xa818
movb $0x0, %al
callq 0x8ca0
jmp 0x360a
jmp 0x360c
jmp 0x360e
jmp 0x3610
jmp 0x3612
jmp 0x3614
jmp 0x3616
jmp 0x3618
jmp 0x361a
jmp 0x361c
movq 0xbd25(%rip), %rdi      # 0xf348
callq 0x90b0
jmp 0x2f06
movq 0xbd14(%rip), %rdi      # 0xf348
leaq 0x7211(%rip), %rsi      # 0xa84c
movb $0x0, %al
callq 0x1120
movq 0xbcff(%rip), %rdi      # 0xf348
callq 0x9240
movq 0xbcf3(%rip), %rax      # 0xf348
movq 0xa97c(%rip), %rcx      # 0xdfd8
cmpq (%rcx), %rax
je 0x367e
leaq 0x71e4(%rip), %rdi      # 0xa84c
movb $0x0, %al
callq 0x10b0
movq 0xa962(%rip), %rax      # 0xdfd8
movq (%rax), %rdi
callq 0x9240
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq
nopw (%rax,%rax)