#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*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgetsnolfs(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ strncasecmp(char *, char *, int /*<<< orphan*/);
int ishiddendir(char *p) {
  int hidden = 0;
  FILE *hf;
  char tmpfile[300];
  if (hf = fopen("/ftp-data/misc/f00-hiddendirs.txt", "r")) {
    while (fgetsnolfs(tmpfile, 300, hf))
      if (tmpfile[0] && !strncasecmp(tmpfile, p, strlen(tmpfile)))
        hidden = 1;
    fclose(hf);
  }
  return hidden;
}


x86 assembly (clang, -O0):
<ishiddendir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe93(%rip),%rdi
lea    0xeae(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1213 <ishiddendir+0xc3>
jmp    118c <ishiddendir+0x3c>
lea    -0x150(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x12c,%esi
call   1050 <fgetsnolfs@plt>
cmp    $0x0,%rax
je     120a <ishiddendir+0xba>
movsbl -0x150(%rbp),%eax
cmp    $0x0,%eax
je     1205 <ishiddendir+0xb5>
lea    -0x150(%rbp),%rax
mov    %rax,-0x160(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x158(%rbp)
lea    -0x150(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x160(%rbp),%rdi
mov    -0x158(%rbp),%rsi
mov    %eax,%edx
call   1060 <strncasecmp@plt>
cmp    $0x0,%eax
jne    1205 <ishiddendir+0xb5>
movl   $0x1,-0xc(%rbp)
jmp    118c <ishiddendir+0x3c>
mov    -0x18(%rbp),%rdi
call   1030 <fclose@plt>
mov    -0xc(%rbp),%eax
add    $0x160,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ishiddendir>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x130,%rsp
mov    %rdi,%r14
lea    0xe97(%rip),%rdi
lea    0xeb2(%rip),%rsi
call   1070 <fopen@plt>
test   %rax,%rax
je     11e2 <ishiddendir+0x92>
mov    %rax,%r15
mov    %rsp,%rdi
mov    $0x12c,%esi
mov    %rax,%rdx
call   1050 <fgetsnolfs@plt>
xor    %ebp,%ebp
test   %rax,%rax
je     11d8 <ishiddendir+0x88>
mov    %rsp,%rbx
mov    $0x1,%r12d
jmp    11b5 <ishiddendir+0x65>
nop
mov    %rbx,%rdi
mov    $0x12c,%esi
mov    %r15,%rdx
call   1050 <fgetsnolfs@plt>
test   %rax,%rax
je     11d8 <ishiddendir+0x88>
cmpb   $0x0,(%rsp)
je     11a0 <ishiddendir+0x50>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %eax,%edx
call   1060 <strncasecmp@plt>
test   %eax,%eax
cmove  %r12d,%ebp
jmp    11a0 <ishiddendir+0x50>
mov    %r15,%rdi
call   1030 <fclose@plt>
jmp    11e4 <ishiddendir+0x94>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x130,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"/ftp-data/misc/f00-hiddendirs.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @ishiddendir(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32*
%5 = alloca [300 x i8]
store i8* %0, i8** %2
store i32 0, i32* %3
%6 = call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %6, i32** %4
%7 = icmp ne i32* %6, null
br i1 %7, label %8, label %31
8: ; preds = %1
br label %9
9: ; preds = %27, %8
%10 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%11 = load i32*, i32** %4
%12 = call i64 @fgetsnolfs(i8* %10, i32 300, i32* %11)
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %28
14: ; preds = %9
%15 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 0
br i1 %18, label %19, label %27
19: ; preds = %14
%20 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%21 = load i8*, i8** %2
%22 = getelementptr inbounds [300 x i8], [300 x i8]* %5, i64 0, i64 0
%23 = call i32 @strlen(i8* %22)
%24 = call i32 @strncasecmp(i8* %20, i8* %21, i32 %23)
%25 = icmp ne i32 %24, 0
br i1 %25, label %27, label %26
26: ; preds = %19
store i32 1, i32* %3
br label %27
27: ; preds = %26, %19, %14
br label %9
28: ; preds = %9
%29 = load i32*, i32** %4
%30 = call i32 @fclose(i32* %29)
br label %31
31: ; preds = %28, %1
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [34 x i8] c"/ftp-data/misc/f00-hiddendirs.txt\00"
@.str.1 = [2 x i8] c"r\00"
define i32 @ishiddendir(i8* nocapture %0) {
%2 = alloca [300 x i8]
%3 = getelementptr inbounds [300 x i8], [300 x i8]* %2, i64 0, i64 0
%4 = tail call i32* @fopen(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = icmp eq i32* %4, null
br i1 %5, label %25, label %6
6: ; preds = %1
%7 = call i64 @fgetsnolfs(i8* %3, i32 300, i32* %4)
%8 = icmp eq i64 %7, 0
br i1 %8, label %22, label %9
9: ; preds = %6, %18
%10 = phi i32 [ %19, %18 ], [ 0, %6 ]
%11 = load i8, i8* %3
%12 = icmp eq i8 %11, 0
br i1 %12, label %18, label %13
13: ; preds = %9
%14 = call i32 @strlen(i8* %3)
%15 = call i32 @strncasecmp(i8* %3, i8* %0, i32 %14)
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32 1, i32 %10
br label %18
18: ; preds = %13, %9
%19 = phi i32 [ %10, %9 ], [ %17, %13 ]
%20 = call i64 @fgetsnolfs(i8* %3, i32 300, i32* %4)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %9
22: ; preds = %18, %6
%23 = phi i32 [ 0, %6 ], [ %19, %18 ]
%24 = call i32 @fclose(i32* %4)
br label %25
25: ; preds = %22, %1
%26 = phi i32 [ %23, %22 ], [ 0, %1 ]
ret i32 %26
}