#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*/ free(char *);
int getline(char **, size_t *, int /*<<< orphan*/ *);
int /*<<< orphan*/ is_commented(char *);
int /*<<< orphan*/ set_variable(char *, char *, int);
char *strtok_r(char *, char *, char **);
void parse(FILE *file, bool overwrite) {
  char *name, *original, *line = NULL, *tok_ptr;
  size_t len = 0;
  while (-1 != getline(&line, &len, file)) {
    if (!is_commented(line)) {
      name = strtok_r(line, "=", &tok_ptr);
      original = strtok_r(NULL, "\n", &tok_ptr);
      set_variable(name, original, overwrite);
    }
  }
  free(line);
}


x86 assembly (clang, -O0):
<parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x38(%rbp)
mov    -0x8(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x38(%rbp),%rsi
call   1070 <getline@plt>
mov    %eax,%ecx
mov    $0xffffffff,%eax
cmp    %ecx,%eax
je     11e6 <parse+0x96>
mov    -0x28(%rbp),%rdi
call   1060 <is_commented@plt>
cmp    $0x0,%eax
jne    11e1 <parse+0x91>
mov    -0x28(%rbp),%rdi
lea    0xe54(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xe3e(%rip),%rsi
lea    -0x30(%rbp),%rdx
call   1050 <strtok_r@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1040 <set_variable@plt>
jmp    116f <parse+0x1f>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %esi,%r15d
mov    %rdi,%rbx
movq   $0x0,(%rsp)
movq   $0x0,0x8(%rsp)
mov    %rsp,%rdi
lea    0x8(%rsp),%rsi
mov    %rbx,%rdx
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     11f7 <parse+0xa7>
lea    0x10(%rsp),%r13
mov    %rsp,%rbp
lea    0x8(%rsp),%r14
jmp    11b3 <parse+0x63>
nopl   0x0(%rax)
mov    %rbp,%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1070 <getline@plt>
cmp    $0xffffffff,%eax
je     11f7 <parse+0xa7>
mov    (%rsp),%rdi
call   1060 <is_commented@plt>
test   %eax,%eax
jne    11a0 <parse+0x50>
mov    (%rsp),%rdi
lea    0xe35(%rip),%rsi
mov    %r13,%rdx
call   1050 <strtok_r@plt>
mov    %rax,%r12
xor    %edi,%edi
lea    0xe23(%rip),%rsi
mov    %r13,%rdx
call   1050 <strtok_r@plt>
mov    %r12,%rdi
mov    %rax,%rsi
mov    %r15d,%edx
call   1040 <set_variable@plt>
jmp    11a0 <parse+0x50>
mov    (%rsp),%rdi
call   1030 <free@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @parse(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i64
store i32* %0, i32** %3
store i32 %1, i32* %4
store i8* null, i8** %7
store i64 0, i64* %9
br label %10
10: ; preds = %26, %2
%11 = load i32*, i32** %3
%12 = call i32 @getline(i8** %7, i64* %9, i32* %11)
%13 = icmp ne i32 -1, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %7
%16 = call i32 @is_commented(i8* %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %26, label %18
18: ; preds = %14
%19 = load i8*, i8** %7
%20 = call i8* @strtok_r(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %8)
store i8* %20, i8** %5
%21 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %8)
store i8* %21, i8** %6
%22 = load i8*, i8** %5
%23 = load i8*, i8** %6
%24 = load i32, i32* %4
%25 = call i32 @set_variable(i8* %22, i8* %23, i32 %24)
br label %26
26: ; preds = %18, %14
br label %10
27: ; preds = %10
%28 = load i8*, i8** %7
%29 = call i32 @free(i8* %28)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"=\00"
@.str.1 = [2 x i8] c"\0A\00"
define void @parse(i32* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
%6 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%7 = bitcast i8** %4 to i8*
%8 = bitcast i64* %5 to i8*
store i64 0, i64* %5
%9 = call i32 @getline(i8** %3, i64* %5, i32* %0)
%10 = icmp eq i32 %9, -1
br i1 %10, label %23, label %11
11: ; preds = %2, %20
%12 = load i8*, i8** %3
%13 = call i32 @is_commented(i8* %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %20
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i8* @strtok_r(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %4)
%18 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %4)
%19 = call i32 @set_variable(i8* %17, i8* %18, i32 %1)
br label %20
20: ; preds = %15, %11
%21 = call i32 @getline(i8** %3, i64* %5, i32* %0)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %11
23: ; preds = %20, %2
%24 = load i8*, i8** %3
%25 = call i32 @free(i8* %24)
ret void
}