#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*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, 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 awkvar(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/Variants", current_directory);
  system(sys_command);
  sprintf(sys_command, "mkdir %s/Variants/logs", current_directory);
  system(sys_command);
  filelistfp = fopen(config[0], "r");
  if (filelistfp == NULL) {
    printf("The filelist could not be opened.  Exiting \n");
    return 2;
  }
  while (fgets(filestring, 50000, filelistfp) != NULL) {
    filestring[strlen(filestring) - 1] = '\0';
    filename = strrchr(filestring, '/');
    if (filename == NULL) {
      filename = filestring;
    } else {
      filename++;
    }
    printf("filename contains %s\n", filename);
    sprintf(snplist_job_file, "%s/Variants/logs/snplistJob%d.job", config[1],
            i);
    logp = fopen(snplist_job_file, "w");
    if (logp == NULL) {
      printf("could not open log file for writing\n");
    } else {
      printf("hey we wrote a log file\n");
      fprintf(logp, "#!/bin/bash\n");
      fprintf(logp, "#BSUB -J snplistJob%d\n", i);
      fprintf(logp, "#BSUB -o %s/Variants/logs/snplistJob%d.out\n", config[1],
              i);
      fprintf(logp, "#BSUB -e %s/Variants/logs/snplistJob%d.err\n", config[1],
              i);
      fprintf(logp, "#BSUB -W 5:00\n");
      fprintf(logp, "#BSUB -n 1\n");
      fprintf(logp, "#BSUB -q small\n");
      fprintf(logp, "#BSUB -u dvanbooven\n");
      fprintf(logp, "#BSUB -g /ex_var1\n\n");
      fprintf(logp, "awk '/^#/ || $5 != \".\" ' %s > %s/Variants/%s\n\n",
              filestring, config[1], filename);
    }
    fclose(logp);
    printf("file is %s/Variants/logs/snplistJob%d.job\n", config[1], i);
    sprintf(sys_command, "bsub < %s/Variants/logs/snplistJob%d.job\n",
            config[1], i);
    system(sys_command);
    sleep(1);
    i++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<awkvar>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe7c0,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0xe7b4(%rbp)
lea    0xe40(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xd7f0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe3e(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0xd7f0(%rbp),%rsi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xe3c0(%rbp),%rdi
lea    -0xd7f0(%rbp),%rdx
lea    0xe2a(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1050 <system@plt>
lea    -0xe3c0(%rbp),%rdi
lea    -0xd7f0(%rbp),%rdx
lea    0xe14(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1050 <system@plt>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe0a(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    1285 <awkvar+0xe5>
lea    0xdf1(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x2,-0x4(%rbp)
jmp    14d8 <awkvar+0x338>
jmp    128a <awkvar+0xea>
lea    -0xd400(%rbp),%rdi
mov    -0x48(%rbp),%rdx
mov    $0xc350,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     14d1 <awkvar+0x331>
lea    -0xd400(%rbp),%rdi
call   1040 <strlen@plt>
sub    $0x1,%eax
cltq
movb   $0x0,-0xd400(%rbp,%rax,1)
lea    -0xd400(%rbp),%rdi
mov    $0x2f,%esi
call   1070 <strrchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    12f2 <awkvar+0x152>
lea    -0xd400(%rbp),%rax
mov    %rax,-0x38(%rbp)
jmp    12fe <awkvar+0x15e>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xdfd0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0xe7b4(%rbp),%ecx
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0xdfd0(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    1368 <awkvar+0x1c8>
lea    0xd6e(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    145f <awkvar+0x2bf>
lea    0xd80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd87(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
mov    -0xe7b4(%rbp),%edx
lea    0xd7c(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0xe7b4(%rbp),%ecx
lea    0xd73(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0xe7b4(%rbp),%ecx
lea    0xd7f(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd99(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd96(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd90(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd8e(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    0xd91(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
lea    -0xd400(%rbp),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x38(%rbp),%r8
lea    0xd80(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0xe7b4(%rbp),%edx
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
lea    -0xe3c0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0xe7b4(%rbp),%ecx
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   10b0 <sprintf@plt>
lea    -0xe3c0(%rbp),%rdi
call   1050 <system@plt>
mov    $0x1,%edi
call   10c0 <sleep@plt>
mov    -0xe7b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xe7b4(%rbp)
jmp    128a <awkvar+0xea>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xe7c0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<awkvar>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xcf38,%rsp
mov    %rdi,%r14
lea    0xfe8(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%r14),%rsi
lea    0x7f0(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xdf5(%rip),%rdi
xor    %r13d,%r13d
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xdfb(%rip),%rsi
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <sprintf@plt>
mov    %r15,%rdi
call   1070 <system@plt>
lea    0xdec(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   10d0 <sprintf@plt>
mov    %r15,%rdi
call   1070 <system@plt>
mov    (%r14),%rdi
lea    0xde4(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     1497 <awkvar+0x2c7>
mov    %rax,%rbx
lea    0xbe0(%rsp),%r15
mov    %r15,%rdi
mov    $0xc350,%esi
mov    %rax,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     14a9 <awkvar+0x2d9>
xor    %r12d,%r12d
mov    %rbx,0x8(%rsp)
jmp    1412 <awkvar+0x242>
xchg   %ax,%ax
lea    0xf46(%rip),%rdi
call   1040 <puts@plt>
mov    $0xc,%esi
mov    $0x1,%edx
lea    0xdc2(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    %r13,%rdi
lea    0xdbd(%rip),%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x8(%r14),%rdx
mov    %r13,%rdi
lea    0xdbc(%rip),%rsi
mov    %r12d,%ecx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x8(%r14),%rdx
mov    %r13,%rdi
lea    0xdd0(%rip),%rsi
mov    %r12d,%ecx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0xe,%esi
mov    $0x1,%edx
lea    0xde1(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    $0xb,%esi
mov    $0x1,%edx
lea    0xdd7(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    $0xf,%esi
mov    $0x1,%edx
lea    0xdca(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    $0x14,%esi
mov    $0x1,%edx
lea    0xdc1(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    $0x13,%esi
mov    $0x1,%edx
lea    0xdbd(%rip),%rdi
mov    %r13,%rcx
call   10e0 <fwrite@plt>
mov    0x8(%r14),%rcx
mov    %r13,%rdi
lea    0xdbb(%rip),%rsi
mov    %r15,%rdx
mov    %rbp,%r8
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x8(%rsp),%rbx
mov    %r13,%rdi
call   1050 <fclose@plt>
mov    0x8(%r14),%rsi
xor    %r13d,%r13d
lea    0xdc2(%rip),%rdi
mov    %r12d,%edx
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%r14),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
lea    0xdd0(%rip),%rsi
mov    %r12d,%ecx
xor    %eax,%eax
call   10d0 <sprintf@plt>
mov    %rbp,%rdi
call   1070 <system@plt>
mov    $0x1,%edi
call   10f0 <sleep@plt>
add    $0x1,%r12d
mov    %r15,%rdi
mov    $0xc350,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %rax,%rax
je     14a9 <awkvar+0x2d9>
mov    %r15,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r15,1)
mov    %r15,%rdi
mov    $0x2f,%esi
call   1090 <strrchr@plt>
lea    0x1(%rax),%rbp
test   %rax,%rax
cmove  %r15,%rbp
lea    0xc04(%rip),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x8(%r14),%rdx
lea    0x400(%rsp),%rbx
mov    %rbx,%rdi
lea    0xbfa(%rip),%rsi
mov    %r12d,%ecx
xor    %eax,%eax
call   10d0 <sprintf@plt>
mov    %rbx,%rdi
lea    0xc08(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,%r13
test   %rax,%rax
jne    12a0 <awkvar+0xd0>
lea    0xd78(%rip),%rdi
call   1040 <puts@plt>
jmp    13a1 <awkvar+0x1d1>
lea    0xd8b(%rip),%rdi
call   1040 <puts@plt>
mov    $0x2,%r13d
mov    %r13d,%eax
add    $0xcf38,%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 = [18 x i8] c"mkdir %s/Variants\00"
@.str.4 = [23 x i8] c"mkdir %s/Variants/logs\00"
@.str.5 = [2 x i8] c"r\00"
@.str.6 = [45 x i8] c"The filelist could not be opened. Exiting \0A\00"
@.str.7 = [22 x i8] c"filename contains %s\0A\00"
@.str.8 = [34 x i8] c"%s/Variants/logs/snplistJob%d.job\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [37 x i8] c"could not open log file for writing\0A\00"
@.str.11 = [25 x i8] c"hey we wrote a log file\0A\00"
@.str.12 = [13 x i8] c"#!/bin/bash\0A\00"
@.str.13 = [23 x i8] c"#BSUB -J snplistJob%d\0A\00"
@.str.14 = [44 x i8] c"#BSUB -o %s/Variants/logs/snplistJob%d.out\0A\00"
@.str.15 = [44 x i8] c"#BSUB -e %s/Variants/logs/snplistJob%d.err\0A\00"
@.str.16 = [15 x i8] c"#BSUB -W 5:00\0A\00"
@.str.17 = [12 x i8] c"#BSUB -n 1\0A\00"
@.str.18 = [16 x i8] c"#BSUB -q small\0A\00"
@.str.19 = [21 x i8] c"#BSUB -u dvanbooven\0A\00"
@.str.20 = [20 x i8] c"#BSUB -g /ex_var1\0A\0A\00"
@.str.21 = [47 x i8] c"awk '/^#/ || $5 != \22.\22 ' %s > %s/Variants/%s\0A\0A\00"
@.str.22 = [43 x i8] c"file is %s/Variants/logs/snplistJob%d.job\0A\00"
@.str.23 = [42 x i8] c"bsub < %s/Variants/logs/snplistJob%d.job\0A\00"
define i32 @awkvar(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 ([18 x i8], [18 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 ([23 x i8], [23 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 0
%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 i32*, i32** %10
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %50
48: ; preds = %1
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
store i32 2, i32* %2
br label %142
50: ; preds = %1
br label %51
51: ; preds = %122, %50
%52 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%53 = load i32*, i32** %10
%54 = call i32* @fgets(i8* %52, i32 50000, i32* %53)
%55 = icmp ne i32* %54, null
br i1 %55, label %56, label %141
56: ; preds = %51
%57 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%58 = call i32 @strlen(i8* %57)
%59 = sub nsw i32 %58, 1
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 %60
store i8 0, i8* %61
%62 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
%63 = call i8* @strrchr(i8* %62, i8 signext 47)
store i8* %63, i8** %8
%64 = load i8*, i8** %8
%65 = icmp eq i8* %64, null
br i1 %65, label %66, label %68
66: ; preds = %56
%67 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, i64 0, i64 0
store i8* %67, i8** %8
br label %71
68: ; preds = %56
%69 = load i8*, i8** %8
%70 = getelementptr inbounds i8, i8* %69, i32 1
store i8* %70, i8** %8
br label %71
71: ; preds = %68, %66
%72 = load i8*, i8** %8
%73 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %72)
%74 = getelementptr inbounds [1000 x i8], [1000 x i8]* %20, i64 0, i64 0
%75 = load i8**, i8*** %3
%76 = getelementptr inbounds i8*, i8** %75, i64 1
%77 = load i8*, i8** %76
%78 = load i32, i32* %23
%79 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %74, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %77, i32 %78)
%80 = getelementptr inbounds [1000 x i8], [1000 x i8]* %20, i64 0, i64 0
%81 = call i32* @fopen(i8* %80, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %81, i32** %9
%82 = load i32*, i32** %9
%83 = icmp eq i32* %82, null
br i1 %83, label %84, label %86
84: ; preds = %71
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.10, i64 0, i64 0))
br label %122
86: ; preds = %71
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.11, i64 0, i64 0))
%88 = load i32*, i32** %9
%89 = call i32 (i32*, i8*, ...) @fprintf(i32* %88, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0))
%90 = load i32*, i32** %9
%91 = load i32, i32* %23
%92 = call i32 (i32*, i8*, ...) @fprintf(i32* %90, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %91)
%93 = load i32*, i32** %9
%94 = load i8**, i8*** %3
%95 = getelementptr inbounds i8*, i8** %94, i64 1
%96 = load i8*, i8** %95
%97 = load i32, i32* %23
%98 = call i32 (i32*, i8*, ...) @fprintf(i32* %93, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0), i8* %96, i32 %97)
%99 = load i32*, i32** %9
%100 = load i8**, i8*** %3
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = load i32, i32* %23
%104 = call i32 (i32*, i8*, ...) @fprintf(i32* %99, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i8* %102, i32 %103)
%105 = load i32*, i32** %9
%106 = call i32 (i32*, i8*, ...) @fprintf(i32* %105, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0))
%107 = load i32*, i32** %9
%108 = call i32 (i32*, i8*, ...) @fprintf(i32* %107, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0))
%109 = load i32*, i32** %9
%110 = call i32 (i32*, i8*, ...) @fprintf(i32* %109, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0))
%111 = load i32*, i32** %9
%112 = call i32 (i32*, i8*, ...) @fprintf(i32* %111, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0))
%113 = load i32*, i32** %9
%114 = call i32 (i32*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
%115 = load i32*, i32** %9
%116 = getelementptr inbounds [50000 x i8], [50000 x i8]* %17, 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** %8
%121 = call i32 (i32*, i8*, ...) @fprintf(i32* %115, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.21, i64 0, i64 0), i8* %116, i8* %119, i8* %120)
br label %122
122: ; preds = %86, %84
%123 = load i32*, i32** %9
%124 = call i32 @fclose(i32* %123)
%125 = load i8**, i8*** %3
%126 = getelementptr inbounds i8*, i8** %125, i64 1
%127 = load i8*, i8** %126
%128 = load i32, i32* %23
%129 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.22, i64 0, i64 0), i8* %127, i32 %128)
%130 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%131 = load i8**, i8*** %3
%132 = getelementptr inbounds i8*, i8** %131, i64 1
%133 = load i8*, i8** %132
%134 = load i32, i32* %23
%135 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %130, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.23, i64 0, i64 0), i8* %133, i32 %134)
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %21, i64 0, i64 0
%137 = call i32 @system(i8* %136)
%138 = call i32 @sleep(i32 1)
%139 = load i32, i32* %23
%140 = add nsw i32 %139, 1
store i32 %140, i32* %23
br label %51
141: ; preds = %51
store i32 0, i32* %2
br label %142
142: ; preds = %141, %48
%143 = load i32, i32* %2
ret i32 %143
}

LLVM IR (-O2):
%struct.dirent = type { i32 }
@.str.2 = [26 x i8] c"Current directory is \09%s\0A\00"
@.str.3 = [18 x i8] c"mkdir %s/Variants\00"
@.str.4 = [23 x i8] c"mkdir %s/Variants/logs\00"
@.str.5 = [2 x i8] c"r\00"
@.str.7 = [22 x i8] c"filename contains %s\0A\00"
@.str.8 = [34 x i8] c"%s/Variants/logs/snplistJob%d.job\00"
@.str.9 = [2 x i8] c"w\00"
@.str.12 = [13 x i8] c"#!/bin/bash\0A\00"
@.str.13 = [23 x i8] c"#BSUB -J snplistJob%d\0A\00"
@.str.14 = [44 x i8] c"#BSUB -o %s/Variants/logs/snplistJob%d.out\0A\00"
@.str.15 = [44 x i8] c"#BSUB -e %s/Variants/logs/snplistJob%d.err\0A\00"
@.str.16 = [15 x i8] c"#BSUB -W 5:00\0A\00"
@.str.17 = [12 x i8] c"#BSUB -n 1\0A\00"
@.str.18 = [16 x i8] c"#BSUB -q small\0A\00"
@.str.19 = [21 x i8] c"#BSUB -u dvanbooven\0A\00"
@.str.20 = [20 x i8] c"#BSUB -g /ex_var1\0A\0A\00"
@.str.21 = [47 x i8] c"awk '/^#/ || $5 != \22.\22 ' %s > %s/Variants/%s\0A\0A\00"
@.str.22 = [43 x i8] c"file is %s/Variants/logs/snplistJob%d.job\0A\00"
@.str.23 = [42 x i8] c"bsub < %s/Variants/logs/snplistJob%d.job\0A\00"
@str = [26 x i8] c"within snplist_generation\00"
@str.24 = [24 x i8] c"hey we wrote a log file\00"
@str.25 = [36 x i8] c"could not open log file for writing\00"
@str.26 = [44 x i8] c"The filelist could not be opened. Exiting \00"
define i32 @awkvar(i8** nocapture %0) {
%2 = alloca [50000 x i8]
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [50000 x i8], [50000 x i8]* %2, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%9 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
%11 = getelementptr inbounds i8*, i8** %0, i64 1
%12 = load i8*, i8** %11
%13 = call i8* @strcpy(i8* %7, i8* dereferenceable(1) %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %7)
%15 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%16 = call i32 @system(i8* %9)
%17 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i8* %7)
%18 = call i32 @system(i8* %9)
%19 = load i8*, i8** %0
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%21 = icmp eq i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %1
%23 = call i32* @fgets(i8* %6, i32 50000, i32* %20)
%24 = icmp eq i32* %23, null
br i1 %24, label %70, label %27
25: ; preds = %1
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.26, i64 0, i64 0))
br label %70
27: ; preds = %22, %59
%28 = phi i32 [ %67, %59 ], [ 0, %22 ]
%29 = call i32 @strlen(i8* %6)
%30 = add nsw i32 %29, -1
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [50000 x i8], [50000 x i8]* %2, i64 0, i64 %31
store i8 0, i8* %32
%33 = call i8* @strrchr(i8* %6, i8 signext 47)
%34 = icmp eq i8* %33, null
%35 = getelementptr inbounds i8, i8* %33, i64 1
%36 = select i1 %34, i8* %6, i8* %35
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.7, i64 0, i64 0), i8* %36)
%38 = load i8*, i8** %11
%39 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.8, i64 0, i64 0), i8* %38, i32 %28)
%40 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%41 = icmp eq i32* %40, null
br i1 %41, label %42, label %44
42: ; preds = %27
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.25, i64 0, i64 0))
br label %59
44: ; preds = %27
%45 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.24, i64 0, i64 0))
%46 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.12, i64 0, i64 0), i64 12, i64 1, i32* %40)
%47 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.13, i64 0, i64 0), i32 %28)
%48 = load i8*, i8** %11
%49 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.14, i64 0, i64 0), i8* %48, i32 %28)
%50 = load i8*, i8** %11
%51 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.15, i64 0, i64 0), i8* %50, i32 %28)
%52 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.16, i64 0, i64 0), i64 14, i64 1, i32* %40)
%53 = call i64 @fwrite(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.17, i64 0, i64 0), i64 11, i64 1, i32* %40)
%54 = call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.18, i64 0, i64 0), i64 15, i64 1, i32* %40)
%55 = call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.19, i64 0, i64 0), i64 20, i64 1, i32* %40)
%56 = call i64 @fwrite(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0), i64 19, i64 1, i32* %40)
%57 = load i8*, i8** %11
%58 = call i32 (i32*, i8*, ...) @fprintf(i32* %40, i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.21, i64 0, i64 0), i8* %6, i8* %57, i8* %36)
br label %59
59: ; preds = %44, %42
%60 = call i32 @fclose(i32* %40)
%61 = load i8*, i8** %11
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.22, i64 0, i64 0), i8* %61, i32 %28)
%63 = load i8*, i8** %11
%64 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %9, i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.23, i64 0, i64 0), i8* %63, i32 %28)
%65 = call i32 @system(i8* %9)
%66 = call i32 @sleep(i32 1)
%67 = add nuw nsw i32 %28, 1
%68 = call i32* @fgets(i8* %6, i32 50000, i32* %20)
%69 = icmp eq i32* %68, null
br i1 %69, label %70, label %27
70: ; preds = %59, %22, %25
%71 = phi i32 [ 2, %25 ], [ 0, %22 ], [ 0, %59 ]
ret i32 %71
}