#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 */

/* Variables and functions */
double ExtScore(char *, char *, int, int *, int *);
int /*<<< orphan*/ GetCorrectPos(int *, int *, int *, int *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
double pvalue(char *, double *);
int /*<<< orphan*/ stderr;
int strlen(char *);
int /*<<< orphan*/ substr(char *, int, int, char *);
double sumscore(char *, char *, double *);
void similarity(char *id, char *seqA, char *seqB, int wordsize, double limit,
                double *bases, char *output) {
  int m, n;
  int i, j, k;
  char *seqA_f, *seqB_f, *overA, *overB, *subseq, *subpatt;
  double score, extscore;
  double percent;
  int startA, startB, lenA, lenB;
  int comm_start, comm_len;
  double p;
  m = strlen(seqA) - wordsize + 1;
  n = strlen(seqB) - wordsize + 1;
  seqA_f = malloc(wordsize + 1);
  seqB_f = malloc(wordsize + 1);
  overA = malloc(strlen(seqA) + 1);
  overB = malloc(strlen(seqB) + 1);
  subseq = malloc(strlen(seqA) + 1);
  subpatt = malloc(strlen(seqB) + 1);
  if ((seqA_f == NULL) || (seqB_f == NULL) || (overA == NULL) ||
      (overB == NULL) || (subseq == NULL) || (subpatt == NULL)) {
    fprintf(stderr, "Memory is not enought\n");
    exit(2);
  }
  for (i = 0; i < m; i++) {
    substr(seqA, i, wordsize, seqA_f);
    for (j = 0; j < n; j++) {
      substr(seqB, j, wordsize, seqB_f);
      score = sumscore(seqA_f, seqB_f, &percent);
      if (percent >= limit) {
        startA = i + 1;
        startB = j + 1;
        lenA = strlen(seqA);
        lenB = strlen(seqB);
        GetCorrectPos(&startA, &startB, &lenA, &lenB);
        substr(seqA, startA, lenA, overA);
        substr(seqB, startB, lenB, overB);
        extscore = ExtScore(overA, overB, wordsize, &comm_start, &comm_len);
        if (extscore != score) {
          substr(overA, comm_start, comm_len, subseq);
          substr(overB, comm_start, comm_len, subpatt);
          startA = startA + comm_start + 1;
          startB = startB + comm_start + 1;
          i += comm_len;
          j += comm_len;
        } else {
          substr(seqA, i, wordsize, subseq);
          substr(seqB, j, wordsize, subpatt);
          startA = i + 1;
          startB = j + 1;
        }
        p = pvalue(subpatt, bases);
        for (k = 0; k < 12; k++) {
          switch (output[k]) {
          case 'i':
            printf("%s ", id);
            break;
          case 's':
            printf("%.2f ", score);
            break;
          case 'e':
            printf("%.2f ", extscore);
            break;
          case 'p':
            printf("%f ", p);
            break;
          case 'd':
            printf("%s ", subseq);
            break;
          case 'D':
            printf("%s ", seqA);
            break;
          case 'q':
            printf("%s ", subpatt);
            break;
          case 'Q':
            printf("%s ", seqB);
            break;
          case 'f':
            printf("%d ", startB);
            break;
          case 'F':
            printf("%d ", startA);
            break;
          case '%':
            printf("%.2f ", percent);
          };
        }
        printf("\n");
      }
    }
  }
  free(subpatt);
  free(subseq);
  free(overB);
  free(overA);
  free(seqA_f);
  free(seqB_f);
  return;
}


x86 assembly (clang, -O0):
<similarity>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
sub    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x58(%rbp)
mov    -0x1c(%rbp),%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x60(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x68(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x70(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x78(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
call   1090 <malloc@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     12b7 <similarity+0x107>
cmpq   $0x0,-0x60(%rbp)
je     12b7 <similarity+0x107>
cmpq   $0x0,-0x68(%rbp)
je     12b7 <similarity+0x107>
cmpq   $0x0,-0x70(%rbp)
je     12b7 <similarity+0x107>
cmpq   $0x0,-0x78(%rbp)
je     12b7 <similarity+0x107>
cmpq   $0x0,-0x80(%rbp)
jne    12d6 <similarity+0x126>
mov    0x2d22(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0x2,%edi
call   10b0 <exit@plt>
movl   $0x0,-0x44(%rbp)
mov    -0x44(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1689 <similarity+0x4d9>
mov    -0x10(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x58(%rbp),%rcx
call   1060 <substr@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x40(%rbp),%eax
jge    1676 <similarity+0x4c6>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x60(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rsi
lea    -0x98(%rbp),%rdx
call   10d0 <sumscore@plt>
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
ucomisd -0x28(%rbp),%xmm0
jb     1663 <similarity+0x4b3>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
mov    -0x10(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xa4(%rbp)
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0xa8(%rbp)
lea    -0x9c(%rbp),%rdi
lea    -0xa0(%rbp),%rsi
lea    -0xa4(%rbp),%rdx
lea    -0xa8(%rbp),%rcx
call   10a0 <GetCorrectPos@plt>
mov    -0x10(%rbp),%rdi
mov    -0x9c(%rbp),%esi
mov    -0xa4(%rbp),%edx
mov    -0x68(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x18(%rbp),%rdi
mov    -0xa0(%rbp),%esi
mov    -0xa8(%rbp),%edx
mov    -0x70(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x68(%rbp),%rdi
mov    -0x70(%rbp),%rsi
mov    -0x1c(%rbp),%edx
lea    -0xac(%rbp),%rcx
lea    -0xb0(%rbp),%r8
call   1040 <ExtScore@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
ucomisd -0x88(%rbp),%xmm0
ff
jne    1421 <similarity+0x271>
jp     1421 <similarity+0x271>
jmp    149a <similarity+0x2ea>
mov    -0x68(%rbp),%rdi
mov    -0xac(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0x78(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x70(%rbp),%rdi
mov    -0xac(%rbp),%esi
mov    -0xb0(%rbp),%edx
mov    -0x80(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x9c(%rbp),%eax
add    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0xa0(%rbp),%eax
add    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
mov    -0xb0(%rbp),%eax
add    -0x44(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0xb0(%rbp),%eax
add    -0x48(%rbp),%eax
mov    %eax,-0x48(%rbp)
jmp    14d8 <similarity+0x328>
mov    -0x10(%rbp),%rdi
mov    -0x44(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x78(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    -0x80(%rbp),%rcx
call   1060 <substr@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x9c(%rbp)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xa0(%rbp)
mov    -0x80(%rbp),%rdi
mov    -0x30(%rbp),%rsi
call   10c0 <pvalue@plt>
movsd  %xmm0,-0xb8(%rbp)
ff
movl   $0x0,-0x4c(%rbp)
cmpl   $0xc,-0x4c(%rbp)
jge    1655 <similarity+0x4a5>
mov    -0x38(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
add    $0xffffffdb,%eax
mov    %eax,%ecx
mov    %rcx,-0xc0(%rbp)
sub    $0x4e,%eax
ja     1642 <similarity+0x492>
mov    -0xc0(%rbp),%rax
lea    0xad3(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x8(%rbp),%rsi
lea    0xc12(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
movsd  -0x88(%rbp),%xmm0
ff
lea    0xbfb(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
movsd  -0x90(%rbp),%xmm0
ff
lea    0xbe0(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
movsd  -0xb8(%rbp),%xmm0
ff
lea    0xbcb(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0x78(%rbp),%rsi
lea    0xbaa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0x10(%rbp),%rsi
lea    0xb93(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0x80(%rbp),%rsi
lea    0xb7c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0x18(%rbp),%rsi
lea    0xb65(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0xa0(%rbp),%esi
lea    0xb5a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
mov    -0x9c(%rbp),%esi
lea    0xb41(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1642 <similarity+0x492>
movsd  -0x98(%rbp),%xmm0
ff
lea    0xb1c(%rip),%rdi
mov    $0x1,%al
call   1070 <printf@plt>
jmp    1647 <similarity+0x497>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    14f4 <similarity+0x344>
lea    0xaf5(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    1668 <similarity+0x4b8>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1303 <similarity+0x153>
jmp    167b <similarity+0x4cb>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    12dd <similarity+0x12d>
mov    -0x80(%rbp),%rdi
call   1030 <free@plt>
mov    -0x78(%rbp),%rdi
call   1030 <free@plt>
mov    -0x70(%rbp),%rdi
call   1030 <free@plt>
mov    -0x68(%rbp),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x60(%rbp),%rdi
call   1030 <free@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<similarity>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %r9,%rbx
mov    %r8,0x98(%rsp)
movsd  %xmm0,0xa0(%rsp)
mov    %ecx,%r15d
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,0xa8(%rsp)
mov    %rsi,%rdi
call   1060 <strlen@plt>
mov    %eax,0x34(%rsp)
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,0xc(%rsp)
lea    0x1(%r15),%ebp
mov    %ebp,%edi
call   10a0 <malloc@plt>
mov    %rax,0x40(%rsp)
mov    %ebp,%edi
mov    %r14,%rbp
call   10a0 <malloc@plt>
mov    %rax,0x48(%rsp)
mov    %r14,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
mov    %rax,%r14
mov    %r12,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
mov    %rax,%r13
mov    %rbp,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
mov    %rax,0x28(%rsp)
mov    %r12,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edi
call   10a0 <malloc@plt>
mov    %rax,0x18(%rsp)
mov    0x40(%rsp),%rax
test   %rax,%rax
je     1640 <similarity+0x480>
cmpq   $0x0,0x48(%rsp)
je     1640 <similarity+0x480>
test   %r14,%r14
je     1640 <similarity+0x480>
test   %r13,%r13
je     1640 <similarity+0x480>
cmpq   $0x0,0x28(%rsp)
je     1640 <similarity+0x480>
cmpq   $0x0,0x18(%rsp)
je     1640 <similarity+0x480>
mov    %r13,0x70(%rsp)
mov    %r14,0x78(%rsp)
sub    %r15d,0x34(%rsp)
mov    0x18(%rsp),%r13
js     15f4 <similarity+0x434>
sub    %r15d,0xc(%rsp)
lea    0xd19(%rip),%r14
xor    %esi,%esi
mov    %r15,0x50(%rsp)
mov    %r12,0x80(%rsp)
mov    %rbp,0x60(%rsp)
jmp    1319 <similarity+0x159>
nopl   (%rax)
mov    0x20(%rsp),%rcx
lea    0x1(%rcx),%eax
cmp    0x34(%rsp),%ecx
mov    %eax,%esi
mov    0x60(%rsp),%rbp
jge    15f4 <similarity+0x434>
mov    %rbp,%rdi
mov    %rsi,0x20(%rsp)
mov    %r15d,%edx
mov    0x40(%rsp),%rcx
call   1070 <substr@plt>
cmpl   $0x0,0xc(%rsp)
js     1300 <similarity+0x140>
xor    %ebp,%ebp
jmp    135a <similarity+0x19a>
nopl   0x0(%rax)
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x50(%rsp),%r15
lea    0x1(%rbp),%eax
cmp    0xc(%rsp),%ebp
mov    %eax,%ebp
jge    1300 <similarity+0x140>
mov    %r12,%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    0x48(%rsp),%r13
mov    %r13,%rcx
call   1070 <substr@plt>
mov    0x40(%rsp),%rdi
mov    %r13,%rsi
lea    0x90(%rsp),%rdx
call   10e0 <sumscore@plt>
movsd  0x90(%rsp),%xmm1
ucomisd 0xa0(%rsp),%xmm1
jae    13a0 <similarity+0x1e0>
mov    0x18(%rsp),%r13
jmp    134f <similarity+0x18f>
nop
mov    0x20(%rsp),%rax
add    $0x1,%eax
mov    %eax,0x58(%rsp)
mov    %eax,0x8(%rsp)
lea    0x1(%rbp),%eax
mov    %eax,0x6c(%rsp)
mov    %eax,0x4(%rsp)
mov    0x60(%rsp),%r13
mov    %r13,%rdi
movsd  %xmm0,0x88(%rsp)
call   1060 <strlen@plt>
mov    %eax,0x3c(%rsp)
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,0x38(%rsp)
lea    0x8(%rsp),%rdi
lea    0x4(%rsp),%rsi
lea    0x3c(%rsp),%rdx
lea    0x38(%rsp),%rcx
call   10b0 <GetCorrectPos@plt>
mov    0x8(%rsp),%esi
mov    0x3c(%rsp),%edx
mov    %r13,%rdi
mov    0x78(%rsp),%r15
mov    %r15,%rcx
call   1070 <substr@plt>
mov    0x4(%rsp),%esi
mov    0x38(%rsp),%edx
mov    %r12,%rdi
mov    0x70(%rsp),%r12
mov    %r12,%rcx
call   1070 <substr@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    0x50(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
call   1050 <ExtScore@plt>
movsd  %xmm0,0xb0(%rsp)
ucomisd 0x88(%rsp),%xmm0
jne    145a <similarity+0x29a>
jnp    14aa <similarity+0x2ea>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r15,%rdi
mov    0x28(%rsp),%rcx
call   1070 <substr@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    %r12,%rdi
mov    0x18(%rsp),%r13
mov    %r13,%rcx
call   1070 <substr@plt>
mov    0x14(%rsp),%eax
add    $0x1,%eax
add    %eax,0x8(%rsp)
add    %eax,0x4(%rsp)
mov    0x10(%rsp),%eax
mov    0x20(%rsp),%rcx
add    %eax,%ecx
mov    %rcx,0x20(%rsp)
add    %eax,%ebp
jmp    14ee <similarity+0x32e>
mov    %r13,%rdi
mov    0x20(%rsp),%rsi
mov    0x50(%rsp),%r15
mov    %r15d,%edx
mov    0x28(%rsp),%rcx
call   1070 <substr@plt>
mov    0x80(%rsp),%rdi
mov    %ebp,%esi
mov    %r15d,%edx
mov    0x18(%rsp),%r13
mov    %r13,%rcx
call   1070 <substr@plt>
mov    0x58(%rsp),%eax
mov    %eax,0x8(%rsp)
mov    0x6c(%rsp),%eax
mov    %eax,0x4(%rsp)
mov    %r13,%rdi
mov    0x98(%rsp),%rsi
call   10d0 <pvalue@plt>
movsd  %xmm0,0x58(%rsp)
xor    %r15d,%r15d
mov    0x80(%rsp),%r12
jmp    1532 <similarity+0x372>
lea    0xc3b(%rip),%rdi
mov    0x28(%rsp),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
add    $0x1,%r15
cmp    $0xc,%r15
je     1340 <similarity+0x180>
movsbl (%rbx,%r15,1),%eax
add    $0xffffffdb,%eax
cmp    $0x4e,%eax
ja     1524 <similarity+0x364>
movslq (%r14,%rax,4),%rax
add    %r14,%rax
jmp    *%rax
movsd  0x90(%rsp),%xmm0
lea    0xbff(%rip),%rdi
jmp    15e8 <similarity+0x428>
lea    0xbf3(%rip),%rdi
movsd  0x88(%rsp),%xmm0
jmp    15e8 <similarity+0x428>
lea    0xbe1(%rip),%rdi
movsd  0xb0(%rsp),%xmm0
jmp    15e8 <similarity+0x428>
lea    0xbcb(%rip),%rdi
mov    %r12,%rsi
jmp    151d <similarity+0x35d>
lea    0xbbf(%rip),%rdi
mov    0x60(%rsp),%rsi
jmp    151d <similarity+0x35d>
mov    0x8(%rsp),%esi
jmp    15a5 <similarity+0x3e5>
mov    0x4(%rsp),%esi
lea    0xbb5(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
jmp    1524 <similarity+0x364>
lea    0xb94(%rip),%rdi
mov    0xa8(%rsp),%rsi
jmp    151d <similarity+0x35d>
lea    0xb80(%rip),%rdi
mov    %r13,%rsi
jmp    151d <similarity+0x35d>
lea    0xb7b(%rip),%rdi
movsd  0x58(%rsp),%xmm0
mov    $0x1,%al
call   1080 <printf@plt>
jmp    1524 <similarity+0x364>
mov    %r13,%rdi
call   1030 <free@plt>
mov    0x28(%rsp),%rdi
call   1030 <free@plt>
mov    0x70(%rsp),%rdi
call   1030 <free@plt>
mov    0x78(%rsp),%rdi
call   1030 <free@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
mov    0x48(%rsp),%rdi
call   1030 <free@plt>
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2999(%rip),%rax
mov    (%rax),%edi
lea    0xaec(%rip),%rsi
call   1090 <fprintf@plt>
mov    $0x2,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [23 x i8] c"Memory is not enought\0A\00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [6 x i8] c"%.2f \00"
@.str.3 = [4 x i8] c"%f \00"
@.str.4 = [4 x i8] c"%d \00"
@.str.5 = [2 x i8] c"\0A\00"
define void @similarity(i8* %0, i8* %1, i8* %2, i32 %3, double %4, double* %5, i8* %6) {
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i32
%12 = alloca double
%13 = alloca double*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
%21 = alloca i8*
%22 = alloca i8*
%23 = alloca i8*
%24 = alloca i8*
%25 = alloca i8*
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca i32
%30 = alloca i32
%31 = alloca i32
%32 = alloca i32
%33 = alloca i32
%34 = alloca i32
%35 = alloca double
store i8* %0, i8** %8
store i8* %1, i8** %9
store i8* %2, i8** %10
store i32 %3, i32* %11
store double %4, double* %12
store double* %5, double** %13
store i8* %6, i8** %14
%36 = load i8*, i8** %9
%37 = call i32 @strlen(i8* %36)
%38 = load i32, i32* %11
%39 = sub nsw i32 %37, %38
%40 = add nsw i32 %39, 1
store i32 %40, i32* %15
%41 = load i8*, i8** %10
%42 = call i32 @strlen(i8* %41)
%43 = load i32, i32* %11
%44 = sub nsw i32 %42, %43
%45 = add nsw i32 %44, 1
store i32 %45, i32* %16
%46 = load i32, i32* %11
%47 = add nsw i32 %46, 1
%48 = call i8* @malloc(i32 %47)
store i8* %48, i8** %20
%49 = load i32, i32* %11
%50 = add nsw i32 %49, 1
%51 = call i8* @malloc(i32 %50)
store i8* %51, i8** %21
%52 = load i8*, i8** %9
%53 = call i32 @strlen(i8* %52)
%54 = add nsw i32 %53, 1
%55 = call i8* @malloc(i32 %54)
store i8* %55, i8** %22
%56 = load i8*, i8** %10
%57 = call i32 @strlen(i8* %56)
%58 = add nsw i32 %57, 1
%59 = call i8* @malloc(i32 %58)
store i8* %59, i8** %23
%60 = load i8*, i8** %9
%61 = call i32 @strlen(i8* %60)
%62 = add nsw i32 %61, 1
%63 = call i8* @malloc(i32 %62)
store i8* %63, i8** %24
%64 = load i8*, i8** %10
%65 = call i32 @strlen(i8* %64)
%66 = add nsw i32 %65, 1
%67 = call i8* @malloc(i32 %66)
store i8* %67, i8** %25
%68 = load i8*, i8** %20
%69 = icmp eq i8* %68, null
br i1 %69, label %85, label %70
70: ; preds = %7
%71 = load i8*, i8** %21
%72 = icmp eq i8* %71, null
br i1 %72, label %85, label %73
73: ; preds = %70
%74 = load i8*, i8** %22
%75 = icmp eq i8* %74, null
br i1 %75, label %85, label %76
76: ; preds = %73
%77 = load i8*, i8** %23
%78 = icmp eq i8* %77, null
br i1 %78, label %85, label %79
79: ; preds = %76
%80 = load i8*, i8** %24
%81 = icmp eq i8* %80, null
br i1 %81, label %85, label %82
82: ; preds = %79
%83 = load i8*, i8** %25
%84 = icmp eq i8* %83, null
br i1 %84, label %85, label %89
85: ; preds = %82, %79, %76, %73, %70, %7
%86 = load i32, i32* @stderr
%87 = call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%88 = call i32 @exit(i32 2)
unreachable
89: ; preds = %82
store i32 0, i32* %17
br label %90
90: ; preds = %241, %89
%91 = load i32, i32* %17
%92 = load i32, i32* %15
%93 = icmp slt i32 %91, %92
br i1 %93, label %94, label %244
94: ; preds = %90
%95 = load i8*, i8** %9
%96 = load i32, i32* %17
%97 = load i32, i32* %11
%98 = load i8*, i8** %20
%99 = call i32 @substr(i8* %95, i32 %96, i32 %97, i8* %98)
store i32 0, i32* %18
br label %100
100: ; preds = %237, %94
%101 = load i32, i32* %18
%102 = load i32, i32* %16
%103 = icmp slt i32 %101, %102
br i1 %103, label %104, label %240
104: ; preds = %100
%105 = load i8*, i8** %10
%106 = load i32, i32* %18
%107 = load i32, i32* %11
%108 = load i8*, i8** %21
%109 = call i32 @substr(i8* %105, i32 %106, i32 %107, i8* %108)
%110 = load i8*, i8** %20
%111 = load i8*, i8** %21
%112 = call double @sumscore(i8* %110, i8* %111, double* %28)
store double %112, double* %26
%113 = load double, double* %28
%114 = load double, double* %12
%115 = fcmp oge double %113, %114
br i1 %115, label %116, label %236
116: ; preds = %104
%117 = load i32, i32* %17
%118 = add nsw i32 %117, 1
store i32 %118, i32* %29
%119 = load i32, i32* %18
%120 = add nsw i32 %119, 1
store i32 %120, i32* %30
%121 = load i8*, i8** %9
%122 = call i32 @strlen(i8* %121)
store i32 %122, i32* %31
%123 = load i8*, i8** %10
%124 = call i32 @strlen(i8* %123)
store i32 %124, i32* %32
%125 = call i32 @GetCorrectPos(i32* %29, i32* %30, i32* %31, i32* %32)
%126 = load i8*, i8** %9
%127 = load i32, i32* %29
%128 = load i32, i32* %31
%129 = load i8*, i8** %22
%130 = call i32 @substr(i8* %126, i32 %127, i32 %128, i8* %129)
%131 = load i8*, i8** %10
%132 = load i32, i32* %30
%133 = load i32, i32* %32
%134 = load i8*, i8** %23
%135 = call i32 @substr(i8* %131, i32 %132, i32 %133, i8* %134)
%136 = load i8*, i8** %22
%137 = load i8*, i8** %23
%138 = load i32, i32* %11
%139 = call double @ExtScore(i8* %136, i8* %137, i32 %138, i32* %33, i32* %34)
store double %139, double* %27
%140 = load double, double* %27
%141 = load double, double* %26
%142 = fcmp une double %140, %141
br i1 %142, label %143, label %168
143: ; preds = %116
%144 = load i8*, i8** %22
%145 = load i32, i32* %33
%146 = load i32, i32* %34
%147 = load i8*, i8** %24
%148 = call i32 @substr(i8* %144, i32 %145, i32 %146, i8* %147)
%149 = load i8*, i8** %23
%150 = load i32, i32* %33
%151 = load i32, i32* %34
%152 = load i8*, i8** %25
%153 = call i32 @substr(i8* %149, i32 %150, i32 %151, i8* %152)
%154 = load i32, i32* %29
%155 = load i32, i32* %33
%156 = add nsw i32 %154, %155
%157 = add nsw i32 %156, 1
store i32 %157, i32* %29
%158 = load i32, i32* %30
%159 = load i32, i32* %33
%160 = add nsw i32 %158, %159
%161 = add nsw i32 %160, 1
store i32 %161, i32* %30
%162 = load i32, i32* %34
%163 = load i32, i32* %17
%164 = add nsw i32 %163, %162
store i32 %164, i32* %17
%165 = load i32, i32* %34
%166 = load i32, i32* %18
%167 = add nsw i32 %166, %165
store i32 %167, i32* %18
br label %183
168: ; preds = %116
%169 = load i8*, i8** %9
%170 = load i32, i32* %17
%171 = load i32, i32* %11
%172 = load i8*, i8** %24
%173 = call i32 @substr(i8* %169, i32 %170, i32 %171, i8* %172)
%174 = load i8*, i8** %10
%175 = load i32, i32* %18
%176 = load i32, i32* %11
%177 = load i8*, i8** %25
%178 = call i32 @substr(i8* %174, i32 %175, i32 %176, i8* %177)
%179 = load i32, i32* %17
%180 = add nsw i32 %179, 1
store i32 %180, i32* %29
%181 = load i32, i32* %18
%182 = add nsw i32 %181, 1
store i32 %182, i32* %30
br label %183
183: ; preds = %168, %143
%184 = load i8*, i8** %25
%185 = load double*, double** %13
%186 = call double @pvalue(i8* %184, double* %185)
store double %186, double* %35
store i32 0, i32* %19
br label %187
187: ; preds = %231, %183
%188 = load i32, i32* %19
%189 = icmp slt i32 %188, 12
br i1 %189, label %190, label %234
190: ; preds = %187
%191 = load i8*, i8** %14
%192 = load i32, i32* %19
%193 = sext i32 %192 to i64
%194 = getelementptr inbounds i8, i8* %191, i64 %193
%195 = load i8, i8* %194
%196 = sext i8 %195 to i32
switch i32 %196, label %230 [
i32 105, label %197
i32 115, label %200
i32 101, label %203
i32 112, label %206
i32 100, label %209
i32 68, label %212
i32 113, label %215
i32 81, label %218
i32 102, label %221
i32 70, label %224
i32 37, label %227
]
197: ; preds = %190
%198 = load i8*, i8** %8
%199 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %198)
br label %230
200: ; preds = %190
%201 = load double, double* %26
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %201)
br label %230
203: ; preds = %190
%204 = load double, double* %27
%205 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %204)
br label %230
206: ; preds = %190
%207 = load double, double* %35
%208 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %207)
br label %230
209: ; preds = %190
%210 = load i8*, i8** %24
%211 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %210)
br label %230
212: ; preds = %190
%213 = load i8*, i8** %9
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %213)
br label %230
215: ; preds = %190
%216 = load i8*, i8** %25
%217 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %216)
br label %230
218: ; preds = %190
%219 = load i8*, i8** %10
%220 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %219)
br label %230
221: ; preds = %190
%222 = load i32, i32* %30
%223 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %222)
br label %230
224: ; preds = %190
%225 = load i32, i32* %29
%226 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %225)
br label %230
227: ; preds = %190
%228 = load double, double* %28
%229 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %228)
br label %230
230: ; preds = %227, %190, %224, %221, %218, %215, %212, %209, %206, %203, %200, %197
br label %231
231: ; preds = %230
%232 = load i32, i32* %19
%233 = add nsw i32 %232, 1
store i32 %233, i32* %19
br label %187
234: ; preds = %187
%235 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %236
236: ; preds = %234, %104
br label %237
237: ; preds = %236
%238 = load i32, i32* %18
%239 = add nsw i32 %238, 1
store i32 %239, i32* %18
br label %100
240: ; preds = %100
br label %241
241: ; preds = %240
%242 = load i32, i32* %17
%243 = add nsw i32 %242, 1
store i32 %243, i32* %17
br label %90
244: ; preds = %90
%245 = load i8*, i8** %25
%246 = call i32 @free(i8* %245)
%247 = load i8*, i8** %24
%248 = call i32 @free(i8* %247)
%249 = load i8*, i8** %23
%250 = call i32 @free(i8* %249)
%251 = load i8*, i8** %22
%252 = call i32 @free(i8* %251)
%253 = load i8*, i8** %20
%254 = call i32 @free(i8* %253)
%255 = load i8*, i8** %21
%256 = call i32 @free(i8* %255)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [23 x i8] c"Memory is not enought\0A\00"
@.str.1 = [4 x i8] c"%s \00"
@.str.2 = [6 x i8] c"%.2f \00"
@.str.3 = [4 x i8] c"%f \00"
@.str.4 = [4 x i8] c"%d \00"
define void @similarity(i8* %0, i8* %1, i8* %2, i32 %3, double %4, double* %5, i8* nocapture %6) {
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = bitcast double* %8 to i8*
%16 = bitcast i32* %9 to i8*
%17 = bitcast i32* %10 to i8*
%18 = bitcast i32* %11 to i8*
%19 = bitcast i32* %12 to i8*
%20 = bitcast i32* %13 to i8*
%21 = bitcast i32* %14 to i8*
%22 = tail call i32 @strlen(i8* %1)
%23 = sub nsw i32 %22, %3
%24 = tail call i32 @strlen(i8* %2)
%25 = sub nsw i32 %24, %3
%26 = add nsw i32 %3, 1
%27 = tail call i8* @malloc(i32 %26)
%28 = tail call i8* @malloc(i32 %26)
%29 = tail call i32 @strlen(i8* %1)
%30 = add nsw i32 %29, 1
%31 = tail call i8* @malloc(i32 %30)
%32 = tail call i32 @strlen(i8* %2)
%33 = add nsw i32 %32, 1
%34 = tail call i8* @malloc(i32 %33)
%35 = tail call i32 @strlen(i8* %1)
%36 = add nsw i32 %35, 1
%37 = tail call i8* @malloc(i32 %36)
%38 = tail call i32 @strlen(i8* %2)
%39 = add nsw i32 %38, 1
%40 = tail call i8* @malloc(i32 %39)
%41 = icmp eq i8* %27, null
%42 = icmp eq i8* %28, null
%43 = or i1 %41, %42
%44 = icmp eq i8* %31, null
%45 = or i1 %43, %44
%46 = icmp eq i8* %34, null
%47 = or i1 %45, %46
%48 = icmp eq i8* %37, null
%49 = or i1 %47, %48
%50 = icmp eq i8* %40, null
%51 = or i1 %49, %50
br i1 %51, label %56, label %52
52: ; preds = %7
%53 = icmp slt i32 %23, 0
br i1 %53, label %151, label %54
54: ; preds = %52
%55 = icmp slt i32 %25, 0
br label %60
56: ; preds = %7
%57 = load i32, i32* @stderr
%58 = tail call i32 @fprintf(i32 %57, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%59 = tail call i32 @exit(i32 2)
unreachable
60: ; preds = %54, %147
%61 = phi i32 [ 0, %54 ], [ %149, %147 ]
%62 = call i32 @substr(i8* %1, i32 %61, i32 %3, i8* %27)
br i1 %55, label %147, label %63
63: ; preds = %60, %142
%64 = phi i32 [ %144, %142 ], [ %61, %60 ]
%65 = phi i32 [ %145, %142 ], [ 0, %60 ]
%66 = call i32 @substr(i8* %2, i32 %65, i32 %3, i8* %28)
%67 = call double @sumscore(i8* %27, i8* %28, double* %8)
%68 = load double, double* %8
%69 = fcmp ult double %68, %4
br i1 %69, label %142, label %70
70: ; preds = %63
%71 = add nsw i32 %64, 1
store i32 %71, i32* %9
%72 = add nsw i32 %65, 1
store i32 %72, i32* %10
%73 = call i32 @strlen(i8* %1)
store i32 %73, i32* %11
%74 = call i32 @strlen(i8* %2)
store i32 %74, i32* %12
%75 = call i32 @GetCorrectPos(i32* %9, i32* %10, i32* %11, i32* %12)
%76 = load i32, i32* %9
%77 = load i32, i32* %11
%78 = call i32 @substr(i8* %1, i32 %76, i32 %77, i8* %31)
%79 = load i32, i32* %10
%80 = load i32, i32* %12
%81 = call i32 @substr(i8* %2, i32 %79, i32 %80, i8* %34)
%82 = call double @ExtScore(i8* %31, i8* %34, i32 %3, i32* %13, i32* %14)
%83 = fcmp une double %82, %67
br i1 %83, label %84, label %100
84: ; preds = %70
%85 = load i32, i32* %13
%86 = load i32, i32* %14
%87 = call i32 @substr(i8* %31, i32 %85, i32 %86, i8* %37)
%88 = load i32, i32* %13
%89 = load i32, i32* %14
%90 = call i32 @substr(i8* %34, i32 %88, i32 %89, i8* %40)
%91 = load i32, i32* %9
%92 = load i32, i32* %13
%93 = add i32 %92, 1
%94 = add i32 %93, %91
store i32 %94, i32* %9
%95 = load i32, i32* %10
%96 = add i32 %93, %95
store i32 %96, i32* %10
%97 = load i32, i32* %14
%98 = add nsw i32 %97, %64
%99 = add nsw i32 %97, %65
br label %103
100: ; preds = %70
%101 = call i32 @substr(i8* %1, i32 %64, i32 %3, i8* %37)
%102 = call i32 @substr(i8* %2, i32 %65, i32 %3, i8* %40)
store i32 %71, i32* %9
store i32 %72, i32* %10
br label %103
103: ; preds = %100, %84
%104 = phi i32 [ %99, %84 ], [ %65, %100 ]
%105 = phi i32 [ %98, %84 ], [ %64, %100 ]
%106 = call double @pvalue(i8* %40, double* %5)
br label %107
107: ; preds = %103, %137
%108 = phi i64 [ 0, %103 ], [ %138, %137 ]
%109 = getelementptr inbounds i8, i8* %6, i64 %108
%110 = load i8, i8* %109
%111 = sext i8 %110 to i32
switch i32 %111, label %137 [
i32 105, label %112
i32 115, label %114
i32 101, label %116
i32 112, label %118
i32 100, label %120
i32 68, label %122
i32 113, label %124
i32 81, label %126
i32 102, label %128
i32 70, label %131
i32 37, label %134
]
112: ; preds = %107
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %137
114: ; preds = %107
%115 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %67)
br label %137
116: ; preds = %107
%117 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %82)
br label %137
118: ; preds = %107
%119 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), double %106)
br label %137
120: ; preds = %107
%121 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %37)
br label %137
122: ; preds = %107
%123 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %137
124: ; preds = %107
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %40)
br label %137
126: ; preds = %107
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %137
128: ; preds = %107
%129 = load i32, i32* %10
%130 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %129)
br label %137
131: ; preds = %107
%132 = load i32, i32* %9
%133 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %132)
br label %137
134: ; preds = %107
%135 = load double, double* %8
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %135)
br label %137
137: ; preds = %112, %114, %116, %118, %120, %122, %124, %126, %128, %131, %107, %134
%138 = add nuw nsw i64 %108, 1
%139 = icmp eq i64 %138, 12
br i1 %139, label %140, label %107
140: ; preds = %137
%141 = call i32 @putchar(i32 10)
br label %142
142: ; preds = %63, %140
%143 = phi i32 [ %104, %140 ], [ %65, %63 ]
%144 = phi i32 [ %105, %140 ], [ %64, %63 ]
%145 = add nsw i32 %143, 1
%146 = icmp slt i32 %143, %25
br i1 %146, label %63, label %147
147: ; preds = %142, %60
%148 = phi i32 [ %61, %60 ], [ %144, %142 ]
%149 = add nsw i32 %148, 1
%150 = icmp slt i32 %148, %23
br i1 %150, label %60, label %151
151: ; preds = %147, %52
%152 = call i32 @free(i8* %40)
%153 = call i32 @free(i8* %37)
%154 = call i32 @free(i8* %34)
%155 = call i32 @free(i8* %31)
%156 = call i32 @free(i8* %27)
%157 = call i32 @free(i8* %28)
ret void
}