#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 */
struct lafe_matching {
  int dummy;
};
struct lafe_line_reader {
  int dummy;
};

/* Variables and functions */
scalar_t__ lafe_include(struct lafe_matching **, char const *);
struct lafe_line_reader *lafe_line_reader(char const *, int);
int /*<<< orphan*/ lafe_line_reader_free(struct lafe_line_reader *);
char *lafe_line_reader_next(struct lafe_line_reader *);
int lafe_include_from_file(struct lafe_matching **matching,
                           const char *pathname, int nullSeparator) {
  struct lafe_line_reader *lr;
  const char *p;
  int ret = 0;
  lr = lafe_line_reader(pathname, nullSeparator);
  while ((p = lafe_line_reader_next(lr)) != NULL) {
    if (lafe_include(matching, p) != 0)
      ret = -1;
  }
  lafe_line_reader_free(lr);
  return (ret);
}


x86 assembly (clang, -O0):
<lafe_include_from_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <lafe_line_reader@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <lafe_line_reader_next@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     11a4 <lafe_include_from_file+0x64>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1060 <lafe_include@plt>
cmp    $0x0,%rax
je     119f <lafe_include_from_file+0x5f>
movl   $0xffffffff,-0x2c(%rbp)
jmp    116a <lafe_include_from_file+0x2a>
mov    -0x20(%rbp),%rdi
call   1050 <lafe_line_reader_free@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lafe_include_from_file>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
mov    %rsi,%rdi
mov    %edx,%esi
call   1040 <lafe_line_reader@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <lafe_line_reader_next@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     118f <lafe_include_from_file+0x4f>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r14,%rdi
mov    %rax,%rsi
call   1060 <lafe_include@plt>
neg    %rax
sbb    %eax,%eax
or     %eax,%ebp
mov    %rbx,%rdi
call   1030 <lafe_line_reader_next@plt>
test   %rax,%rax
jne    1170 <lafe_include_from_file+0x30>
mov    %rbx,%rdi
call   1050 <lafe_line_reader_free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.lafe_matching = type { i32 }
%struct.lafe_line_reader = type { i32 }
define i32 @lafe_include_from_file(%struct.lafe_matching** %0, i8* %1, i32 %2) {
%4 = alloca %struct.lafe_matching**
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.lafe_line_reader*
%8 = alloca i8*
%9 = alloca i32
store %struct.lafe_matching** %0, %struct.lafe_matching*** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
store i32 0, i32* %9
%10 = load i8*, i8** %5
%11 = load i32, i32* %6
%12 = call %struct.lafe_line_reader* @lafe_line_reader(i8* %10, i32 %11)
store %struct.lafe_line_reader* %12, %struct.lafe_line_reader** %7
br label %13
13: ; preds = %23, %3
%14 = load %struct.lafe_line_reader*, %struct.lafe_line_reader** %7
%15 = call i8* @lafe_line_reader_next(%struct.lafe_line_reader* %14)
store i8* %15, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %24
17: ; preds = %13
%18 = load %struct.lafe_matching**, %struct.lafe_matching*** %4
%19 = load i8*, i8** %8
%20 = call i64 @lafe_include(%struct.lafe_matching** %18, i8* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %17
store i32 -1, i32* %9
br label %23
23: ; preds = %22, %17
br label %13
24: ; preds = %13
%25 = load %struct.lafe_line_reader*, %struct.lafe_line_reader** %7
%26 = call i32 @lafe_line_reader_free(%struct.lafe_line_reader* %25)
%27 = load i32, i32* %9
ret i32 %27
}

LLVM IR (-O2):
%struct.lafe_matching = type { i32 }
%struct.lafe_line_reader = type { i32 }
define i32 @lafe_include_from_file(%struct.lafe_matching** %0, i8* %1, i32 %2) {
%4 = tail call %struct.lafe_line_reader* @lafe_line_reader(i8* %1, i32 %2)
%5 = tail call i8* @lafe_line_reader_next(%struct.lafe_line_reader* %4)
%6 = icmp eq i8* %5, null
br i1 %6, label %15, label %7
7: ; preds = %3, %7
%8 = phi i8* [ %13, %7 ], [ %5, %3 ]
%9 = phi i32 [ %12, %7 ], [ 0, %3 ]
%10 = tail call i64 @lafe_include(%struct.lafe_matching** %0, i8* %8)
%11 = icmp eq i64 %10, 0
%12 = select i1 %11, i32 %9, i32 -1
%13 = tail call i8* @lafe_line_reader_next(%struct.lafe_line_reader* %4)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %7
15: ; preds = %7, %3
%16 = phi i32 [ 0, %3 ], [ %12, %7 ]
%17 = tail call i32 @lafe_line_reader_free(%struct.lafe_line_reader* %4)
ret i32 %16
}