#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ errhandler(int, char *, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
scalar_t__ isalnum(int);
scalar_t__ isspace(int);
int /*<<< orphan*/ sprintf(char *, char *, char *, char const *, char const *,
                           ...);
scalar_t__ strcmp(char const *, char *);
int strlen(char *);
char *find_string(const char *szFileName, const char *szVarName) {
  int nLine = 0;
  int i;
  FILE *fh = NULL;
  static char szBuffer[1024];
  char *szLine = szBuffer;
  char *szValue = NULL;
  char *szName = NULL;
  fh = fopen(szFileName, "rt");
  if (fh == 0) {
    char szTmp[80];
    if (0)
      sprintf(szTmp, " %s  File: %s   Variable: %s  Line: %d",
              "Could not open file", szFileName, szVarName, 0);
    else
      sprintf(szTmp, " %s  File: %s   Variable: %s ", "Could not open file",
              szFileName, szVarName);
    errhandler(113,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
               "master/Worksheet4/helper.c",
               szTmp);
  };
  while (!feof(fh)) {
    if (fgets(szLine, 1024, fh))
      ;
    ++nLine;
    for (i = 0; i < strlen(szLine); i++)
      if (szLine[i] == '#') {
        szLine[i] = '\0';
        break;
      }
    while (isspace((int)*szLine) && *szLine)
      ++szLine;
    if (strlen(szLine) == 0)
      continue;
    szName = szLine;
    szValue = szLine;
    while ((isalnum((int)*szValue) || *szValue == '_') && *szValue)
      ++szValue;
    if (*szValue == '\n' || strlen(szValue) == 0) {
      char szTmp[80];
      if (nLine)
        sprintf(szTmp, " %s  File: %s   Variable: %s  Line: %d", "wrong format",
                szFileName, szName, nLine);
      else
        sprintf(szTmp, " %s  File: %s   Variable: %s ", "wrong format",
                szFileName, szName);
      errhandler(140,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
                 "master/Worksheet4/helper.c",
                 szTmp);
    };
    *szValue = 0;
    ++szValue;
    if (strcmp(szVarName, szName))
      continue;
    while (isspace((int)*szValue))
      ++szValue;
    if (*szValue == '\n' || strlen(szValue) == 0) {
      char szTmp[80];
      if (nLine)
        sprintf(szTmp, " %s  File: %s   Variable: %s  Line: %d", "wrong format",
                szFileName, szName, nLine);
      else
        sprintf(szTmp, " %s  File: %s   Variable: %s ", "wrong format",
                szFileName, szName);
      errhandler(151,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
                 "master/Worksheet4/helper.c",
                 szTmp);
    };
    fclose(fh);
    return szValue;
  }
  {
    char szTmp[80];
    if (nLine)
      sprintf(szTmp, " %s  File: %s   Variable: %s  Line: %d",
              "variable not found", szFileName, szVarName, nLine);
    else
      sprintf(szTmp, " %s  File: %s   Variable: %s ", "variable not found",
              szFileName, szVarName);
    errhandler(157,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/"
               "master/Worksheet4/helper.c",
               szTmp);
  };
  return NULL;
}


