#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 */
int /*<<< orphan*/ add_subst(char *, char *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
scalar_t__ isspace(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
char *strchr(char *, char);
int strlen(char *);
void parse_config_file(FILE *f) {
  char line[2048];
  char *cp, *ptr;
  while (!feof(f)) {
    memset(line, 0, sizeof(line));
    if (fgets(line, sizeof(line), f) == NULL)
      break;
    cp = strchr(line, '\n');
    if (cp)
      *cp = 0;
    cp = strchr(line, '#');
    if (cp)
      *cp = 0;
    for (cp = line + strlen(line) - 1; cp >= line; cp--) {
      if (*cp == ' ' || *cp == '\t')
        *cp = 0;
      else
        break;
    }
    cp = line;
    while (*cp && isspace(*cp))
      cp++;
    ptr = cp;
    if (*ptr == 0)
      continue;
    if (*ptr == '@')
      continue;
    for (cp = ptr; *cp; cp++)
      if (isspace(*cp))
        break;
    *cp = 0;
    for (cp++; *cp; cp++)
      if (!isspace(*cp))
        break;
    add_subst(ptr, cp);
  }
}


x86 assembly (clang, -O0):
<parse_config_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x830,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1080 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    119d <parse_config_file+0x2d>
jmp    1458 <parse_config_file+0x2e8>
lea    -0x810(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
lea    -0x810(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    $0x800,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
jne    11d4 <parse_config_file+0x64>
jmp    1458 <parse_config_file+0x2e8>
lea    -0x810(%rbp),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0x818(%rbp)
cmpq   $0x0,-0x818(%rbp)
je     1204 <parse_config_file+0x94>
mov    -0x818(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x810(%rbp),%rdi
mov    $0x23,%esi
call   1040 <strchr@plt>
mov    %rax,-0x818(%rbp)
cmpq   $0x0,-0x818(%rbp)
je     1234 <parse_config_file+0xc4>
mov    -0x818(%rbp),%rax
movb   $0x0,(%rax)
lea    -0x810(%rbp),%rax
mov    %rax,-0x828(%rbp)
lea    -0x810(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x828(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rax
lea    -0x810(%rbp),%rcx
cmp    %rcx,%rax
jb     12d5 <parse_config_file+0x165>
mov    -0x818(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
je     12a5 <parse_config_file+0x135>
mov    -0x818(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    12b4 <parse_config_file+0x144>
mov    -0x818(%rbp),%rax
movb   $0x0,(%rax)
jmp    12b9 <parse_config_file+0x149>
jmp    12d5 <parse_config_file+0x165>
jmp    12be <parse_config_file+0x14e>
mov    -0x818(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x818(%rbp)
jmp    1268 <parse_config_file+0xf8>
lea    -0x810(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x829(%rbp)
je     131a <parse_config_file+0x1aa>
mov    -0x818(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x829(%rbp)
mov    -0x829(%rbp),%al
test   $0x1,%al
jne    132d <parse_config_file+0x1bd>
jmp    1344 <parse_config_file+0x1d4>
mov    -0x818(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x818(%rbp)
jmp    12e3 <parse_config_file+0x173>
mov    -0x818(%rbp),%rax
mov    %rax,-0x820(%rbp)
mov    -0x820(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    136a <parse_config_file+0x1fa>
jmp    117f <parse_config_file+0xf>
mov    -0x820(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    1382 <parse_config_file+0x212>
jmp    117f <parse_config_file+0xf>
mov    -0x820(%rbp),%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rax
cmpb   $0x0,(%rax)
je     13da <parse_config_file+0x26a>
mov    -0x818(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
je     13be <parse_config_file+0x24e>
jmp    13da <parse_config_file+0x26a>
jmp    13c3 <parse_config_file+0x253>
mov    -0x818(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x818(%rbp)
jmp    1390 <parse_config_file+0x220>
mov    -0x818(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x818(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x818(%rbp)
mov    -0x818(%rbp),%rax
cmpb   $0x0,(%rax)
je     1440 <parse_config_file+0x2d0>
mov    -0x818(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isspace@plt>
cmp    $0x0,%rax
jne    1424 <parse_config_file+0x2b4>
jmp    1440 <parse_config_file+0x2d0>
jmp    1429 <parse_config_file+0x2b9>
mov    -0x818(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x818(%rbp)
jmp    13f6 <parse_config_file+0x286>
mov    -0x820(%rbp),%rdi
mov    -0x818(%rbp),%rsi
call   1090 <add_subst@plt>
jmp    117f <parse_config_file+0xf>
add    $0x830,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_config_file>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x800,%rsp
mov    %rdi,%r14
call   1080 <feof@plt>
test   %eax,%eax
je     119d <parse_config_file+0x2d>
add    $0x800,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
mov    %rsp,%r15
jmp    11c6 <parse_config_file+0x56>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%rbx),%al
test   $0xbf,%al
jne    1282 <parse_config_file+0x112>
mov    %r14,%rdi
call   1080 <feof@plt>
test   %eax,%eax
jne    118c <parse_config_file+0x1c>
mov    %r15,%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1050 <memset@plt>
mov    %r15,%rdi
mov    $0x800,%esi
mov    %r14,%rdx
call   1070 <fgets@plt>
test   %rax,%rax
je     118c <parse_config_file+0x1c>
mov    %r15,%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     11ff <parse_config_file+0x8f>
movb   $0x0,(%rax)
mov    %r15,%rdi
mov    $0x23,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1214 <parse_config_file+0xa4>
movb   $0x0,(%rax)
mov    %r15,%rdi
call   1030 <strlen@plt>
cltq
add    %rsp,%rax
add    $0xffffffffffffffff,%rax
jmp    1237 <parse_config_file+0xc7>
nopw   0x0(%rax,%rax,1)
movb   $0x0,(%rax)
add    $0xffffffffffffffff,%rax
cmp    %r15,%rax
jb     1250 <parse_config_file+0xe0>
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     1230 <parse_config_file+0xc0>
cmp    $0x9,%cl
je     1230 <parse_config_file+0xc0>
nopl   0x0(%rax)
mov    (%rsp),%al
test   %al,%al
je     11ba <parse_config_file+0x4a>
mov    %r15,%rbx
xchg   %ax,%ax
movsbl %al,%edi
call   1060 <isspace@plt>
test   %rax,%rax
je     11b0 <parse_config_file+0x40>
movzbl 0x1(%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1260 <parse_config_file+0xf0>
jmp    11ba <parse_config_file+0x4a>
mov    %rbx,%r13
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %al,%edi
call   1060 <isspace@plt>
test   %rax,%rax
jne    12aa <parse_config_file+0x13a>
movzbl 0x1(%r13),%eax
add    $0x1,%r13
test   %al,%al
jne    1290 <parse_config_file+0x120>
movb   $0x0,0x0(%r13)
add    $0x1,%r13
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%r12
movzbl 0x0(%r13),%eax
test   %al,%al
je     12de <parse_config_file+0x16e>
movsbl %al,%edi
call   1060 <isspace@plt>
lea    0x1(%r12),%r13
test   %rax,%rax
jne    12c0 <parse_config_file+0x150>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1090 <add_subst@plt>
jmp    11ba <parse_config_file+0x4a>

LLVM IR (-O0):
define void @parse_config_file(i32* %0) {
%2 = alloca i32*
%3 = alloca [2048 x i8]
%4 = alloca i8*
%5 = alloca i8*
store i32* %0, i32** %2
br label %6
6: ; preds = %125, %90, %84, %1
%7 = load i32*, i32** %2
%8 = call i32 @feof(i32* %7)
%9 = icmp ne i32 %8, 0
%10 = xor i1 %9, true
br i1 %10, label %11, label %129
11: ; preds = %6
%12 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%13 = call i32 @memset(i8* %12, i32 0, i32 2048)
%14 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%15 = load i32*, i32** %2
%16 = call i32* @fgets(i8* %14, i32 2048, i32* %15)
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %19
18: ; preds = %11
br label %129
19: ; preds = %11
%20 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%21 = call i8* @strchr(i8* %20, i8 signext 10)
store i8* %21, i8** %4
%22 = load i8*, i8** %4
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = load i8*, i8** %4
store i8 0, i8* %25
br label %26
26: ; preds = %24, %19
%27 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%28 = call i8* @strchr(i8* %27, i8 signext 35)
store i8* %28, i8** %4
%29 = load i8*, i8** %4
%30 = icmp ne i8* %29, null
br i1 %30, label %31, label %33
31: ; preds = %26
%32 = load i8*, i8** %4
store i8 0, i8* %32
br label %33
33: ; preds = %31, %26
%34 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%35 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%36 = call i32 @strlen(i8* %35)
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %34, i64 %37
%39 = getelementptr inbounds i8, i8* %38, i64 -1
store i8* %39, i8** %4
br label %40
40: ; preds = %58, %33
%41 = load i8*, i8** %4
%42 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
%43 = icmp uge i8* %41, %42
br i1 %43, label %44, label %61
44: ; preds = %40
%45 = load i8*, i8** %4
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 32
br i1 %48, label %54, label %49
49: ; preds = %44
%50 = load i8*, i8** %4
%51 = load i8, i8* %50
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 9
br i1 %53, label %54, label %56
54: ; preds = %49, %44
%55 = load i8*, i8** %4
store i8 0, i8* %55
br label %57
56: ; preds = %49
br label %61
57: ; preds = %54
br label %58
58: ; preds = %57
%59 = load i8*, i8** %4
%60 = getelementptr inbounds i8, i8* %59, i32 -1
store i8* %60, i8** %4
br label %40
61: ; preds = %56, %40
%62 = getelementptr inbounds [2048 x i8], [2048 x i8]* %3, i64 0, i64 0
store i8* %62, i8** %4
br label %63
63: ; preds = %75, %61
%64 = load i8*, i8** %4
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %73
68: ; preds = %63
%69 = load i8*, i8** %4
%70 = load i8, i8* %69
%71 = call i64 @isspace(i8 signext %70)
%72 = icmp ne i64 %71, 0
br label %73
73: ; preds = %68, %63
%74 = phi i1 [ false, %63 ], [ %72, %68 ]
br i1 %74, label %75, label %78
75: ; preds = %73
%76 = load i8*, i8** %4
%77 = getelementptr inbounds i8, i8* %76, i32 1
store i8* %77, i8** %4
br label %63
78: ; preds = %73
%79 = load i8*, i8** %4
store i8* %79, i8** %5
%80 = load i8*, i8** %5
%81 = load i8, i8* %80
%82 = sext i8 %81 to i32
%83 = icmp eq i32 %82, 0
br i1 %83, label %84, label %85
84: ; preds = %78
br label %6
85: ; preds = %78
%86 = load i8*, i8** %5
%87 = load i8, i8* %86
%88 = sext i8 %87 to i32
%89 = icmp eq i32 %88, 64
br i1 %89, label %90, label %91
90: ; preds = %85
br label %6
91: ; preds = %85
%92 = load i8*, i8** %5
store i8* %92, i8** %4
br label %93
93: ; preds = %104, %91
%94 = load i8*, i8** %4
%95 = load i8, i8* %94
%96 = icmp ne i8 %95, 0
br i1 %96, label %97, label %107
97: ; preds = %93
%98 = load i8*, i8** %4
%99 = load i8, i8* %98
%100 = call i64 @isspace(i8 signext %99)
%101 = icmp ne i64 %100, 0
br i1 %101, label %102, label %103
102: ; preds = %97
br label %107
103: ; preds = %97
br label %104
104: ; preds = %103
%105 = load i8*, i8** %4
%106 = getelementptr inbounds i8, i8* %105, i32 1
store i8* %106, i8** %4
br label %93
107: ; preds = %102, %93
%108 = load i8*, i8** %4
store i8 0, i8* %108
%109 = load i8*, i8** %4
%110 = getelementptr inbounds i8, i8* %109, i32 1
store i8* %110, i8** %4
br label %111
111: ; preds = %122, %107
%112 = load i8*, i8** %4
%113 = load i8, i8* %112
%114 = icmp ne i8 %113, 0
br i1 %114, label %115, label %125
115: ; preds = %111
%116 = load i8*, i8** %4
%117 = load i8, i8* %116
%118 = call i64 @isspace(i8 signext %117)
%119 = icmp ne i64 %118, 0
br i1 %119, label %121, label %120
120: ; preds = %115
br label %125
121: ; preds = %115
br label %122
122: ; preds = %121
%123 = load i8*, i8** %4
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %4
br label %111
125: ; preds = %120, %111
%126 = load i8*, i8** %5
%127 = load i8*, i8** %4
%128 = call i32 @add_subst(i8* %126, i8* %127)
br label %6
129: ; preds = %18, %6
ret void
}

LLVM IR (-O2):
define void @parse_config_file(i32* nocapture %0) {
%2 = alloca [2048 x i8]
%3 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 0
%4 = call i32 @feof(i32* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %68
6: ; preds = %1, %65
%7 = call i32 @memset(i8* %3, i32 0, i32 2048)
%8 = call i32* @fgets(i8* %3, i32 2048, i32* %0)
%9 = icmp eq i32* %8, null
br i1 %9, label %68, label %10
10: ; preds = %6
%11 = call i8* @strchr(i8* %3, i8 signext 10)
%12 = icmp eq i8* %11, null
br i1 %12, label %14, label %13
13: ; preds = %10
store i8 0, i8* %11
br label %14
14: ; preds = %13, %10
%15 = call i8* @strchr(i8* %3, i8 signext 35)
%16 = icmp eq i8* %15, null
br i1 %16, label %18, label %17
17: ; preds = %14
store i8 0, i8* %15
br label %18
18: ; preds = %17, %14
%19 = call i32 @strlen(i8* %3)
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [2048 x i8], [2048 x i8]* %2, i64 0, i64 %20
%22 = getelementptr inbounds i8, i8* %21, i64 -1
%23 = icmp ult i8* %22, %3
br i1 %23, label %30, label %24
24: ; preds = %18, %27
%25 = phi i8* [ %28, %27 ], [ %22, %18 ]
%26 = load i8, i8* %25
switch i8 %26, label %30 [
i8 32, label %27
i8 9, label %27
]
27: ; preds = %24, %24
store i8 0, i8* %25
%28 = getelementptr inbounds i8, i8* %25, i64 -1
%29 = icmp ult i8* %28, %3
br i1 %29, label %30, label %24
30: ; preds = %27, %24, %18
%31 = load i8, i8* %3
%32 = icmp eq i8 %31, 0
br i1 %32, label %65, label %33
33: ; preds = %30, %38
%34 = phi i8 [ %40, %38 ], [ %31, %30 ]
%35 = phi i8* [ %39, %38 ], [ %3, %30 ]
%36 = call i64 @isspace(i8 signext %34)
%37 = icmp eq i64 %36, 0
br i1 %37, label %42, label %38
38: ; preds = %33
%39 = getelementptr inbounds i8, i8* %35, i64 1
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %65, label %33
42: ; preds = %33
%43 = load i8, i8* %35
switch i8 %43, label %44 [
i8 0, label %65
i8 64, label %65
]
44: ; preds = %42, %49
%45 = phi i8 [ %51, %49 ], [ %43, %42 ]
%46 = phi i8* [ %50, %49 ], [ %35, %42 ]
%47 = call i64 @isspace(i8 signext %45)
%48 = icmp eq i64 %47, 0
br i1 %48, label %49, label %53
49: ; preds = %44
%50 = getelementptr inbounds i8, i8* %46, i64 1
%51 = load i8, i8* %50
%52 = icmp eq i8 %51, 0
br i1 %52, label %53, label %44
53: ; preds = %49, %44
%54 = phi i8* [ %46, %44 ], [ %50, %49 ]
store i8 0, i8* %54
br label %55
55: ; preds = %60, %53
%56 = phi i8* [ %54, %53 ], [ %57, %60 ]
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = load i8, i8* %57
%59 = icmp eq i8 %58, 0
br i1 %59, label %63, label %60
60: ; preds = %55
%61 = call i64 @isspace(i8 signext %58)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %55
63: ; preds = %60, %55
%64 = call i32 @add_subst(i8* %35, i8* %57)
br label %65
65: ; preds = %38, %30, %63, %42, %42
%66 = call i32 @feof(i32* %0)
%67 = icmp eq i32 %66, 0
br i1 %67, label %6, label %68
68: ; preds = %65, %6, %1
ret void
}