#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*/ tmpname;
typedef int /*<<< orphan*/ symname;
typedef int /*<<< orphan*/ outfile;
typedef int /*<<< orphan*/ folder;
typedef int /*<<< orphan*/ filelist;
typedef int /*<<< orphan*/ data;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
scalar_t__ EOF;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, unsigned int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ fwrite(char *, int /*<<< orphan*/, int,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int, int);
int /*<<< orphan*/ printf(char *, char *, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strlen(char *);
char *strstr(char *, char *);
int main(void) {
  char folder[(1024u)];
  char tmpname[(1024u)];
  char filelist[(1024u)];
  char outfile[(1024u)];
  char symname[(1024u)];
  char data[(1024u)];
  int retval = 0;
  int header;
  FILE *finputfiles = NULL;
  FILE *fsymbolfile = NULL;
  FILE *ffolderfile = NULL;
  FILE *fout = NULL;
  finputfiles = fopen("inputfiles.txt", "r");
  if (finputfiles == NULL) {
    printf("Not able to open %s ", "inputfiles.txt");
    retval = -1;
    goto BAIL_OUT;
  }
  fsymbolfile = fopen("symbol.txt", "r");
  if (fsymbolfile == NULL) {
    printf("Not able to open %s ", "symbol.txt");
    retval = -2;
    goto BAIL_OUT;
  }
  ffolderfile = fopen("inputfolder.txt", "r");
  if (ffolderfile == NULL) {
    printf("Not able to open %s ", "inputfolder.txt");
    retval = -3;
    goto BAIL_OUT;
  }
  memset(folder, 0x0, sizeof(folder));
  memset(tmpname, 0x0, sizeof(tmpname));
  memset(filelist, 0x0, sizeof(filelist));
  memset(outfile, 0x0, sizeof(outfile));
  memset(symname, 0x0, sizeof(symname));
  memset(data, 0x0, sizeof(data));
  if (fscanf(ffolderfile, "%s", folder) != EOF) {
    strcat(folder, "\\");
  }
  fclose(ffolderfile);
  ffolderfile = NULL;
  while (!feof(fsymbolfile)) {
    if (fscanf(fsymbolfile, "%s", symname) != EOF) {
      strcpy(outfile, symname);
      strcat(outfile, ".csv");
      strcat(symname, ",");
      fout = fopen(outfile, "w");
      printf("Extracting symbol :: %s into %s \n", symname, outfile);
      if (fout == NULL) {
        printf("Not able to open %s \n", outfile);
        retval = -4;
        goto BAIL_OUT;
      }
      header = 0;
      while (!feof(finputfiles)) {
        if (fscanf(finputfiles, "%s", filelist) != EOF) {
          FILE *fin;
          strcpy(tmpname, folder);
          strcat(tmpname, filelist);
          fin = fopen(tmpname, "r");
          printf("Opening the file %s \n", tmpname);
          if (fin == NULL) {
            printf("Not able to open %s \n", tmpname);
            retval = -5;
            goto BAIL_OUT;
          }
          while (!feof(fin)) {
            fgets(data, (1024u), fin);
            if (header == 0) {
              fwrite(data, strlen(data), 1, fout);
              header = 1;
            }
            if (strstr(data, symname) == data) {
              fwrite(data, strlen(data), 1, fout);
            }
          }
          fclose(fin);
        }
      }
      fclose(fout);
      rewind(finputfiles);
    }
  }
BAIL_OUT:
  if (finputfiles != NULL) {
    fclose(finputfiles);
  }
  if (fsymbolfile != NULL) {
    fclose(fsymbolfile);
  }
  if (ffolderfile != NULL) {
    fclose(ffolderfile);
  }
  return retval;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1850,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1814(%rbp)
movq   $0x0,-0x1820(%rbp)
movq   $0x0,-0x1828(%rbp)
movq   $0x0,-0x1830(%rbp)
movq   $0x0,-0x1838(%rbp)
lea    0xde1(%rip),%rdi
lea    0xde9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1820(%rbp)
cmpq   $0x0,-0x1820(%rbp)
jne    1264 <main+0x94>
lea    0xdca(%rip),%rdi
lea    0xdb2(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xffffffff,-0x1814(%rbp)
ff ff ff
jmp    16a2 <main+0x4d2>
lea    0xdbb(%rip),%rdi
lea    0xd9d(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1828(%rbp)
cmpq   $0x0,-0x1828(%rbp)
jne    12b0 <main+0xe0>
lea    0xd7e(%rip),%rdi
lea    0xd8c(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xfffffffe,-0x1814(%rbp)
ff ff ff
jmp    16a2 <main+0x4d2>
lea    0xd7a(%rip),%rdi
lea    0xd51(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1830(%rbp)
cmpq   $0x0,-0x1830(%rbp)
jne    12fc <main+0x12c>
lea    0xd32(%rip),%rdi
lea    0xd4b(%rip),%rsi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xfffffffd,-0x1814(%rbp)
ff ff ff
jmp    16a2 <main+0x4d2>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0xc10(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x1010(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x1410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x1810(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    -0x1830(%rbp),%rdi
lea    -0x410(%rbp),%rdx
lea    0xcbe(%rip),%rsi
call   1090 <fscanf@plt>
mov    0x2c59(%rip),%rcx
cmp    (%rcx),%rax
je     13ab <main+0x1db>
lea    -0x410(%rbp),%rdi
lea    0xc9e(%rip),%rsi
call   10d0 <strcat@plt>
mov    -0x1830(%rbp),%rdi
call   1040 <fclose@plt>
movq   $0x0,-0x1830(%rbp)
mov    -0x1828(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13e3 <main+0x213>
jmp    169d <main+0x4cd>
mov    -0x1828(%rbp),%rdi
lea    -0x1410(%rbp),%rdx
lea    0xc49(%rip),%rsi
call   1090 <fscanf@plt>
mov    0x2be4(%rip),%rcx
cmp    (%rcx),%rax
je     1698 <main+0x4c8>
lea    -0x1010(%rbp),%rdi
lea    -0x1410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x1010(%rbp),%rdi
lea    0xc18(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1410(%rbp),%rdi
lea    0xc0a(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1010(%rbp),%rdi
lea    0xbf9(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1838(%rbp)
lea    -0x1410(%rbp),%rsi
lea    -0x1010(%rbp),%rdx
lea    0xbda(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x1838(%rbp)
jne    14ae <main+0x2de>
lea    -0x1010(%rbp),%rsi
lea    0xbd9(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xfffffffc,-0x1814(%rbp)
ff ff ff
jmp    16a2 <main+0x4d2>
movl   $0x0,-0x1818(%rbp)
mov    -0x1820(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    14d9 <main+0x309>
jmp    1680 <main+0x4b0>
mov    -0x1820(%rbp),%rdi
lea    -0xc10(%rbp),%rdx
lea    0xb53(%rip),%rsi
call   1090 <fscanf@plt>
mov    0x2aee(%rip),%rcx
cmp    (%rcx),%rax
je     167b <main+0x4ab>
lea    -0x810(%rbp),%rdi
lea    -0x410(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0x810(%rbp),%rdi
lea    -0xc10(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x810(%rbp),%rdi
lea    0xad8(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x1840(%rbp)
lea    -0x810(%rbp),%rsi
lea    0xb36(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
cmpq   $0x0,-0x1840(%rbp)
jne    158a <main+0x3ba>
lea    -0x810(%rbp),%rsi
lea    0xafd(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0xfffffffb,-0x1814(%rbp)
ff ff ff
jmp    16a2 <main+0x4d2>
jmp    158f <main+0x3bf>
mov    -0x1840(%rbp),%rdi
call   10b0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    15b0 <main+0x3e0>
jmp    166f <main+0x49f>
lea    -0x1810(%rbp),%rdi
mov    -0x1840(%rbp),%rdx
mov    $0x400,%esi
call   10a0 <fgets@plt>
cmpl   $0x0,-0x1818(%rbp)
jne    1613 <main+0x443>
lea    -0x1810(%rbp),%rax
mov    %rax,-0x1848(%rbp)
lea    -0x1810(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1848(%rbp),%rdi
mov    %eax,%esi
mov    -0x1838(%rbp),%rcx
mov    $0x1,%edx
call   10e0 <fwrite@plt>
movl   $0x1,-0x1818(%rbp)
lea    -0x1810(%rbp),%rdi
lea    -0x1410(%rbp),%rsi
call   10f0 <strstr@plt>
lea    -0x1810(%rbp),%rcx
cmp    %rcx,%rax
jne    166a <main+0x49a>
lea    -0x1810(%rbp),%rax
mov    %rax,-0x1850(%rbp)
lea    -0x1810(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x1850(%rbp),%rdi
mov    %eax,%esi
mov    -0x1838(%rbp),%rcx
mov    $0x1,%edx
call   10e0 <fwrite@plt>
jmp    158f <main+0x3bf>
mov    -0x1840(%rbp),%rdi
call   1040 <fclose@plt>
jmp    14b8 <main+0x2e8>
mov    -0x1838(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x1820(%rbp),%rdi
call   1070 <rewind@plt>
jmp    13c2 <main+0x1f2>
jmp    16a2 <main+0x4d2>
cmpq   $0x0,-0x1820(%rbp)
je     16bc <main+0x4ec>
mov    -0x1820(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x1828(%rbp)
je     16d6 <main+0x506>
mov    -0x1828(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x1830(%rbp)
je     16f0 <main+0x520>
mov    -0x1830(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x1814(%rbp),%eax
add    $0x1850,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1828,%rsp
lea    0xe18(%rip),%rdi
lea    0xe20(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     1327 <main+0x157>
mov    %rax,%rbp
lea    0xe1f(%rip),%rdi
lea    0xe01(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     15a6 <main+0x3d6>
mov    %rax,0x8(%rsp)
lea    0xe09(%rip),%rdi
lea    0xde0(%rip),%rsi
call   10d0 <fopen@plt>
test   %rax,%rax
je     15cb <main+0x3fb>
mov    %rax,%r14
mov    %rbp,0x10(%rsp)
lea    0xc20(%rsp),%r12
xor    %r15d,%r15d
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0x820(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0x420(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0x20(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0x1420(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0x1020(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    0xd7a(%rip),%rsi
mov    %r14,%rdi
mov    %r12,%rdx
call   10a0 <fscanf@plt>
mov    0x2d0f(%rip),%r12
cmp    (%r12),%rax
je     12f3 <main+0x123>
lea    0xd5e(%rip),%rsi
lea    0xc20(%rsp),%rdi
call   10e0 <strcat@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
mov    0x10(%rsp),%rbp
jne    1620 <main+0x450>
lea    0x1420(%rsp),%r15
lea    0x1020(%rsp),%r13
jmp    1377 <main+0x1a7>
lea    0xce3(%rip),%rdi
lea    0xccb(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%r15d
jmp    1630 <main+0x460>
nopw   0x0(%rax,%rax,1)
mov    0x18(%rsp),%rdi
call   1050 <fclose@plt>
mov    %rbp,%rdi
call   1080 <rewind@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    15fd <main+0x42d>
mov    %rbx,%rdi
lea    0xcc0(%rip),%rsi
mov    %r15,%rdx
call   10a0 <fscanf@plt>
cmp    (%r12),%rax
je     1367 <main+0x197>
lea    0x20(%rsp),%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
lea    0xc9d(%rip),%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
lea    0xc93(%rip),%rsi
call   10e0 <strcat@plt>
mov    %r14,%rdi
lea    0xc86(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%rbx
lea    0xc79(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbx,0x18(%rsp)
test   %rbx,%rbx
je     1602 <main+0x432>
mov    %rbp,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
lea    0x420(%rsp),%rbx
jne    1350 <main+0x180>
movl   $0x0,0x4(%rsp)
jmp    1443 <main+0x273>
movl   $0x1,0x4(%rsp)
mov    %r12,%rdi
call   1050 <fclose@plt>
mov    %rbx,%r12
mov    0x10(%rsp),%rbp
lea    0x420(%rsp),%rbx
mov    %rbp,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    1350 <main+0x180>
mov    %rbp,%rdi
lea    0xbf4(%rip),%rsi
mov    %rbx,%rdx
call   10a0 <fscanf@plt>
cmp    (%r12),%rax
je     1433 <main+0x263>
mov    %rbx,%rbp
mov    %r12,%rbx
lea    0x820(%rsp),%r14
mov    %r14,%rdi
lea    0xc20(%rsp),%rsi
call   1040 <strcpy@plt>
mov    %r14,%rdi
mov    %rbp,%rsi
call   10e0 <strcat@plt>
mov    %r14,%rdi
lea    0xb81(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,%r12
lea    0xbea(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
test   %r12,%r12
je     15e8 <main+0x418>
mov    %r12,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    141b <main+0x24b>
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
call   10b0 <fgets@plt>
cmpl   $0x0,0x4(%rsp)
mov    0x18(%rsp),%rbp
jne    14f6 <main+0x326>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10f0 <fwrite@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    152a <main+0x35a>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10f0 <fwrite@plt>
mov    %r12,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    1413 <main+0x243>
movl   $0x1,0x4(%rsp)
jmp    1560 <main+0x390>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    141b <main+0x24b>
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
call   10b0 <fgets@plt>
mov    %r15,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %eax,%eax
jne    1550 <main+0x380>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r13,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %rbp,%rcx
call   10f0 <fwrite@plt>
jmp    1550 <main+0x380>
lea    0xa64(%rip),%rdi
lea    0xa72(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    $0xfffffffe,%r15d
jmp    1630 <main+0x460>
lea    0xa3f(%rip),%rdi
lea    0xa58(%rip),%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xfffffffd,%r15d
jmp    161b <main+0x44b>
mov    $0xfffffffb,%r15d
lea    0x820(%rsp),%rsi
mov    0x10(%rsp),%rbp
jmp    160d <main+0x43d>
xor    %r15d,%r15d
jmp    1620 <main+0x450>
mov    $0xfffffffc,%r15d
lea    0x20(%rsp),%rsi
lea    0xa5d(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    0x8(%rsp),%rbx
mov    %rbp,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15d,%eax
add    $0x1828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"inputfiles.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Not able to open %s \00"
@.str.3 = [11 x i8] c"symbol.txt\00"
@.str.4 = [16 x i8] c"inputfolder.txt\00"
@.str.5 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.6 = [2 x i8] c"\\\00"
@.str.7 = [5 x i8] c".csv\00"
@.str.8 = [2 x i8] c",\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [34 x i8] c"Extracting symbol :: %s into %s \0A\00"
@.str.11 = [22 x i8] c"Not able to open %s \0A\00"
@.str.12 = [22 x i8] c"Opening the file %s \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca i32*
store i32 0, i32* %1
store i32 0, i32* %8
store i32* null, i32** %10
store i32* null, i32** %11
store i32* null, i32** %12
store i32* null, i32** %13
%15 = call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %15, i32** %10
%16 = load i32*, i32** %10
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %8
br label %155
20: ; preds = %0
%21 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %21, i32** %11
%22 = load i32*, i32** %11
%23 = icmp eq i32* %22, null
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
store i32 -2, i32* %8
br label %155
26: ; preds = %20
%27 = call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %27, i32** %12
%28 = load i32*, i32** %12
%29 = icmp eq i32* %28, null
br i1 %29, label %30, label %32
30: ; preds = %26
%31 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
store i32 -3, i32* %8
br label %155
32: ; preds = %26
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%34 = call i32 @memset(i8* %33, i32 0, i32 1024)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%36 = call i32 @memset(i8* %35, i32 0, i32 1024)
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%38 = call i32 @memset(i8* %37, i32 0, i32 1024)
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%40 = call i32 @memset(i8* %39, i32 0, i32 1024)
%41 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%42 = call i32 @memset(i8* %41, i32 0, i32 1024)
%43 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%44 = call i32 @memset(i8* %43, i32 0, i32 1024)
%45 = load i32*, i32** %12
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%47 = call i64 @fscanf(i32* %45, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %46)
%48 = load i64, i64* @EOF
%49 = icmp ne i64 %47, %48
br i1 %49, label %50, label %53
50: ; preds = %32
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %53
53: ; preds = %50, %32
%54 = load i32*, i32** %12
%55 = call i32 @fclose(i32* %54)
store i32* null, i32** %12
br label %56
56: ; preds = %153, %53
%57 = load i32*, i32** %11
%58 = call i32 @feof(i32* %57)
%59 = icmp ne i32 %58, 0
%60 = xor i1 %59, true
br i1 %60, label %61, label %154
61: ; preds = %56
%62 = load i32*, i32** %11
%63 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%64 = call i64 @fscanf(i32* %62, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %63)
%65 = load i64, i64* @EOF
%66 = icmp ne i64 %64, %65
br i1 %66, label %67, label %153
67: ; preds = %61
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%69 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%70 = call i32 @strcpy(i8* %68, i8* %69)
%71 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%72 = call i32 @strcat(i8* %71, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%74 = call i32 @strcat(i8* %73, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%76 = call i32* @fopen(i8* %75, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
store i32* %76, i32** %13
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%78 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%79 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %77, i8* %78)
%80 = load i32*, i32** %13
%81 = icmp eq i32* %80, null
br i1 %81, label %82, label %85
82: ; preds = %67
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%84 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %83)
store i32 -4, i32* %8
br label %155
85: ; preds = %67
store i32 0, i32* %9
br label %86
86: ; preds = %147, %85
%87 = load i32*, i32** %10
%88 = call i32 @feof(i32* %87)
%89 = icmp ne i32 %88, 0
%90 = xor i1 %89, true
br i1 %90, label %91, label %148
91: ; preds = %86
%92 = load i32*, i32** %10
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%94 = call i64 @fscanf(i32* %92, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %93)
%95 = load i64, i64* @EOF
%96 = icmp ne i64 %94, %95
br i1 %96, label %97, label %147
97: ; preds = %91
%98 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%100 = call i32 @strcpy(i8* %98, i8* %99)
%101 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%102 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%103 = call i32 @strcat(i8* %101, i8* %102)
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%105 = call i32* @fopen(i8* %104, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %105, i32** %14
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%107 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %106)
%108 = load i32*, i32** %14
%109 = icmp eq i32* %108, null
br i1 %109, label %110, label %113
110: ; preds = %97
%111 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%112 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %111)
store i32 -5, i32* %8
br label %155
113: ; preds = %97
br label %114
114: ; preds = %143, %113
%115 = load i32*, i32** %14
%116 = call i32 @feof(i32* %115)
%117 = icmp ne i32 %116, 0
%118 = xor i1 %117, true
br i1 %118, label %119, label %144
119: ; preds = %114
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%121 = load i32*, i32** %14
%122 = call i32 @fgets(i8* %120, i32 1024, i32* %121)
%123 = load i32, i32* %9
%124 = icmp eq i32 %123, 0
br i1 %124, label %125, label %131
125: ; preds = %119
%126 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%127 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%128 = call i32 @strlen(i8* %127)
%129 = load i32*, i32** %13
%130 = call i32 @fwrite(i8* %126, i32 %128, i32 1, i32* %129)
store i32 1, i32* %9
br label %131
131: ; preds = %125, %119
%132 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%133 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%134 = call i8* @strstr(i8* %132, i8* %133)
%135 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%136 = icmp eq i8* %134, %135
br i1 %136, label %137, label %143
137: ; preds = %131
%138 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%139 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%140 = call i32 @strlen(i8* %139)
%141 = load i32*, i32** %13
%142 = call i32 @fwrite(i8* %138, i32 %140, i32 1, i32* %141)
br label %143
143: ; preds = %137, %131
br label %114
144: ; preds = %114
%145 = load i32*, i32** %14
%146 = call i32 @fclose(i32* %145)
br label %147
147: ; preds = %144, %91
br label %86
148: ; preds = %86
%149 = load i32*, i32** %13
%150 = call i32 @fclose(i32* %149)
%151 = load i32*, i32** %10
%152 = call i32 @rewind(i32* %151)
br label %153
153: ; preds = %148, %61
br label %56
154: ; preds = %56
br label %155
155: ; preds = %154, %110, %82, %30, %24, %18
%156 = load i32*, i32** %10
%157 = icmp ne i32* %156, null
br i1 %157, label %158, label %161
158: ; preds = %155
%159 = load i32*, i32** %10
%160 = call i32 @fclose(i32* %159)
br label %161
161: ; preds = %158, %155
%162 = load i32*, i32** %11
%163 = icmp ne i32* %162, null
br i1 %163, label %164, label %167
164: ; preds = %161
%165 = load i32*, i32** %11
%166 = call i32 @fclose(i32* %165)
br label %167
167: ; preds = %164, %161
%168 = load i32*, i32** %12
%169 = icmp ne i32* %168, null
br i1 %169, label %170, label %173
170: ; preds = %167
%171 = load i32*, i32** %12
%172 = call i32 @fclose(i32* %171)
br label %173
173: ; preds = %170, %167
%174 = load i32, i32* %8
ret i32 %174
}

LLVM IR (-O2):
@.str = [15 x i8] c"inputfiles.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [21 x i8] c"Not able to open %s \00"
@.str.3 = [11 x i8] c"symbol.txt\00"
@.str.4 = [16 x i8] c"inputfolder.txt\00"
@.str.5 = [3 x i8] c"%s\00"
@EOF = global i64 0
@.str.6 = [2 x i8] c"\\\00"
@.str.7 = [5 x i8] c".csv\00"
@.str.8 = [2 x i8] c",\00"
@.str.9 = [2 x i8] c"w\00"
@.str.10 = [34 x i8] c"Extracting symbol :: %s into %s \0A\00"
@.str.11 = [22 x i8] c"Not able to open %s \0A\00"
@.str.12 = [22 x i8] c"Opening the file %s \0A\00"
define i32 @main() {
%1 = alloca [1024 x i8]
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%13 = tail call i32* @fopen(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%14 = icmp eq i32* %13, null
br i1 %14, label %15, label %17
15: ; preds = %0
%16 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %120
17: ; preds = %0
%18 = tail call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %23
20: ; preds = %17
%21 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @fclose(i32* %13)
br label %120
23: ; preds = %17
%24 = tail call i32* @fopen(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0))
br label %116
28: ; preds = %23
%29 = call i32 @memset(i8* %7, i32 0, i32 1024)
%30 = call i32 @memset(i8* %8, i32 0, i32 1024)
%31 = call i32 @memset(i8* %9, i32 0, i32 1024)
%32 = call i32 @memset(i8* %10, i32 0, i32 1024)
%33 = call i32 @memset(i8* %11, i32 0, i32 1024)
%34 = call i32 @memset(i8* %12, i32 0, i32 1024)
%35 = call i64 @fscanf(i32* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%36 = load i64, i64* @EOF
%37 = icmp eq i64 %35, %36
br i1 %37, label %40, label %38
38: ; preds = %28
%39 = call i32 @strcat(i8* %7, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
br label %40
40: ; preds = %38, %28
%41 = call i32 @fclose(i32* %24)
%42 = call i32 @feof(i32* %18)
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %116
44: ; preds = %40, %109
%45 = call i64 @fscanf(i32* %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %11)
%46 = load i64, i64* @EOF
%47 = icmp eq i64 %45, %46
br i1 %47, label %109, label %48
48: ; preds = %44
%49 = call i32 @strcpy(i8* %10, i8* %11)
%50 = call i32 @strcat(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
%51 = call i32 @strcat(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.8, i64 0, i64 0))
%52 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%53 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.10, i64 0, i64 0), i8* %11, i8* %10)
%54 = icmp eq i32* %52, null
br i1 %54, label %112, label %55
55: ; preds = %48
%56 = call i32 @feof(i32* %13)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %106
58: ; preds = %55, %102
%59 = phi i32 [ %103, %102 ], [ 0, %55 ]
%60 = call i64 @fscanf(i32* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i8* %9)
%61 = load i64, i64* @EOF
%62 = icmp eq i64 %60, %61
br i1 %62, label %102, label %63
63: ; preds = %58
%64 = call i32 @strcpy(i8* %8, i8* %7)
%65 = call i32 @strcat(i8* %8, i8* %9)
%66 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%67 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.12, i64 0, i64 0), i8* %8)
%68 = icmp eq i32* %66, null
br i1 %68, label %112, label %69
69: ; preds = %63
%70 = call i32 @feof(i32* %66)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %99
72: ; preds = %69
%73 = call i32 @fgets(i8* %12, i32 1024, i32* %66)
%74 = icmp eq i32 %59, 0
br i1 %74, label %75, label %78
75: ; preds = %72
%76 = call i32 @strlen(i8* %12)
%77 = call i32 @fwrite(i8* %12, i32 %76, i32 1, i32* %52)
br label %78
78: ; preds = %75, %72
%79 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %11)
%80 = call i32 @strncmp(i8* %12, i8* %11, i64 %79)
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %85
82: ; preds = %78
%83 = call i32 @strlen(i8* %12)
%84 = call i32 @fwrite(i8* %12, i32 %83, i32 1, i32* %52)
br label %85
85: ; preds = %82, %78
%86 = call i32 @feof(i32* %66)
%87 = icmp eq i32 %86, 0
br i1 %87, label %88, label %99
88: ; preds = %85, %96
%89 = call i32 @fgets(i8* %12, i32 1024, i32* %66)
%90 = call i64 bitcast (i32 (i8*)* @strlen to i64 (i8*)*)(i8* %11)
%91 = call i32 @strncmp(i8* %12, i8* %11, i64 %90)
%92 = icmp eq i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %88
%94 = call i32 @strlen(i8* %12)
%95 = call i32 @fwrite(i8* %12, i32 %94, i32 1, i32* %52)
br label %96
96: ; preds = %93, %88
%97 = call i32 @feof(i32* %66)
%98 = icmp eq i32 %97, 0
br i1 %98, label %88, label %99
99: ; preds = %96, %85, %69
%100 = phi i32 [ %59, %69 ], [ 1, %85 ], [ 1, %96 ]
%101 = call i32 @fclose(i32* %66)
br label %102
102: ; preds = %99, %58
%103 = phi i32 [ %59, %58 ], [ %100, %99 ]
%104 = call i32 @feof(i32* %13)
%105 = icmp eq i32 %104, 0
br i1 %105, label %58, label %106
106: ; preds = %102, %55
%107 = call i32 @fclose(i32* %52)
%108 = call i32 @rewind(i32* %13)
br label %109
109: ; preds = %106, %44
%110 = call i32 @feof(i32* %18)
%111 = icmp eq i32 %110, 0
br i1 %111, label %44, label %116
112: ; preds = %48, %63
%113 = phi i8* [ %8, %63 ], [ %10, %48 ]
%114 = phi i32 [ -5, %63 ], [ -4, %48 ]
%115 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.11, i64 0, i64 0), i8* %113)
br label %116
116: ; preds = %109, %112, %40, %26
%117 = phi i32 [ 0, %40 ], [ -3, %26 ], [ %114, %112 ], [ 0, %109 ]
%118 = call i32 @fclose(i32* %13)
%119 = call i32 @fclose(i32* %18)
br label %120
120: ; preds = %20, %15, %116
%121 = phi i32 [ -1, %15 ], [ %117, %116 ], [ -2, %20 ]
ret i32 %121
}