#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*/ *fgets(char *, size_t const, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
char *malloc(size_t const);
int /*<<< orphan*/ parser(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char **);
int main() {
  int ctr;
  FILE *fp;
  char filename[255];
  printf("Enter Filename Note add .txt to it: ");
  scanf("%s", &filename);
  fp = fopen(filename, "r");
  if (fp == NULL) {
    printf("file does not exists %s", filename);
    return 0;
  }
  const size_t line_size = 300;
  char *line = malloc(line_size);
  while (fgets(line, line_size, fp) != NULL) {
    if (ctr == 1) {
      parser(line);
    }
    ctr = 1;
  }
  free(line);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x110(%rbp),%rsi
lea    0xe9e(%rip),%rdi
call   1080 <scanf@plt>
lea    -0x110(%rbp),%rdi
lea    0xe74(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    11e6 <main+0x76>
lea    -0x110(%rbp),%rsi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    124f <main+0xdf>
movq   $0x12c,-0x118(%rbp)
mov    $0x12c,%edi
call   1070 <malloc@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x12c,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     1243 <main+0xd3>
cmpl   $0x1,-0x8(%rbp)
jne    1237 <main+0xc7>
mov    -0x120(%rbp),%rdi
call   1060 <parser@plt>
movl   $0x1,-0x8(%rbp)
jmp    1202 <main+0x92>
mov    -0x120(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x108,%rsp
lea    0xe7f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xead(%rip),%rdi
mov    %rsp,%rbx
mov    %rbx,%rsi
call   1080 <scanf@plt>
lea    0xe84(%rip),%rsi
mov    %rbx,%rdi
call   1090 <fopen@plt>
test   %rax,%rax
je     11f9 <main+0x89>
mov    %rax,%r14
mov    $0x12c,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    $0x12c,%esi
mov    %rax,%rdi
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdx
call   1050 <fgets@plt>
test   %rax,%rax
je     11ef <main+0x7f>
mov    %rbx,%rdi
call   1060 <parser@plt>
mov    $0x12c,%esi
mov    %rbx,%rdi
jmp    11d0 <main+0x60>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    120a <main+0x9a>
lea    0xe27(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [37 x i8] c"Enter Filename Note add .txt to it: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [24 x i8] c"file does not exists %s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = alloca [255 x i8]
%5 = alloca i64
%6 = alloca i8*
store i32 0, i32* %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%8 = bitcast [255 x i8]* %4 to i8**
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %8)
%10 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %11, i32** %3
%12 = load i32*, i32** %3
%13 = icmp eq i32* %12, null
br i1 %13, label %14, label %17
14: ; preds = %0
%15 = getelementptr inbounds [255 x i8], [255 x i8]* %4, i64 0, i64 0
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %15)
store i32 0, i32* %1
br label %34
17: ; preds = %0
store i64 300, i64* %5
%18 = call i8* @malloc(i64 300)
store i8* %18, i8** %6
br label %19
19: ; preds = %30, %17
%20 = load i8*, i8** %6
%21 = load i32*, i32** %3
%22 = call i32* @fgets(i8* %20, i64 300, i32* %21)
%23 = icmp ne i32* %22, null
br i1 %23, label %24, label %31
24: ; preds = %19
%25 = load i32, i32* %2
%26 = icmp eq i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i8*, i8** %6
%29 = call i32 @parser(i8* %28)
br label %30
30: ; preds = %27, %24
store i32 1, i32* %2
br label %19
31: ; preds = %19
%32 = load i8*, i8** %6
%33 = call i32 @free(i8* %32)
br label %34
34: ; preds = %31, %14
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [37 x i8] c"Enter Filename Note add .txt to it: \00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [24 x i8] c"file does not exists %s\00"
define i32 @main() {
%1 = alloca [255 x i8]
%2 = getelementptr inbounds [255 x i8], [255 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
%4 = bitcast [255 x i8]* %1 to i8**
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%6 = call i32* @fopen(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %10
8: ; preds = %0
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i8* %2)
br label %20
10: ; preds = %0
%11 = call dereferenceable_or_null(300) i8* @malloc(i64 300)
%12 = call i32* @fgets(i8* %11, i64 300, i32* %6)
%13 = icmp eq i32* %12, null
br i1 %13, label %18, label %14
14: ; preds = %10, %14
%15 = call i32 @parser(i8* %11)
%16 = call i32* @fgets(i8* %11, i64 300, i32* %6)
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %14
18: ; preds = %14, %10
%19 = call i32 @free(i8* %11)
br label %20
20: ; preds = %18, %8
ret i32 0
}