#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*/ _assert(char *, int, char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
char *getenv(char *);
char *strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
char *strtok(char *, char *);
void getPath(char *pathBuffer, char *attribute) {
  FILE *configFile;
  char *word;
  char oneLine[1000] = {'\0'};
  char searchBox[1000] = {'\0'};
  char home[1000] = {'\0'};
  int doneSearchBox;
  doneSearchBox = 0;
  strcpy(home, getenv("HOME"));
  if ((configFile = fopen("vr.rc", "r")) != NULL ||
      (configFile = fopen(strcat(home, "/vr.rc"), "r")) != NULL) {
    while (fgets(oneLine, 500, configFile) != NULL || !doneSearchBox) {
      word = strtok(oneLine, "=");
      _assert("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/CS4098Group/Project/refs/heads/master/"
              "peos/os/virtual_repository/seekerTools.c",
              185, word);
      if (strcmp(attribute, word) == 0) {
        word = strtok(NULL, "\n");
        _assert("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/CS4098Group/Project/refs/"
                "heads/master/peos/os/virtual_repository/seekerTools.c",
                190, word);
        strcpy(searchBox, word);
        doneSearchBox = 1;
      }
    }
    fclose(configFile);
    strcpy(pathBuffer, searchBox);
  }
}


x86 assembly (clang, -O0):
<getPath>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
lea    -0x800(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
lea    -0xbf0(%rbp),%rdi
xor    %esi,%esi
mov    $0x3e8,%edx
call   1060 <memset@plt>
movl   $0x0,-0xbf4(%rbp)
lea    -0xbf0(%rbp),%rax
mov    %rax,-0xc00(%rbp)
lea    0xdf5(%rip),%rdi
call   1030 <getenv@plt>
mov    -0xc00(%rbp),%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    0xde2(%rip),%rdi
lea    0xdd8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    1270 <getPath+0xd0>
lea    -0xbf0(%rbp),%rdi
lea    0xdb9(%rip),%rsi
call   10b0 <strcat@plt>
mov    %rax,%rdi
lea    0xda8(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1368 <getPath+0x1c8>
jmp    1275 <getPath+0xd5>
lea    -0x410(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1f4,%esi
call   1070 <fgets@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0xc01(%rbp)
jne    12b1 <getPath+0x111>
cmpl   $0x0,-0xbf4(%rbp)
setne  %al
xor    $0xff,%al
mov    %al,-0xc01(%rbp)
mov    -0xc01(%rbp),%al
test   $0x1,%al
jne    12c4 <getPath+0x124>
jmp    134f <getPath+0x1af>
lea    -0x410(%rbp),%rdi
lea    0xd3c(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
lea    0xd2a(%rip),%rdi
mov    $0xb9,%esi
call   10c0 <_assert@plt>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    134a <getPath+0x1aa>
xor    %eax,%eax
mov    %eax,%edi
lea    0xda7(%rip),%rsi
call   10a0 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdx
lea    0xcea(%rip),%rdi
mov    $0xbe,%esi
call   10c0 <_assert@plt>
lea    -0x800(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1040 <strcpy@plt>
movl   $0x1,-0xbf4(%rbp)
jmp    1275 <getPath+0xd5>
mov    -0x18(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x8(%rbp),%rdi
lea    -0x800(%rbp),%rsi
call   1040 <strcpy@plt>
add    $0xc10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPath>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xbd8,%rsp
mov    %rsi,%r15
mov    %rdi,%r14
lea    0x7f0(%rsp),%rdi
xor    %ebp,%ebp
mov    $0x3e8,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x400(%rsp),%rdi
mov    $0x3e8,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    0x10(%rsp),%rbx
mov    $0x3e8,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <memset@plt>
lea    0xe04(%rip),%rdi
call   1030 <getenv@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <strcpy@plt>
lea    0xdf5(%rip),%rdi
lea    0xdeb(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
jne    125f <getPath+0xbf>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <strlen@plt>
movl   $0x2e72762f,0x10(%rsp,%rax,1)
2e
movl   $0x63722e,0x13(%rsp,%rax,1)
lea    0xdba(%rip),%rsi
mov    %rbx,%rdi
call   10a0 <fopen@plt>
mov    %rax,%r12
test   %rax,%rax
je     132f <getPath+0x18f>
mov    %r14,0x8(%rsp)
lea    0x7f0(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %r12,%rdx
call   1080 <fgets@plt>
lea    0xd8d(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
lea    0xd74(%rip),%rsi
call   10b0 <strtok@plt>
mov    %rax,%r14
mov    %r13,%rdi
mov    $0xb9,%esi
mov    %rax,%rdx
call   10c0 <_assert@plt>
mov    %r15,%rdi
mov    %r14,%rsi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    12f8 <getPath+0x158>
xor    %edi,%edi
lea    0xdee(%rip),%rsi
call   10b0 <strtok@plt>
mov    %rax,%rbp
mov    %r13,%rdi
mov    $0xbe,%esi
mov    %rax,%rdx
call   10c0 <_assert@plt>
lea    0x400(%rsp),%rdi
mov    %rbp,%rsi
call   1040 <strcpy@plt>
mov    $0x1,%ebp
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %r12,%rdx
call   1080 <fgets@plt>
test   %rax,%rax
jne    1290 <getPath+0xf0>
test   %ebp,%ebp
je     1290 <getPath+0xf0>
mov    %r12,%rdi
call   1050 <fclose@plt>
lea    0x400(%rsp),%rsi
mov    0x8(%rsp),%rdi
call   1040 <strcpy@plt>
add    $0xbd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [6 x i8] c"vr.rc\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [7 x i8] c"/vr.rc\00"
@.str.4 = [2 x i8] c"=\00"
@.str.5 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CS4098Group/Project/refs/heads/master/peos/os/virtual_repository/seekerTools.c\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @getPath(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca [1000 x i8]
%10 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%11 = bitcast [1000 x i8]* %7 to i8*
%12 = bitcast [1000 x i8]* %8 to i8*
%13 = bitcast [1000 x i8]* %9 to i8*
store i32 0, i32* %10
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%15 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%16 = call i32 @strcpy(i8* %14, i8* %15)
%17 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %17, i32** %5
%18 = icmp ne i32* %17, null
br i1 %18, label %24, label %19
19: ; preds = %2
%20 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%21 = call i8* @strcat(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32* @fopen(i8* %21, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %22, i32** %5
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %59
24: ; preds = %19, %2
br label %25
25: ; preds = %52, %24
%26 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%27 = load i32*, i32** %5
%28 = call i32* @fgets(i8* %26, i32 500, i32* %27)
%29 = icmp ne i32* %28, null
br i1 %29, label %34, label %30
30: ; preds = %25
%31 = load i32, i32* %10
%32 = icmp ne i32 %31, 0
%33 = xor i1 %32, true
br label %34
34: ; preds = %30, %25
%35 = phi i1 [ true, %25 ], [ %33, %30 ]
br i1 %35, label %36, label %53
36: ; preds = %34
%37 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%38 = call i8* @strtok(i8* %37, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i8* %38, i8** %6
%39 = load i8*, i8** %6
%40 = call i32 @_assert(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.5, i64 0, i64 0), i32 185, i8* %39)
%41 = load i8*, i8** %4
%42 = load i8*, i8** %6
%43 = call i64 @strcmp(i8* %41, i8* %42)
%44 = icmp eq i64 %43, 0
br i1 %44, label %45, label %52
45: ; preds = %36
%46 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %46, i8** %6
%47 = load i8*, i8** %6
%48 = call i32 @_assert(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.5, i64 0, i64 0), i32 190, i8* %47)
%49 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%50 = load i8*, i8** %6
%51 = call i32 @strcpy(i8* %49, i8* %50)
store i32 1, i32* %10
br label %52
52: ; preds = %45, %36
br label %25
53: ; preds = %34
%54 = load i32*, i32** %5
%55 = call i32 @fclose(i32* %54)
%56 = load i8*, i8** %3
%57 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%58 = call i32 @strcpy(i8* %56, i8* %57)
br label %59
59: ; preds = %53, %19
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"HOME\00"
@.str.1 = [6 x i8] c"vr.rc\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [7 x i8] c"/vr.rc\00"
@.str.4 = [2 x i8] c"=\00"
@.str.5 = [169 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CS4098Group/Project/refs/heads/master/peos/os/virtual_repository/seekerTools.c\00"
@.str.6 = [2 x i8] c"\0A\00"
define void @getPath(i8* %0, i8* %1) {
%3 = alloca [1000 x i8]
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = getelementptr inbounds [1000 x i8], [1000 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%9 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @strcpy(i8* %8, i8* %9)
%11 = call i32* @fopen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = call i64 @strlen(i8* %8)
%15 = getelementptr [1000 x i8], [1000 x i8]* %5, i64 0, i64 %14
%16 = call i32* @fopen(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%17 = icmp eq i32* %16, null
br i1 %17, label %40, label %18
18: ; preds = %13, %2
%19 = phi i32* [ %11, %2 ], [ %16, %13 ]
%20 = call i32* @fgets(i8* %6, i32 500, i32* %19)
br label %21
21: ; preds = %18, %31
%22 = phi i32 [ 0, %18 ], [ %32, %31 ]
%23 = call i8* @strtok(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%24 = call i32 @_assert(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.5, i64 0, i64 0), i32 185, i8* %23)
%25 = call i64 @strcmp(i8* %1, i8* %23)
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %31
27: ; preds = %21
%28 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%29 = call i32 @_assert(i8* getelementptr inbounds ([169 x i8], [169 x i8]* @.str.5, i64 0, i64 0), i32 190, i8* %28)
%30 = call i32 @strcpy(i8* %7, i8* %28)
br label %31
31: ; preds = %27, %21
%32 = phi i32 [ 1, %27 ], [ %22, %21 ]
%33 = call i32* @fgets(i8* %6, i32 500, i32* %19)
%34 = icmp ne i32* %33, null
%35 = icmp eq i32 %32, 0
%36 = select i1 %34, i1 true, i1 %35
br i1 %36, label %21, label %37
37: ; preds = %31
%38 = call i32 @fclose(i32* %19)
%39 = call i32 @strcpy(i8* %0, i8* %7)
br label %40
40: ; preds = %37, %13
ret void
}