#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 */

/* Variables and functions */
scalar_t__ mmapfile(char const *, int);
int /*<<< orphan*/ munmapfile();
char *nextline();
int parseinitline(char *);
int readinittab(const char *file, int strict) {
  int ret = -1;
  char *ls;
  if (mmapfile(file, -0x10000))
    return -1;
  while ((ls = nextline()))
    if ((ret = parseinitline(ls)) && strict)
      break;
  munmapfile();
  return strict ? ret : 0;
}


x86 assembly (clang, -O0):
<readinittab>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0xffff0000,%esi
call   1030 <mmapfile@plt>
cmp    $0x0,%rax
je     117a <readinittab+0x3a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e9 <readinittab+0xa9>
jmp    117f <readinittab+0x3f>
mov    $0x0,%al
call   1060 <nextline@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11bd <readinittab+0x7d>
mov    -0x20(%rbp),%rdi
call   1050 <parseinitline@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
je     11b8 <readinittab+0x78>
cmpl   $0x0,-0x14(%rbp)
je     11b8 <readinittab+0x78>
jmp    11bd <readinittab+0x7d>
jmp    117f <readinittab+0x3f>
mov    $0x0,%al
call   1040 <munmapfile@plt>
cmpl   $0x0,-0x14(%rbp)
je     11d9 <readinittab+0x99>
mov    -0x18(%rbp),%eax
mov    %eax,-0x24(%rbp)
jmp    11e3 <readinittab+0xa3>
xor    %eax,%eax
mov    %eax,-0x24(%rbp)
jmp    11e3 <readinittab+0xa3>
mov    -0x24(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<readinittab>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    $0xffff0000,%esi
call   1030 <mmapfile@plt>
mov    $0xffffffff,%ebp
test   %rax,%rax
jne    119a <readinittab+0x5a>
xor    %eax,%eax
call   1060 <nextline@plt>
test   %rax,%rax
jne    117c <readinittab+0x3c>
mov    $0xffffffff,%ebp
jmp    118e <readinittab+0x4e>
nopl   0x0(%rax)
xor    %eax,%eax
call   1060 <nextline@plt>
test   %rax,%rax
je     118e <readinittab+0x4e>
mov    %rax,%rdi
call   1050 <parseinitline@plt>
mov    %eax,%ebp
test   %ebx,%ebx
je     1170 <readinittab+0x30>
test   %ebp,%ebp
je     1170 <readinittab+0x30>
xor    %eax,%eax
call   1040 <munmapfile@plt>
test   %ebx,%ebx
cmove  %ebx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @readinittab(i8* %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 -1, i32* %6
%8 = load i8*, i8** %4
%9 = call i64 @mmapfile(i8* %8, i32 -65536)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %34
12: ; preds = %2
br label %13
13: ; preds = %24, %12
%14 = call i8* (...) @nextline()
store i8* %14, i8** %7
%15 = icmp ne i8* %14, null
br i1 %15, label %16, label %25
16: ; preds = %13
%17 = load i8*, i8** %7
%18 = call i32 @parseinitline(i8* %17)
store i32 %18, i32* %6
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %16
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %20
br label %25
24: ; preds = %20, %16
br label %13
25: ; preds = %23, %13
%26 = call i32 (...) @munmapfile()
%27 = load i32, i32* %5
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i32, i32* %6
br label %32
31: ; preds = %25
br label %32
32: ; preds = %31, %29
%33 = phi i32 [ %30, %29 ], [ 0, %31 ]
store i32 %33, i32* %3
br label %34
34: ; preds = %32, %11
%35 = load i32, i32* %3
ret i32 %35
}

LLVM IR (-O2):
define i32 @readinittab(i8* %0, i32 %1) {
%3 = tail call i64 @mmapfile(i8* %0, i32 -65536)
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %23
5: ; preds = %2
%6 = tail call i8* (...) @nextline()
%7 = icmp eq i8* %6, null
br i1 %7, label %18, label %8
8: ; preds = %5
%9 = icmp ne i32 %1, 0
br label %13
10: ; preds = %13
%11 = tail call i8* (...) @nextline()
%12 = icmp eq i8* %11, null
br i1 %12, label %18, label %13
13: ; preds = %8, %10
%14 = phi i8* [ %6, %8 ], [ %11, %10 ]
%15 = tail call i32 @parseinitline(i8* %14)
%16 = icmp ne i32 %15, 0
%17 = and i1 %9, %16
br i1 %17, label %18, label %10
18: ; preds = %10, %13, %5
%19 = phi i32 [ -1, %5 ], [ %15, %13 ], [ %15, %10 ]
%20 = tail call i32 (...) @munmapfile()
%21 = icmp eq i32 %1, 0
%22 = select i1 %21, i32 0, i32 %19
br label %23
23: ; preds = %2, %18
%24 = phi i32 [ %22, %18 ], [ -1, %2 ]
ret i32 %24
}