#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 */
scalar_t__ EOF;
double fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fscanf(int /*<<< orphan*/, char *, char *, int *, int *);
int /*<<< orphan*/ genotype_likelihood(int *, int, int, double *, double *,
                                       double *);
int getopt(int, char **, char *);
double log10(double);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ snpcaller(int *, int, int, int, double *, double *);
int /*<<< orphan*/ sscanf(int /*<<< orphan*/, char *, int *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int main(int argc, char *argv[]) {
  char line[102400];
  int quals[102400];
  int opt;
  int i;
  int naive;
  int qbase;
  int num_phred_quals;
  int num_alt_phred_quals;
  double pvalue;
  double likelihood;
  double ref_hom;
  double alt_hom;
  double het;
  if (argc != 5) {
    fprintf(stderr, "\n");
    fprintf(stderr, "Usage: cat <input> | %s -n <0/1> -q <int>\n", argv[0]);
    fprintf(stderr, "Options:\n");
    fprintf(stderr, "    -n <0/1>      (Required)    naive (but slower)\n");
    fprintf(stderr, "    -q <int>      (Required)    ascii_base\n");
    fprintf(stderr, "<input> format:\n");
    fprintf(stderr, "    field1: a string of ascii-based phred scores\n");
    fprintf(stderr,
            "    field2: the number of reference and alternative bases\n");
    fprintf(stderr, "    field3: the number of alternative bases\n");
    fprintf(stderr, "<output> format:\n");
    fprintf(
        stderr,
        "    field1: the phred score of probability in LoFreq (Wilm et al.)\n");
    fprintf(stderr, "    field2: the natural logarithm of likelihood for "
                    "genotype ref_hom\n");
    fprintf(
        stderr,
        "    field3: the natural logarithm of likelihood for genotype het\n");
    fprintf(stderr, "    field4: the natural logarithm of likelihood for "
                    "genotype alt_hom\n\n");
    return 1;
  }
  while ((opt = getopt(argc, argv, "n:q:")) != -1) {
    if (opt == 'n') {
      sscanf(optarg, "%d", &naive);
    }
    if (opt == 'q') {
      sscanf(optarg, "%d", &qbase);
    }
  }
  while (fscanf(stdin, "%s%d%d", line, &num_phred_quals,
                &num_alt_phred_quals) != EOF) {
    for (i = 0; i < num_phred_quals; i++) {
      quals[i] = line[i] - qbase;
    }
    snpcaller(quals, num_phred_quals, num_alt_phred_quals, naive, &pvalue,
              &likelihood);
    genotype_likelihood(quals, num_phred_quals, num_alt_phred_quals, &ref_hom,
                        &alt_hom, &het);
    if (naive) {
      fprintf(stdout, "%f\t%f\t%f\t%f\n", fabs(((-10.0 * log10(pvalue)))),
              ref_hom, het, alt_hom);
    } else {
      fprintf(stdout, "%f\t%f\t%f\t%f\n", fabs(((-10.0 * log10(pvalue)))),
              ref_hom, het, alt_hom);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7d060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     12e8 <main+0x178>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0x10d8(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2e17(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe57(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
lea    0xe6b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2de2(%rip),%rax
mov    (%rax),%edi
lea    0xe5e(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2dcb(%rip),%rax
mov    (%rax),%edi
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2db4(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d86(%rip),%rax
mov    (%rax),%edi
lea    0xea5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d6f(%rip),%rax
mov    (%rax),%edi
lea    0xec9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
lea    0xedf(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d41(%rip),%rax
mov    (%rax),%edi
lea    0xeda(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
lea    0xf07(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2d13(%rip),%rax
mov    (%rax),%edi
lea    0xf36(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2cfc(%rip),%rax
mov    (%rax),%edi
lea    0xf61(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1533 <main+0x3c3>
jmp    12ed <main+0x17d>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xf82(%rip),%rdx
call   1070 <getopt@plt>
mov    %eax,-0x7d014(%rbp)
cmp    $0xffffffff,%eax
je     1366 <main+0x1f6>
cmpl   $0x6e,-0x7d014(%rbp)
jne    1338 <main+0x1c8>
mov    0x2cd5(%rip),%rax
mov    (%rax),%edi
lea    0xf5a(%rip),%rsi
lea    -0x7d01c(%rbp),%rdx
call   1060 <sscanf@plt>
cmpl   $0x71,-0x7d014(%rbp)
jne    1361 <main+0x1f1>
mov    0x2cac(%rip),%rax
mov    (%rax),%edi
lea    0xf31(%rip),%rsi
lea    -0x7d020(%rbp),%rdx
call   1060 <sscanf@plt>
jmp    12ed <main+0x17d>
jmp    136b <main+0x1fb>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
lea    -0x19010(%rbp),%rdx
lea    0xf00(%rip),%rsi
lea    -0x7d024(%rbp),%rcx
lea    -0x7d028(%rbp),%r8
call   1030 <fscanf@plt>
mov    0x2c3c(%rip),%rcx
cmp    (%rcx),%rax
je     152c <main+0x3bc>
movl   $0x0,-0x7d018(%rbp)
mov    -0x7d018(%rbp),%eax
cmp    -0x7d024(%rbp),%eax
jge    13f8 <main+0x288>
movslq -0x7d018(%rbp),%rax
movsbl -0x19010(%rbp,%rax,1),%ecx
ff
sub    -0x7d020(%rbp),%ecx
movslq -0x7d018(%rbp),%rax
mov    %ecx,-0x7d010(%rbp,%rax,4)
mov    -0x7d018(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7d018(%rbp)
jmp    13af <main+0x23f>
lea    -0x7d010(%rbp),%rdi
mov    -0x7d024(%rbp),%esi
mov    -0x7d028(%rbp),%edx
mov    -0x7d01c(%rbp),%ecx
lea    -0x7d030(%rbp),%r8
lea    -0x7d038(%rbp),%r9
call   1090 <snpcaller@plt>
lea    -0x7d010(%rbp),%rdi
mov    -0x7d024(%rbp),%esi
mov    -0x7d028(%rbp),%edx
lea    -0x7d040(%rbp),%rcx
lea    -0x7d048(%rbp),%r8
lea    -0x7d050(%rbp),%r9
call   1040 <genotype_likelihood@plt>
cmpl   $0x0,-0x7d01c(%rbp)
je     14c5 <main+0x355>
mov    0x2b5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7d054(%rbp)
movsd  -0x7d030(%rbp),%xmm0
ff
call   1080 <log10@plt>
mov    -0x7d054(%rbp),%edi
movaps %xmm0,%xmm1
movsd  0xb85(%rip),%xmm0
mulsd  %xmm1,%xmm0
movaps 0xb6a(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x7d040(%rbp),%xmm1
ff
movsd  -0x7d050(%rbp),%xmm2
ff
movsd  -0x7d048(%rbp),%xmm3
ff
lea    0xdd0(%rip),%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
jmp    1527 <main+0x3b7>
mov    0x2af4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x7d058(%rbp)
movsd  -0x7d030(%rbp),%xmm0
ff
call   1080 <log10@plt>
mov    -0x7d058(%rbp),%edi
movaps %xmm0,%xmm1
movsd  0xb1e(%rip),%xmm0
mulsd  %xmm1,%xmm0
movaps 0xb03(%rip),%xmm1
pand   %xmm1,%xmm0
movsd  -0x7d040(%rbp),%xmm1
ff
movsd  -0x7d050(%rbp),%xmm2
ff
movsd  -0x7d048(%rbp),%xmm3
ff
lea    0xd69(%rip),%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
jmp    136b <main+0x1fb>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x7d060,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7d048,%rsp
mov    %rsi,%rbx
cmp    $0x5,%edi
jne    1446 <main+0x2d6>
lea    0x10f1(%rip),%r15
lea    0x14(%rsp),%rbp
mov    0x2e58(%rip),%r12
lea    0x10e7(%rip),%r14
lea    0x10(%rsp),%r13
jmp    11bf <main+0x4f>
xchg   %ax,%ax
mov    %r13,%rdx
mov    (%r12),%edi
mov    %r14,%rsi
call   1060 <sscanf@plt>
mov    $0x5,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1070 <getopt@plt>
mov    %rbp,%rdx
cmp    $0x6e,%eax
je     11b3 <main+0x43>
cmp    $0x71,%eax
je     11b0 <main+0x40>
cmp    $0xffffffff,%eax
jne    11bf <main+0x4f>
mov    0x2df8(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0x1098(%rip),%rsi
lea    0x40(%rsp),%rdx
lea    0xc(%rsp),%rcx
lea    0x8(%rsp),%r8
call   1030 <fscanf@plt>
mov    %rax,%rcx
mov    0x2dc8(%rip),%rbx
xor    %eax,%eax
cmp    (%rbx),%rcx
je     1547 <main+0x3d7>
lea    0x19040(%rsp),%r12
lea    0xc(%rsp),%r13
lea    0x8(%rsp),%r15
jmp    12e4 <main+0x174>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    0x8(%rsp),%edx
mov    0x14(%rsp),%ecx
mov    %r12,%rdi
lea    0x30(%rsp),%r8
lea    0x38(%rsp),%r9
call   1090 <snpcaller@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
mov    %r12,%rdi
lea    0x28(%rsp),%rcx
lea    0x20(%rsp),%r8
lea    0x18(%rsp),%r9
call   1040 <genotype_likelihood@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%r14d
movsd  0x30(%rsp),%xmm0
call   1080 <log10@plt>
mulsd  0xd6a(%rip),%xmm0
andpd  0xd72(%rip),%xmm0
movq   0x28(%rsp),%xmm1
movq   0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm3
mov    %r14d,%edi
lea    0xfd7(%rip),%rsi
mov    $0x4,%al
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xfbf(%rip),%rsi
lea    0x40(%rsp),%rdx
mov    %r13,%rcx
mov    %r15,%r8
call   1030 <fscanf@plt>
cmp    (%rbx),%rax
je     1545 <main+0x3d5>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    1240 <main+0xd0>
mov    0x10(%rsp),%eax
cmp    $0x8,%esi
jae    1300 <main+0x190>
xor    %ecx,%ecx
jmp    1420 <main+0x2b0>
mov    %rbx,%r8
mov    %rbp,%rbx
mov    %esi,%ecx
and    $0xfffffff8,%ecx
movd   %eax,%xmm0
pshufd $0x0,%xmm0,%xmm0
lea    -0x8(%rcx),%rdx
mov    %rdx,%rbp
shr    $0x3,%rbp
add    $0x1,%rbp
test   %rdx,%rdx
je     143c <main+0x2cc>
mov    %rbp,%rdi
and    $0xfffffffffffffffe,%rdi
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nop
movd   0x44(%rsp,%rdx,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
punpcklbw 0x40(%rsp,%rdx,1),%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm2
psrad  $0x18,%xmm1
psubd  %xmm0,%xmm2
psubd  %xmm0,%xmm1
movdqa %xmm2,0x19040(%rsp,%rdx,4)
movdqa %xmm1,0x19050(%rsp,%rdx,4)
movq   0x48(%rsp,%rdx,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
movd   0x4c(%rsp,%rdx,1),%xmm2
punpcklbw %xmm2,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm1
psrad  $0x18,%xmm2
psubd  %xmm0,%xmm1
psubd  %xmm0,%xmm2
movdqa %xmm1,0x19060(%rsp,%rdx,4)
movdqa %xmm2,0x19070(%rsp,%rdx,4)
add    $0x10,%rdx
add    $0xfffffffffffffffe,%rdi
jne    1340 <main+0x1d0>
test   $0x1,%bpl
je     1410 <main+0x2a0>
movq   0x40(%rsp,%rdx,1),%xmm1
punpcklbw %xmm1,%xmm1
punpcklwd %xmm1,%xmm1
movd   0x44(%rsp,%rdx,1),%xmm2
punpcklbw %xmm2,%xmm2
punpcklwd %xmm2,%xmm2
psrad  $0x18,%xmm1
psrad  $0x18,%xmm2
psubd  %xmm0,%xmm1
psubd  %xmm0,%xmm2
movdqa %xmm1,0x19040(%rsp,%rdx,4)
movdqa %xmm2,0x19050(%rsp,%rdx,4)
cmp    %rsi,%rcx
mov    %rbx,%rbp
mov    %r8,%rbx
je     1240 <main+0xd0>
nop
movsbl 0x40(%rsp,%rcx,1),%edx
sub    %eax,%edx
mov    %edx,0x19040(%rsp,%rcx,4)
add    $0x1,%rcx
cmp    %rcx,%rsi
jne    1420 <main+0x2b0>
jmp    1240 <main+0xd0>
xor    %edx,%edx
test   $0x1,%bpl
jne    13d0 <main+0x260>
jmp    1410 <main+0x2a0>
mov    0x2b7b(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xe2c(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xbb5(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xbcf(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xbc8(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xbeb(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc06(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc06(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc27(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc51(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc6d(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc6e(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xca1(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xcd6(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xd07(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0x1,%eax
jmp    1547 <main+0x3d7>
xor    %eax,%eax
add    $0x7d048,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [43 x i8] c"Usage: cat <input> | %s -n <0/1> -q <int>\0A\00"
@.str.2 = [10 x i8] c"Options:\0A\00"
@.str.3 = [52 x i8] c" -n <0/1> (Required) naive (but slower)\0A\00"
@.str.4 = [44 x i8] c" -q <int> (Required) ascii_base\0A\00"
@.str.5 = [17 x i8] c"<input> format:\0A\00"
@.str.6 = [50 x i8] c" field1: a string of ascii-based phred scores\0A\00"
@.str.7 = [59 x i8] c" field2: the number of reference and alternative bases\0A\00"
@.str.8 = [45 x i8] c" field3: the number of alternative bases\0A\00"
@.str.9 = [18 x i8] c"<output> format:\0A\00"
@.str.10 = [68 x i8] c" field1: the phred score of probability in LoFreq (Wilm et al.)\0A\00"
@.str.11 = [70 x i8] c" field2: the natural logarithm of likelihood for genotype ref_hom\0A\00"
@.str.12 = [66 x i8] c" field3: the natural logarithm of likelihood for genotype het\0A\00"
@.str.13 = [71 x i8] c" field4: the natural logarithm of likelihood for genotype alt_hom\0A\0A\00"
@.str.14 = [5 x i8] c"n:q:\00"
@optarg = global i32 0
@.str.15 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.16 = [7 x i8] c"%s%d%d\00"
@EOF = global i64 0
@stdout = global i32 0
@.str.17 = [13 x i8] c"%f\09%f\09%f\09%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [102400 x i8]
%7 = alloca [102400 x i32]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* %4
%20 = icmp ne i32 %19, 5
br i1 %20, label %21, label %53
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%33 = load i32, i32* @stderr
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %33, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%35 = load i32, i32* @stderr
%36 = call i32 (i32, i8*, ...) @fprintf(i32 %35, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%37 = load i32, i32* @stderr
%38 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%39 = load i32, i32* @stderr
%40 = call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
%41 = load i32, i32* @stderr
%42 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
%43 = load i32, i32* @stderr
%44 = call i32 (i32, i8*, ...) @fprintf(i32 %43, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%45 = load i32, i32* @stderr
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0))
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.11, i64 0, i64 0))
%49 = load i32, i32* @stderr
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%51 = load i32, i32* @stderr
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.13, i64 0, i64 0))
store i32 1, i32* %3
br label %132
53: ; preds = %2
br label %54
54: ; preds = %71, %53
%55 = load i32, i32* %4
%56 = load i8**, i8*** %5
%57 = call i32 @getopt(i32 %55, i8** %56, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
store i32 %57, i32* %8
%58 = icmp ne i32 %57, -1
br i1 %58, label %59, label %72
59: ; preds = %54
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 110
br i1 %61, label %62, label %65
62: ; preds = %59
%63 = load i32, i32* @optarg
%64 = call i32 @sscanf(i32 %63, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i32* %10)
br label %65
65: ; preds = %62, %59
%66 = load i32, i32* %8
%67 = icmp eq i32 %66, 113
br i1 %67, label %68, label %71
68: ; preds = %65
%69 = load i32, i32* @optarg
%70 = call i32 @sscanf(i32 %69, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i32* %11)
br label %71
71: ; preds = %68, %65
br label %54
72: ; preds = %54
br label %73
73: ; preds = %130, %72
%74 = load i32, i32* @stdin
%75 = getelementptr inbounds [102400 x i8], [102400 x i8]* %6, i64 0, i64 0
%76 = call i64 @fscanf(i32 %74, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8* %75, i32* %12, i32* %13)
%77 = load i64, i64* @EOF
%78 = icmp ne i64 %76, %77
br i1 %78, label %79, label %131
79: ; preds = %73
store i32 0, i32* %9
br label %80
80: ; preds = %95, %79
%81 = load i32, i32* %9
%82 = load i32, i32* %12
%83 = icmp slt i32 %81, %82
br i1 %83, label %84, label %98
84: ; preds = %80
%85 = load i32, i32* %9
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [102400 x i8], [102400 x i8]* %6, i64 0, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = load i32, i32* %11
%91 = sub nsw i32 %89, %90
%92 = load i32, i32* %9
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [102400 x i32], [102400 x i32]* %7, i64 0, i64 %93
store i32 %91, i32* %94
br label %95
95: ; preds = %84
%96 = load i32, i32* %9
%97 = add nsw i32 %96, 1
store i32 %97, i32* %9
br label %80
98: ; preds = %80
%99 = getelementptr inbounds [102400 x i32], [102400 x i32]* %7, i64 0, i64 0
%100 = load i32, i32* %12
%101 = load i32, i32* %13
%102 = load i32, i32* %10
%103 = call i32 @snpcaller(i32* %99, i32 %100, i32 %101, i32 %102, double* %14, double* %15)
%104 = getelementptr inbounds [102400 x i32], [102400 x i32]* %7, i64 0, i64 0
%105 = load i32, i32* %12
%106 = load i32, i32* %13
%107 = call i32 @genotype_likelihood(i32* %104, i32 %105, i32 %106, double* %16, double* %17, double* %18)
%108 = load i32, i32* %10
%109 = icmp ne i32 %108, 0
br i1 %109, label %110, label %120
110: ; preds = %98
%111 = load i32, i32* @stdout
%112 = load double, double* %14
%113 = call double @log10(double %112)
%114 = fmul double -1.000000e+01, %113
%115 = call double @llvm.fabs.f64(double %114)
%116 = load double, double* %16
%117 = load double, double* %18
%118 = load double, double* %17
%119 = call i32 (i32, i8*, ...) @fprintf(i32 %111, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), double %115, double %116, double %117, double %118)
br label %130
120: ; preds = %98
%121 = load i32, i32* @stdout
%122 = load double, double* %14
%123 = call double @log10(double %122)
%124 = fmul double -1.000000e+01, %123
%125 = call double @llvm.fabs.f64(double %124)
%126 = load double, double* %16
%127 = load double, double* %18
%128 = load double, double* %17
%129 = call i32 (i32, i8*, ...) @fprintf(i32 %121, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), double %125, double %126, double %127, double %128)
br label %130
130: ; preds = %120, %110
br label %73
131: ; preds = %73
store i32 0, i32* %3
br label %132
132: ; preds = %131, %21
%133 = load i32, i32* %3
ret i32 %133
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [43 x i8] c"Usage: cat <input> | %s -n <0/1> -q <int>\0A\00"
@.str.2 = [10 x i8] c"Options:\0A\00"
@.str.3 = [52 x i8] c" -n <0/1> (Required) naive (but slower)\0A\00"
@.str.4 = [44 x i8] c" -q <int> (Required) ascii_base\0A\00"
@.str.5 = [17 x i8] c"<input> format:\0A\00"
@.str.6 = [50 x i8] c" field1: a string of ascii-based phred scores\0A\00"
@.str.7 = [59 x i8] c" field2: the number of reference and alternative bases\0A\00"
@.str.8 = [45 x i8] c" field3: the number of alternative bases\0A\00"
@.str.9 = [18 x i8] c"<output> format:\0A\00"
@.str.10 = [68 x i8] c" field1: the phred score of probability in LoFreq (Wilm et al.)\0A\00"
@.str.11 = [70 x i8] c" field2: the natural logarithm of likelihood for genotype ref_hom\0A\00"
@.str.12 = [66 x i8] c" field3: the natural logarithm of likelihood for genotype het\0A\00"
@.str.13 = [71 x i8] c" field4: the natural logarithm of likelihood for genotype alt_hom\0A\0A\00"
@.str.14 = [5 x i8] c"n:q:\00"
@optarg = global i32 0
@.str.15 = [3 x i8] c"%d\00"
@stdin = global i32 0
@.str.16 = [7 x i8] c"%s%d%d\00"
@EOF = global i64 0
@stdout = global i32 0
@.str.17 = [13 x i8] c"%f\09%f\09%f\09%f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca [102400 x i8]
%4 = alloca [102400 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 0
%15 = bitcast [102400 x i32]* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = bitcast i32* %6 to i8*
%18 = bitcast i32* %7 to i8*
%19 = bitcast i32* %8 to i8*
%20 = bitcast double* %9 to i8*
%21 = bitcast double* %10 to i8*
%22 = bitcast double* %11 to i8*
%23 = bitcast double* %12 to i8*
%24 = bitcast double* %13 to i8*
%25 = icmp eq i32 %0, 5
br i1 %25, label %56, label %26
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = tail call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%29 = load i32, i32* @stderr
%30 = load i8*, i8** %1
%31 = tail call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0), i8* %30)
%32 = load i32, i32* @stderr
%33 = tail call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%34 = load i32, i32* @stderr
%35 = tail call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.3, i64 0, i64 0))
%36 = load i32, i32* @stderr
%37 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.4, i64 0, i64 0))
%38 = load i32, i32* @stderr
%39 = tail call i32 (i32, i8*, ...) @fprintf(i32 %38, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%40 = load i32, i32* @stderr
%41 = tail call i32 (i32, i8*, ...) @fprintf(i32 %40, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.6, i64 0, i64 0))
%42 = load i32, i32* @stderr
%43 = tail call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.7, i64 0, i64 0))
%44 = load i32, i32* @stderr
%45 = tail call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
%46 = load i32, i32* @stderr
%47 = tail call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
%48 = load i32, i32* @stderr
%49 = tail call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.10, i64 0, i64 0))
%50 = load i32, i32* @stderr
%51 = tail call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.11, i64 0, i64 0))
%52 = load i32, i32* @stderr
%53 = tail call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.12, i64 0, i64 0))
%54 = load i32, i32* @stderr
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.13, i64 0, i64 0))
br label %177
56: ; preds = %2, %70
%57 = call i32 @getopt(i32 5, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.14, i64 0, i64 0))
switch i32 %57, label %70 [
i32 -1, label %58
i32 110, label %66
i32 113, label %65
]
58: ; preds = %56
%59 = load i32, i32* @stdin
%60 = call i64 @fscanf(i32 %59, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8* %14, i32* %7, i32* %8)
%61 = load i64, i64* @EOF
%62 = icmp eq i64 %60, %61
br i1 %62, label %177, label %63
63: ; preds = %58
%64 = getelementptr inbounds [102400 x i32], [102400 x i32]* %4, i64 0, i64 0
br label %71
65: ; preds = %56
br label %66
66: ; preds = %56, %65
%67 = phi i32* [ %6, %65 ], [ %5, %56 ]
%68 = load i32, i32* @optarg
%69 = call i32 @sscanf(i32 %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.15, i64 0, i64 0), i32* %67)
br label %70
70: ; preds = %66, %56
br label %56
71: ; preds = %63, %157
%72 = load i32, i32* %7
%73 = icmp sgt i32 %72, 0
br i1 %73, label %74, label %157
74: ; preds = %71
%75 = load i32, i32* %6
%76 = zext i32 %72 to i64
%77 = icmp ult i32 %72, 8
br i1 %77, label %146, label %78
78: ; preds = %74
%79 = and i64 %76, 4294967288
%80 = insertelement <4 x i32> poison, i32 %75, i64 0
%81 = shufflevector <4 x i32> %80, <4 x i32> poison, <4 x i32> zeroinitializer
%82 = insertelement <4 x i32> poison, i32 %75, i64 0
%83 = shufflevector <4 x i32> %82, <4 x i32> poison, <4 x i32> zeroinitializer
%84 = add nsw i64 %79, -8
%85 = lshr exact i64 %84, 3
%86 = add nuw nsw i64 %85, 1
%87 = and i64 %86, 1
%88 = icmp eq i64 %84, 0
br i1 %88, label %126, label %89
89: ; preds = %78
%90 = and i64 %86, 4611686018427387902
br label %91
91: ; preds = %91, %89
%92 = phi i64 [ 0, %89 ], [ %123, %91 ]
%93 = phi i64 [ 0, %89 ], [ %124, %91 ]
%94 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 %92
%95 = bitcast i8* %94 to <4 x i8>*
%96 = load <4 x i8>, <4 x i8>* %95
%97 = getelementptr inbounds i8, i8* %94, i64 4
%98 = bitcast i8* %97 to <4 x i8>*
%99 = load <4 x i8>, <4 x i8>* %98
%100 = sext <4 x i8> %96 to <4 x i32>
%101 = sext <4 x i8> %99 to <4 x i32>
%102 = sub nsw <4 x i32> %100, %81
%103 = sub nsw <4 x i32> %101, %83
%104 = getelementptr inbounds [102400 x i32], [102400 x i32]* %4, i64 0, i64 %92
%105 = bitcast i32* %104 to <4 x i32>*
store <4 x i32> %102, <4 x i32>* %105
%106 = getelementptr inbounds i32, i32* %104, i64 4
%107 = bitcast i32* %106 to <4 x i32>*
store <4 x i32> %103, <4 x i32>* %107
%108 = or i64 %92, 8
%109 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 %108
%110 = bitcast i8* %109 to <4 x i8>*
%111 = load <4 x i8>, <4 x i8>* %110
%112 = getelementptr inbounds i8, i8* %109, i64 4
%113 = bitcast i8* %112 to <4 x i8>*
%114 = load <4 x i8>, <4 x i8>* %113
%115 = sext <4 x i8> %111 to <4 x i32>
%116 = sext <4 x i8> %114 to <4 x i32>
%117 = sub nsw <4 x i32> %115, %81
%118 = sub nsw <4 x i32> %116, %83
%119 = getelementptr inbounds [102400 x i32], [102400 x i32]* %4, i64 0, i64 %108
%120 = bitcast i32* %119 to <4 x i32>*
store <4 x i32> %117, <4 x i32>* %120
%121 = getelementptr inbounds i32, i32* %119, i64 4
%122 = bitcast i32* %121 to <4 x i32>*
store <4 x i32> %118, <4 x i32>* %122
%123 = add nuw i64 %92, 16
%124 = add i64 %93, 2
%125 = icmp eq i64 %124, %90
br i1 %125, label %126, label %91
126: ; preds = %91, %78
%127 = phi i64 [ 0, %78 ], [ %123, %91 ]
%128 = icmp eq i64 %87, 0
br i1 %128, label %144, label %129
129: ; preds = %126
%130 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 %127
%131 = bitcast i8* %130 to <4 x i8>*
%132 = load <4 x i8>, <4 x i8>* %131
%133 = getelementptr inbounds i8, i8* %130, i64 4
%134 = bitcast i8* %133 to <4 x i8>*
%135 = load <4 x i8>, <4 x i8>* %134
%136 = sext <4 x i8> %132 to <4 x i32>
%137 = sext <4 x i8> %135 to <4 x i32>
%138 = sub nsw <4 x i32> %136, %81
%139 = sub nsw <4 x i32> %137, %83
%140 = getelementptr inbounds [102400 x i32], [102400 x i32]* %4, i64 0, i64 %127
%141 = bitcast i32* %140 to <4 x i32>*
store <4 x i32> %138, <4 x i32>* %141
%142 = getelementptr inbounds i32, i32* %140, i64 4
%143 = bitcast i32* %142 to <4 x i32>*
store <4 x i32> %139, <4 x i32>* %143
br label %144
144: ; preds = %126, %129
%145 = icmp eq i64 %79, %76
br i1 %145, label %157, label %146
146: ; preds = %74, %144
%147 = phi i64 [ 0, %74 ], [ %79, %144 ]
br label %148
148: ; preds = %146, %148
%149 = phi i64 [ %155, %148 ], [ %147, %146 ]
%150 = getelementptr inbounds [102400 x i8], [102400 x i8]* %3, i64 0, i64 %149
%151 = load i8, i8* %150
%152 = sext i8 %151 to i32
%153 = sub nsw i32 %152, %75
%154 = getelementptr inbounds [102400 x i32], [102400 x i32]* %4, i64 0, i64 %149
store i32 %153, i32* %154
%155 = add nuw nsw i64 %149, 1
%156 = icmp eq i64 %155, %76
br i1 %156, label %157, label %148
157: ; preds = %148, %144, %71
%158 = load i32, i32* %8
%159 = load i32, i32* %5
%160 = call i32 @snpcaller(i32* %64, i32 %72, i32 %158, i32 %159, double* %9, double* %10)
%161 = load i32, i32* %7
%162 = load i32, i32* %8
%163 = call i32 @genotype_likelihood(i32* %64, i32 %161, i32 %162, double* %11, double* %12, double* %13)
%164 = load i32, i32* @stdout
%165 = load double, double* %9
%166 = call double @log10(double %165)
%167 = fmul double %166, -1.000000e+01
%168 = call double @llvm.fabs.f64(double %167)
%169 = load double, double* %11
%170 = load double, double* %13
%171 = load double, double* %12
%172 = call i32 (i32, i8*, ...) @fprintf(i32 %164, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i64 0, i64 0), double %168, double %169, double %170, double %171)
%173 = load i32, i32* @stdin
%174 = call i64 @fscanf(i32 %173, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.16, i64 0, i64 0), i8* %14, i32* %7, i32* %8)
%175 = load i64, i64* @EOF
%176 = icmp eq i64 %174, %175
br i1 %176, label %177, label %71
177: ; preds = %157, %58, %26
%178 = phi i32 [ 1, %26 ], [ 0, %58 ], [ 0, %157 ]
ret i32 %178
}