#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ file_exists(char *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int get_ind_count(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ readGeno(int, char *, int *, long *, double *, char *,
                            double *, double *, char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, char *, char *,
                          char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int main(int nARG, char *ARGV[]) {
  if (nARG != 2) {
    printf("Please provide plink transposed file name to convert\n");
    exit(1);
  }
  char *fname = ARGV[1];
  char tped_file[100];
  char tfam_file[100];
  char tped_out[100];
  char snpinfo_out[100];
  char mlinfo_out[100];
  char id_out[100];
  char trait_out[100];
  sprintf(tped_file, "%s.tped", fname);
  sprintf(tfam_file, "%s.tfam", fname);
  if (!file_exists(tped_file)) {
    printf("%s does not exist\n", tped_file);
    exit(1);
  }
  if (!file_exists(tfam_file)) {
    printf("%s does not exist\n", tfam_file);
    exit(1);
  }
  printf("Starting conversion to FAST dosage format\n");
  sprintf(tped_out, "%s.fast.tped", fname);
  sprintf(snpinfo_out, "%s.fast.snp.info", fname);
  sprintf(mlinfo_out, "%s.fast.mlinfo", fname);
  sprintf(id_out, "%s.fast.id", fname);
  sprintf(trait_out, "%s.fast.tfam", fname);
  static char sline_geno[120000];
  FILE *fp_tped = fopen(tped_file, "r");
  FILE *fp_tfam = fopen(tfam_file, "r");
  FILE *fp_tped_out = fopen(tped_out, "w");
  FILE *fp_snpinfo_out = fopen(snpinfo_out, "w");
  FILE *fp_mlinfo_out = fopen(mlinfo_out, "w");
  FILE *fp_id_out = fopen(id_out, "w");
  FILE *fp_tfam_out = fopen(trait_out, "w");
  int chr = 0;
  long bp = 0;
  double cm = 0;
  char name[40];
  double MAF = 0;
  double FREQ1 = 0;
  char a1 = '0';
  char a2 = '0';
  int nsample = get_ind_count(tfam_file);
  double *geno = (double *)malloc(sizeof(double) * 20000);
  fprintf(fp_snpinfo_out, "#snp\tchr\tcm\tbp\n");
  fprintf(fp_mlinfo_out, "#snp\ta1\ta2\tmaf\tfreq1\tRsq\n");
  while (!feof(fp_tped)) {
    strcpy(sline_geno, "");
    fgets(sline_geno, 120000, fp_tped);
    if (strcmp(sline_geno, "") == 0)
      continue;
    readGeno(nsample, sline_geno, &chr, &bp, &cm, name, &FREQ1, geno, &a1, &a2);
    int i = 0;
    for (i = 0; i < nsample; i++) {
      fprintf(fp_tped_out, "%.4g\t", geno[i]);
    }
    fprintf(fp_tped_out, "\n");
    fprintf(fp_snpinfo_out, "%s\t%d\t%g\t%ld\n", name, chr, cm, bp);
    MAF = FREQ1;
    if (MAF > 0.5)
      MAF = 1.0 - FREQ1;
    fprintf(fp_mlinfo_out, "%s\t%c\t%c\t%.4g\t%.4g\t1.0\n", name, a1, a2, MAF,
            FREQ1);
    printf("snp = %s\n", name);
  }
  fclose(fp_tped);
  fclose(fp_tped_out);
  fclose(fp_snpinfo_out);
  fclose(fp_mlinfo_out);
  fprintf(fp_tfam_out, "#fid\tiid\tmid\tdid\tsex\tpheno\n");
  while (!feof(fp_tfam)) {
    strcpy(sline_geno, "");
    fgets(sline_geno, 120000, fp_tfam);
    if (strcmp(sline_geno, "") == 0)
      break;
    char fid[40];
    char iid[40];
    char mid[40];
    char did[40];
    char sex[40];
    char pheno[40];
    sscanf(sline_geno, "%s %s %s %s %s %s", fid, iid, mid, did, sex, pheno);
    fprintf(fp_id_out, "%s\n", iid);
    fprintf(fp_tfam_out, "%s\t%s\t%s\t%s\t%s\t%s\n", fid, iid, mid, did, sex,
            pheno);
  }
  fclose(fp_tfam);
  fclose(fp_id_out);
  fclose(fp_tfam_out);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
sub    $0x508,%rsp
movl   $0x0,-0xc(%rbp)
mov    %edi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpl   $0x2,-0x10(%rbp)
je     122c <main+0x3c>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xdfc(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x100(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xded(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x90(%rbp),%rdi
call   1040 <file_exists@plt>
cmp    $0x0,%eax
jne    129a <main+0xaa>
lea    -0x90(%rbp),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x100(%rbp),%rdi
call   1040 <file_exists@plt>
cmp    $0x0,%eax
jne    12ce <main+0xde>
lea    -0x100(%rbp),%rsi
lea    0xd99(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xd94(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0x170(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xda6(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x1e0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd9c(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x250(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd96(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x2c0(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd8e(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x330(%rbp),%rdi
mov    -0x20(%rbp),%rdx
lea    0xd82(%rip),%rsi
call   1100 <sprintf@plt>
lea    -0x90(%rbp),%rdi
lea    0xd7c(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x338(%rbp)
lea    -0x100(%rbp),%rdi
lea    0xd62(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x340(%rbp)
lea    -0x170(%rbp),%rdi
lea    0xd4a(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x348(%rbp)
lea    -0x1e0(%rbp),%rdi
lea    0xd30(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x350(%rbp)
lea    -0x250(%rbp),%rdi
lea    0xd16(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x358(%rbp)
lea    -0x2c0(%rbp),%rdi
lea    0xcfc(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x360(%rbp)
lea    -0x330(%rbp),%rdi
lea    0xce2(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x368(%rbp)
movl   $0x0,-0x36c(%rbp)
movq   $0x0,-0x378(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x380(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x3b8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x3c0(%rbp)
ff
movb   $0x30,-0x3c1(%rbp)
movb   $0x30,-0x3c2(%rbp)
lea    -0x100(%rbp),%rdi
call   1070 <get_ind_count@plt>
mov    %eax,-0x3c8(%rbp)
mov    $0x27100,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x3d0(%rbp)
mov    -0x350(%rbp),%rdi
lea    0xc63(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x358(%rbp),%rdi
lea    0xc5e(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x338(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    14b7 <main+0x2c7>
jmp    16a0 <main+0x4b0>
lea    0x2bf2(%rip),%rdi
lea    0xc47(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x338(%rbp),%rdx
lea    0x2bd8(%rip),%rdi
mov    $0x1d4c0,%esi
call   1080 <fgets@plt>
lea    0x2bc7(%rip),%rdi
lea    0xc1c(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1504 <main+0x314>
jmp    1496 <main+0x2a6>
mov    -0x3c8(%rbp),%edi
lea    -0x3b0(%rbp),%r9
mov    -0x3d0(%rbp),%r11
lea    0x2b91(%rip),%rsi
lea    -0x36c(%rbp),%rdx
lea    -0x378(%rbp),%rcx
lea    -0x380(%rbp),%r8
lea    -0x3c0(%rbp),%rbx
lea    -0x3c1(%rbp),%r10
lea    -0x3c2(%rbp),%rax
mov    %rbx,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   10e0 <readGeno@plt>
movl   $0x0,-0x3d4(%rbp)
movl   $0x0,-0x3d4(%rbp)
mov    -0x3d4(%rbp),%eax
cmp    -0x3c8(%rbp),%eax
jge    15c3 <main+0x3d3>
mov    -0x348(%rbp),%rdi
mov    -0x3d0(%rbp),%rax
movslq -0x3d4(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xb5f(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
mov    -0x3d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3d4(%rbp)
jmp    1575 <main+0x385>
mov    -0x348(%rbp),%rdi
lea    0xb60(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x350(%rbp),%rdi
lea    -0x3b0(%rbp),%rdx
mov    -0x36c(%rbp),%ecx
movsd  -0x380(%rbp),%xmm0
ff
mov    -0x378(%rbp),%r8
lea    0xb0b(%rip),%rsi
mov    $0x1,%al
call   10a0 <fprintf@plt>
movsd  -0x3c0(%rbp),%xmm0
ff
movsd  %xmm0,-0x3b8(%rbp)
ff
movsd  -0x3b8(%rbp),%xmm0
ff
movsd  0x9d7(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    164b <main+0x45b>
movsd  0x9cd(%rip),%xmm0
subsd  -0x3c0(%rbp),%xmm0
ff
movsd  %xmm0,-0x3b8(%rbp)
ff
mov    -0x358(%rbp),%rdi
lea    -0x3b0(%rbp),%rdx
movsbl -0x3c1(%rbp),%ecx
movsbl -0x3c2(%rbp),%r8d
ff
movsd  -0x3b8(%rbp),%xmm0
ff
movsd  -0x3c0(%rbp),%xmm1
ff
lea    0xa9c(%rip),%rsi
mov    $0x2,%al
call   10a0 <fprintf@plt>
lea    -0x3b0(%rbp),%rsi
lea    0xa9f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1496 <main+0x2a6>
mov    -0x338(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x348(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x350(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x358(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x368(%rbp),%rdi
lea    0xa5f(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x340(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1706 <main+0x516>
jmp    1802 <main+0x612>
lea    0x29a3(%rip),%rdi
lea    0x9f8(%rip),%rsi
call   1030 <strcpy@plt>
mov    -0x340(%rbp),%rdx
lea    0x2989(%rip),%rdi
mov    $0x1d4c0,%esi
call   1080 <fgets@plt>
lea    0x2978(%rip),%rdi
lea    0x9cd(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1753 <main+0x563>
jmp    1802 <main+0x612>
lea    -0x400(%rbp),%rdx
lea    -0x430(%rbp),%rcx
lea    -0x460(%rbp),%r8
lea    -0x490(%rbp),%r9
lea    -0x4c0(%rbp),%r10
lea    -0x4f0(%rbp),%rax
lea    0x292c(%rip),%rdi
lea    0x9ce(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   10d0 <sscanf@plt>
mov    -0x360(%rbp),%rdi
lea    -0x430(%rbp),%rdx
lea    0x9cc(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x368(%rbp),%rdi
lea    -0x400(%rbp),%rdx
lea    -0x430(%rbp),%rcx
lea    -0x460(%rbp),%r8
lea    -0x490(%rbp),%r9
lea    -0x4c0(%rbp),%r10
lea    -0x4f0(%rbp),%rax
lea    0x97e(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    16e5 <main+0x4f5>
mov    -0x340(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x360(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x368(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0xc(%rbp),%eax
add    $0x508,%rsp
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4b8,%rsp
cmp    $0x2,%edi
jne    1731 <main+0x511>
mov    0x8(%rsi),%rbx
lea    0xdcb(%rip),%rsi
lea    0x160(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xdb9(%rip),%rsi
lea    0xf0(%rsp),%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
mov    %rbp,%rdi
call   1040 <file_exists@plt>
test   %eax,%eax
je     1747 <main+0x527>
lea    0xf0(%rsp),%rdi
call   1040 <file_exists@plt>
test   %eax,%eax
je     1758 <main+0x538>
lea    0xe82(%rip),%rdi
call   1050 <puts@plt>
lea    0xd8c(%rip),%rsi
lea    0x450(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xd7f(%rip),%rsi
lea    0x3e0(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xd76(%rip),%rsi
lea    0x370(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xd6b(%rip),%rsi
lea    0x300(%rsp),%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xd5f(%rip),%rsi
lea    0x290(%rsp),%rdi
mov    %rbx,%rdx
call   1120 <sprintf@plt>
lea    0xd55(%rip),%rbx
lea    0x160(%rsp),%rdi
mov    %rbx,%rsi
call   1110 <fopen@plt>
mov    %rax,%r13
lea    0xf0(%rsp),%rdi
mov    %rbx,%rsi
call   1110 <fopen@plt>
mov    %rax,0x50(%rsp)
lea    0xd28(%rip),%r12
mov    %r14,%rdi
mov    %r12,%rsi
call   1110 <fopen@plt>
mov    %rax,%rbx
mov    %rbp,%rdi
mov    %r12,%rsi
call   1110 <fopen@plt>
mov    %rax,%rbp
mov    %r15,%rdi
mov    %r12,%rsi
call   1110 <fopen@plt>
mov    %rax,%r14
lea    0x300(%rsp),%rdi
mov    %r12,%rsi
call   1110 <fopen@plt>
mov    %rax,0x20(%rsp)
lea    0x290(%rsp),%rdi
mov    %r12,%rsi
call   1110 <fopen@plt>
mov    %rax,0x18(%rsp)
movl   $0x0,0x14(%rsp)
movq   $0x0,0x48(%rsp)
movq   $0x0,0x40(%rsp)
movq   $0x0,0x38(%rsp)
movb   $0x30,0xf(%rsp)
movb   $0x30,0xe(%rsp)
lea    0xf0(%rsp),%rdi
call   1080 <get_ind_count@plt>
mov    %eax,0x10(%rsp)
mov    $0x27100,%edi
call   10e0 <malloc@plt>
mov    %rax,%r12
lea    0xc84(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %rbp,0x30(%rsp)
mov    %rbp,%rcx
call   1140 <fwrite@plt>
lea    0xc76(%rip),%rdi
mov    $0x19,%esi
mov    $0x1,%edx
mov    %r14,0x28(%rsp)
mov    %r14,%rcx
call   1140 <fwrite@plt>
mov    %r13,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
je     15b2 <main+0x392>
mov    %r13,%rdi
call   1060 <fclose@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    0x30(%rsp),%rdi
call   1060 <fclose@plt>
mov    0x28(%rsp),%rdi
call   1060 <fclose@plt>
lea    0xc74(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
mov    0x18(%rsp),%rcx
call   1140 <fwrite@plt>
mov    0x50(%rsp),%r14
mov    %r14,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
jne    1582 <main+0x362>
lea    0x2c28(%rip),%r13
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
lea    0xc01(%rip),%r12
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r13,%rdi
mov    $0x1d4c0,%esi
mov    %r14,%rdx
call   10a0 <fgets@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1582 <main+0x362>
mov    %r13,%rdi
lea    0xc18(%rip),%rsi
lea    0x260(%rsp),%rbx
mov    %rbx,%rdx
mov    %r14,%rbp
lea    0x230(%rsp),%r14
mov    %r14,%rcx
lea    0x200(%rsp),%r15
mov    %r15,%r8
lea    0x1d0(%rsp),%r12
mov    %r12,%r9
lea    0x60(%rsp),%rax
push   %rax
lea    0x98(%rsp),%rax
push   %rax
call   10f0 <sscanf@plt>
add    $0x10,%rsp
mov    0x20(%rsp),%rdi
lea    0xbe6(%rip),%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   10c0 <fprintf@plt>
mov    0x18(%rsp),%rdi
lea    0xbc1(%rip),%rsi
mov    %rbx,%rdx
mov    %r14,%rcx
mov    %rbp,%r14
mov    %r15,%r8
mov    %r12,%r9
xor    %eax,%eax
lea    0x60(%rsp),%rbp
push   %rbp
lea    0x98(%rsp),%rbp
push   %rbp
call   10c0 <fprintf@plt>
add    $0x10,%rsp
mov    %r14,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
je     14a0 <main+0x280>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x20(%rsp),%rdi
call   1060 <fclose@plt>
mov    0x18(%rsp),%rdi
call   1060 <fclose@plt>
xor    %eax,%eax
add    $0x4b8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x10(%rsp),%r14d
mov    %r13,0x58(%rsp)
jmp    167c <main+0x45c>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
mov    %rbx,%rsi
call   1090 <fputc@plt>
mov    0x14(%rsp),%ecx
movsd  0x40(%rsp),%xmm0
mov    0x48(%rsp),%r8
mov    0x30(%rsp),%rdi
lea    0xab4(%rip),%rsi
lea    0xc0(%rsp),%rbp
mov    %rbp,%rdx
mov    $0x1,%al
call   10c0 <fprintf@plt>
movsd  0x38(%rsp),%xmm1
movsd  0x9e8(%rip),%xmm2
subsd  %xmm1,%xmm2
movsd  0x9e4(%rip),%xmm0
cmpltsd %xmm1,%xmm0
andpd  %xmm0,%xmm2
andnpd %xmm1,%xmm0
orpd   %xmm2,%xmm0
movsbl 0xf(%rsp),%ecx
movsbl 0xe(%rsp),%r8d
mov    0x28(%rsp),%rdi
lea    0xa6e(%rip),%rsi
mov    %rbp,%rdx
mov    $0x2,%al
call   10c0 <fprintf@plt>
lea    0xa75(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x58(%rsp),%r13
mov    %r13,%rdi
call   10d0 <feof@plt>
test   %eax,%eax
jne    143d <main+0x21d>
lea    0x2a3d(%rip),%rbp
mov    %rbp,%rdi
mov    %r13,%r15
lea    0xa1b(%rip),%r13
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    %rbp,%rdi
mov    $0x1d4c0,%esi
mov    %r15,%rdx
call   10a0 <fgets@plt>
mov    %rbp,%rdi
mov    %r13,%rsi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     1667 <main+0x447>
mov    0x10(%rsp),%ebp
mov    %ebp,%edi
lea    0x29fb(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x48(%rsp),%rcx
lea    0x40(%rsp),%r8
lea    0xc0(%rsp),%r9
lea    0xe(%rsp),%rax
push   %rax
lea    0x17(%rsp),%rax
push   %rax
push   %r12
lea    0x50(%rsp),%rax
push   %rax
call   1100 <readGeno@plt>
add    $0x20,%rsp
test   %ebp,%ebp
lea    0x9a4(%rip),%rbp
jle    15d0 <main+0x3b0>
xor    %r13d,%r13d
nopl   0x0(%rax,%rax,1)
movsd  (%r12,%r13,8),%xmm0
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x1,%al
call   10c0 <fprintf@plt>
add    $0x1,%r13
cmp    %r13,%r14
jne    1710 <main+0x4f0>
jmp    15d0 <main+0x3b0>
lea    0xa0f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1130 <exit@plt>
lea    0x8d2(%rip),%rdi
lea    0x160(%rsp),%rsi
jmp    1767 <main+0x547>
lea    0x8c1(%rip),%rdi
lea    0xf0(%rsp),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   1130 <exit@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"Please provide plink transposed file name to convert\0A\00"
@.str.1 = [8 x i8] c"%s.tped\00"
@.str.2 = [8 x i8] c"%s.tfam\00"
@.str.3 = [19 x i8] c"%s does not exist\0A\00"
@.str.4 = [43 x i8] c"Starting conversion to FAST dosage format\0A\00"
@.str.5 = [13 x i8] c"%s.fast.tped\00"
@.str.6 = [17 x i8] c"%s.fast.snp.info\00"
@.str.7 = [15 x i8] c"%s.fast.mlinfo\00"
@.str.8 = [11 x i8] c"%s.fast.id\00"
@.str.9 = [13 x i8] c"%s.fast.tfam\00"
@main.sline_geno = internal global [120000 x i8] zeroinitializer
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [16 x i8] c"#snp\09chr\09cm\09bp\0A\00"
@.str.13 = [26 x i8] c"#snp\09a1\09a2\09maf\09freq1\09Rsq\0A\00"
@.str.14 = [1 x i8] zeroinitializer
@.str.15 = [6 x i8] c"%.4g\09\00"
@.str.16 = [2 x i8] c"\0A\00"
@.str.17 = [14 x i8] c"%s\09%d\09%g\09%ld\0A\00"
@.str.18 = [24 x i8] c"%s\09%c\09%c\09%.4g\09%.4g\091.0\0A\00"
@.str.19 = [10 x i8] c"snp = %s\0A\00"
@.str.20 = [28 x i8] c"#fid\09iid\09mid\09did\09sex\09pheno\0A\00"
@.str.21 = [18 x i8] c"%s %s %s %s %s %s\00"
@.str.22 = [4 x i8] c"%s\0A\00"
@.str.23 = [19 x i8] c"%s\09%s\09%s\09%s\09%s\09%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca [100 x i8]
%11 = alloca [100 x i8]
%12 = alloca [100 x i8]
%13 = alloca [100 x i8]
%14 = alloca i32*
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32*
%18 = alloca i32*
%19 = alloca i32*
%20 = alloca i32*
%21 = alloca i32
%22 = alloca i64
%23 = alloca double
%24 = alloca [40 x i8]
%25 = alloca double
%26 = alloca double
%27 = alloca i8
%28 = alloca i8
%29 = alloca i32
%30 = alloca double*
%31 = alloca i32
%32 = alloca [40 x i8]
%33 = alloca [40 x i8]
%34 = alloca [40 x i8]
%35 = alloca [40 x i8]
%36 = alloca [40 x i8]
%37 = alloca [40 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%38 = load i32, i32* %4
%39 = icmp ne i32 %38, 2
br i1 %39, label %40, label %43
40: ; preds = %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @exit(i32 1)
unreachable
43: ; preds = %2
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
store i8* %46, i8** %6
%47 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%48 = load i8*, i8** %6
%49 = call i32 @sprintf(i8* %47, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %48)
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%51 = load i8*, i8** %6
%52 = call i32 @sprintf(i8* %50, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%54 = call i32 @file_exists(i8* %53)
%55 = icmp ne i32 %54, 0
br i1 %55, label %60, label %56
56: ; preds = %43
%57 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %57)
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %43
%61 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%62 = call i32 @file_exists(i8* %61)
%63 = icmp ne i32 %62, 0
br i1 %63, label %68, label %64
64: ; preds = %60
%65 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = call i32 @exit(i32 1)
unreachable
68: ; preds = %60
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.4, i64 0, i64 0))
%70 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%71 = load i8*, i8** %6
%72 = call i32 @sprintf(i8* %70, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %71)
%73 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%74 = load i8*, i8** %6
%75 = call i32 @sprintf(i8* %73, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %74)
%76 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%77 = load i8*, i8** %6
%78 = call i32 @sprintf(i8* %76, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %77)
%79 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%80 = load i8*, i8** %6
%81 = call i32 @sprintf(i8* %79, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %80)
%82 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%83 = load i8*, i8** %6
%84 = call i32 @sprintf(i8* %82, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %83)
%85 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%86 = call i32* @fopen(i8* %85, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %86, i32** %14
%87 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%88 = call i32* @fopen(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %88, i32** %15
%89 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%90 = call i32* @fopen(i8* %89, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %90, i32** %16
%91 = getelementptr inbounds [100 x i8], [100 x i8]* %10, i64 0, i64 0
%92 = call i32* @fopen(i8* %91, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %92, i32** %17
%93 = getelementptr inbounds [100 x i8], [100 x i8]* %11, i64 0, i64 0
%94 = call i32* @fopen(i8* %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %94, i32** %18
%95 = getelementptr inbounds [100 x i8], [100 x i8]* %12, i64 0, i64 0
%96 = call i32* @fopen(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %96, i32** %19
%97 = getelementptr inbounds [100 x i8], [100 x i8]* %13, i64 0, i64 0
%98 = call i32* @fopen(i8* %97, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %98, i32** %20
store i32 0, i32* %21
store i64 0, i64* %22
store double 0.000000e+00, double* %23
store double 0.000000e+00, double* %25
store double 0.000000e+00, double* %26
store i8 48, i8* %27
store i8 48, i8* %28
%99 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%100 = call i32 @get_ind_count(i8* %99)
store i32 %100, i32* %29
%101 = call i64 @malloc(i32 160000)
%102 = inttoptr i64 %101 to double*
store double* %102, double** %30
%103 = load i32*, i32** %17
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %103, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
%105 = load i32*, i32** %18
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0))
br label %107
107: ; preds = %154, %118, %68
%108 = load i32*, i32** %14
%109 = call i32 @feof(i32* %108)
%110 = icmp ne i32 %109, 0
%111 = xor i1 %110, true
br i1 %111, label %112, label %166
112: ; preds = %107
%113 = call i32 @strcpy(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%114 = load i32*, i32** %14
%115 = call i32 @fgets(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32 120000, i32* %114)
%116 = call i64 @strcmp(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%117 = icmp eq i64 %116, 0
br i1 %117, label %118, label %119
118: ; preds = %112
br label %107
119: ; preds = %112
%120 = load i32, i32* %29
%121 = getelementptr inbounds [40 x i8], [40 x i8]* %24, i64 0, i64 0
%122 = load double*, double** %30
%123 = call i32 @readGeno(i32 %120, i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32* %21, i64* %22, double* %23, i8* %121, double* %26, double* %122, i8* %27, i8* %28)
store i32 0, i32* %31
store i32 0, i32* %31
br label %124
124: ; preds = %136, %119
%125 = load i32, i32* %31
%126 = load i32, i32* %29
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %139
128: ; preds = %124
%129 = load i32*, i32** %16
%130 = load double*, double** %30
%131 = load i32, i32* %31
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %130, i64 %132
%134 = load double, double* %133
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %129, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), double %134)
br label %136
136: ; preds = %128
%137 = load i32, i32* %31
%138 = add nsw i32 %137, 1
store i32 %138, i32* %31
br label %124
139: ; preds = %124
%140 = load i32*, i32** %16
%141 = call i32 (i32*, i8*, ...) @fprintf(i32* %140, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%142 = load i32*, i32** %17
%143 = getelementptr inbounds [40 x i8], [40 x i8]* %24, i64 0, i64 0
%144 = load i32, i32* %21
%145 = load double, double* %23
%146 = load i64, i64* %22
%147 = call i32 (i32*, i8*, ...) @fprintf(i32* %142, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i8* %143, i32 %144, double %145, i64 %146)
%148 = load double, double* %26
store double %148, double* %25
%149 = load double, double* %25
%150 = fcmp ogt double %149, 5.000000e-01
br i1 %150, label %151, label %154
151: ; preds = %139
%152 = load double, double* %26
%153 = fsub double 1.000000e+00, %152
store double %153, double* %25
br label %154
154: ; preds = %151, %139
%155 = load i32*, i32** %18
%156 = getelementptr inbounds [40 x i8], [40 x i8]* %24, i64 0, i64 0
%157 = load i8, i8* %27
%158 = sext i8 %157 to i32
%159 = load i8, i8* %28
%160 = sext i8 %159 to i32
%161 = load double, double* %25
%162 = load double, double* %26
%163 = call i32 (i32*, i8*, ...) @fprintf(i32* %155, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %156, i32 %158, i32 %160, double %161, double %162)
%164 = getelementptr inbounds [40 x i8], [40 x i8]* %24, i64 0, i64 0
%165 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i8* %164)
br label %107
166: ; preds = %107
%167 = load i32*, i32** %14
%168 = call i32 @fclose(i32* %167)
%169 = load i32*, i32** %16
%170 = call i32 @fclose(i32* %169)
%171 = load i32*, i32** %17
%172 = call i32 @fclose(i32* %171)
%173 = load i32*, i32** %18
%174 = call i32 @fclose(i32* %173)
%175 = load i32*, i32** %20
%176 = call i32 (i32*, i8*, ...) @fprintf(i32* %175, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0))
br label %177
177: ; preds = %189, %166
%178 = load i32*, i32** %15
%179 = call i32 @feof(i32* %178)
%180 = icmp ne i32 %179, 0
%181 = xor i1 %180, true
br i1 %181, label %182, label %208
182: ; preds = %177
%183 = call i32 @strcpy(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%184 = load i32*, i32** %15
%185 = call i32 @fgets(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32 120000, i32* %184)
%186 = call i64 @strcmp(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%187 = icmp eq i64 %186, 0
br i1 %187, label %188, label %189
188: ; preds = %182
br label %208
189: ; preds = %182
%190 = getelementptr inbounds [40 x i8], [40 x i8]* %32, i64 0, i64 0
%191 = getelementptr inbounds [40 x i8], [40 x i8]* %33, i64 0, i64 0
%192 = getelementptr inbounds [40 x i8], [40 x i8]* %34, i64 0, i64 0
%193 = getelementptr inbounds [40 x i8], [40 x i8]* %35, i64 0, i64 0
%194 = getelementptr inbounds [40 x i8], [40 x i8]* %36, i64 0, i64 0
%195 = getelementptr inbounds [40 x i8], [40 x i8]* %37, i64 0, i64 0
%196 = call i32 @sscanf(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8* %190, i8* %191, i8* %192, i8* %193, i8* %194, i8* %195)
%197 = load i32*, i32** %19
%198 = getelementptr inbounds [40 x i8], [40 x i8]* %33, i64 0, i64 0
%199 = call i32 (i32*, i8*, ...) @fprintf(i32* %197, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8* %198)
%200 = load i32*, i32** %20
%201 = getelementptr inbounds [40 x i8], [40 x i8]* %32, i64 0, i64 0
%202 = getelementptr inbounds [40 x i8], [40 x i8]* %33, i64 0, i64 0
%203 = getelementptr inbounds [40 x i8], [40 x i8]* %34, i64 0, i64 0
%204 = getelementptr inbounds [40 x i8], [40 x i8]* %35, i64 0, i64 0
%205 = getelementptr inbounds [40 x i8], [40 x i8]* %36, i64 0, i64 0
%206 = getelementptr inbounds [40 x i8], [40 x i8]* %37, i64 0, i64 0
%207 = call i32 (i32*, i8*, ...) @fprintf(i32* %200, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i8* %201, i8* %202, i8* %203, i8* %204, i8* %205, i8* %206)
br label %177
208: ; preds = %188, %177
%209 = load i32*, i32** %15
%210 = call i32 @fclose(i32* %209)
%211 = load i32*, i32** %19
%212 = call i32 @fclose(i32* %211)
%213 = load i32*, i32** %20
%214 = call i32 @fclose(i32* %213)
%215 = load i32, i32* %3
ret i32 %215
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"%s.tped\00"
@.str.2 = [8 x i8] c"%s.tfam\00"
@.str.3 = [19 x i8] c"%s does not exist\0A\00"
@.str.5 = [13 x i8] c"%s.fast.tped\00"
@.str.6 = [17 x i8] c"%s.fast.snp.info\00"
@.str.7 = [15 x i8] c"%s.fast.mlinfo\00"
@.str.8 = [11 x i8] c"%s.fast.id\00"
@.str.9 = [13 x i8] c"%s.fast.tfam\00"
@main.sline_geno = internal global [120000 x i8] zeroinitializer
@.str.10 = [2 x i8] c"r\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [16 x i8] c"#snp\09chr\09cm\09bp\0A\00"
@.str.13 = [26 x i8] c"#snp\09a1\09a2\09maf\09freq1\09Rsq\0A\00"
@.str.14 = [1 x i8] zeroinitializer
@.str.15 = [6 x i8] c"%.4g\09\00"
@.str.17 = [14 x i8] c"%s\09%d\09%g\09%ld\0A\00"
@.str.18 = [24 x i8] c"%s\09%c\09%c\09%.4g\09%.4g\091.0\0A\00"
@.str.19 = [10 x i8] c"snp = %s\0A\00"
@.str.20 = [28 x i8] c"#fid\09iid\09mid\09did\09sex\09pheno\0A\00"
@.str.21 = [18 x i8] c"%s %s %s %s %s %s\00"
@.str.22 = [4 x i8] c"%s\0A\00"
@.str.23 = [19 x i8] c"%s\09%s\09%s\09%s\09%s\09%s\0A\00"
@str = [42 x i8] c"Starting conversion to FAST dosage format\00"
@str.24 = [53 x i8] c"Please provide plink transposed file name to convert\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [100 x i8]
%4 = alloca [100 x i8]
%5 = alloca [100 x i8]
%6 = alloca [100 x i8]
%7 = alloca [100 x i8]
%8 = alloca [100 x i8]
%9 = alloca [100 x i8]
%10 = alloca i32
%11 = alloca i64
%12 = alloca double
%13 = alloca [40 x i8]
%14 = alloca double
%15 = alloca i8
%16 = alloca i8
%17 = alloca [40 x i8]
%18 = alloca [40 x i8]
%19 = alloca [40 x i8]
%20 = alloca [40 x i8]
%21 = alloca [40 x i8]
%22 = alloca [40 x i8]
%23 = icmp eq i32 %0, 2
br i1 %23, label %27, label %24
24: ; preds = %2
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.24, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %2
%28 = getelementptr inbounds i8*, i8** %1, i64 1
%29 = load i8*, i8** %28
%30 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%31 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%32 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%33 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%34 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%35 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%36 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%37 = call i32 @sprintf(i8* %30, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8* %29)
%38 = call i32 @sprintf(i8* %31, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i8* %29)
%39 = call i32 @file_exists(i8* %30)
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %27
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %30)
%43 = call i32 @exit(i32 1)
unreachable
44: ; preds = %27
%45 = call i32 @file_exists(i8* %31)
%46 = icmp eq i32 %45, 0
br i1 %46, label %47, label %50
47: ; preds = %44
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %44
%51 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @str, i64 0, i64 0))
%52 = call i32 @sprintf(i8* %32, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %29)
%53 = call i32 @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.6, i64 0, i64 0), i8* %29)
%54 = call i32 @sprintf(i8* %34, i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.7, i64 0, i64 0), i8* %29)
%55 = call i32 @sprintf(i8* %35, i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i8* %29)
%56 = call i32 @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.9, i64 0, i64 0), i8* %29)
%57 = call i32* @fopen(i8* %30, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%58 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%59 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%60 = call i32* @fopen(i8* %33, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%61 = call i32* @fopen(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%62 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%63 = call i32* @fopen(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%64 = bitcast i32* %10 to i8*
store i32 0, i32* %10
%65 = bitcast i64* %11 to i8*
store i64 0, i64* %11
%66 = bitcast double* %12 to i8*
store double 0.000000e+00, double* %12
%67 = getelementptr inbounds [40 x i8], [40 x i8]* %13, i64 0, i64 0
%68 = bitcast double* %14 to i8*
store double 0.000000e+00, double* %14
store i8 48, i8* %15
store i8 48, i8* %16
%69 = call i32 @get_ind_count(i8* %31)
%70 = call i64 @malloc(i32 160000)
%71 = inttoptr i64 %70 to double*
%72 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), i64 15, i64 1, i32* %60)
%73 = call i64 @fwrite(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.13, i64 0, i64 0), i64 25, i64 1, i32* %61)
%74 = call i32 @feof(i32* %57)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %112
76: ; preds = %50
%77 = icmp sgt i32 %69, 0
%78 = zext i32 %69 to i64
br label %79
79: ; preds = %76, %109
%80 = call i32 @strcpy(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%81 = call i32 @fgets(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32 120000, i32* %57)
%82 = call i64 @strcmp(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%83 = icmp eq i64 %82, 0
br i1 %83, label %109, label %84
84: ; preds = %79
%85 = call i32 @readGeno(i32 %69, i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32* %10, i64* %11, double* %12, i8* %67, double* %14, double* %71, i8* %15, i8* %16)
br i1 %77, label %86, label %93
86: ; preds = %84, %86
%87 = phi i64 [ %91, %86 ], [ 0, %84 ]
%88 = getelementptr inbounds double, double* %71, i64 %87
%89 = load double, double* %88
%90 = call i32 (i32*, i8*, ...) @fprintf(i32* %59, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.15, i64 0, i64 0), double %89)
%91 = add nuw nsw i64 %87, 1
%92 = icmp eq i64 %91, %78
br i1 %92, label %93, label %86
93: ; preds = %86, %84
%94 = call i32 @fputc(i32 10, i32* %59)
%95 = load i32, i32* %10
%96 = load double, double* %12
%97 = load i64, i64* %11
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %60, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.17, i64 0, i64 0), i8* %67, i32 %95, double %96, i64 %97)
%99 = load double, double* %14
%100 = fcmp ogt double %99, 5.000000e-01
%101 = fsub double 1.000000e+00, %99
%102 = select i1 %100, double %101, double %99
%103 = load i8, i8* %15
%104 = sext i8 %103 to i32
%105 = load i8, i8* %16
%106 = sext i8 %105 to i32
%107 = call i32 (i32*, i8*, ...) @fprintf(i32* %61, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.18, i64 0, i64 0), i8* %67, i32 %104, i32 %106, double %102, double %99)
%108 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.19, i64 0, i64 0), i8* %67)
br label %109
109: ; preds = %93, %79
%110 = call i32 @feof(i32* %57)
%111 = icmp eq i32 %110, 0
br i1 %111, label %79, label %112
112: ; preds = %109, %50
%113 = call i32 @fclose(i32* %57)
%114 = call i32 @fclose(i32* %59)
%115 = call i32 @fclose(i32* %60)
%116 = call i32 @fclose(i32* %61)
%117 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.20, i64 0, i64 0), i64 27, i64 1, i32* %63)
%118 = call i32 @feof(i32* %58)
%119 = icmp eq i32 %118, 0
br i1 %119, label %120, label %138
120: ; preds = %112
%121 = getelementptr inbounds [40 x i8], [40 x i8]* %17, i64 0, i64 0
%122 = getelementptr inbounds [40 x i8], [40 x i8]* %18, i64 0, i64 0
%123 = getelementptr inbounds [40 x i8], [40 x i8]* %19, i64 0, i64 0
%124 = getelementptr inbounds [40 x i8], [40 x i8]* %20, i64 0, i64 0
%125 = getelementptr inbounds [40 x i8], [40 x i8]* %21, i64 0, i64 0
%126 = getelementptr inbounds [40 x i8], [40 x i8]* %22, i64 0, i64 0
br label %127
127: ; preds = %120, %132
%128 = call i32 @strcpy(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%129 = call i32 @fgets(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i32 120000, i32* %58)
%130 = call i64 @strcmp(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.14, i64 0, i64 0))
%131 = icmp eq i64 %130, 0
br i1 %131, label %138, label %132
132: ; preds = %127
%133 = call i32 @sscanf(i8* getelementptr inbounds ([120000 x i8], [120000 x i8]* @main.sline_geno, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.21, i64 0, i64 0), i8* %121, i8* %122, i8* %123, i8* %124, i8* %125, i8* %126)
%134 = call i32 (i32*, i8*, ...) @fprintf(i32* %62, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.22, i64 0, i64 0), i8* %122)
%135 = call i32 (i32*, i8*, ...) @fprintf(i32* %63, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.23, i64 0, i64 0), i8* %121, i8* %122, i8* %123, i8* %124, i8* %125, i8* %126)
%136 = call i32 @feof(i32* %58)
%137 = icmp eq i32 %136, 0
br i1 %137, label %127, label %138
138: ; preds = %132, %127, %112
%139 = call i32 @fclose(i32* %58)
%140 = call i32 @fclose(i32* %62)
%141 = call i32 @fclose(i32* %63)
ret i32 0
}