#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*/ allTrim(char *);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
scalar_t__ isEmpty(char *);
int /*<<< orphan*/ printf(char *, char const *, char const *);
char *strchr(char *, char);
char *strerror(int /*<<< orphan*/);
size_t strlen(char *);
char *strstr(char *, char *);
int main() {
  FILE *fp;
  char line[500 + 1];
  *line = 0;
  char *c, *p, *name;
  char *value;
  const char *file = "./xx.txt";
  fp = fopen(file, "r");
  if (fp) {
    while (c = fgets(line, 500, fp)) {
      line[strlen(line)] = 0;
      if (p = strstr(line, "//"))
        *p = 0;
      allTrim(line);
      if (isEmpty(line))
        continue;
      if (!(name = strstr(line, "var ")) || !(value = strchr(line, '='))) {
        printf("Info: Ignoring invalid line [%s] in '%s'\n", line, file);
        continue;
      }
      if (name >= value) {
        printf("Info: Ignoring invalid line [%s] in '%s'\n", line, file);
        continue;
      }
      name += strlen("var ");
      *value = 0;
      value++;
      allTrim(name);
      allTrim(value);
      printf("append variable '%s' with vaue '%s'\n", name, value);
    }
    fclose(fp);
  } else
    printf("Can't open '%s', error was '%s'\n", file, strerror(errno));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x240,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x0,-0x210(%rbp)
lea    0xe40(%rip),%rax
mov    %rax,-0x238(%rbp)
mov    -0x238(%rbp),%rdi
lea    0xe34(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1390 <main+0x1f0>
jmp    11ee <main+0x4e>
lea    -0x210(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    $0x1f4,%esi
call   1070 <fgets@plt>
mov    %rax,-0x218(%rbp)
cmp    $0x0,%rax
je     1382 <main+0x1e2>
lea    -0x210(%rbp),%rdi
call   1040 <strlen@plt>
movb   $0x0,-0x210(%rbp,%rax,1)
lea    -0x210(%rbp),%rdi
lea    0xdd5(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x220(%rbp)
cmp    $0x0,%rax
je     1256 <main+0xb6>
mov    -0x220(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x210(%rbp),%rdi
call   1090 <allTrim@plt>
lea    -0x210(%rbp),%rdi
call   1080 <isEmpty@plt>
cmp    $0x0,%rax
je     127d <main+0xdd>
jmp    11ee <main+0x4e>
lea    -0x210(%rbp),%rdi
lea    0xd83(%rip),%rsi
call   10c0 <strstr@plt>
mov    %rax,-0x228(%rbp)
cmp    $0x0,%rax
je     12c3 <main+0x123>
lea    -0x210(%rbp),%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
mov    %rax,-0x230(%rbp)
cmp    $0x0,%rax
jne    12e2 <main+0x142>
lea    -0x210(%rbp),%rsi
mov    -0x238(%rbp),%rdx
lea    0xd3b(%rip),%rdi
call   1060 <printf@plt>
jmp    11ee <main+0x4e>
mov    -0x228(%rbp),%rax
cmp    -0x230(%rbp),%rax
jb     1315 <main+0x175>
lea    -0x210(%rbp),%rsi
mov    -0x238(%rbp),%rdx
lea    0xd08(%rip),%rdi
call   1060 <printf@plt>
jmp    11ee <main+0x4e>
lea    0xcf2(%rip),%rdi
call   1040 <strlen@plt>
add    -0x228(%rbp),%rax
mov    %rax,-0x228(%rbp)
mov    -0x230(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x230(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x230(%rbp)
mov    -0x228(%rbp),%rdi
call   1090 <allTrim@plt>
mov    -0x230(%rbp),%rdi
call   1090 <allTrim@plt>
mov    -0x228(%rbp),%rsi
mov    -0x230(%rbp),%rdx
lea    0xcc5(%rip),%rdi
call   1060 <printf@plt>
jmp    11ee <main+0x4e>
mov    -0x10(%rbp),%rdi
call   1030 <fclose@plt>
jmp    13c2 <main+0x222>
mov    -0x238(%rbp),%rax
mov    %rax,-0x240(%rbp)
mov    0x2c3b(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
mov    -0x240(%rbp),%rsi
mov    %rax,%rdx
lea    0xca5(%rip),%rdi
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x240,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1f8,%rsp
movb   $0x0,(%rsp)
lea    0xe44(%rip),%rdi
lea    0xe46(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     12d0 <main+0x130>
mov    %rax,%r14
mov    %rsp,%rdi
mov    $0x1f4,%esi
mov    %rax,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12c6 <main+0x126>
mov    %rsp,%rbx
lea    0xe14(%rip),%r15
lea    0xe10(%rip),%r12
jmp    122f <main+0x8f>
lea    0xe0c(%rip),%rdi
mov    %rbx,%rsi
lea    0xdef(%rip),%rdx
call   1060 <printf@plt>
mov    %rbx,%rdi
mov    $0x1f4,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     12c6 <main+0x126>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movb   $0x0,(%rsp,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     124e <main+0xae>
movb   $0x0,(%rax)
mov    %rbx,%rdi
call   1090 <allTrim@plt>
mov    %rbx,%rdi
call   1080 <isEmpty@plt>
test   %rax,%rax
jne    1216 <main+0x76>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10c0 <strstr@plt>
test   %rax,%rax
je     1200 <main+0x60>
mov    %rax,%r13
mov    %rbx,%rdi
mov    $0x3d,%esi
call   1050 <strchr@plt>
test   %rax,%rax
je     1200 <main+0x60>
mov    %rax,%rbp
cmp    %rax,%r13
jae    1200 <main+0x60>
add    $0x4,%r13
movb   $0x0,0x0(%rbp)
add    $0x1,%rbp
mov    %r13,%rdi
call   1090 <allTrim@plt>
mov    %rbp,%rdi
call   1090 <allTrim@plt>
lea    0xd82(%rip),%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
jmp    1211 <main+0x71>
mov    %r14,%rdi
call   1030 <fclose@plt>
jmp    12f4 <main+0x154>
mov    0x2d09(%rip),%rax
mov    (%rax),%edi
call   10b0 <strerror@plt>
lea    0xd7d(%rip),%rdi
lea    0xd14(%rip),%rsi
mov    %rax,%rdx
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x1f8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"./xx.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"//\00"
@.str.3 = [5 x i8] c"var \00"
@.str.4 = [42 x i8] c"Info: Ignoring invalid line [%s] in '%s'\0A\00"
@.str.5 = [37 x i8] c"append variable '%s' with vaue '%s'\0A\00"
@.str.6 = [33 x i8] c"Can't open '%s', error was '%s'\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [501 x i8]
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
store i32 0, i32* %1
%9 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
store i8 0, i8* %9
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %8
%10 = load i8*, i8** %8
%11 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %2
%12 = load i32*, i32** %2
%13 = icmp ne i32* %12, null
br i1 %13, label %14, label %73
14: ; preds = %0
br label %15
15: ; preds = %56, %52, %44, %35, %14
%16 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%17 = load i32*, i32** %2
%18 = call i8* @fgets(i8* %16, i32 500, i32* %17)
store i8* %18, i8** %4
%19 = icmp ne i8* %18, null
br i1 %19, label %20, label %70
20: ; preds = %15
%21 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%22 = call i64 @strlen(i8* %21)
%23 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 %22
store i8 0, i8* %23
%24 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%25 = call i8* @strstr(i8* %24, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
store i8* %25, i8** %5
%26 = icmp ne i8* %25, null
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = load i8*, i8** %5
store i8 0, i8* %28
br label %29
29: ; preds = %27, %20
%30 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%31 = call i32 @allTrim(i8* %30)
%32 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%33 = call i64 @isEmpty(i8* %32)
%34 = icmp ne i64 %33, 0
br i1 %34, label %35, label %36
35: ; preds = %29
br label %15
36: ; preds = %29
%37 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%38 = call i8* @strstr(i8* %37, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
store i8* %38, i8** %6
%39 = icmp ne i8* %38, null
br i1 %39, label %40, label %44
40: ; preds = %36
%41 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%42 = call i8* @strchr(i8* %41, i8 signext 61)
store i8* %42, i8** %7
%43 = icmp ne i8* %42, null
br i1 %43, label %48, label %44
44: ; preds = %40, %36
%45 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%46 = load i8*, i8** %8
%47 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %45, i8* %46)
br label %15
48: ; preds = %40
%49 = load i8*, i8** %6
%50 = load i8*, i8** %7
%51 = icmp uge i8* %49, %50
br i1 %51, label %52, label %56
52: ; preds = %48
%53 = getelementptr inbounds [501 x i8], [501 x i8]* %3, i64 0, i64 0
%54 = load i8*, i8** %8
%55 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %53, i8* %54)
br label %15
56: ; preds = %48
%57 = call i64 @strlen(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%58 = load i8*, i8** %6
%59 = getelementptr inbounds i8, i8* %58, i64 %57
store i8* %59, i8** %6
%60 = load i8*, i8** %7
store i8 0, i8* %60
%61 = load i8*, i8** %7
%62 = getelementptr inbounds i8, i8* %61, i32 1
store i8* %62, i8** %7
%63 = load i8*, i8** %6
%64 = call i32 @allTrim(i8* %63)
%65 = load i8*, i8** %7
%66 = call i32 @allTrim(i8* %65)
%67 = load i8*, i8** %6
%68 = load i8*, i8** %7
%69 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %67, i8* %68)
br label %15
70: ; preds = %15
%71 = load i32*, i32** %2
%72 = call i32 @fclose(i32* %71)
br label %78
73: ; preds = %0
%74 = load i8*, i8** %8
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* %74, i8* %76)
br label %78
78: ; preds = %73, %70
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"./xx.txt\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"//\00"
@.str.3 = [5 x i8] c"var \00"
@.str.4 = [42 x i8] c"Info: Ignoring invalid line [%s] in '%s'\0A\00"
@.str.5 = [37 x i8] c"append variable '%s' with vaue '%s'\0A\00"
@.str.6 = [33 x i8] c"Can't open '%s', error was '%s'\0A\00"
@errno = global i32 0
define i32 @main() {
%1 = alloca [501 x i8]
%2 = getelementptr inbounds [501 x i8], [501 x i8]* %1, i64 0, i64 0
store i8 0, i8* %2
%3 = tail call i32* @fopen(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%4 = icmp eq i32* %3, null
br i1 %4, label %41, label %5
5: ; preds = %0
%6 = call i8* @fgets(i8* %2, i32 500, i32* %3)
%7 = icmp eq i8* %6, null
br i1 %7, label %39, label %8
8: ; preds = %5, %26
%9 = call i64 @strlen(i8* %2)
%10 = getelementptr inbounds [501 x i8], [501 x i8]* %1, i64 0, i64 %9
store i8 0, i8* %10
%11 = call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %8
store i8 0, i8* %11
br label %14
14: ; preds = %13, %8
%15 = call i32 @allTrim(i8* %2)
%16 = call i64 @isEmpty(i8* %2)
%17 = icmp eq i64 %16, 0
br i1 %17, label %18, label %26
18: ; preds = %14
%19 = call i8* @strstr(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i8* %19, null
br i1 %20, label %24, label %21
21: ; preds = %18
%22 = call i8* @strchr(i8* %2, i8 signext 61)
%23 = icmp eq i8* %22, null
br i1 %23, label %24, label %29
24: ; preds = %21, %18
%25 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %26
26: ; preds = %24, %31, %33, %14
%27 = call i8* @fgets(i8* %2, i32 500, i32* %3)
%28 = icmp eq i8* %27, null
br i1 %28, label %39, label %8
29: ; preds = %21
%30 = icmp ult i8* %19, %22
br i1 %30, label %33, label %31
31: ; preds = %29
%32 = call i32 @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
br label %26
33: ; preds = %29
%34 = getelementptr inbounds i8, i8* %19, i64 4
store i8 0, i8* %22
%35 = getelementptr inbounds i8, i8* %22, i64 1
%36 = call i32 @allTrim(i8* %34)
%37 = call i32 @allTrim(i8* %35)
%38 = call i32 @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.5, i64 0, i64 0), i8* %34, i8* %35)
br label %26
39: ; preds = %26, %5
%40 = call i32 @fclose(i32* %3)
br label %45
41: ; preds = %0
%42 = load i32, i32* @errno
%43 = tail call i8* @strerror(i32 %42)
%44 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* %43)
br label %45
45: ; preds = %41, %39
ret i32 0
}