#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 */
struct dirent {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
int strlen(char *);
char *strrchr(char *, char);
int /*<<< orphan*/ system(char *);
int snplist_generation(char *config[]) {
  DIR *dir;
  struct dirent *ent;
  char *subit;
  char *subit2;
  char *filename;
  FILE *logp;
  FILE *filelistfp;
  char description[100];
  char sample[50];
  char read1[1000];
  char read2[1000];
  char current_command[1000];
  char dir_trunk[1000];
  char filestring[50000];
  char current_directory[1000];
  char rmdup_job_file[1000];
  char snplist_job_file[1000];
  char sys_command[1000];
  char run_dir[1000];
  int i;
  i = 0;
  printf("within snplist_generation\n");
  sprintf(current_directory, "%s", config[1]);
  printf("Current directory is \t%s\n", current_directory);
  sprintf(sys_command, "mkdir %s/Positions", current_directory);
  system(sys_command);
  sprintf(sys_command, "mkdir %s/Positions/logs", current_directory);
  system(sys_command);
  filelistfp = fopen(config[3], "r");
  printf("filelist is %s\n", config[3]);
  if (filelistfp == NULL) {
    printf("The filelist could not be opened.  Exiting \n");
    return 2;
  }
  printf("whoa\n");
  while (fgets(filestring, 50000, filelistfp) != NULL) {
    printf("within filelist\n");
    filestring[strlen(filestring) - 1] = '\0';
    filename = strrchr(filestring, '/');
    if (filename == NULL) {
      filename = filestring;
    } else {
      filename++;
    }
    sprintf(
        sys_command,
        "awk '!/#/ { print $1 \"\\t\" $2 } ' %s/Variants/%s > %s/Positions/%s",
        config[1], filename, config[1], filename);
    system(sys_command);
    printf("sys command is %s\n", sys_command);
    sleep(1);
    i++;
  }
  sprintf(sys_command, "cat %s/Positions/*vcf > %s/Positions/all.vcf.positions",
          config[1], config[1]);
  system(sys_command);
  sprintf(sys_command, "sed -i 's/X/23/g' %s/Positions/all.vcf.positions",
          config[1], config[1]);
  system(sys_command);
  sprintf(sys_command, "sed -i 's/Y/24/g' %s/Positions/all.vcf.positions",
          config[1], config[1]);
  system(sys_command);
  sprintf(sys_command,
          "sort -k1,1n -k2,2n %s/Positions/all.vcf.positions > "
          "%s/Positions/all.vcf.positions.sorted",
          config[1], config[1]);
  system(sys_command);
  sprintf(sys_command,
          "sed -i 's/^23/X/g' %s/Positions/all.vcf.positions.sorted", config[1],
          config[1]);
  system(sys_command);
  sprintf(sys_command,
          "sed -i 's/^24/Y/g' %s/Positions/all.vcf.positions.sorted", config[1],
          config[1]);
  system(sys_command);
  sprintf(sys_command,
          "uniq %s/Positions/all.vcf.positions.sorted > snplist.txt",
          config[1]);
  system(sys_command);
  return 0;
}


x86 assembly (clang, -O0):
<snplist_generation>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe7c0,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0xe7b4(%rbp)
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xd7f0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xf38(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xd7f0(%rbp),%rsi
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe3c0(%rbp),%rdi
lea    -0xd7f0(%rbp),%rdx
lea    0xe47(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
lea    -0xd7f0(%rbp),%rdx
lea    0xe32(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xe28(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xe12(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpq   $0x0,-0x48(%rbp)
jne    127c <snplist_generation+0xfc>
lea    0xe09(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14ce <snplist_generation+0x34e>
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xd400(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    $0xc350,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1378 <snplist_generation+0x1f8>
lea    0xdf5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xd400(%rbp),%rdi
call   1030 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0xd400(%rbp,%rax,1)
lea    -0xd400(%rbp),%rdi
mov    $0x2f,%esi
call   1060 <strrchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    1300 <snplist_generation+0x180>
lea    -0xd400(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    130c <snplist_generation+0x18c>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x38(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%r8
mov    -0x38(%rbp),%r9
lea    0xd84(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rsi
lea    0xda5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   10a0 <sleep@plt>
mov    -0xe7b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe7b4(%rbp)
jmp    128a <snplist_generation+0x10a>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd75(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xd7b(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xda4(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0xdac(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xdbc(%rip),%rsi
mov    $0x0,%al
call   1090 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe7c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<snplist_generation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xcb38,%rsp
mov    %rdi,%r15
lea    0x108f(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%r15),%rsi
lea    0x3f0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xe25(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xe2e(%rip),%rsi
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
lea    0xe22(%rip),%rsi
mov    %rbp,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x18(%r15),%rdi
lea    0xe1a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r13
mov    0x18(%r15),%rsi
lea    0xe09(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r13,%r13
je     13f3 <snplist_generation+0x253>
lea    0x100f(%rip),%rdi
call   1040 <puts@plt>
lea    0x7e0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0xc350,%esi
mov    %r13,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     130e <snplist_generation+0x16e>
lea    0xdd5(%rip),%r12
mov    %rsp,%rbp
lea    0xe0d(%rip),%r14
nopl   0x0(%rax)
lea    0xfd2(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%rbx,1)
mov    %rbx,%rdi
mov    $0x2f,%esi
call   1080 <strrchr@plt>
lea    0x1(%rax),%rcx
test   %rax,%rax
cmove  %rbx,%rcx
mov    0x8(%r15),%rdx
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %rdx,%r8
mov    %rcx,%r9
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    %rbx,%rdi
mov    $0xc350,%esi
mov    %r13,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    1290 <snplist_generation+0xf0>
mov    0x8(%r15),%rcx
lea    0xd93(%rip),%rsi
xor    %r14d,%r14d
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rcx
lea    0xda4(%rip),%rsi
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rcx
lea    0xdb5(%rip),%rsi
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rcx
lea    0xdc6(%rip),%rsi
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rcx
lea    0xe00(%rip),%rsi
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rcx
lea    0xe19(%rip),%rsi
mov    %rbp,%rdi
mov    %rcx,%rdx
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    0x8(%r15),%rdx
lea    0xe32(%rip),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   10b0 <sprintf@plt>
mov    %rbp,%rdi
call   1060 <system@plt>
jmp    1405 <snplist_generation+0x265>
lea    0xe7f(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%r14d
mov    %r14d,%eax
add    $0xcb38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i32 }
@.str = [27 x i8] c"within snplist_generation\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [26 x i8] c"Current directory is \09%s\0A\00"
@.str.3 = [19 x i8] c"mkdir %s/Positions\00"
@.str.4 = [24 x i8] c"mkdir %s/Positions/logs\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [16 x i8] c"filelist is %s\0A\00"
@.str.7 = [45 x i8] c"The filelist could not be opened. Exiting \0A\00"
@.str.8 = [6 x i8] c"whoa\0A\00"
@.str.9 = [17 x i8] c"within filelist\0A\00"
@.str.10 = [66 x i8] c"awk '!/#/ { print $1 \22\\t\22 $2 } ' %s/Variants/%s > %s/Positions/%s\00"
@.str.11 = [19 x i8] c"sys command is %s\0A\00"
@.str.12 = [55 x i8] c"cat %s/Positions/*vcf > %s/Positions/all.vcf.positions\00"
@.str.13 = [49 x i8] c"sed -i 's/X/23/g' %s/Positions/all.vcf.positions\00"
@.str.14 = [49 x i8] c"sed -i 's/Y/24/g' %s/Positions/all.vcf.positions\00"
@.str.15 = [90 x i8] c"sort -k1,1n -k2,2n %s/Positions/all.vcf.positions > %s/Positions/all.vcf.positions.sorted\00"
@.str.16 = [57 x i8] c"sed -i 's/^23/X/g' %s/Positions/all.vcf.positions.sorted\00"
@.str.17 = [57 x i8] c"sed -i 's/^24/Y/g' %s/Positions/all.vcf.positions.sorted\00"
@.str.18 = [57 x i8] c"uniq %s/Positions/all.vcf.positions.sorted > snplist.txt\00"
define i32 @snplist_generation(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca i32*
%5 = alloca %struct.dirent*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [100 x i8]
%12 = alloca [50 x i8]
%13 = alloca [1000 x i8]
%14 = alloca [1000 x i8]
%15 = alloca [1000 x i8]
%16 = alloca [1000 x i8]
%17 = alloca [50000 x i8]
%18 = alloca [1000 x i8]
%19 = alloca [1000 x i8]
%20 = alloca [1000 x i8]
%21 = alloca [1000 x i8]
%22 = alloca [1000 x i8]
%23 = alloca i32
store i8** %0, i8*** %3
store i32 0, i32* %23
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%25 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%26 = load i8**, i8*** %3
%27 = getelementptr inbounds i8*, i8** %26, i64 1
%28 = load i8*, i8** %27
%29 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %30)
%32 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%33 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%34 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %32, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%36 = call i32 @system(i8* %35)
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%38 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%39 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %37, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %38)
%40 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%41 = call i32 @system(i8* %40)
%42 = load i8**, i8*** %3
%43 = getelementptr inbounds i8*, i8** %42, i64 3
%44 = load i8*, i8** %43
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %45, i32** %10
%46 = load i8**, i8*** %3
%47 = getelementptr inbounds i8*, i8** %46, i64 3
%48 = load i8*, i8** %47
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %48)
%50 = load i32*, i32** %10
%51 = icmp eq i32* %50, null
br i1 %51, label %52, label %54
52: ; preds = %1
%53 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.7, i64 0, i64 0))
store i32 2, i32* %2
br label %163
54: ; preds = %1
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %56
56: ; preds = %77, %54
%57 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%58 = load i32*, i32** %10
%59 = call i32* @fgets(i8* %57, i32 50000, i32* %58)
%60 = icmp ne i32* %59, null
br i1 %60, label %61, label %95
61: ; preds = %56
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.9, i64 0, i64 0))
%63 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%64 = call i32 @strlen(i8* %63)
%65 = sub nsw i32 %64, 1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 %66
store i8 0, i8* %67
%68 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%69 = call i8* @strrchr(i8* %68, i8 signext 47)
store i8* %69, i8** %8
%70 = load i8*, i8** %8
%71 = icmp eq i8* %70, null
br i1 %71, label %72, label %74
72: ; preds = %61
%73 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
store i8* %73, i8** %8
br label %77
74: ; preds = %61
%75 = load i8*, i8** %8
%76 = getelementptr inbounds i8, i8* %75, i32 1
store i8* %76, i8** %8
br label %77
77: ; preds = %74, %72
%78 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%79 = load i8**, i8*** %3
%80 = getelementptr inbounds i8*, i8** %79, i64 1
%81 = load i8*, i8** %80
%82 = load i8*, i8** %8
%83 = load i8**, i8*** %3
%84 = getelementptr inbounds i8*, i8** %83, i64 1
%85 = load i8*, i8** %84
%86 = load i8*, i8** %8
%87 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %78, i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.10, i64 0, i64 0), i8* %81, i8* %82, i8* %85, i8* %86)
%88 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%89 = call i32 @system(i8* %88)
%90 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i8* %90)
%92 = call i32 @sleep(i32 1)
%93 = load i32, i32* %23
%94 = add nsw i32 %93, 1
store i32 %94, i32* %23
br label %56
95: ; preds = %56
%96 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%97 = load i8**, i8*** %3
%98 = getelementptr inbounds i8*, i8** %97, i64 1
%99 = load i8*, i8** %98
%100 = load i8**, i8*** %3
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %96, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i8* %99, i8* %102)
%104 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%105 = call i32 @system(i8* %104)
%106 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%107 = load i8**, i8*** %3
%108 = getelementptr inbounds i8*, i8** %107, i64 1
%109 = load i8*, i8** %108
%110 = load i8**, i8*** %3
%111 = getelementptr inbounds i8*, i8** %110, i64 1
%112 = load i8*, i8** %111
%113 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %106, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0), i8* %109, i8* %112)
%114 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%115 = call i32 @system(i8* %114)
%116 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%117 = load i8**, i8*** %3
%118 = getelementptr inbounds i8*, i8** %117, i64 1
%119 = load i8*, i8** %118
%120 = load i8**, i8*** %3
%121 = getelementptr inbounds i8*, i8** %120, i64 1
%122 = load i8*, i8** %121
%123 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %116, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.14, i64 0, i64 0), i8* %119, i8* %122)
%124 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%125 = call i32 @system(i8* %124)
%126 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%127 = load i8**, i8*** %3
%128 = getelementptr inbounds i8*, i8** %127, i64 1
%129 = load i8*, i8** %128
%130 = load i8**, i8*** %3
%131 = getelementptr inbounds i8*, i8** %130, i64 1
%132 = load i8*, i8** %131
%133 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %126, i8* getelementptr inbounds ([90 x i8], [90 x i8]* @.str.15, i64 0, i64 0), i8* %129, i8* %132)
%134 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%135 = call i32 @system(i8* %134)
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%137 = load i8**, i8*** %3
%138 = getelementptr inbounds i8*, i8** %137, i64 1
%139 = load i8*, i8** %138
%140 = load i8**, i8*** %3
%141 = getelementptr inbounds i8*, i8** %140, i64 1
%142 = load i8*, i8** %141
%143 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %136, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.16, i64 0, i64 0), i8* %139, i8* %142)
%144 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%145 = call i32 @system(i8* %144)
%146 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%147 = load i8**, i8*** %3
%148 = getelementptr inbounds i8*, i8** %147, i64 1
%149 = load i8*, i8** %148
%150 = load i8**, i8*** %3
%151 = getelementptr inbounds i8*, i8** %150, i64 1
%152 = load i8*, i8** %151
%153 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %146, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.17, i64 0, i64 0), i8* %149, i8* %152)
%154 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%155 = call i32 @system(i8* %154)
%156 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%157 = load i8**, i8*** %3
%158 = getelementptr inbounds i8*, i8** %157, i64 1
%159 = load i8*, i8** %158
%160 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %156, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.18, i64 0, i64 0), i8* %159)
%161 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%162 = call i32 @system(i8* %161)
store i32 0, i32* %2
br label %163
163: ; preds = %95, %52
%164 = load i32, i32* %2
ret i32 %164
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str.2 = [26 x i8] c"Current directory is \09%s\0A\00"
@.str.3 = [19 x i8] c"mkdir %s/Positions\00"
@.str.4 = [24 x i8] c"mkdir %s/Positions/logs\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [16 x i8] c"filelist is %s\0A\00"
@.str.10 = [66 x i8] c"awk '!/#/ { print $1 \22\\t\22 $2 } ' %s/Variants/%s > %s/Positions/%s\00"
@.str.11 = [19 x i8] c"sys command is %s\0A\00"
@.str.12 = [55 x i8] c"cat %s/Positions/*vcf > %s/Positions/all.vcf.positions\00"
@.str.13 = [49 x i8] c"sed -i 's/X/23/g' %s/Positions/all.vcf.positions\00"
@.str.14 = [49 x i8] c"sed -i 's/Y/24/g' %s/Positions/all.vcf.positions\00"
@.str.15 = [90 x i8] c"sort -k1,1n -k2,2n %s/Positions/all.vcf.positions > %s/Positions/all.vcf.positions.sorted\00"
@.str.16 = [57 x i8] c"sed -i 's/^23/X/g' %s/Positions/all.vcf.positions.sorted\00"
@.str.17 = [57 x i8] c"sed -i 's/^24/Y/g' %s/Positions/all.vcf.positions.sorted\00"
@.str.18 = [57 x i8] c"uniq %s/Positions/all.vcf.positions.sorted > snplist.txt\00"
@str = [26 x i8] c"within snplist_generation\00"
@str.19 = [5 x i8] c"whoa\00"
@str.20 = [16 x i8] c"within filelist\00"
@str.21 = [44 x i8] c"The filelist could not be opened. Exiting \00"
define i32 @snplist_generation(i8** nocapture %0) {
%2 = alloca [50000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = getelementptr inbounds [50000 x i8], [50000 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%9 = getelementptr inbounds i8*, i8** %0, i64 1
%10 = load i8*, i8** %9
%11 = call i8* @strcpy(i8* %6, i8* dereferenceable(1) %10)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %6)
%13 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%14 = call i32 @system(i8* %7)
%15 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i8* %6)
%16 = call i32 @system(i8* %7)
%17 = getelementptr inbounds i8*, i8** %0, i64 3
%18 = load i8*, i8** %17
%19 = call i32* @fopen(i8* %18, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%20 = load i8*, i8** %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0), i8* %20)
%22 = icmp eq i32* %19, null
br i1 %22, label %23, label %25
23: ; preds = %1
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.21, i64 0, i64 0))
br label %68
25: ; preds = %1
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.19, i64 0, i64 0))
%27 = call i32* @fgets(i8* %5, i32 50000, i32* %19)
%28 = icmp eq i32* %27, null
br i1 %28, label %46, label %29
29: ; preds = %25, %29
%30 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.20, i64 0, i64 0))
%31 = call i32 @strlen(i8* %5)
%32 = add nsw i32 %31, -1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [50000 x i8], [50000 x i8]* %2, i64 0, i64 %33
store i8 0, i8* %34
%35 = call i8* @strrchr(i8* %5, i8 signext 47)
%36 = icmp eq i8* %35, null
%37 = getelementptr inbounds i8, i8* %35, i64 1
%38 = select i1 %36, i8* %5, i8* %37
%39 = load i8*, i8** %9
%40 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([66 x i8], [66 x i8]* @.str.10, i64 0, i64 0), i8* %39, i8* %38, i8* %39, i8* %38)
%41 = call i32 @system(i8* %7)
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i8* %7)
%43 = call i32 @sleep(i32 1)
%44 = call i32* @fgets(i8* %5, i32 50000, i32* %19)
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %29
46: ; preds = %29, %25
%47 = load i8*, i8** %9
%48 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.12, i64 0, i64 0), i8* %47, i8* %47)
%49 = call i32 @system(i8* %7)
%50 = load i8*, i8** %9
%51 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.13, i64 0, i64 0), i8* %50, i8* %50)
%52 = call i32 @system(i8* %7)
%53 = load i8*, i8** %9
%54 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.14, i64 0, i64 0), i8* %53, i8* %53)
%55 = call i32 @system(i8* %7)
%56 = load i8*, i8** %9
%57 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([90 x i8], [90 x i8]* @.str.15, i64 0, i64 0), i8* %56, i8* %56)
%58 = call i32 @system(i8* %7)
%59 = load i8*, i8** %9
%60 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.16, i64 0, i64 0), i8* %59, i8* %59)
%61 = call i32 @system(i8* %7)
%62 = load i8*, i8** %9
%63 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.17, i64 0, i64 0), i8* %62, i8* %62)
%64 = call i32 @system(i8* %7)
%65 = load i8*, i8** %9
%66 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.18, i64 0, i64 0), i8* %65)
%67 = call i32 @system(i8* %7)
br label %68
68: ; preds = %46, %23
%69 = phi i32 [ 2, %23 ], [ 0, %46 ]
ret i32 %69
}