#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*/ evf_eat_spaces(char **);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ strncpy(char *, char *, size_t);
void evf_read_line_preprocess(FILE *config, char *buf, size_t buf_len) {
  char str_buf[buf_len];
  char *line;
  do {
    line = str_buf;
    *line = '\0';
    fscanf(config, "%4096[^\n]\n", line);
    evf_eat_spaces(&line);
    if (*line == '#')
      *line = '\0';
    if (*line)
      break;
  } while (!feof(config));
  strncpy(buf, line, buf_len);
}


x86 assembly (clang, -O0):
<evf_read_line_preprocess>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0x30(%rbp),%rdx
lea    0xe67(%rip),%rsi
call   1050 <fscanf@plt>
lea    -0x30(%rbp),%rdi
call   1040 <evf_eat_spaces@plt>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    11be <evf_read_line_preprocess+0x7e>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11d0 <evf_read_line_preprocess+0x90>
jmp    11ee <evf_read_line_preprocess+0xae>
jmp    11d5 <evf_read_line_preprocess+0x95>
mov    -0x8(%rbp),%rdi
call   1060 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    117b <evf_read_line_preprocess+0x3b>
mov    -0x10(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncpy@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<evf_read_line_preprocess>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    %rsi,-0x38(%rbp)
mov    %rdi,%r12
mov    %rsp,%rbx
lea    0xf(%rdx),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
lea    0xe8d(%rip),%r13
lea    -0x30(%rbp),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,-0x30(%rbp)
movb   $0x0,(%rbx)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
call   1050 <fscanf@plt>
mov    %r14,%rdi
call   1040 <evf_eat_spaces@plt>
mov    -0x30(%rbp),%rsi
movzbl (%rsi),%eax
cmp    $0x23,%al
jne    11b2 <evf_read_line_preprocess+0x72>
movb   $0x0,(%rsi)
mov    -0x30(%rbp),%rsi
movzbl (%rsi),%eax
test   %al,%al
jne    11c6 <evf_read_line_preprocess+0x86>
mov    %r12,%rdi
call   1060 <feof@plt>
test   %eax,%eax
je     1180 <evf_read_line_preprocess+0x40>
mov    -0x30(%rbp),%rsi
mov    -0x38(%rbp),%rdi
mov    %r15,%rdx
call   1030 <strncpy@plt>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [11 x i8] c"%4096[^\0A]\0A\00"
define void @evf_read_line_preprocess(i32* %0, i8* %1, i64 %2) {
%4 = alloca i32*
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i8*
store i32* %0, i32** %4
store i8* %1, i8** %5
store i64 %2, i64* %6
%10 = load i64, i64* %6
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %7
%12 = alloca i8, i64 %10
store i64 %10, i64* %8
br label %13
13: ; preds = %31, %3
store i8* %12, i8** %9
%14 = load i8*, i8** %9
store i8 0, i8* %14
%15 = load i32*, i32** %4
%16 = load i8*, i8** %9
%17 = call i32 @fscanf(i32* %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %16)
%18 = call i32 @evf_eat_spaces(i8** %9)
%19 = load i8*, i8** %9
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 35
br i1 %22, label %23, label %25
23: ; preds = %13
%24 = load i8*, i8** %9
store i8 0, i8* %24
br label %25
25: ; preds = %23, %13
%26 = load i8*, i8** %9
%27 = load i8, i8* %26
%28 = icmp ne i8 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %25
br label %36
30: ; preds = %25
br label %31
31: ; preds = %30
%32 = load i32*, i32** %4
%33 = call i32 @feof(i32* %32)
%34 = icmp ne i32 %33, 0
%35 = xor i1 %34, true
br i1 %35, label %13, label %36
36: ; preds = %31, %29
%37 = load i8*, i8** %5
%38 = load i8*, i8** %9
%39 = load i64, i64* %6
%40 = call i32 @strncpy(i8* %37, i8* %38, i64 %39)
%41 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"%4096[^\0A]\0A\00"
define void @evf_read_line_preprocess(i32* nocapture %0, i8* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca i8, i64 %2
%6 = bitcast i8** %4 to i8*
br label %7
7: ; preds = %20, %3
store i8* %5, i8** %4
store i8 0, i8* %5
%8 = call i32 @fscanf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %5)
%9 = call i32 @evf_eat_spaces(i8** %4)
%10 = load i8*, i8** %4
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 35
br i1 %12, label %13, label %16
13: ; preds = %7
store i8 0, i8* %10
%14 = load i8*, i8** %4
%15 = load i8, i8* %14
br label %16
16: ; preds = %13, %7
%17 = phi i8 [ %15, %13 ], [ %11, %7 ]
%18 = phi i8* [ %14, %13 ], [ %10, %7 ]
%19 = icmp eq i8 %17, 0
br i1 %19, label %20, label %25
20: ; preds = %16
%21 = call i32 @feof(i32* %0)
%22 = icmp eq i32 %21, 0
br i1 %22, label %7, label %23
23: ; preds = %20
%24 = load i8*, i8** %4
br label %25
25: ; preds = %16, %23
%26 = phi i8* [ %24, %23 ], [ %18, %16 ]
%27 = call i32 @strncpy(i8* %1, i8* %26, i64 %2)
ret void
}