#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*/ *);
int /*<<< orphan*/ 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(106,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/"
               "heads/master/worksheet1/helper.c",
               szTmp);
  };
  while (!feof(fh)) {
    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(133,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/"
                 "heads/master/worksheet1/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(144,
                 "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                 "outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/"
                 "heads/master/worksheet1/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(150,
               "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/"
               "heads/master/worksheet1/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    $0x6a,%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    155c <find_string+0x3bc>
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
mov    $0x400,%esi
call   1080 <fgets@plt>
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    12d8 <find_string+0x138>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    12c5 <find_string+0x125>
mov    -0x30(%rbp),%rax
movslq -0x20(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    12d8 <find_string+0x138>
jmp    12ca <find_string+0x12a>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    127d <find_string+0xdd>
jmp    12dd <find_string+0x13d>
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     1311 <find_string+0x171>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x185(%rbp)
mov    -0x185(%rbp),%al
test   $0x1,%al
jne    1324 <find_string+0x184>
jmp    1335 <find_string+0x195>
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    12dd <find_string+0x13d>
mov    -0x30(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    134c <find_string+0x1ac>
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    138a <find_string+0x1ea>
mov    -0x38(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x5f,%ecx
mov    %al,-0x186(%rbp)
jne    139d <find_string+0x1fd>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x186(%rbp)
mov    -0x186(%rbp),%al
test   $0x1,%al
jne    13b0 <find_string+0x210>
jmp    13c1 <find_string+0x221>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    135c <find_string+0x1bc>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     13e3 <find_string+0x243>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1456 <find_string+0x2b6>
cmpl   $0x0,-0x1c(%rbp)
je     141a <find_string+0x27a>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xcc1(%rip),%rsi
lea    0xce1(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    143e <find_string+0x29e>
lea    -0xe0(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
lea    0xbd3(%rip),%rsi
lea    0xcb8(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xe0(%rbp),%rdx
mov    $0x85,%edi
lea    0xbe4(%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     1485 <find_string+0x2e5>
jmp    123d <find_string+0x9d>
jmp    148a <find_string+0x2ea>
mov    -0x38(%rbp),%rax
movsbl (%rax),%edi
call   1070 <isspace@plt>
cmp    $0x0,%rax
je     14b1 <find_string+0x311>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    148a <find_string+0x2ea>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     14d3 <find_string+0x333>
mov    -0x38(%rbp),%rdi
call   1050 <strlen@plt>
cmp    $0x0,%eax
jne    1546 <find_string+0x3a6>
cmpl   $0x0,-0x1c(%rbp)
je     150a <find_string+0x36a>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xbd1(%rip),%rsi
lea    0xbf1(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    152e <find_string+0x38e>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x40(%rbp),%r8
lea    0xae3(%rip),%rsi
lea    0xbc8(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x130(%rbp),%rdx
mov    $0x90,%edi
lea    0xaf4(%rip),%rsi
call   1030 <errhandler@plt>
mov    -0x28(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    15d7 <find_string+0x437>
cmpl   $0x0,-0x1c(%rbp)
je     1593 <find_string+0x3f3>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
mov    -0x1c(%rbp),%r9d
lea    0xb48(%rip),%rsi
lea    0xb75(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
jmp    15b7 <find_string+0x417>
lea    -0x180(%rbp),%rdi
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xa5a(%rip),%rsi
lea    0xb4c(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0x180(%rbp),%rdx
mov    $0x96,%edi
lea    0xa6b(%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    $0x6a,%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    0xedf(%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    0xe69(%rip),%rsi
lea    0xe89(%rip),%rdx
mov    0x8(%rsp),%rcx
mov    %rbx,%r8
mov    %r14d,%r9d
xor    %eax,%eax
call   10c0 <sprintf@plt>
mov    $0x85,%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    0xd0b(%rip),%rsi
lea    0xd2b(%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    $0x90,%edi
mov    %r15,%rdx
call   1030 <errhandler@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
jmp    143a <find_string+0x29a>
lea    0xcc5(%rip),%rsi
lea    0xcf2(%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    $0x96,%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 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/heads/master/worksheet1/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 106, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %20, %2
br label %28
28: ; preds = %141, %82, %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 %182
33: ; preds = %28
%34 = load i8*, i8** %9
%35 = load i32*, i32** %8
%36 = call i32 @fgets(i8* %34, i32 1024, i32* %35)
%37 = load i32, i32* %6
%38 = add nsw i32 %37, 1
store i32 %38, i32* %6
store i32 0, i32* %7
br label %39
39: ; preds = %58, %33
%40 = load i32, i32* %7
%41 = load i8*, i8** %9
%42 = call i32 @strlen(i8* %41)
%43 = icmp slt i32 %40, %42
br i1 %43, label %44, label %61
44: ; preds = %39
%45 = load i8*, i8** %9
%46 = load i32, i32* %7
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
%49 = load i8, i8* %48
%50 = sext i8 %49 to i32
%51 = icmp eq i32 %50, 35
br i1 %51, label %52, label %57
52: ; preds = %44
%53 = load i8*, i8** %9
%54 = load i32, i32* %7
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
store i8 0, i8* %56
br label %61
57: ; preds = %44
br label %58
58: ; preds = %57
%59 = load i32, i32* %7
%60 = add nsw i32 %59, 1
store i32 %60, i32* %7
br label %39
61: ; preds = %52, %39
br label %62
62: ; preds = %75, %61
%63 = load i8*, i8** %9
%64 = load i8, i8* %63
%65 = sext i8 %64 to i32
%66 = call i64 @isspace(i32 %65)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %62
%69 = load i8*, i8** %9
%70 = load i8, i8* %69
%71 = sext i8 %70 to i32
%72 = icmp ne i32 %71, 0
br label %73
73: ; preds = %68, %62
%74 = phi i1 [ false, %62 ], [ %72, %68 ]
br i1 %74, label %75, label %78
75: ; preds = %73
%76 = load i8*, i8** %9
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %9
br label %62
78: ; preds = %73
%79 = load i8*, i8** %9
%80 = call i32 @strlen(i8* %79)
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %83
82: ; preds = %78
br label %28
83: ; preds = %78
%84 = load i8*, i8** %9
store i8* %84, i8** %11
%85 = load i8*, i8** %9
store i8* %85, i8** %10
br label %86
86: ; preds = %104, %83
%87 = load i8*, i8** %10
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = call i64 @isalnum(i32 %89)
%91 = icmp ne i64 %90, 0
br i1 %91, label %97, label %92
92: ; preds = %86
%93 = load i8*, i8** %10
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = icmp eq i32 %95, 95
br i1 %96, label %97, label %102
97: ; preds = %92, %86
%98 = load i8*, i8** %10
%99 = load i8, i8* %98
%100 = sext i8 %99 to i32
%101 = icmp ne i32 %100, 0
br label %102
102: ; preds = %97, %92
%103 = phi i1 [ false, %92 ], [ %101, %97 ]
br i1 %103, label %104, label %107
104: ; preds = %102
%105 = load i8*, i8** %10
%106 = getelementptr inbounds i8, i8* %105, i32 1
store i8* %106, i8** %10
br label %86
107: ; preds = %102
%108 = load i8*, i8** %10
%109 = load i8, i8* %108
%110 = sext i8 %109 to i32
%111 = icmp eq i32 %110, 10
br i1 %111, label %116, label %112
112: ; preds = %107
%113 = load i8*, i8** %10
%114 = call i32 @strlen(i8* %113)
%115 = icmp eq i32 %114, 0
br i1 %115, label %116, label %133
116: ; preds = %112, %107
%117 = load i32, i32* %6
%118 = icmp ne i32 %117, 0
br i1 %118, label %119, label %125
119: ; preds = %116
%120 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%121 = load i8*, i8** %4
%122 = load i8*, i8** %11
%123 = load i32, i32* %6
%124 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %120, 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* %121, i8* %122, i32 %123)
br label %130
125: ; preds = %116
%126 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%127 = load i8*, i8** %4
%128 = load i8*, i8** %11
%129 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %126, 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* %127, i8* %128)
br label %130
130: ; preds = %125, %119
%131 = getelementptr inbounds [80 x i8], [80 x i8]* %13, i64 0, i64 0
%132 = call i32 @errhandler(i32 133, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.3, i64 0, i64 0), i8* %131)
br label %133
133: ; preds = %130, %112
%134 = load i8*, i8** %10
store i8 0, i8* %134
%135 = load i8*, i8** %10
%136 = getelementptr inbounds i8, i8* %135, i32 1
store i8* %136, i8** %10
%137 = load i8*, i8** %5
%138 = load i8*, i8** %11
%139 = call i64 @strcmp(i8* %137, i8* %138)
%140 = icmp ne i64 %139, 0
br i1 %140, label %141, label %142
141: ; preds = %133
br label %28
142: ; preds = %133
br label %143
143: ; preds = %149, %142
%144 = load i8*, i8** %10
%145 = load i8, i8* %144
%146 = sext i8 %145 to i32
%147 = call i64 @isspace(i32 %146)
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %143
%150 = load i8*, i8** %10
%151 = getelementptr inbounds i8, i8* %150, i32 1
store i8* %151, i8** %10
br label %143
152: ; preds = %143
%153 = load i8*, i8** %10
%154 = load i8, i8* %153
%155 = sext i8 %154 to i32
%156 = icmp eq i32 %155, 10
br i1 %156, label %161, label %157
157: ; preds = %152
%158 = load i8*, i8** %10
%159 = call i32 @strlen(i8* %158)
%160 = icmp eq i32 %159, 0
br i1 %160, label %161, label %178
161: ; preds = %157, %152
%162 = load i32, i32* %6
%163 = icmp ne i32 %162, 0
br i1 %163, label %164, label %170
164: ; preds = %161
%165 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%166 = load i8*, i8** %4
%167 = load i8*, i8** %11
%168 = load i32, i32* %6
%169 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %165, 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* %166, i8* %167, i32 %168)
br label %175
170: ; preds = %161
%171 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%172 = load i8*, i8** %4
%173 = load i8*, i8** %11
%174 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %171, 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* %172, i8* %173)
br label %175
175: ; preds = %170, %164
%176 = getelementptr inbounds [80 x i8], [80 x i8]* %14, i64 0, i64 0
%177 = call i32 @errhandler(i32 144, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.3, i64 0, i64 0), i8* %176)
br label %178
178: ; preds = %175, %157
%179 = load i32*, i32** %8
%180 = call i32 @fclose(i32* %179)
%181 = load i8*, i8** %10
store i8* %181, i8** %3
br label %199
182: ; preds = %28
%183 = load i32, i32* %6
%184 = icmp ne i32 %183, 0
br i1 %184, label %185, label %191
185: ; preds = %182
%186 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%187 = load i8*, i8** %4
%188 = load i8*, i8** %5
%189 = load i32, i32* %6
%190 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %186, 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* %187, i8* %188, i32 %189)
br label %196
191: ; preds = %182
%192 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%193 = load i8*, i8** %4
%194 = load i8*, i8** %5
%195 = call i32 (i8*, i8*, i8*, i8*, i8*, ...) @sprintf(i8* %192, 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* %193, i8* %194)
br label %196
196: ; preds = %191, %185
%197 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%198 = call i32 @errhandler(i32 150, i8* getelementptr inbounds ([147 x i8], [147 x i8]* @.str.3, i64 0, i64 0), i8* %197)
store i8* null, i8** %3
br label %199
199: ; preds = %196, %178
%200 = load i8*, i8** %3
ret i8* %200
}

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 = [147 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/nathanwbrei/cfdlab/refs/heads/master/worksheet1/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 106, i8* getelementptr inbounds ([147 x i8], [147 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 i32 @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 133, i8* getelementptr inbounds ([147 x i8], [147 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 144, i8* getelementptr inbounds ([147 x i8], [147 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 150, i8* getelementptr inbounds ([147 x i8], [147 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
}