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

/* Variables and functions */
scalar_t__ ENOENT;
scalar_t__ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ free(char *);
scalar_t__ malloc(int);
scalar_t__ stat(char const *, struct stat *);
char *strchr(char *, char);
int strlen(char *const);
int /*<<< orphan*/ strncat(char *const, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ traceEvent(int /*<<< orphan*/, char *, int, char *, ...);
int readConfFile(const char *filename, char *const linebuffer) {
  struct stat stats;
  FILE *fd;
  char *buffer = NULL;
  buffer = (char *)malloc(1024);
  if (!buffer) {
    traceEvent(0,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/heads/"
               "master/n2n_utils.c",
               39, "Unable to allocate memory");
    return -1;
  }
  if (stat(filename, &stats)) {
    if (errno == ENOENT)
      traceEvent(0,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/"
                 "heads/master/n2n_utils.c",
                 46, "parameter file %s not found/unable to access\n",
                 filename);
    else
      traceEvent(0,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/"
                 "heads/master/n2n_utils.c",
                 48, "cannot stat file %s, errno=%d\n", filename, errno);
    free(buffer);
    return -1;
  }
  fd = fopen(filename, "rb");
  if (!fd) {
    traceEvent(0,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/heads/"
               "master/n2n_utils.c",
               56, "Unable to open parameter file '%s' (%d)...\n", filename,
               errno);
    free(buffer);
    return -1;
  }
  while (fgets(buffer, 1024, fd)) {
    char *p = NULL;
    p = strchr(buffer, '#');
    if (p)
      *p = '\0';
    p = strchr(buffer, '\n');
    if (p)
      *p = '\0';
    p = buffer;
    while (*p == ' ' && *p != '\0')
      ++p;
    if (p != buffer)
      strncpy(buffer, p, strlen(p) + 1);
    while (strlen(buffer) && buffer[strlen(buffer) - 1] == ' ')
      buffer[strlen(buffer) - 1] = '\0';
    if (strchr(buffer, '@')) {
      traceEvent(0,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/"
                 "heads/master/n2n_utils.c",
                 88, "@file in file nesting is not supported\n");
      free(buffer);
      return -1;
    }
    if ((strlen(linebuffer) + strlen(buffer) + 2) < 4096) {
      strncat(linebuffer, " ", 1);
      strncat(linebuffer, buffer, strlen(buffer));
    } else {
      traceEvent(0,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/"
                 "heads/master/n2n_utils.c",
                 99, "too many argument");
      free(buffer);
      return -1;
    }
  }
  free(buffer);
  fclose(fd);
  return 0;
}


x86 assembly (clang, -O0):
<readConfFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movq   $0x0,-0x30(%rbp)
mov    $0x400,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    120c <readConfFile+0x5c>
xor    %edi,%edi
lea    0xe13(%rip),%rsi
mov    $0x27,%edx
lea    0xe90(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <readConfFile+0x3c9>
mov    -0x10(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   10a0 <stat@plt>
cmp    $0x0,%rax
je     12a1 <readConfFile+0xf1>
mov    0x2db6(%rip),%rax
mov    (%rax),%rax
mov    0x2d9c(%rip),%rcx
cmp    (%rcx),%rax
jne    1262 <readConfFile+0xb2>
mov    -0x10(%rbp),%r8
xor    %edi,%edi
lea    0xdb6(%rip),%rsi
mov    $0x2e,%edx
lea    0xe4d(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
jmp    128c <readConfFile+0xdc>
mov    -0x10(%rbp),%r8
mov    0x2d73(%rip),%rax
mov    (%rax),%r9
xor    %edi,%edi
lea    0xd87(%rip),%rsi
mov    $0x30,%edx
lea    0xe4c(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <readConfFile+0x3c9>
mov    -0x10(%rbp),%rdi
lea    0xe44(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    12ff <readConfFile+0x14f>
mov    -0x10(%rbp),%r8
mov    0x2d15(%rip),%rax
mov    (%rax),%r9
xor    %edi,%edi
lea    0xd29(%rip),%rsi
mov    $0x38,%edx
lea    0xe10(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <readConfFile+0x3c9>
jmp    1304 <readConfFile+0x154>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x400,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
je     1560 <readConfFile+0x3b0>
movq   $0x0,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x23,%esi
call   1070 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     134c <readConfFile+0x19c>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1370 <readConfFile+0x1c0>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x39(%rbp)
jne    139d <readConfFile+0x1ed>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x39(%rbp)
mov    -0x39(%rbp),%al
test   $0x1,%al
jne    13ad <readConfFile+0x1fd>
jmp    13be <readConfFile+0x20e>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1378 <readConfFile+0x1c8>
mov    -0x38(%rbp),%rax
cmp    -0x30(%rbp),%rax
je     13f7 <readConfFile+0x247>
mov    -0x30(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1040 <strncpy@plt>
jmp    13fc <readConfFile+0x24c>
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x51(%rbp)
je     143f <readConfFile+0x28f>
mov    -0x30(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x60(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
sete   %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
test   $0x1,%al
jne    144f <readConfFile+0x29f>
jmp    1475 <readConfFile+0x2c5>
mov    -0x30(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x68(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    13fc <readConfFile+0x24c>
mov    -0x30(%rbp),%rdi
mov    $0x40,%esi
call   1070 <strchr@plt>
cmp    $0x0,%rax
je     14be <readConfFile+0x30e>
xor    %edi,%edi
lea    0xb6a(%rip),%rsi
mov    $0x58,%edx
lea    0xc7d(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <readConfFile+0x3c9>
mov    -0x18(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x6c(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x6c(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
cmp    $0x1000,%eax
jge    152a <readConfFile+0x37a>
mov    -0x18(%rbp),%rdi
lea    0xc54(%rip),%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    -0x18(%rbp),%rax
mov    %rax,-0x80(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x78(%rbp)
mov    -0x30(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x80(%rbp),%rdi
mov    -0x78(%rbp),%rsi
mov    %eax,%edx
call   1080 <strncat@plt>
jmp    155b <readConfFile+0x3ab>
xor    %edi,%edi
lea    0xacd(%rip),%rsi
mov    $0x63,%edx
lea    0xc0a(%rip),%rcx
mov    $0x0,%al
call   10b0 <traceEvent@plt>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1579 <readConfFile+0x3c9>
jmp    1304 <readConfFile+0x154>
mov    -0x30(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readConfFile>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r12
mov    $0x400,%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     1221 <readConfFile+0x71>
mov    %rax,%r13
mov    %rsp,%rsi
mov    %r12,%rdi
call   10a0 <stat@plt>
test   %rax,%rax
je     1242 <readConfFile+0x92>
mov    0x2df6(%rip),%rax
mov    (%rax),%r9
mov    0x2ddc(%rip),%rax
cmp    (%rax),%r9
jne    13a7 <readConfFile+0x1f7>
lea    0xdfc(%rip),%rsi
lea    0xe98(%rip),%rcx
xor    %edi,%edi
mov    $0x2e,%edx
mov    %r12,%r8
xor    %eax,%eax
call   10b0 <traceEvent@plt>
jmp    13e7 <readConfFile+0x237>
lea    0xdd8(%rip),%rsi
lea    0xe5a(%rip),%rcx
xor    %edi,%edi
mov    $0x27,%edx
xor    %eax,%eax
call   10b0 <traceEvent@plt>
jmp    13ef <readConfFile+0x23f>
lea    0xea7(%rip),%rsi
mov    %r12,%rdi
call   10d0 <fopen@plt>
test   %rax,%rax
je     13be <readConfFile+0x20e>
mov    %rax,%r15
mov    %r13,%rdi
mov    $0x400,%esi
mov    %rax,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
je     1393 <readConfFile+0x1e3>
mov    %r13,%rbp
add    $0xffffffffffffffff,%rbp
lea    0xec3(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    $0x23,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     12a5 <readConfFile+0xf5>
movb   $0x0,(%rax)
mov    %r13,%rdi
mov    $0xa,%esi
call   1070 <strchr@plt>
test   %rax,%rax
je     12ba <readConfFile+0x10a>
movb   $0x0,(%rax)
xor    %ebx,%ebx
nopl   0x0(%rax)
cmpb   $0x20,0x0(%r13,%rbx,1)
lea    0x1(%rbx),%rbx
je     12c0 <readConfFile+0x110>
cmp    $0x1,%rbx
je     12f0 <readConfFile+0x140>
add    %rbp,%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
lea    0x1(%rax),%edx
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <strncpy@plt>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
je     1320 <readConfFile+0x170>
mov    %r13,%rdi
call   1060 <strlen@plt>
cltq
cmpb   $0x20,-0x1(%rax,%r13,1)
jne    1320 <readConfFile+0x170>
mov    %r13,%rdi
call   1060 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r13,1)
jmp    12f0 <readConfFile+0x140>
mov    %r13,%rdi
mov    $0x40,%esi
call   1070 <strchr@plt>
test   %rax,%rax
jne    1403 <readConfFile+0x253>
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebx
mov    %r13,%rdi
call   1060 <strlen@plt>
add    %ebx,%eax
cmp    $0xffd,%eax
jg     141a <readConfFile+0x26a>
mov    %r14,%rdi
mov    %r12,%rsi
mov    $0x1,%edx
call   1080 <strncat@plt>
mov    %r13,%rdi
call   1060 <strlen@plt>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1080 <strncat@plt>
mov    %r13,%rdi
mov    $0x400,%esi
mov    %r15,%rdx
call   1090 <fgets@plt>
test   %rax,%rax
jne    1290 <readConfFile+0xe0>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
xor    %eax,%eax
jmp    13f4 <readConfFile+0x244>
lea    0xc52(%rip),%rsi
lea    0xd1c(%rip),%rcx
xor    %edi,%edi
mov    $0x30,%edx
jmp    13dd <readConfFile+0x22d>
mov    0x2c1b(%rip),%rax
mov    (%rax),%r9
lea    0xc31(%rip),%rsi
lea    0xd1d(%rip),%rcx
xor    %edi,%edi
mov    $0x38,%edx
mov    %r12,%r8
xor    %eax,%eax
call   10b0 <traceEvent@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbf6(%rip),%rsi
lea    0xd0e(%rip),%rcx
xor    %edi,%edi
mov    $0x58,%edx
jmp    142f <readConfFile+0x27f>
lea    0xbdf(%rip),%rsi
lea    0xd21(%rip),%rcx
xor    %edi,%edi
mov    $0x63,%edx
xor    %eax,%eax
call   10b0 <traceEvent@plt>
jmp    13e7 <readConfFile+0x237>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/heads/master/n2n_utils.c\00"
@.str.1 = [26 x i8] c"Unable to allocate memory\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.2 = [46 x i8] c"parameter file %s not found/unable to access\0A\00"
@.str.3 = [31 x i8] c"cannot stat file %s, errno=%d\0A\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [44 x i8] c"Unable to open parameter file '%s' (%d)...\0A\00"
@.str.6 = [40 x i8] c"@file in file nesting is not supported\0A\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [18 x i8] c"too many argument\00"
define i32 @readConfFile(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca %struct.stat
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* null, i8** %8
%10 = call i64 @malloc(i32 1024)
%11 = inttoptr i64 %10 to i8*
store i8* %11, i8** %8
%12 = load i8*, i8** %8
%13 = icmp ne i8* %12, null
br i1 %13, label %16, label %14
14: ; preds = %2
%15 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %151
16: ; preds = %2
%17 = load i8*, i8** %4
%18 = call i64 @stat(i8* %17, %struct.stat* %6)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %34
20: ; preds = %16
%21 = load i64, i64* @errno
%22 = load i64, i64* @ENOENT
%23 = icmp eq i64 %21, %22
br i1 %23, label %24, label %27
24: ; preds = %20
%25 = load i8*, i8** %4
%26 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %25)
br label %31
27: ; preds = %20
%28 = load i8*, i8** %4
%29 = load i64, i64* @errno
%30 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 48, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %28, i64 %29)
br label %31
31: ; preds = %27, %24
%32 = load i8*, i8** %8
%33 = call i32 @free(i8* %32)
store i32 -1, i32* %3
br label %151
34: ; preds = %16
%35 = load i8*, i8** %4
%36 = call i32* @fopen(i8* %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
store i32* %36, i32** %7
%37 = load i32*, i32** %7
%38 = icmp ne i32* %37, null
br i1 %38, label %45, label %39
39: ; preds = %34
%40 = load i8*, i8** %4
%41 = load i64, i64* @errno
%42 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* %40, i64 %41)
%43 = load i8*, i8** %8
%44 = call i32 @free(i8* %43)
store i32 -1, i32* %3
br label %151
45: ; preds = %34
br label %46
46: ; preds = %145, %45
%47 = load i8*, i8** %8
%48 = load i32*, i32** %7
%49 = call i64 @fgets(i8* %47, i32 1024, i32* %48)
%50 = icmp ne i64 %49, 0
br i1 %50, label %51, label %146
51: ; preds = %46
store i8* null, i8** %9
%52 = load i8*, i8** %8
%53 = call i8* @strchr(i8* %52, i8 signext 35)
store i8* %53, i8** %9
%54 = load i8*, i8** %9
%55 = icmp ne i8* %54, null
br i1 %55, label %56, label %58
56: ; preds = %51
%57 = load i8*, i8** %9
store i8 0, i8* %57
br label %58
58: ; preds = %56, %51
%59 = load i8*, i8** %8
%60 = call i8* @strchr(i8* %59, i8 signext 10)
store i8* %60, i8** %9
%61 = load i8*, i8** %9
%62 = icmp ne i8* %61, null
br i1 %62, label %63, label %65
63: ; preds = %58
%64 = load i8*, i8** %9
store i8 0, i8* %64
br label %65
65: ; preds = %63, %58
%66 = load i8*, i8** %8
store i8* %66, i8** %9
br label %67
67: ; preds = %79, %65
%68 = load i8*, i8** %9
%69 = load i8, i8* %68
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 32
br i1 %71, label %72, label %77
72: ; preds = %67
%73 = load i8*, i8** %9
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp ne i32 %75, 0
br label %77
77: ; preds = %72, %67
%78 = phi i1 [ false, %67 ], [ %76, %72 ]
br i1 %78, label %79, label %82
79: ; preds = %77
%80 = load i8*, i8** %9
%81 = getelementptr inbounds i8, i8* %80, i32 1
store i8* %81, i8** %9
br label %67
82: ; preds = %77
%83 = load i8*, i8** %9
%84 = load i8*, i8** %8
%85 = icmp ne i8* %83, %84
br i1 %85, label %86, label %93
86: ; preds = %82
%87 = load i8*, i8** %8
%88 = load i8*, i8** %9
%89 = load i8*, i8** %9
%90 = call i32 @strlen(i8* %89)
%91 = add nsw i32 %90, 1
%92 = call i32 @strncpy(i8* %87, i8* %88, i32 %91)
br label %93
93: ; preds = %86, %82
br label %94
94: ; preds = %110, %93
%95 = load i8*, i8** %8
%96 = call i32 @strlen(i8* %95)
%97 = icmp ne i32 %96, 0
br i1 %97, label %98, label %108
98: ; preds = %94
%99 = load i8*, i8** %8
%100 = load i8*, i8** %8
%101 = call i32 @strlen(i8* %100)
%102 = sub nsw i32 %101, 1
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i8, i8* %99, i64 %103
%105 = load i8, i8* %104
%106 = sext i8 %105 to i32
%107 = icmp eq i32 %106, 32
br label %108
108: ; preds = %98, %94
%109 = phi i1 [ false, %94 ], [ %107, %98 ]
br i1 %109, label %110, label %117
110: ; preds = %108
%111 = load i8*, i8** %8
%112 = load i8*, i8** %8
%113 = call i32 @strlen(i8* %112)
%114 = sub nsw i32 %113, 1
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds i8, i8* %111, i64 %115
store i8 0, i8* %116
br label %94
117: ; preds = %108
%118 = load i8*, i8** %8
%119 = call i8* @strchr(i8* %118, i8 signext 64)
%120 = icmp ne i8* %119, null
br i1 %120, label %121, label %125
121: ; preds = %117
%122 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 88, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%123 = load i8*, i8** %8
%124 = call i32 @free(i8* %123)
store i32 -1, i32* %3
br label %151
125: ; preds = %117
%126 = load i8*, i8** %5
%127 = call i32 @strlen(i8* %126)
%128 = load i8*, i8** %8
%129 = call i32 @strlen(i8* %128)
%130 = add nsw i32 %127, %129
%131 = add nsw i32 %130, 2
%132 = icmp slt i32 %131, 4096
br i1 %132, label %133, label %141
133: ; preds = %125
%134 = load i8*, i8** %5
%135 = call i32 @strncat(i8* %134, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%136 = load i8*, i8** %5
%137 = load i8*, i8** %8
%138 = load i8*, i8** %8
%139 = call i32 @strlen(i8* %138)
%140 = call i32 @strncat(i8* %136, i8* %137, i32 %139)
br label %145
141: ; preds = %125
%142 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 99, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%143 = load i8*, i8** %8
%144 = call i32 @free(i8* %143)
store i32 -1, i32* %3
br label %151
145: ; preds = %133
br label %46
146: ; preds = %46
%147 = load i8*, i8** %8
%148 = call i32 @free(i8* %147)
%149 = load i32*, i32** %7
%150 = call i32 @fclose(i32* %149)
store i32 0, i32* %3
br label %151
151: ; preds = %146, %141, %121, %39, %31, %14
%152 = load i32, i32* %3
ret i32 %152
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [137 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/lukablurr/n2n_v3/refs/heads/master/n2n_utils.c\00"
@.str.1 = [26 x i8] c"Unable to allocate memory\00"
@errno = global i64 0
@ENOENT = global i64 0
@.str.2 = [46 x i8] c"parameter file %s not found/unable to access\0A\00"
@.str.3 = [31 x i8] c"cannot stat file %s, errno=%d\0A\00"
@.str.4 = [3 x i8] c"rb\00"
@.str.5 = [44 x i8] c"Unable to open parameter file '%s' (%d)...\0A\00"
@.str.6 = [40 x i8] c"@file in file nesting is not supported\0A\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [18 x i8] c"too many argument\00"
define i32 @readConfFile(i8* %0, i8* %1) {
%3 = alloca %struct.stat
%4 = bitcast %struct.stat* %3 to i8*
%5 = tail call i64 @malloc(i32 1024)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i64 %5, 0
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = tail call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 39, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %93
10: ; preds = %2
%11 = call i64 @stat(i8* %0, %struct.stat* %3)
%12 = icmp eq i64 %11, 0
br i1 %12, label %23, label %13
13: ; preds = %10
%14 = load i64, i64* @errno
%15 = load i64, i64* @ENOENT
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 46, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %21
19: ; preds = %13
%20 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 48, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i8* %0, i64 %14)
br label %21
21: ; preds = %19, %17
%22 = call i32 @free(i8* %6)
br label %93
23: ; preds = %10
%24 = call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = call i64 @fgets(i8* %6, i32 1024, i32* %24)
%28 = icmp eq i64 %27, 0
br i1 %28, label %90, label %33
29: ; preds = %23
%30 = load i64, i64* @errno
%31 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.5, i64 0, i64 0), i8* %0, i64 %30)
%32 = call i32 @free(i8* %6)
br label %93
33: ; preds = %26, %81
%34 = call i8* @strchr(i8* %6, i8 signext 35)
%35 = icmp eq i8* %34, null
br i1 %35, label %37, label %36
36: ; preds = %33
store i8 0, i8* %34
br label %37
37: ; preds = %36, %33
%38 = call i8* @strchr(i8* %6, i8 signext 10)
%39 = icmp eq i8* %38, null
br i1 %39, label %41, label %40
40: ; preds = %37
store i8 0, i8* %38
br label %41
41: ; preds = %40, %37
br label %42
42: ; preds = %41, %42
%43 = phi i8* [ %46, %42 ], [ %6, %41 ]
%44 = load i8, i8* %43
%45 = icmp eq i8 %44, 32
%46 = getelementptr inbounds i8, i8* %43, i64 1
br i1 %45, label %42, label %47
47: ; preds = %42
%48 = icmp eq i8* %43, %6
br i1 %48, label %53, label %49
49: ; preds = %47
%50 = call i32 @strlen(i8* %43)
%51 = add nsw i32 %50, 1
%52 = call i32 @strncpy(i8* %6, i8* %43, i32 %51)
br label %53
53: ; preds = %49, %47
%54 = call i32 @strlen(i8* %6)
%55 = icmp eq i32 %54, 0
br i1 %55, label %70, label %56
56: ; preds = %53, %63
%57 = call i32 @strlen(i8* %6)
%58 = add nsw i32 %57, -1
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds i8, i8* %6, i64 %59
%61 = load i8, i8* %60
%62 = icmp eq i8 %61, 32
br i1 %62, label %63, label %70
63: ; preds = %56
%64 = call i32 @strlen(i8* %6)
%65 = add nsw i32 %64, -1
%66 = sext i32 %65 to i64
%67 = getelementptr inbounds i8, i8* %6, i64 %66
store i8 0, i8* %67
%68 = call i32 @strlen(i8* %6)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %56
70: ; preds = %56, %63, %53
%71 = call i8* @strchr(i8* %6, i8 signext 64)
%72 = icmp eq i8* %71, null
br i1 %72, label %76, label %73
73: ; preds = %70
%74 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 88, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0))
%75 = call i32 @free(i8* %6)
br label %93
76: ; preds = %70
%77 = call i32 @strlen(i8* %1)
%78 = call i32 @strlen(i8* %6)
%79 = add nsw i32 %78, %77
%80 = icmp slt i32 %79, 4094
br i1 %80, label %81, label %87
81: ; preds = %76
%82 = call i32 @strncat(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0), i32 1)
%83 = call i32 @strlen(i8* %6)
%84 = call i32 @strncat(i8* %1, i8* %6, i32 %83)
%85 = call i64 @fgets(i8* %6, i32 1024, i32* %24)
%86 = icmp eq i64 %85, 0
br i1 %86, label %90, label %33
87: ; preds = %76
%88 = call i32 (i32, i8*, i32, i8*, ...) @traceEvent(i32 0, i8* getelementptr inbounds ([137 x i8], [137 x i8]* @.str, i64 0, i64 0), i32 99, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%89 = call i32 @free(i8* %6)
br label %93
90: ; preds = %81, %26
%91 = call i32 @free(i8* %6)
%92 = call i32 @fclose(i32* %24)
br label %93
93: ; preds = %73, %87, %90, %29, %21, %8
%94 = phi i32 [ -1, %21 ], [ 0, %90 ], [ -1, %29 ], [ -1, %8 ], [ -1, %87 ], [ -1, %73 ]
ret i32 %94
}