#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*/ line;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
char EOF;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
char *getenv(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printValue(char *, int);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int /*<<< orphan*/ strcat(char *, char *);
size_t strlen(char *);
scalar_t__ strstr(char *, char *);
int main(void) {
  char ch;
  FILE *fp;
  char *value;
  char *file_name = "/.config/google-chrome/Default/Bookmarks";
  value = getenv("HOME");
  fp = fopen(strcat(value, file_name), "r");
  if (fp == NULL) {
    perror("Error while opening the file.n");
    exit(EXIT_FAILURE);
  }
  int index = 0;
  int lineAmount = 0;
  int lineLength = 0;
  int lineLengthCounter = 0;
  while ((ch = fgetc(fp)) != EOF) {
    if (ch == '\n') {
      lineAmount++;
      if (lineLengthCounter > lineLength) {
        lineLength = lineLengthCounter;
      }
      lineLengthCounter = 0;
    } else
      lineLengthCounter++;
  }
  char lineArray[lineAmount][lineLength];
  char line[lineLength];
  rewind(fp);
  while ((ch = fgetc(fp)) != EOF) {
    if (ch == '\n') {
      if (strstr(line, "name"))
        printValue(line, sizeof(line));
      else if (strstr(line, "url") && !strstr(line, "type"))
        printValue(line, sizeof(line));
      memset(line, 0, strlen(line));
      index++;
    } else
      line[strlen(line)] = ch;
  }
  fclose(fp);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe2a(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xe48(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   10c0 <strcat@plt>
mov    %eax,%edi
lea    0xe2e(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    122e <main+0x6e>
lea    0xe15(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2d88(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     12ad <main+0xed>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    129f <main+0xdf>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    1293 <main+0xd3>
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
jmp    12a8 <main+0xe8>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    124a <main+0x8a>
mov    -0x28(%rbp),%eax
mov    %eax,%ecx
mov    -0x2c(%rbp),%eax
mov    %rsp,%rdx
mov    %rdx,-0x38(%rbp)
mov    %rcx,%rsi
imul   %rax,%rsi
add    $0xf,%rsi
and    $0xfffffffffffffff0,%rsi
mov    %rsp,%rdx
sub    %rsi,%rdx
mov    %rdx,%rsp
mov    %rcx,-0x40(%rbp)
mov    %rax,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rax,-0x60(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <rewind@plt>
mov    -0x10(%rbp),%rdi
call   1080 <fgetc@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2cca(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     13f2 <main+0x232>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    13d1 <main+0x211>
mov    -0x58(%rbp),%rdi
lea    0xd0e(%rip),%rsi
call   10e0 <strstr@plt>
cmp    $0x0,%rax
je     1364 <main+0x1a4>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    %eax,%esi
call   1090 <printValue@plt>
jmp    13ac <main+0x1ec>
mov    -0x58(%rbp),%rdi
lea    0xce5(%rip),%rsi
call   10e0 <strstr@plt>
cmp    $0x0,%rax
je     13a7 <main+0x1e7>
mov    -0x58(%rbp),%rdi
lea    0xccf(%rip),%rsi
call   10e0 <strstr@plt>
cmp    $0x0,%rax
jne    13a7 <main+0x1e7>
mov    -0x58(%rbp),%rdi
mov    -0x60(%rbp),%rax
mov    %eax,%esi
call   1090 <printValue@plt>
jmp    13ac <main+0x1ec>
mov    -0x58(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rdx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13ed <main+0x22d>
mov    -0x58(%rbp),%rdi
mov    -0x5(%rbp),%al
mov    %al,-0x61(%rbp)
call   1050 <strlen@plt>
mov    -0x61(%rbp),%dl
mov    %rax,%rcx
mov    -0x58(%rbp),%rax
mov    %dl,(%rax,%rcx,1)
jmp    1308 <main+0x148>
mov    -0x10(%rbp),%rdi
call   1040 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xe54(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe1f(%rip),%rsi
mov    %rax,%rdi
call   10c0 <strcat@plt>
lea    0xe3e(%rip),%rsi
mov    %eax,%edi
call   10a0 <fopen@plt>
test   %rax,%rax
je     131e <main+0x15e>
mov    %rax,%r14
mov    %rax,%rdi
call   1080 <fgetc@plt>
mov    0x2dd6(%rip),%rbx
xor    %r12d,%r12d
cmp    (%rbx),%al
je     125a <main+0x9a>
xor    %r15d,%r15d
xor    %ecx,%ecx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%r13
lea    0x1(%rcx),%ebx
cmp    %r12d,%ecx
cmovle %r12d,%ecx
cmp    $0xa,%al
cmove  %ecx,%r12d
cmove  %r15d,%ebx
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    %ebx,%ecx
mov    %r13,%rbx
cmp    0x0(%r13),%al
jne    1230 <main+0x70>
mov    %r12d,%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    %r14,%rdi
call   1060 <rewind@plt>
mov    %r14,%rdi
call   1080 <fgetc@plt>
cmp    (%rbx),%al
jne    129b <main+0xdb>
mov    %r14,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%r13d
jmp    12b8 <main+0xf8>
call   1050 <strlen@plt>
mov    %r13b,(%r15,%rax,1)
mov    %r14,%rdi
call   1080 <fgetc@plt>
mov    %eax,%r13d
cmp    (%rbx),%al
je     1282 <main+0xc2>
mov    %r15,%rdi
cmp    $0xa,%r13b
jne    12a0 <main+0xe0>
lea    0xd87(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     12f4 <main+0x134>
mov    %r15,%rdi
mov    %r12d,%esi
call   1090 <printValue@plt>
mov    %r15,%rdi
call   1050 <strlen@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %rax,%rdx
call   1070 <memset@plt>
jmp    12a9 <main+0xe9>
mov    %r15,%rdi
lea    0xd56(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
je     12dd <main+0x11d>
mov    %r15,%rdi
lea    0xd46(%rip),%rsi
call   10e0 <strstr@plt>
test   %rax,%rax
jne    12dd <main+0x11d>
jmp    12d2 <main+0x112>
lea    0xd0b(%rip),%rdi
call   10b0 <perror@plt>
mov    0x2ca7(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"/.config/google-chrome/Default/Bookmarks\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Error while opening the file.n\00"
@EXIT_FAILURE = global i32 0
@EOF = global i8 0
@.str.4 = [5 x i8] c"name\00"
@.str.5 = [4 x i8] c"url\00"
@.str.6 = [5 x i8] c"type\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = alloca i32*
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
store i32 0, i32* %1
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8** %5
%14 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %14, i8** %4
%15 = load i8*, i8** %4
%16 = load i8*, i8** %5
%17 = call i32 @strcat(i8* %15, i8* %16)
%18 = call i32* @fopen(i32 %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %18, i32** %3
%19 = load i32*, i32** %3
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %0
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %26
26: ; preds = %49, %25
%27 = load i32*, i32** %3
%28 = call signext i8 @fgetc(i32* %27)
store i8 %28, i8* %2
%29 = sext i8 %28 to i32
%30 = load i8, i8* @EOF
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %29, %31
br i1 %32, label %33, label %50
33: ; preds = %26
%34 = load i8, i8* %2
%35 = sext i8 %34 to i32
%36 = icmp eq i32 %35, 10
br i1 %36, label %37, label %46
37: ; preds = %33
%38 = load i32, i32* %7
%39 = add nsw i32 %38, 1
store i32 %39, i32* %7
%40 = load i32, i32* %9
%41 = load i32, i32* %8
%42 = icmp sgt i32 %40, %41
br i1 %42, label %43, label %45
43: ; preds = %37
%44 = load i32, i32* %9
store i32 %44, i32* %8
br label %45
45: ; preds = %43, %37
store i32 0, i32* %9
br label %49
46: ; preds = %33
%47 = load i32, i32* %9
%48 = add nsw i32 %47, 1
store i32 %48, i32* %9
br label %49
49: ; preds = %46, %45
br label %26
50: ; preds = %26
%51 = load i32, i32* %7
%52 = zext i32 %51 to i64
%53 = load i32, i32* %8
%54 = zext i32 %53 to i64
%55 = call i8* @llvm.stacksave()
store i8* %55, i8** %10
%56 = mul nuw i64 %52, %54
%57 = alloca i8, i64 %56
store i64 %52, i64* %11
store i64 %54, i64* %12
%58 = load i32, i32* %8
%59 = zext i32 %58 to i64
%60 = alloca i8, i64 %59
store i64 %59, i64* %13
%61 = load i32*, i32** %3
%62 = call i32 @rewind(i32* %61)
br label %63
63: ; preds = %99, %50
%64 = load i32*, i32** %3
%65 = call signext i8 @fgetc(i32* %64)
store i8 %65, i8* %2
%66 = sext i8 %65 to i32
%67 = load i8, i8* @EOF
%68 = sext i8 %67 to i32
%69 = icmp ne i32 %66, %68
br i1 %69, label %70, label %100
70: ; preds = %63
%71 = load i8, i8* %2
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 10
br i1 %73, label %74, label %95
74: ; preds = %70
%75 = call i64 @strstr(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %74
%78 = trunc i64 %59 to i32
%79 = call i32 @printValue(i8* %60, i32 %78)
br label %90
80: ; preds = %74
%81 = call i64 @strstr(i8* %60, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%82 = icmp ne i64 %81, 0
br i1 %82, label %83, label %89
83: ; preds = %80
%84 = call i64 @strstr(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%85 = icmp ne i64 %84, 0
br i1 %85, label %89, label %86
86: ; preds = %83
%87 = trunc i64 %59 to i32
%88 = call i32 @printValue(i8* %60, i32 %87)
br label %89
89: ; preds = %86, %83, %80
br label %90
90: ; preds = %89, %77
%91 = call i64 @strlen(i8* %60)
%92 = call i32 @memset(i8* %60, i32 0, i64 %91)
%93 = load i32, i32* %6
%94 = add nsw i32 %93, 1
store i32 %94, i32* %6
br label %99
95: ; preds = %70
%96 = load i8, i8* %2
%97 = call i64 @strlen(i8* %60)
%98 = getelementptr inbounds i8, i8* %60, i64 %97
store i8 %96, i8* %98
br label %99
99: ; preds = %95, %90
br label %63
100: ; preds = %63
%101 = load i32*, i32** %3
%102 = call i32 @fclose(i32* %101)
store i32 0, i32* %1
%103 = load i8*, i8** %10
%104 = load i32, i32* %1
ret i32 %104
}

LLVM IR (-O2):
@.str = [41 x i8] c"/.config/google-chrome/Default/Bookmarks\00"
@.str.1 = [5 x i8] c"HOME\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [31 x i8] c"Error while opening the file.n\00"
@EXIT_FAILURE = global i32 0
@EOF = global i8 0
@.str.4 = [5 x i8] c"name\00"
@.str.5 = [4 x i8] c"url\00"
@.str.6 = [5 x i8] c"type\00"
define i32 @main() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @strcat(i8* %1, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32* @fopen(i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %9, label %5
5: ; preds = %0
%6 = tail call signext i8 @fgetc(i32* %3)
%7 = load i8, i8* @EOF
%8 = icmp eq i8 %6, %7
br i1 %8, label %26, label %13
9: ; preds = %0
%10 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %5, %13
%14 = phi i8 [ %23, %13 ], [ %6, %5 ]
%15 = phi i32 [ %22, %13 ], [ 0, %5 ]
%16 = phi i32 [ %21, %13 ], [ 0, %5 ]
%17 = icmp eq i8 %14, 10
%18 = icmp sgt i32 %15, %16
%19 = add nsw i32 %15, 1
%20 = select i1 %17, i1 %18, i1 false
%21 = select i1 %20, i32 %15, i32 %16
%22 = select i1 %17, i32 0, i32 %19
%23 = tail call signext i8 @fgetc(i32* %3)
%24 = load i8, i8* @EOF
%25 = icmp eq i8 %23, %24
br i1 %25, label %26, label %13
26: ; preds = %13, %5
%27 = phi i32 [ 0, %5 ], [ %21, %13 ]
%28 = zext i32 %27 to i64
%29 = alloca i8, i64 %28
%30 = tail call i32 @rewind(i32* %3)
%31 = call signext i8 @fgetc(i32* %3)
%32 = load i8, i8* @EOF
%33 = icmp eq i8 %31, %32
br i1 %33, label %58, label %34
34: ; preds = %26, %54
%35 = phi i8 [ %55, %54 ], [ %31, %26 ]
%36 = icmp eq i8 %35, 10
br i1 %36, label %37, label %51
37: ; preds = %34
%38 = call i64 @strstr(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%39 = icmp eq i64 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = call i64 @strstr(i8* %29, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %48, label %43
43: ; preds = %40
%44 = call i64 @strstr(i8* %29, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.6, i64 0, i64 0))
%45 = icmp eq i64 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %43, %37
%47 = call i32 @printValue(i8* %29, i32 %27)
br label %48
48: ; preds = %46, %40, %43
%49 = call i64 @strlen(i8* %29)
%50 = call i32 @memset(i8* %29, i32 0, i64 %49)
br label %54
51: ; preds = %34
%52 = call i64 @strlen(i8* %29)
%53 = getelementptr inbounds i8, i8* %29, i64 %52
store i8 %35, i8* %53
br label %54
54: ; preds = %51, %48
%55 = call signext i8 @fgetc(i32* %3)
%56 = load i8, i8* @EOF
%57 = icmp eq i8 %55, %56
br i1 %57, label %58, label %34
58: ; preds = %54, %26
%59 = call i32 @fclose(i32* %3)
ret i32 0
}