#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
double atof(char *);
unsigned int atoi(char *);
int /*<<< orphan*/ basefreq(char *, double *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int load_matrix(char *);
char *malloc(int);
int /*<<< orphan*/ showhelp(int);
int /*<<< orphan*/ similarity(char *, char *, char *, unsigned int, double,
                              double *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
unsigned int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
int validseq(char *);
int main(int argc, char *argv[]) {
  int i, j = -1;
  char *list_array[50];
  char *patt_array[50];
  int c_la = 0;
  int c_pa = 0;
  char *line;
  size_t ls;
  char *id;
  char *seq;
  unsigned int ws = 6;
  double limit = 0.9;
  FILE *list_file;
  double bases[4];
  char list = 0;
  char pattern = 0;
  char output[12] = {'i', 'e', 'q', 'd'};
  int mofext_error = 0;
  int error_pos;
  if (argc == 1)
    showhelp(1);
  for (i = 1; i < argc; i++) {
    if (argv[i][0] == '-') {
      switch (argv[i][1]) {
      case 'd':
        list = 1;
        pattern = 0;
        break;
      case 'h':
        showhelp(3);
      case 'q':
        pattern = 1;
        list = 0;
        break;
      case 'f':
        c_pa = -1;
        pattern = 0;
        list = 0;
        break;
      case 'm':
        j = load_matrix(argv[i + 1]);
        pattern = 0;
        list = 0;
        break;
      case 'w':
        ws = atoi(argv[i + 1]);
        if (ws < 5) {
          fprintf(stderr, "Wordsize too small\n");
          mofext_error = 1;
        }
        pattern = 0;
        list = 0;
        break;
      case 'c':
        limit = atof(argv[i + 1]);
        if ((limit <= 0.0) || (limit > 1.0)) {
          fprintf(stderr, "Cutoff parameter should be between 0.0 - 1.0\n");
          mofext_error = 1;
        }
        pattern = 0;
        list = 0;
        break;
      case 'o':
        strncpy(output, argv[i + 1], 12 - 1);
        pattern = 0;
        list = 0;
        break;
      }
    } else {
      if (list) {
        if (c_la == 50 - 1) {
          fprintf(stderr, "I can't handle more database\n");
          continue;
        }
        list_array[c_la] = malloc(strlen(argv[i]) + 1);
        strcpy(list_array[c_la], argv[i]);
        c_la++;
      }
      if (pattern) {
        if (c_pa == 50 - 1) {
          fprintf(stderr, "I can't handle more pattern\n");
          continue;
        }
        patt_array[c_pa] = malloc(strlen(argv[i]) + 1);
        strcpy(patt_array[c_pa], argv[i]);
        c_pa++;
      }
    }
  }
  if (j == -1) {
    fprintf(stderr, "Can't open matrix file\n");
    mofext_error = 1;
  }
  line = malloc(100);
  if (line == NULL) {
    fprintf(stderr, "Memory not enought\n");
    exit(2);
  }
  if (c_pa == 0) {
    fprintf(stderr, "Query pattern did not specified\n");
    mofext_error = 1;
  }
  if (c_la == 0) {
    fprintf(stderr, "Motif database did not specified\n");
    mofext_error = 1;
  }
  if (mofext_error == 1)
    showhelp(1);
  ls = 100;
  for (j = 0; j < c_pa; j++) {
    if (strlen(patt_array[j]) < ws) {
      fprintf(stderr, "%s pattern smaller than the wordsize\n", patt_array[j]);
      continue;
    }
    if ((error_pos = validseq(patt_array[j])) != -1) {
      fprintf(stderr, "Invalid character in the query (%d. position)\n",
              error_pos);
      continue;
    }
    for (i = 0; i < c_la; i++) {
      list_file = fopen(list_array[i], "r");
      while (getline(&line, &ls, list_file) != -1) {
        id = strtok(line, " \t");
        seq = strtok(NULL, " \t\n");
        if (seq == NULL) {
          fprintf(stderr, "Invalid row in file %s\n", list_array[i]);
          continue;
        }
        basefreq(seq, bases);
        if ((error_pos = validseq(seq)) != -1) {
          fprintf(
              stderr,
              "Invalid character in the database element:%s (%d. position)\n",
              seq, error_pos);
          continue;
        }
        similarity(id, seq, patt_array[j], ws, limit, bases, output);
      }
      fclose(list_file);
    }
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x3c0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x344(%rbp)
movl   $0x0,-0x348(%rbp)
movl   $0x6,-0x36c(%rbp)
movsd  0xdaa(%rip),%xmm0
movsd  %xmm0,-0x378(%rbp)
ff
movb   $0x0,-0x3a1(%rbp)
movb   $0x0,-0x3a2(%rbp)
mov    0xdf1(%rip),%rax
mov    %rax,-0x3ae(%rbp)
mov    0xdec(%rip),%eax
mov    %eax,-0x3a6(%rbp)
movl   $0x0,-0x3b4(%rbp)
cmpl   $0x1,-0x8(%rbp)
jne    12a4 <main+0x94>
mov    $0x1,%edi
call   10e0 <showhelp@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    15cf <main+0x3bf>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1493 <main+0x283>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
add    $0xffffff9d,%eax
mov    %eax,%ecx
mov    %rcx,-0x3c0(%rbp)
sub    $0x14,%eax
ja     148e <main+0x27e>
mov    -0x3c0(%rbp),%rax
lea    0xd0e(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
movb   $0x1,-0x3a1(%rbp)
movb   $0x0,-0x3a2(%rbp)
jmp    148e <main+0x27e>
mov    $0x3,%edi
call   10e0 <showhelp@plt>
movb   $0x1,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    148e <main+0x27e>
movl   $0xffffffff,-0x348(%rbp)
ff ff ff
movb   $0x0,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    148e <main+0x27e>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1090 <load_matrix@plt>
mov    %eax,-0x18(%rbp)
movb   $0x0,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    148e <main+0x27e>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   10f0 <atoi@plt>
mov    %eax,-0x36c(%rbp)
cmpl   $0x5,-0x36c(%rbp)
jae    13ce <main+0x1be>
mov    0x2c2c(%rip),%rax
mov    (%rax),%edi
lea    0xcb3(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x3b4(%rbp)
movb   $0x0,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    148e <main+0x27e>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
call   1050 <atof@plt>
movsd  %xmm0,-0x378(%rbp)
ff
xorps  %xmm0,%xmm0
ucomisd -0x378(%rbp),%xmm0
ff
jae    142a <main+0x21a>
movsd  -0x378(%rbp),%xmm0
ff
movsd  0xbe8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    144b <main+0x23b>
mov    0x2baf(%rip),%rax
mov    (%rax),%edi
lea    0xc4a(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x3b4(%rbp)
movb   $0x0,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    148e <main+0x27e>
lea    -0x3ae(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
mov    $0xb,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x3a2(%rbp)
movb   $0x0,-0x3a1(%rbp)
jmp    15bc <main+0x3ac>
cmpb   $0x0,-0x3a1(%rbp)
je     1525 <main+0x315>
cmpl   $0x31,-0x344(%rbp)
jne    14c9 <main+0x2b9>
mov    0x2b2c(%rip),%rax
mov    (%rax),%edi
lea    0xbf5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    15c1 <main+0x3b1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,%rcx
movslq -0x344(%rbp),%rax
mov    %rcx,-0x1b0(%rbp,%rax,8)
ff
movslq -0x344(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rdi
ff
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
cmpb   $0x0,-0x3a2(%rbp)
je     15b7 <main+0x3a7>
cmpl   $0x31,-0x348(%rbp)
jne    155b <main+0x34b>
mov    0x2a9a(%rip),%rax
mov    (%rax),%edi
lea    0xb81(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    15c1 <main+0x3b1>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   10a0 <malloc@plt>
mov    %rax,%rcx
movslq -0x348(%rbp),%rax
mov    %rcx,-0x340(%rbp,%rax,8)
ff
movslq -0x348(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rdi
ff
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcpy@plt>
mov    -0x348(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x348(%rbp)
jmp    15bc <main+0x3ac>
jmp    15c1 <main+0x3b1>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12ab <main+0x9b>
cmpl   $0xffffffff,-0x18(%rbp)
jne    15fa <main+0x3ea>
mov    0x2a00(%rip),%rax
mov    (%rax),%edi
lea    0xb04(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x3b4(%rbp)
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x350(%rbp)
cmpq   $0x0,-0x350(%rbp)
jne    163a <main+0x42a>
mov    0x29c0(%rip),%rax
mov    (%rax),%edi
lea    0xadc(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   1120 <exit@plt>
cmpl   $0x0,-0x348(%rbp)
jne    1668 <main+0x458>
mov    0x2992(%rip),%rax
mov    (%rax),%edi
lea    0xac2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x3b4(%rbp)
cmpl   $0x0,-0x344(%rbp)
jne    1696 <main+0x486>
mov    0x2964(%rip),%rax
mov    (%rax),%edi
lea    0xab5(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
movl   $0x1,-0x3b4(%rbp)
cmpl   $0x1,-0x3b4(%rbp)
jne    16ad <main+0x49d>
mov    $0x1,%edi
call   10e0 <showhelp@plt>
movq   $0x64,-0x358(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x348(%rbp),%eax
jge    18d8 <main+0x6c8>
movslq -0x18(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rdi
ff
call   1070 <strlen@plt>
cmp    -0x36c(%rbp),%eax
jae    1713 <main+0x503>
mov    0x28ee(%rip),%rax
mov    (%rax),%edi
movslq -0x18(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rdx
ff
lea    0xa55(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    18ca <main+0x6ba>
movslq -0x18(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rdi
ff
call   1130 <validseq@plt>
mov    %eax,-0x3b8(%rbp)
cmp    $0xffffffff,%eax
je     1755 <main+0x545>
mov    0x28a6(%rip),%rax
mov    (%rax),%edi
mov    -0x3b8(%rbp),%edx
lea    0xa39(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    18ca <main+0x6ba>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x344(%rbp),%eax
jge    18c5 <main+0x6b5>
movslq -0x14(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rdi
ff
lea    0xa33(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x380(%rbp)
mov    -0x380(%rbp),%rdx
lea    -0x350(%rbp),%rdi
lea    -0x358(%rbp),%rsi
call   1100 <getline@plt>
cmp    $0xffffffff,%eax
je     18ab <main+0x69b>
mov    -0x350(%rbp),%rdi
lea    0x9f8(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0x360(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0x9e4(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0x368(%rbp)
cmpq   $0x0,-0x368(%rbp)
jne    1814 <main+0x604>
mov    0x27ed(%rip),%rax
mov    (%rax),%edi
movslq -0x14(%rbp),%rax
mov    -0x1b0(%rbp,%rax,8),%rdx
lea    0x9b2(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    178a <main+0x57a>
mov    -0x368(%rbp),%rdi
lea    -0x3a0(%rbp),%rsi
call   10b0 <basefreq@plt>
mov    -0x368(%rbp),%rdi
call   1130 <validseq@plt>
mov    %eax,-0x3b8(%rbp)
cmp    $0xffffffff,%eax
je     186b <main+0x65b>
mov    0x2797(%rip),%rax
mov    (%rax),%edi
mov    -0x368(%rbp),%rdx
mov    -0x3b8(%rbp),%ecx
lea    0x973(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    178a <main+0x57a>
mov    -0x360(%rbp),%rdi
mov    -0x368(%rbp),%rsi
movslq -0x18(%rbp),%rax
mov    -0x340(%rbp,%rax,8),%rdx
ff
mov    -0x36c(%rbp),%ecx
movsd  -0x378(%rbp),%xmm0
ff
lea    -0x3a0(%rbp),%r8
lea    -0x3ae(%rbp),%r9
call   1110 <similarity@plt>
jmp    178a <main+0x57a>
mov    -0x380(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    175c <main+0x54c>
jmp    18ca <main+0x6ba>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    16bf <main+0x4af>
xor    %eax,%eax
add    $0x3c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x398,%rsp
mov    0xe4d(%rip),%eax
mov    %eax,0x40(%rsp)
mov    0xe3a(%rip),%rax
mov    %rax,0x38(%rsp)
cmp    $0x1,%edi
jne    124b <main+0x3b>
mov    $0x1,%edi
call   10e0 <showhelp@plt>
jmp    14af <main+0x29f>
jle    14af <main+0x29f>
mov    %rsi,%r14
mov    %edi,%r15d
movl   $0xffffffff,0x20(%rsp)
ff
movl   $0x6,0xc(%rsp)
movsd  0xd91(%rip),%xmm0
mov    $0x1,%r13d
movl   $0x0,0x18(%rsp)
xor    %ebp,%ebp
xor    %r12d,%r12d
movl   $0x0,0x10(%rsp)
xor    %ebx,%ebx
jmp    12bf <main+0xaf>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
lea    0xe1c(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%r12b
mov    $0x31,%ebx
movsd  (%rsp),%xmm0
add    $0x1,%r13
cmp    %r13,%r15
je     171a <main+0x50a>
mov    (%r14,%r13,8),%rdi
cmpb   $0x2d,(%rdi)
jne    1340 <main+0x130>
movsbl 0x1(%rdi),%eax
add    $0xffffff9d,%eax
cmp    $0x14,%eax
ja     12b2 <main+0xa2>
lea    0xd3d(%rip),%rdx
movslq (%rdx,%rax,4),%rax
add    %rdx,%rax
jmp    *%rax
mov    0x8(%r14,%r13,8),%rdi
call   1050 <atof@plt>
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    1306 <main+0xf6>
ucomisd 0xd08(%rip),%xmm0
jbe    145a <main+0x24a>
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
xor    %r12d,%r12d
lea    0xd73(%rip),%rsi
xor    %eax,%eax
movsd  %xmm0,(%rsp)
call   1080 <fprintf@plt>
movsd  (%rsp),%xmm0
movl   $0x1,0x18(%rsp)
xor    %ebp,%ebp
jmp    12b2 <main+0xa2>
nopl   0x0(%rax)
test   %r12b,%r12b
movsd  %xmm0,(%rsp)
je     137f <main+0x16f>
cmp    $0x31,%ebx
je     128e <main+0x7e>
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
movslq %ebx,%rcx
mov    %rax,0x200(%rsp,%rcx,8)
mov    (%r14,%r13,8),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
add    $0x1,%ebx
movsd  (%rsp),%xmm0
test   %bpl,%bpl
je     13b4 <main+0x1a4>
mov    0x10(%rsp),%ebp
cmp    $0x31,%ebp
jne    13bb <main+0x1ab>
mov    0x2c4c(%rip),%rax
mov    (%rax),%edi
lea    0xd3b(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%bpl
movl   $0x31,0x10(%rsp)
jmp    12ad <main+0x9d>
xor    %ebp,%ebp
jmp    12b2 <main+0xa2>
mov    (%r14,%r13,8),%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
movslq %ebp,%rcx
mov    %rax,0x70(%rsp,%rcx,8)
mov    (%r14,%r13,8),%rsi
mov    %rax,%rdi
call   1040 <strcpy@plt>
add    $0x1,%ebp
mov    %ebp,0x10(%rsp)
mov    $0x1,%bpl
jmp    12ad <main+0x9d>
mov    $0x1,%r12b
xor    %ebp,%ebp
jmp    12b2 <main+0xa2>
movl   $0xffffffff,0x10(%rsp)
jmp    145a <main+0x24a>
mov    $0x3,%edi
movsd  %xmm0,(%rsp)
call   10e0 <showhelp@plt>
movsd  (%rsp),%xmm0
mov    $0x1,%bpl
xor    %r12d,%r12d
jmp    12b2 <main+0xa2>
mov    0x8(%r14,%r13,8),%rdi
movsd  %xmm0,(%rsp)
call   1090 <load_matrix@plt>
movsd  (%rsp),%xmm0
mov    %eax,0x20(%rsp)
jmp    145a <main+0x24a>
mov    0x8(%r14,%r13,8),%rsi
lea    0x38(%rsp),%rdi
mov    $0xb,%edx
movsd  %xmm0,(%rsp)
call   1030 <strncpy@plt>
movsd  (%rsp),%xmm0
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    12b2 <main+0xa2>
movsd  %xmm0,(%rsp)
mov    0x8(%r14,%r13,8),%rdi
call   10f0 <atoi@plt>
mov    %eax,0xc(%rsp)
cmp    $0x4,%eax
ja     14a5 <main+0x295>
mov    0x2b5d(%rip),%rax
mov    (%rax),%edi
xor    %r12d,%r12d
lea    0xbe9(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
movl   $0x1,0x18(%rsp)
xor    %ebp,%ebp
jmp    12ad <main+0x9d>
xor    %r12d,%r12d
xor    %ebp,%ebp
jmp    12ad <main+0x9d>
xor    %ebp,%ebp
movl   $0x6,0xc(%rsp)
movsd  0xb3f(%rip),%xmm0
movsd  %xmm0,(%rsp)
movl   $0x0,0x8(%rsp)
mov    0x2b0b(%rip),%rax
mov    (%rax),%edi
lea    0xc17(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%ebx
mov    $0x64,%edi
call   10a0 <malloc@plt>
mov    %rax,0x28(%rsp)
test   %rax,%rax
je     173b <main+0x52b>
test   %ebp,%ebp
mov    0x8(%rsp),%ecx
je     1515 <main+0x305>
test   %ecx,%ecx
je     1532 <main+0x322>
cmp    $0x1,%ebx
je     1549 <main+0x339>
jmp    1553 <main+0x343>
mov    0x2ac4(%rip),%rax
mov    (%rax),%edi
lea    0xbfc(%rip),%rsi
xor    %eax,%eax
mov    %ecx,%ebx
call   1080 <fprintf@plt>
test   %ebx,%ebx
jne    1549 <main+0x339>
mov    0x2aa7(%rip),%rax
mov    (%rax),%edi
lea    0xc00(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x1,%edi
call   10e0 <showhelp@plt>
movq   $0x64,0x30(%rsp)
test   %ebp,%ebp
jle    1706 <main+0x4f6>
mov    %ebp,%eax
mov    %rax,0x48(%rsp)
mov    0x8(%rsp),%eax
mov    %rax,0x18(%rsp)
xor    %ebx,%ebx
jmp    15ae <main+0x39e>
nopl   0x0(%rax,%rax,1)
mov    0x2a59(%rip),%rax
mov    (%rax),%edi
lea    0xbd4(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x20(%rsp),%rbx
add    $0x1,%rbx
cmp    0x48(%rsp),%rbx
je     1706 <main+0x4f6>
mov    0x70(%rsp,%rbx,8),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
cmp    0xc(%rsp),%eax
mov    %rbx,0x20(%rsp)
jb     1580 <main+0x370>
mov    %rbp,%rdi
call   1130 <validseq@plt>
cmp    $0xffffffff,%eax
je     15ee <main+0x3de>
mov    0x2a06(%rip),%rcx
mov    (%rcx),%edi
lea    0xba7(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    159a <main+0x38a>
mov    %rbp,0x10(%rsp)
cmpl   $0x0,0x8(%rsp)
jle    159a <main+0x38a>
xor    %ebp,%ebp
jmp    1613 <main+0x403>
xchg   %ax,%ax
mov    %r12,%rdi
call   1060 <fclose@plt>
add    $0x1,%rbp
cmp    0x18(%rsp),%rbp
je     159a <main+0x38a>
mov    0x200(%rsp,%rbp,8),%r15
mov    %r15,%rdi
lea    0xb94(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r12
lea    0x28(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    %rax,%rdx
jmp    1667 <main+0x457>
nopl   0x0(%rax)
mov    0x2999(%rip),%rax
mov    (%rax),%edi
lea    0xb72(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0x28(%rsp),%rdi
lea    0x30(%rsp),%rsi
mov    %r12,%rdx
call   1100 <getline@plt>
cmp    $0xffffffff,%eax
je     1600 <main+0x3f0>
mov    0x28(%rsp),%rdi
lea    0xb3e(%rip),%rsi
call   10d0 <strtok@plt>
mov    %rax,%r14
xor    %edi,%edi
lea    0xb30(%rip),%rsi
call   10d0 <strtok@plt>
test   %rax,%rax
je     1640 <main+0x430>
mov    %rax,%r13
mov    %rax,%rdi
lea    0x50(%rsp),%rbx
mov    %rbx,%rsi
call   10b0 <basefreq@plt>
mov    %r13,%rdi
call   1130 <validseq@plt>
cmp    $0xffffffff,%eax
je     16e0 <main+0x4d0>
mov    0x2921(%rip),%rcx
mov    (%rcx),%edi
lea    0xb12(%rip),%rsi
mov    %r13,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
jmp    165a <main+0x44a>
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r13,%rsi
mov    0x10(%rsp),%rdx
mov    0xc(%rsp),%ecx
movsd  (%rsp),%xmm0
mov    %rbx,%r8
lea    0x38(%rsp),%r9
call   1110 <similarity@plt>
jmp    165a <main+0x44a>
xor    %eax,%eax
add    $0x398,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %ebx,0x8(%rsp)
movsd  %xmm0,(%rsp)
cmpl   $0xffffffff,0x20(%rsp)
mov    0x10(%rsp),%ebp
mov    0x18(%rsp),%ebx
jne    14ea <main+0x2da>
jmp    14ce <main+0x2be>
mov    0x289e(%rip),%rax
mov    (%rax),%edi
lea    0x9c2(%rip),%rsi
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@__const.main.output = <{ i8, i8, i8, i8, [8 x i8] }> <{ i8 105, i8 101, i8 113, i8 100, [8 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [20 x i8] c"Wordsize too small\0A\00"
@.str.1 = [46 x i8] c"Cutoff parameter should be between 0.0 - 1.0\0A\00"
@.str.2 = [30 x i8] c"I can't handle more database\0A\00"
@.str.3 = [29 x i8] c"I can't handle more pattern\0A\00"
@.str.4 = [24 x i8] c"Can't open matrix file\0A\00"
@.str.5 = [20 x i8] c"Memory not enought\0A\00"
@.str.6 = [33 x i8] c"Query pattern did not specified\0A\00"
@.str.7 = [34 x i8] c"Motif database did not specified\0A\00"
@.str.8 = [38 x i8] c"%s pattern smaller than the wordsize\0A\00"
@.str.9 = [47 x i8] c"Invalid character in the query (%d. position)\0A\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [3 x i8] c" \09\00"
@.str.12 = [4 x i8] c" \09\0A\00"
@.str.13 = [24 x i8] c"Invalid row in file %s\0A\00"
@.str.14 = [61 x i8] c"Invalid character in the database element:%s (%d. position)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [50 x i8*]
%9 = alloca [50 x i8*]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i32
%17 = alloca double
%18 = alloca i32*
%19 = alloca [4 x double]
%20 = alloca i8
%21 = alloca i8
%22 = alloca [12 x i8]
%23 = alloca i32
%24 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %7
store i32 0, i32* %10
store i32 0, i32* %11
store i32 6, i32* %16
store double 9.000000e-01, double* %17
store i8 0, i8* %20
store i8 0, i8* %21
%25 = bitcast [12 x i8]* %22 to i8*
store i32 0, i32* %23
%26 = load i32, i32* %4
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 @showhelp(i32 1)
br label %30
30: ; preds = %28, %2
store i32 1, i32* %6
br label %31
31: ; preds = %176, %30
%32 = load i32, i32* %6
%33 = load i32, i32* %4
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %179
35: ; preds = %31
%36 = load i8**, i8*** %5
%37 = load i32, i32* %6
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8*, i8** %36, i64 %38
%40 = load i8*, i8** %39
%41 = getelementptr inbounds i8, i8* %40, i64 0
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 45
br i1 %44, label %45, label %108
45: ; preds = %35
%46 = load i8**, i8*** %5
%47 = load i32, i32* %6
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i8*, i8** %46, i64 %48
%50 = load i8*, i8** %49
%51 = getelementptr inbounds i8, i8* %50, i64 1
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
switch i32 %53, label %107 [
i32 100, label %54
i32 104, label %55
i32 113, label %57
i32 102, label %58
i32 109, label %59
i32 119, label %67
i32 99, label %81
i32 111, label %98
]
54: ; preds = %45
store i8 1, i8* %20
store i8 0, i8* %21
br label %107
55: ; preds = %45
%56 = call i32 @showhelp(i32 3)
br label %57
57: ; preds = %45, %55
store i8 1, i8* %21
store i8 0, i8* %20
br label %107
58: ; preds = %45
store i32 -1, i32* %11
store i8 0, i8* %21
store i8 0, i8* %20
br label %107
59: ; preds = %45
%60 = load i8**, i8*** %5
%61 = load i32, i32* %6
%62 = add nsw i32 %61, 1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %60, i64 %63
%65 = load i8*, i8** %64
%66 = call i32 @load_matrix(i8* %65)
store i32 %66, i32* %7
store i8 0, i8* %21
store i8 0, i8* %20
br label %107
67: ; preds = %45
%68 = load i8**, i8*** %5
%69 = load i32, i32* %6
%70 = add nsw i32 %69, 1
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %68, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @atoi(i8* %73)
store i32 %74, i32* %16
%75 = load i32, i32* %16
%76 = icmp ult i32 %75, 5
br i1 %76, label %77, label %80
77: ; preds = %67
%78 = load i32, i32* @stderr
%79 = call i32 (i32, i8*, ...) @fprintf(i32 %78, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %23
br label %80
80: ; preds = %77, %67
store i8 0, i8* %21
store i8 0, i8* %20
br label %107
81: ; preds = %45
%82 = load i8**, i8*** %5
%83 = load i32, i32* %6
%84 = add nsw i32 %83, 1
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %82, i64 %85
%87 = load i8*, i8** %86
%88 = call double @atof(i8* %87)
store double %88, double* %17
%89 = load double, double* %17
%90 = fcmp ole double %89, 0.000000e+00
br i1 %90, label %94, label %91
91: ; preds = %81
%92 = load double, double* %17
%93 = fcmp ogt double %92, 1.000000e+00
br i1 %93, label %94, label %97
94: ; preds = %91, %81
%95 = load i32, i32* @stderr
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %95, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %23
br label %97
97: ; preds = %94, %91
store i8 0, i8* %21
store i8 0, i8* %20
br label %107
98: ; preds = %45
%99 = getelementptr inbounds [12 x i8], [12 x i8]* %22, i64 0, i64 0
%100 = load i8**, i8*** %5
%101 = load i32, i32* %6
%102 = add nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8*, i8** %100, i64 %103
%105 = load i8*, i8** %104
%106 = call i32 @strncpy(i8* %99, i8* %105, i32 11)
store i8 0, i8* %21
store i8 0, i8* %20
br label %107
107: ; preds = %45, %98, %97, %80, %59, %58, %57, %54
br label %175
108: ; preds = %35
%109 = load i8, i8* %20
%110 = icmp ne i8 %109, 0
br i1 %110, label %111, label %141
111: ; preds = %108
%112 = load i32, i32* %10
%113 = icmp eq i32 %112, 49
br i1 %113, label %114, label %117
114: ; preds = %111
%115 = load i32, i32* @stderr
%116 = call i32 (i32, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %176
117: ; preds = %111
%118 = load i8**, i8*** %5
%119 = load i32, i32* %6
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds i8*, i8** %118, i64 %120
%122 = load i8*, i8** %121
%123 = call i32 @strlen(i8* %122)
%124 = add i32 %123, 1
%125 = call i8* @malloc(i32 %124)
%126 = load i32, i32* %10
%127 = sext i32 %126 to i64
%128 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %127
store i8* %125, i8** %128
%129 = load i32, i32* %10
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %130
%132 = load i8*, i8** %131
%133 = load i8**, i8*** %5
%134 = load i32, i32* %6
%135 = sext i32 %134 to i64
%136 = getelementptr inbounds i8*, i8** %133, i64 %135
%137 = load i8*, i8** %136
%138 = call i32 @strcpy(i8* %132, i8* %137)
%139 = load i32, i32* %10
%140 = add nsw i32 %139, 1
store i32 %140, i32* %10
br label %141
141: ; preds = %117, %108
%142 = load i8, i8* %21
%143 = icmp ne i8 %142, 0
br i1 %143, label %144, label %174
144: ; preds = %141
%145 = load i32, i32* %11
%146 = icmp eq i32 %145, 49
br i1 %146, label %147, label %150
147: ; preds = %144
%148 = load i32, i32* @stderr
%149 = call i32 (i32, i8*, ...) @fprintf(i32 %148, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %176
150: ; preds = %144
%151 = load i8**, i8*** %5
%152 = load i32, i32* %6
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds i8*, i8** %151, i64 %153
%155 = load i8*, i8** %154
%156 = call i32 @strlen(i8* %155)
%157 = add i32 %156, 1
%158 = call i8* @malloc(i32 %157)
%159 = load i32, i32* %11
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %160
store i8* %158, i8** %161
%162 = load i32, i32* %11
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %163
%165 = load i8*, i8** %164
%166 = load i8**, i8*** %5
%167 = load i32, i32* %6
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds i8*, i8** %166, i64 %168
%170 = load i8*, i8** %169
%171 = call i32 @strcpy(i8* %165, i8* %170)
%172 = load i32, i32* %11
%173 = add nsw i32 %172, 1
store i32 %173, i32* %11
br label %174
174: ; preds = %150, %141
br label %175
175: ; preds = %174, %107
br label %176
176: ; preds = %175, %147, %114
%177 = load i32, i32* %6
%178 = add nsw i32 %177, 1
store i32 %178, i32* %6
br label %31
179: ; preds = %31
%180 = load i32, i32* %7
%181 = icmp eq i32 %180, -1
br i1 %181, label %182, label %185
182: ; preds = %179
%183 = load i32, i32* @stderr
%184 = call i32 (i32, i8*, ...) @fprintf(i32 %183, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %23
br label %185
185: ; preds = %182, %179
%186 = call i8* @malloc(i32 100)
store i8* %186, i8** %12
%187 = load i8*, i8** %12
%188 = icmp eq i8* %187, null
br i1 %188, label %189, label %193
189: ; preds = %185
%190 = load i32, i32* @stderr
%191 = call i32 (i32, i8*, ...) @fprintf(i32 %190, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%192 = call i32 @exit(i32 2)
unreachable
193: ; preds = %185
%194 = load i32, i32* %11
%195 = icmp eq i32 %194, 0
br i1 %195, label %196, label %199
196: ; preds = %193
%197 = load i32, i32* @stderr
%198 = call i32 (i32, i8*, ...) @fprintf(i32 %197, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %23
br label %199
199: ; preds = %196, %193
%200 = load i32, i32* %10
%201 = icmp eq i32 %200, 0
br i1 %201, label %202, label %205
202: ; preds = %199
%203 = load i32, i32* @stderr
%204 = call i32 (i32, i8*, ...) @fprintf(i32 %203, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %23
br label %205
205: ; preds = %202, %199
%206 = load i32, i32* %23
%207 = icmp eq i32 %206, 1
br i1 %207, label %208, label %210
208: ; preds = %205
%209 = call i32 @showhelp(i32 1)
br label %210
210: ; preds = %208, %205
store i64 100, i64* %13
store i32 0, i32* %7
br label %211
211: ; preds = %300, %210
%212 = load i32, i32* %7
%213 = load i32, i32* %11
%214 = icmp slt i32 %212, %213
br i1 %214, label %215, label %303
215: ; preds = %211
%216 = load i32, i32* %7
%217 = sext i32 %216 to i64
%218 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %217
%219 = load i8*, i8** %218
%220 = call i32 @strlen(i8* %219)
%221 = load i32, i32* %16
%222 = icmp ult i32 %220, %221
br i1 %222, label %223, label %230
223: ; preds = %215
%224 = load i32, i32* @stderr
%225 = load i32, i32* %7
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %226
%228 = load i8*, i8** %227
%229 = call i32 (i32, i8*, ...) @fprintf(i32 %224, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* %228)
br label %300
230: ; preds = %215
%231 = load i32, i32* %7
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %232
%234 = load i8*, i8** %233
%235 = call i32 @validseq(i8* %234)
store i32 %235, i32* %24
%236 = icmp ne i32 %235, -1
br i1 %236, label %237, label %241
237: ; preds = %230
%238 = load i32, i32* @stderr
%239 = load i32, i32* %24
%240 = call i32 (i32, i8*, ...) @fprintf(i32 %238, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %239)
br label %300
241: ; preds = %230
store i32 0, i32* %6
br label %242
242: ; preds = %296, %241
%243 = load i32, i32* %6
%244 = load i32, i32* %10
%245 = icmp slt i32 %243, %244
br i1 %245, label %246, label %299
246: ; preds = %242
%247 = load i32, i32* %6
%248 = sext i32 %247 to i64
%249 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %248
%250 = load i8*, i8** %249
%251 = call i32* @fopen(i8* %250, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %251, i32** %18
br label %252
252: ; preds = %281, %276, %262, %246
%253 = load i32*, i32** %18
%254 = call i32 @getline(i8** %12, i64* %13, i32* %253)
%255 = icmp ne i32 %254, -1
br i1 %255, label %256, label %293
256: ; preds = %252
%257 = load i8*, i8** %12
%258 = call i8* @strtok(i8* %257, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
store i8* %258, i8** %14
%259 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
store i8* %259, i8** %15
%260 = load i8*, i8** %15
%261 = icmp eq i8* %260, null
br i1 %261, label %262, label %269
262: ; preds = %256
%263 = load i32, i32* @stderr
%264 = load i32, i32* %6
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds [50 x i8*], [50 x i8*]* %8, i64 0, i64 %265
%267 = load i8*, i8** %266
%268 = call i32 (i32, i8*, ...) @fprintf(i32 %263, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %267)
br label %252
269: ; preds = %256
%270 = load i8*, i8** %15
%271 = getelementptr inbounds [4 x double], [4 x double]* %19, i64 0, i64 0
%272 = call i32 @basefreq(i8* %270, double* %271)
%273 = load i8*, i8** %15
%274 = call i32 @validseq(i8* %273)
store i32 %274, i32* %24
%275 = icmp ne i32 %274, -1
br i1 %275, label %276, label %281
276: ; preds = %269
%277 = load i32, i32* @stderr
%278 = load i8*, i8** %15
%279 = load i32, i32* %24
%280 = call i32 (i32, i8*, ...) @fprintf(i32 %277, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.14, i64 0, i64 0), i8* %278, i32 %279)
br label %252
281: ; preds = %269
%282 = load i8*, i8** %14
%283 = load i8*, i8** %15
%284 = load i32, i32* %7
%285 = sext i32 %284 to i64
%286 = getelementptr inbounds [50 x i8*], [50 x i8*]* %9, i64 0, i64 %285
%287 = load i8*, i8** %286
%288 = load i32, i32* %16
%289 = load double, double* %17
%290 = getelementptr inbounds [4 x double], [4 x double]* %19, i64 0, i64 0
%291 = getelementptr inbounds [12 x i8], [12 x i8]* %22, i64 0, i64 0
%292 = call i32 @similarity(i8* %282, i8* %283, i8* %287, i32 %288, double %289, double* %290, i8* %291)
br label %252
293: ; preds = %252
%294 = load i32*, i32** %18
%295 = call i32 @fclose(i32* %294)
br label %296
296: ; preds = %293
%297 = load i32, i32* %6
%298 = add nsw i32 %297, 1
store i32 %298, i32* %6
br label %242
299: ; preds = %242
br label %300
300: ; preds = %299, %237, %223
%301 = load i32, i32* %7
%302 = add nsw i32 %301, 1
store i32 %302, i32* %7
br label %211
303: ; preds = %211
ret i32 0
}

LLVM IR (-O2):
@__const.main.output = <{ i8, i8, i8, i8, [8 x i8] }> <{ i8 105, i8 101, i8 113, i8 100, [8 x i8] zeroinitializer }>
@stderr = global i32 0
@.str = [20 x i8] c"Wordsize too small\0A\00"
@.str.1 = [46 x i8] c"Cutoff parameter should be between 0.0 - 1.0\0A\00"
@.str.2 = [30 x i8] c"I can't handle more database\0A\00"
@.str.3 = [29 x i8] c"I can't handle more pattern\0A\00"
@.str.4 = [24 x i8] c"Can't open matrix file\0A\00"
@.str.5 = [20 x i8] c"Memory not enought\0A\00"
@.str.6 = [33 x i8] c"Query pattern did not specified\0A\00"
@.str.7 = [34 x i8] c"Motif database did not specified\0A\00"
@.str.8 = [38 x i8] c"%s pattern smaller than the wordsize\0A\00"
@.str.9 = [47 x i8] c"Invalid character in the query (%d. position)\0A\00"
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [3 x i8] c" \09\00"
@.str.12 = [4 x i8] c" \09\0A\00"
@.str.13 = [24 x i8] c"Invalid row in file %s\0A\00"
@.str.14 = [61 x i8] c"Invalid character in the database element:%s (%d. position)\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [50 x i8*]
%4 = alloca [50 x i8*]
%5 = alloca i8*
%6 = alloca i64
%7 = alloca [4 x double]
%8 = alloca [12 x i8]
%9 = bitcast [50 x i8*]* %3 to i8*
%10 = bitcast [50 x i8*]* %4 to i8*
%11 = bitcast i8** %5 to i8*
%12 = bitcast i64* %6 to i8*
%13 = bitcast [4 x double]* %7 to i8*
%14 = getelementptr inbounds [12 x i8], [12 x i8]* %8, i64 0, i64 0
%15 = icmp eq i32 %0, 1
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = tail call i32 @showhelp(i32 1)
br label %122
18: ; preds = %2
%19 = icmp sgt i32 %0, 1
br i1 %19, label %20, label %122
20: ; preds = %18
%21 = zext i32 %0 to i64
br label %22
22: ; preds = %20, %109
%23 = phi i64 [ 1, %20 ], [ %118, %109 ]
%24 = phi i32 [ 0, %20 ], [ %117, %109 ]
%25 = phi i8 [ 0, %20 ], [ %116, %109 ]
%26 = phi i8 [ 0, %20 ], [ %115, %109 ]
%27 = phi double [ 9.000000e-01, %20 ], [ %114, %109 ]
%28 = phi i32 [ 6, %20 ], [ %113, %109 ]
%29 = phi i32 [ -1, %20 ], [ %112, %109 ]
%30 = phi i32 [ 0, %20 ], [ %111, %109 ]
%31 = phi i32 [ 0, %20 ], [ %110, %109 ]
%32 = getelementptr inbounds i8*, i8** %1, i64 %23
%33 = load i8*, i8** %32
%34 = load i8, i8* %33
%35 = icmp eq i8 %34, 45
br i1 %35, label %36, label %75
36: ; preds = %22
%37 = getelementptr inbounds i8, i8* %33, i64 1
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
switch i32 %39, label %109 [
i32 100, label %40
i32 104, label %41
i32 113, label %43
i32 102, label %44
i32 109, label %45
i32 119, label %50
i32 99, label %59
i32 111, label %70
]
40: ; preds = %36
br label %109
41: ; preds = %36
%42 = call i32 @showhelp(i32 3)
br label %43
43: ; preds = %36, %41
br label %109
44: ; preds = %36
br label %109
45: ; preds = %36
%46 = add nuw nsw i64 %23, 1
%47 = getelementptr inbounds i8*, i8** %1, i64 %46
%48 = load i8*, i8** %47
%49 = call i32 @load_matrix(i8* %48)
br label %109
50: ; preds = %36
%51 = add nuw nsw i64 %23, 1
%52 = getelementptr inbounds i8*, i8** %1, i64 %51
%53 = load i8*, i8** %52
%54 = call i32 @atoi(i8* %53)
%55 = icmp ult i32 %54, 5
br i1 %55, label %56, label %109
56: ; preds = %50
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %109
59: ; preds = %36
%60 = add nuw nsw i64 %23, 1
%61 = getelementptr inbounds i8*, i8** %1, i64 %60
%62 = load i8*, i8** %61
%63 = call double @atof(i8* %62)
%64 = fcmp ole double %63, 0.000000e+00
%65 = fcmp ogt double %63, 1.000000e+00
%66 = or i1 %64, %65
br i1 %66, label %67, label %109
67: ; preds = %59
%68 = load i32, i32* @stderr
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.1, i64 0, i64 0))
br label %109
70: ; preds = %36
%71 = add nuw nsw i64 %23, 1
%72 = getelementptr inbounds i8*, i8** %1, i64 %71
%73 = load i8*, i8** %72
%74 = call i32 @strncpy(i8* %14, i8* %73, i32 11)
br label %109
75: ; preds = %22
%76 = icmp eq i8 %26, 0
br i1 %76, label %91, label %77
77: ; preds = %75
%78 = icmp eq i32 %31, 49
br i1 %78, label %79, label %82
79: ; preds = %77
%80 = load i32, i32* @stderr
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %80, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
br label %109
82: ; preds = %77
%83 = call i32 @strlen(i8* %33)
%84 = add i32 %83, 1
%85 = call i8* @malloc(i32 %84)
%86 = sext i32 %31 to i64
%87 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %86
store i8* %85, i8** %87
%88 = load i8*, i8** %32
%89 = call i32 @strcpy(i8* %85, i8* %88)
%90 = add nsw i32 %31, 1
br label %91
91: ; preds = %82, %75
%92 = phi i32 [ %90, %82 ], [ %31, %75 ]
%93 = icmp eq i8 %25, 0
br i1 %93, label %109, label %94
94: ; preds = %91
%95 = icmp eq i32 %30, 49
br i1 %95, label %96, label %99
96: ; preds = %94
%97 = load i32, i32* @stderr
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %109
99: ; preds = %94
%100 = load i8*, i8** %32
%101 = call i32 @strlen(i8* %100)
%102 = add i32 %101, 1
%103 = call i8* @malloc(i32 %102)
%104 = sext i32 %30 to i64
%105 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 %104
store i8* %103, i8** %105
%106 = load i8*, i8** %32
%107 = call i32 @strcpy(i8* %103, i8* %106)
%108 = add nsw i32 %30, 1
br label %109
109: ; preds = %67, %59, %50, %56, %36, %70, %45, %44, %43, %40, %99, %91, %96, %79
%110 = phi i32 [ %31, %36 ], [ %31, %70 ], [ %31, %45 ], [ %31, %44 ], [ %31, %43 ], [ %31, %40 ], [ 49, %79 ], [ %92, %96 ], [ %92, %99 ], [ %92, %91 ], [ %31, %56 ], [ %31, %50 ], [ %31, %59 ], [ %31, %67 ]
%111 = phi i32 [ %30, %36 ], [ %30, %70 ], [ %30, %45 ], [ -1, %44 ], [ %30, %43 ], [ %30, %40 ], [ %30, %79 ], [ 49, %96 ], [ %108, %99 ], [ %30, %91 ], [ %30, %56 ], [ %30, %50 ], [ %30, %59 ], [ %30, %67 ]
%112 = phi i32 [ %29, %36 ], [ %29, %70 ], [ %49, %45 ], [ %29, %44 ], [ %29, %43 ], [ %29, %40 ], [ %29, %79 ], [ %29, %96 ], [ %29, %99 ], [ %29, %91 ], [ %29, %56 ], [ %29, %50 ], [ %29, %59 ], [ %29, %67 ]
%113 = phi i32 [ %28, %36 ], [ %28, %70 ], [ %28, %45 ], [ %28, %44 ], [ %28, %43 ], [ %28, %40 ], [ %28, %79 ], [ %28, %96 ], [ %28, %99 ], [ %28, %91 ], [ %54, %56 ], [ %54, %50 ], [ %28, %59 ], [ %28, %67 ]
%114 = phi double [ %27, %36 ], [ %27, %70 ], [ %27, %45 ], [ %27, %44 ], [ %27, %43 ], [ %27, %40 ], [ %27, %79 ], [ %27, %96 ], [ %27, %99 ], [ %27, %91 ], [ %27, %56 ], [ %27, %50 ], [ %63, %59 ], [ %63, %67 ]
%115 = phi i8 [ %26, %36 ], [ 0, %70 ], [ 0, %45 ], [ 0, %44 ], [ 0, %43 ], [ 1, %40 ], [ 1, %79 ], [ %26, %96 ], [ %26, %99 ], [ %26, %91 ], [ 0, %56 ], [ 0, %50 ], [ 0, %59 ], [ 0, %67 ]
%116 = phi i8 [ %25, %36 ], [ 0, %70 ], [ 0, %45 ], [ 0, %44 ], [ 1, %43 ], [ 0, %40 ], [ %25, %79 ], [ 1, %96 ], [ 1, %99 ], [ 0, %91 ], [ 0, %56 ], [ 0, %50 ], [ 0, %59 ], [ 0, %67 ]
%117 = phi i32 [ %24, %36 ], [ %24, %70 ], [ %24, %45 ], [ %24, %44 ], [ %24, %43 ], [ %24, %40 ], [ %24, %79 ], [ %24, %96 ], [ %24, %99 ], [ %24, %91 ], [ 1, %56 ], [ %24, %50 ], [ %24, %59 ], [ 1, %67 ]
%118 = add nuw nsw i64 %23, 1
%119 = icmp eq i64 %118, %21
br i1 %119, label %120, label %22
120: ; preds = %109
%121 = icmp eq i32 %112, -1
br i1 %121, label %122, label %129
122: ; preds = %16, %18, %120
%123 = phi double [ %114, %120 ], [ 9.000000e-01, %18 ], [ 9.000000e-01, %16 ]
%124 = phi i32 [ %113, %120 ], [ 6, %18 ], [ 6, %16 ]
%125 = phi i32 [ %111, %120 ], [ 0, %18 ], [ 0, %16 ]
%126 = phi i32 [ %110, %120 ], [ 0, %18 ], [ 0, %16 ]
%127 = load i32, i32* @stderr
%128 = call i32 (i32, i8*, ...) @fprintf(i32 %127, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0))
br label %129
129: ; preds = %122, %120
%130 = phi double [ %123, %122 ], [ %114, %120 ]
%131 = phi i32 [ %124, %122 ], [ %113, %120 ]
%132 = phi i32 [ %125, %122 ], [ %111, %120 ]
%133 = phi i32 [ %126, %122 ], [ %110, %120 ]
%134 = phi i32 [ 1, %122 ], [ %117, %120 ]
%135 = call dereferenceable_or_null(100) i8* @malloc(i32 100)
store i8* %135, i8** %5
%136 = icmp eq i8* %135, null
br i1 %136, label %137, label %141
137: ; preds = %129
%138 = load i32, i32* @stderr
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.5, i64 0, i64 0))
%140 = call i32 @exit(i32 2)
unreachable
141: ; preds = %129
%142 = icmp eq i32 %132, 0
br i1 %142, label %145, label %143
143: ; preds = %141
%144 = icmp eq i32 %133, 0
br i1 %144, label %149, label %152
145: ; preds = %141
%146 = load i32, i32* @stderr
%147 = call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0))
%148 = icmp eq i32 %133, 0
br i1 %148, label %149, label %154
149: ; preds = %145, %143
%150 = load i32, i32* @stderr
%151 = call i32 (i32, i8*, ...) @fprintf(i32 %150, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
br label %154
152: ; preds = %143
%153 = icmp eq i32 %134, 1
br i1 %153, label %154, label %156
154: ; preds = %145, %149, %152
%155 = call i32 @showhelp(i32 1)
br label %156
156: ; preds = %154, %152
store i64 100, i64* %6
%157 = icmp sgt i32 %132, 0
br i1 %157, label %158, label %213
158: ; preds = %156
%159 = icmp sgt i32 %133, 0
%160 = getelementptr inbounds [4 x double], [4 x double]* %7, i64 0, i64 0
%161 = zext i32 %132 to i64
%162 = zext i32 %133 to i64
br label %163
163: ; preds = %158, %210
%164 = phi i64 [ 0, %158 ], [ %211, %210 ]
%165 = getelementptr inbounds [50 x i8*], [50 x i8*]* %4, i64 0, i64 %164
%166 = load i8*, i8** %165
%167 = call i32 @strlen(i8* %166)
%168 = icmp ult i32 %167, %131
br i1 %168, label %169, label %172
169: ; preds = %163
%170 = load i32, i32* @stderr
%171 = call i32 (i32, i8*, ...) @fprintf(i32 %170, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8* %166)
br label %210
172: ; preds = %163
%173 = call i32 @validseq(i8* %166)
%174 = icmp eq i32 %173, -1
br i1 %174, label %175, label %176
175: ; preds = %172
br i1 %159, label %179, label %210
176: ; preds = %172
%177 = load i32, i32* @stderr
%178 = call i32 (i32, i8*, ...) @fprintf(i32 %177, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0), i32 %173)
br label %210
179: ; preds = %175, %206
%180 = phi i64 [ %208, %206 ], [ 0, %175 ]
%181 = getelementptr inbounds [50 x i8*], [50 x i8*]* %3, i64 0, i64 %180
%182 = load i8*, i8** %181
%183 = call i32* @fopen(i8* %182, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%184 = call i32 @getline(i8** %5, i64* %6, i32* %183)
%185 = icmp eq i32 %184, -1
br i1 %185, label %206, label %186
186: ; preds = %179, %194
%187 = load i8*, i8** %5
%188 = call i8* @strtok(i8* %187, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%189 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%190 = icmp eq i8* %189, null
br i1 %190, label %191, label %197
191: ; preds = %186
%192 = load i32, i32* @stderr
%193 = call i32 (i32, i8*, ...) @fprintf(i32 %192, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.13, i64 0, i64 0), i8* %182)
br label %194
194: ; preds = %191, %201, %204
%195 = call i32 @getline(i8** %5, i64* %6, i32* %183)
%196 = icmp eq i32 %195, -1
br i1 %196, label %206, label %186
197: ; preds = %186
%198 = call i32 @basefreq(i8* %189, double* %160)
%199 = call i32 @validseq(i8* %189)
%200 = icmp eq i32 %199, -1
br i1 %200, label %204, label %201
201: ; preds = %197
%202 = load i32, i32* @stderr
%203 = call i32 (i32, i8*, ...) @fprintf(i32 %202, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.14, i64 0, i64 0), i8* %189, i32 %199)
br label %194
204: ; preds = %197
%205 = call i32 @similarity(i8* %188, i8* %189, i8* %166, i32 %131, double %130, double* %160, i8* %14)
br label %194
206: ; preds = %194, %179
%207 = call i32 @fclose(i32* %183)
%208 = add nuw nsw i64 %180, 1
%209 = icmp eq i64 %208, %162
br i1 %209, label %210, label %179
210: ; preds = %206, %175, %176, %169
%211 = add nuw nsw i64 %164, 1
%212 = icmp eq i64 %211, %161
br i1 %212, label %213, label %163
213: ; preds = %210, %156
ret i32 0
}