x86 assembly (clang, -O0):
<find_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movq   $0x0,-0x28(%rbp)
lea    0x2eb7(%rip),%rax
mov    %rax,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe18(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1238 <find_string+0x98>
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xdf1(%rip),%rsi
lea    0xe08(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x90(%rbp),%rdx
mov    $0x71,%edi
lea    0xe02(%rip),%rsi
call   1030 <errhandler@plt>
jmp    123d <find_string+0x9d>
mov    -0x28(%rbp),%rdi
call   10a0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    125b <find_string+0xbb>
jmp    156b <find_string+0x3cb>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
cmp    $0x0,%rax
je     127c <find_string+0xdc>
jmp    127c <find_string+0xdc>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,%ecx
mov    -0x184(%rbp),%eax
cmp    %ecx,%eax
jge    12e7 <find_string+0x147>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    12d4 <find_string+0x134>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    12e7 <find_string+0x147>
jmp    12d9 <find_string+0x139>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    128c <find_string+0xec>
jmp    12ec <find_string+0x14c>
mov    -0x30(%rbp),%rax
movsbl (%rax),%edi
call   1070 <isspace@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x185(%rbp)
je     1320 <find_string+0x180>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x185(%rbp)
mov    -0x185(%rbp),%al
test   $0x1,%al
jne    1333 <find_string+0x193>
jmp    1344 <find_string+0x1a4>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12ec <find_string+0x14c>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    135b <find_string+0x1bb>
jmp    123d <find_string+0x9d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%rax
jne    1399 <find_string+0x1f9>
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5f,%ecx
mov    %al,-0x186(%rbp)
jne    13ac <find_string+0x20c>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x186(%rbp)
mov    -0x186(%rbp),%al
test   $0x1,%al
jne    13bf <find_string+0x21f>
jmp    13d0 <find_string+0x230>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    136b <find_string+0x1cb>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     13f2 <find_string+0x252>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1465 <find_string+0x2c5>
cmpl   $0x0,-0x1c(%rbp)
je     1429 <find_string+0x289>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xcad(%rip),%rsi
lea    0xccd(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    144d <find_string+0x2ad>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
lea    0xbc4(%rip),%rsi
lea    0xca4(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xe0(%rbp),%rdx
mov    $0x8c,%edi
lea    0xbd5(%rip),%rsi
call   1030 <errhandler@plt>
mov    -0x38(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x40(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
je     1494 <find_string+0x2f4>
jmp    123d <find_string+0x9d>
jmp    1499 <find_string+0x2f9>
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
je     14c0 <find_string+0x320>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    1499 <find_string+0x2f9>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     14e2 <find_string+0x342>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1555 <find_string+0x3b5>
cmpl   $0x0,-0x1c(%rbp)
je     1519 <find_string+0x379>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xbbd(%rip),%rsi
lea    0xbdd(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    153d <find_string+0x39d>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
lea    0xad4(%rip),%rsi
lea    0xbb4(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x130(%rbp),%rdx
mov    $0x97,%edi
lea    0xae5(%rip),%rsi
call   1030 <errhandler@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15e6 <find_string+0x446>
cmpl   $0x0,-0x1c(%rbp)
je     15a2 <find_string+0x402>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xb34(%rip),%rsi
lea    0xb61(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    15c6 <find_string+0x426>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xa4b(%rip),%rsi
lea    0xb38(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x180(%rbp),%rdx
mov    $0x9d,%edi
lea    0xa5c(%rip),%rsi
call   1030 <errhandler@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x190,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x68,%rsp
mov    %rsi,%r15
lea    0xe48(%rip),%rsi
mov    %rdi,0x8(%rsp)
call   10b0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1203 <find_string+0x63>
lea    0xe32(%rip),%rsi
lea    0xe49(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    0x8(%rsp),%rcx
mov    %r15,%r8
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xe3f(%rip),%rsi
mov    $0x71,%edi
mov    %rbx,%rdx
call   1030 <errhandler@plt>
mov    %r12,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
je     1236 <find_string+0x96>
lea    0xded(%rip),%rsi
lea    0xeda(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    0x8(%rsp),%rcx
mov    %r15,%r8
xor    %eax,%eax
call   10c0 <sprintf@plt>
jmp    1421 <find_string+0x281>
lea    0x2e43(%rip),%rbx
xor    %r14d,%r14d
jmp    12b5 <find_string+0x115>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
lea    0xe64(%rip),%rsi
lea    0xe84(%rip),%rdx
mov    0x8(%rsp),%rcx
mov    %rbx,%r8
mov    %r14d,%r9d
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    $0x8c,%edi
lea    0xdb1(%rip),%rsi
mov    %rbp,%rdx
call   1030 <errhandler@plt>
movb   $0x0,0x0(%r13)
mov    %r15,%rdi
mov    %rbx,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
je     1390 <find_string+0x1f0>
mov    %r12,%rdi
call   10a0 <feof@plt>
test   %eax,%eax
jne    13fc <find_string+0x25c>
mov    %rbx,%rdi
mov    $0x400,%esi
mov    %r12,%rdx
call   1080 <fgets@plt>
mov    %rbx,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jle    1304 <find_string+0x164>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmpb   $0x23,(%rbx,%rbp,1)
je     1300 <find_string+0x160>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1050 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     12e0 <find_string+0x140>
jmp    1304 <find_string+0x164>
nopl   0x0(%rax,%rax,1)
movb   $0x0,(%rbx,%rbp,1)
movsbl (%rbx),%edi
nopw   0x0(%rax,%rax,1)
call   1070 <isspace@plt>
test   %rax,%rax
je     1330 <find_string+0x190>
cmpb   $0x0,(%rbx)
je     1330 <find_string+0x190>
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1310 <find_string+0x170>
nopl   0x0(%rax)
add    $0x1,%r14d
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%r13
test   %eax,%eax
jne    1358 <find_string+0x1b8>
jmp    12a5 <find_string+0x105>
nopl   0x0(%rax,%rax,1)
test   %cl,%cl
je     137a <find_string+0x1da>
add    $0x1,%r13
movsbl 0x0(%r13),%edi
call   1060 <isalnum@plt>
movzbl 0x0(%r13),%ecx
test   %rax,%rax
jne    1350 <find_string+0x1b0>
cmp    $0x5f,%cl
je     1354 <find_string+0x1b4>
cmp    $0xa,%cl
je     1250 <find_string+0xb0>
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jne    128c <find_string+0xec>
jmp    1250 <find_string+0xb0>
nop
movsbl 0x1(%r13),%edi
add    $0x1,%r13
call   1070 <isspace@plt>
test   %rax,%rax
jne    1390 <find_string+0x1f0>
cmpb   $0xa,0x0(%r13)
je     13b6 <find_string+0x216>
mov    %r13,%rdi
call   1050 <strlen@plt>
test   %eax,%eax
jne    13f2 <find_string+0x252>
lea    0xd06(%rip),%rsi
lea    0xd26(%rip),%rdx
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    0x8(%rsp),%rcx
mov    %rbx,%r8
mov    %r14d,%r9d
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xc50(%rip),%rsi
mov    $0x97,%edi
mov    %r15,%rdx
call   1030 <errhandler@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
jmp    143a <find_string+0x29a>
lea    0xcc0(%rip),%rsi
lea    0xced(%rip),%rdx
lea    0x10(%rsp),%rdi
mov    0x8(%rsp),%rcx
mov    %r15,%r8
mov    %r14d,%r9d
xor    %eax,%eax
call   10c0 <sprintf@plt>
lea    0xc0d(%rip),%rsi
lea    0x10(%rsp),%rdx
mov    $0x9d,%edi
call   1030 <errhandler@plt>
xor    %r13d,%r13d
mov    %r13,%rax
add    $0x68,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@find_string.szBuffer = internal global [1024 x i8] zeroinitializer
@.str = [3 x i8] c"rt\00"
@.str.1 = [30 x i8] c" %s File: %s Variable: %s \00"
@.str.2 = [20 x i8] c"Could not open file\00"
@.str.3 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Worksheet4/helper.c\00"
@.str.4 = [39 x i8] c" %s File: %s Variable: %s Line: %d\00"
@.str.5 = [13 x i8] c"wrong format\00"
@.str.6 = [19 x i8] c"variable not found\00"
define i8* @find_string(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca [80 x i8]
%13 = alloca [80 x i8]
%14 = alloca [80 x i8]
%15 = alloca [80 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %6
store i32* null, i32** %8
store i8* getelementptr inbounds ([1024 x i8], [1024 x i8]* @find_string.szBuffer, i64 0, i64 0), i8** %9
store i8* null, i8** %10
store i8* null, i8** %11
%16 = load i8*, i8** %4
%17 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %17, i32** %8
%18 = load i32*, i32** %8
%19 = icmp eq i32* %18, null
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%22 = load i8*, i8** %4
%23 = load i8*, i8** %5
%24 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %21, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %22, i8* %23)
%25 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%26 = call i32 @errhandler(i32 113, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %20, %2
br label %28
28: ; preds = %144, %85, %27
%29 = load i32*, i32** %8
%30 = call i32 @feof(i32* %29)
%31 = icmp ne i32 %30, 0
%32 = xor i1 %31, true
br i1 %32, label %33, label %185
33: ; preds = %28
%34 = load i8*, i8** %9
%35 = load i32*, i32** %8
%36 = call i64 @fgets(i8* %34, i32 1024, i32* %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33
br label %39
39: ; preds = %38, %33
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
store i32 0, i32* %7
br label %42
42: ; preds = %61, %39
%43 = load i32, i32* %7
%44 = load i8*, i8** %9
%45 = call i32 @strlen(i8* %44)
%46 = icmp slt i32 %43, %45
br i1 %46, label %47, label %64
47: ; preds = %42
%48 = load i8*, i8** %9
%49 = load i32, i32* %7
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %48, i64 %50
%52 = load i8, i8* %51
%53 = sext i8 %52 to i32
%54 = icmp eq i32 %53, 35
br i1 %54, label %55, label %60
55: ; preds = %47
%56 = load i8*, i8** %9
%57 = load i32, i32* %7
%58 = sext i32 %57 to i64
%59 = getelementptr inbounds i8, i8* %56, i64 %58
store i8 0, i8* %59
br label %64
60: ; preds = %47
br label %61
61: ; preds = %60
%62 = load i32, i32* %7
%63 = add nsw i32 %62, 1
store i32 %63, i32* %7
br label %42
64: ; preds = %55, %42
br label %65
65: ; preds = %78, %64
%66 = load i8*, i8** %9
%67 = load i8, i8* %66
%68 = sext i8 %67 to i32
%69 = call i64 @isspace(i32 %68)
%70 = icmp ne i64 %69, 0
br i1 %70, label %71, label %76
71: ; preds = %65
%72 = load i8*, i8** %9
%73 = load i8, i8* %72
%74 = sext i8 %73 to i32
%75 = icmp ne i32 %74, 0
br label %76
76: ; preds = %71, %65
%77 = phi i1 [ false, %65 ], [ %75, %71 ]
br i1 %77, label %78, label %81
78: ; preds = %76
%79 = load i8*, i8** %9
%80 = getelementptr inbounds i8, i8* %79, i32 1
store i8* %80, i8** %9
br label %65
81: ; preds = %76
%82 = load i8*, i8** %9
%83 = call i32 @strlen(i8* %82)
%84 = icmp eq i32 %83, 0
br i1 %84, label %85, label %86
85: ; preds = %81
br label %28
86: ; preds = %81
%87 = load i8*, i8** %9
store i8* %87, i8** %11
%88 = load i8*, i8** %9
store i8* %88, i8** %10
br label %89
89: ; preds = %107, %86
%90 = load i8*, i8** %10
%91 = load i8, i8* %90
%92 = sext i8 %91 to i32
%93 = call i64 @isalnum(i32 %92)
%94 = icmp ne i64 %93, 0
br i1 %94, label %100, label %95
95: ; preds = %89
%96 = load i8*, i8** %10
%97 = load i8, i8* %96
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 95
br i1 %99, label %100, label %105
100: ; preds = %95, %89
%101 = load i8*, i8** %10
%102 = load i8, i8* %101
%103 = sext i8 %102 to i32
%104 = icmp ne i32 %103, 0
br label %105
105: ; preds = %100, %95
%106 = phi i1 [ false, %95 ], [ %104, %100 ]
br i1 %106, label %107, label %110
107: ; preds = %105
%108 = load i8*, i8** %10
%109 = getelementptr inbounds i8, i8* %108, i32 1
store i8* %109, i8** %10
br label %89
110: ; preds = %105
%111 = load i8*, i8** %10
%112 = load i8, i8* %111
%113 = sext i8 %112 to i32
%114 = icmp eq i32 %113, 10
br i1 %114, label %119, label %115
115: ; preds = %110
%116 = load i8*, i8** %10
%117 = call i32 @strlen(i8* %116)
%118 = icmp eq i32 %117, 0
br i1 %118, label %119, label %136
119: ; preds = %115, %110
%120 = load i32, i32* %6
%121 = icmp ne i32 %120, 0
br i1 %121, label %122, label %128
122: ; preds = %119
%123 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%124 = load i8*, i8** %4
%125 = load i8*, i8** %11
%126 = load i32, i32* %6
%127 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %123, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %124, i8* %125, i32 %126)
br label %133
128: ; preds = %119
%129 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%130 = load i8*, i8** %4
%131 = load i8*, i8** %11
%132 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %129, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %130, i8* %131)
br label %133
133: ; preds = %128, %122
%134 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%135 = call i32 @errhandler(i32 140, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %134)
br label %136
136: ; preds = %133, %115
%137 = load i8*, i8** %10
store i8 0, i8* %137
%138 = load i8*, i8** %10
%139 = getelementptr inbounds i8, i8* %138, i32 1
store i8* %139, i8** %10
%140 = load i8*, i8** %5
%141 = load i8*, i8** %11
%142 = call i64 @strcmp(i8* %140, i8* %141)
%143 = icmp ne i64 %142, 0
br i1 %143, label %144, label %145
144: ; preds = %136
br label %28
145: ; preds = %136
br label %146
146: ; preds = %152, %145
%147 = load i8*, i8** %10
%148 = load i8, i8* %147
%149 = sext i8 %148 to i32
%150 = call i64 @isspace(i32 %149)
%151 = icmp ne i64 %150, 0
br i1 %151, label %152, label %155
152: ; preds = %146
%153 = load i8*, i8** %10
%154 = getelementptr inbounds i8, i8* %153, i32 1
store i8* %154, i8** %10
br label %146
155: ; preds = %146
%156 = load i8*, i8** %10
%157 = load i8, i8* %156
%158 = sext i8 %157 to i32
%159 = icmp eq i32 %158, 10
br i1 %159, label %164, label %160
160: ; preds = %155
%161 = load i8*, i8** %10
%162 = call i32 @strlen(i8* %161)
%163 = icmp eq i32 %162, 0
br i1 %163, label %164, label %181
164: ; preds = %160, %155
%165 = load i32, i32* %6
%166 = icmp ne i32 %165, 0
br i1 %166, label %167, label %173
167: ; preds = %164
%168 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%169 = load i8*, i8** %4
%170 = load i8*, i8** %11
%171 = load i32, i32* %6
%172 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %168, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %169, i8* %170, i32 %171)
br label %178
173: ; preds = %164
%174 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%175 = load i8*, i8** %4
%176 = load i8*, i8** %11
%177 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %174, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %175, i8* %176)
br label %178
178: ; preds = %173, %167
%179 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%180 = call i32 @errhandler(i32 151, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %179)
br label %181
181: ; preds = %178, %160
%182 = load i32*, i32** %8
%183 = call i32 @fclose(i32* %182)
%184 = load i8*, i8** %10
store i8* %184, i8** %3
br label %202
185: ; preds = %28
%186 = load i32, i32* %6
%187 = icmp ne i32 %186, 0
br i1 %187, label %188, label %194
188: ; preds = %185
%189 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%190 = load i8*, i8** %4
%191 = load i8*, i8** %5
%192 = load i32, i32* %6
%193 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %189, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %190, i8* %191, i32 %192)
br label %199
194: ; preds = %185
%195 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%196 = load i8*, i8** %4
%197 = load i8*, i8** %5
%198 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %195, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %196, i8* %197)
br label %199
199: ; preds = %194, %188
%200 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%201 = call i32 @errhandler(i32 157, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %200)
store i8* null, i8** %3
br label %202
202: ; preds = %199, %181
%203 = load i8*, i8** %3
ret i8* %203
}

LLVM IR (-O2):
@find_string.szBuffer = internal global [1024 x i8] zeroinitializer
@.str = [3 x i8] c"rt\00"
@.str.1 = [30 x i8] c" %s File: %s Variable: %s \00"
@.str.2 = [20 x i8] c"Could not open file\00"
@.str.3 = [142 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/EvaBr/CFD-Lab/refs/heads/master/Worksheet4/helper.c\00"
@.str.4 = [39 x i8] c" %s File: %s Variable: %s Line: %d\00"
@.str.5 = [13 x i8] c"wrong format\00"
@.str.6 = [19 x i8] c"variable not found\00"
define i8* @find_string(i8* %0, i8* %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32* %7, null
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%11 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* %0, i8* %1)
%12 = call i32 @errhandler(i32 113, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %10)
br label %13
13: ; preds = %9, %2
%14 = call i32 @feof(i32* %7)
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %103
16: ; preds = %13
%17 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
br label %18
18: ; preds = %16, %57
%19 = phi i8* [ getelementptr inbounds ([1024 x i8], [1024 x i8]* @find_string.szBuffer, i64 0, i64 0), %16 ], [ %54, %57 ]
%20 = phi i32 [ 0, %16 ], [ %22, %57 ]
%21 = call i64 @fgets(i8* %19, i32 1024, i32* %7)
%22 = add nuw nsw i32 %20, 1
%23 = call i32 @strlen(i8* %19)
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %38
25: ; preds = %18, %33
%26 = phi i64 [ %34, %33 ], [ 0, %18 ]
%27 = getelementptr inbounds i8, i8* %19, i64 %26
%28 = load i8, i8* %27
%29 = icmp eq i8 %28, 35
br i1 %29, label %30, label %33
30: ; preds = %25
%31 = and i64 %26, 4294967295
%32 = getelementptr inbounds i8, i8* %19, i64 %31
store i8 0, i8* %32
br label %38
33: ; preds = %25
%34 = add nuw nsw i64 %26, 1
%35 = call i32 @strlen(i8* %19)
%36 = sext i32 %35 to i64
%37 = icmp slt i64 %34, %36
br i1 %37, label %25, label %38
38: ; preds = %33, %18, %30
%39 = load i8, i8* %19
%40 = sext i8 %39 to i32
%41 = call i64 @isspace(i32 %40)
%42 = icmp eq i64 %41, 0
br i1 %42, label %53, label %43
43: ; preds = %38, %47
%44 = phi i8* [ %48, %47 ], [ %19, %38 ]
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 0
br i1 %46, label %53, label %47
47: ; preds = %43
%48 = getelementptr inbounds i8, i8* %44, i64 1
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = call i64 @isspace(i32 %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %43
53: ; preds = %43, %47, %38
%54 = phi i8* [ %19, %38 ], [ %48, %47 ], [ %44, %43 ]
%55 = call i32 @strlen(i8* %54)
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53, %78
%58 = call i32 @feof(i32* %7)
%59 = icmp eq i32 %58, 0
br i1 %59, label %18, label %100
60: ; preds = %53, %70
%61 = phi i8* [ %71, %70 ], [ %54, %53 ]
%62 = load i8, i8* %61
%63 = sext i8 %62 to i32
%64 = call i64 @isalnum(i32 %63)
%65 = icmp eq i64 %64, 0
%66 = load i8, i8* %61
br i1 %65, label %67, label %68
67: ; preds = %60
switch i8 %66, label %72 [
i8 95, label %70
i8 10, label %75
]
68: ; preds = %60
%69 = icmp eq i8 %66, 0
br i1 %69, label %72, label %70
70: ; preds = %67, %68
%71 = getelementptr inbounds i8, i8* %61, i64 1
br label %60
72: ; preds = %67, %68
%73 = call i32 @strlen(i8* %61)
%74 = icmp eq i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67, %72
%76 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %17, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* %54, i32 %22)
%77 = call i32 @errhandler(i32 140, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %17)
br label %78
78: ; preds = %75, %72
store i8 0, i8* %61
%79 = call i64 @strcmp(i8* %1, i8* %54)
%80 = icmp eq i64 %79, 0
br i1 %80, label %81, label %57
81: ; preds = %78, %81
%82 = phi i8* [ %83, %81 ], [ %61, %78 ]
%83 = getelementptr inbounds i8, i8* %82, i64 1
%84 = load i8, i8* %83
%85 = sext i8 %84 to i32
%86 = call i64 @isspace(i32 %85)
%87 = icmp eq i64 %86, 0
br i1 %87, label %88, label %81
88: ; preds = %81
%89 = load i8, i8* %83
%90 = icmp eq i8 %89, 10
br i1 %90, label %94, label %91
91: ; preds = %88
%92 = call i32 @strlen(i8* %83)
%93 = icmp eq i32 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %91, %88
%95 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%96 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %95, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0), i8* %0, i8* %54, i32 %22)
%97 = call i32 @errhandler(i32 151, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %95)
br label %98
98: ; preds = %94, %91
%99 = call i32 @fclose(i32* %7)
br label %109
100: ; preds = %57
%101 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%102 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %101, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %1, i32 %22)
br label %106
103: ; preds = %13
%104 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%105 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %104, i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %0, i8* %1)
br label %106
106: ; preds = %103, %100
%107 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%108 = call i32 @errhandler(i32 157, i8* getelementptr inbounds ([142 x i8], [142 x i8]* @.str.3, i64 0, i64 0), i8* %107)
br label %109
109: ; preds = %106, %98
%110 = phi i8* [ %83, %98 ], [ null, %106 ]
ret i8* %110
}