#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__ ends_with(char const *, char *);
scalar_t__ is_dir(char const *);
scalar_t__ starts_with(char const *, char *);
int all_c_code(const char *f) {
  if (is_dir(f) && !starts_with(f, ".")) {
    return 1;
  }
  if (starts_with(f, "_")) {
    return 0;
  }
  if (ends_with(f, ".h") || ends_with(f, ".c")) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<all_c_code>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <is_dir@plt>
cmp    $0x0,%rax
je     1175 <all_c_code+0x45>
mov    -0x10(%rbp),%rdi
lea    0xea6(%rip),%rsi
call   1050 <starts_with@plt>
cmp    $0x0,%rax
jne    1175 <all_c_code+0x45>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <all_c_code+0xb2>
mov    -0x10(%rbp),%rdi
lea    0xe82(%rip),%rsi
call   1050 <starts_with@plt>
cmp    $0x0,%rax
je     119b <all_c_code+0x6b>
movl   $0x0,-0x4(%rbp)
jmp    11e2 <all_c_code+0xb2>
mov    -0x10(%rbp),%rdi
lea    0xe5e(%rip),%rsi
call   1040 <ends_with@plt>
cmp    $0x0,%rax
jne    11cf <all_c_code+0x9f>
mov    -0x10(%rbp),%rdi
lea    0xe47(%rip),%rsi
call   1040 <ends_with@plt>
cmp    $0x0,%rax
je     11db <all_c_code+0xab>
movl   $0x1,-0x4(%rbp)
jmp    11e2 <all_c_code+0xb2>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<all_c_code>:
push   %rbx
mov    %rdi,%rbx
call   1030 <is_dir@plt>
test   %rax,%rax
je     1152 <all_c_code+0x22>
lea    0xebb(%rip),%rsi
mov    %rbx,%rdi
call   1050 <starts_with@plt>
test   %rax,%rax
je     11a5 <all_c_code+0x75>
lea    0xea9(%rip),%rsi
mov    %rbx,%rdi
call   1050 <starts_with@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     116d <all_c_code+0x3d>
pop    %rbx
ret
lea    0xe90(%rip),%rsi
mov    %rbx,%rdi
call   1040 <ends_with@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    116b <all_c_code+0x3b>
lea    0xe77(%rip),%rsi
mov    %rbx,%rdi
call   1040 <ends_with@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c".\00"
@.str.1 = [2 x i8] c"_\00"
@.str.2 = [3 x i8] c".h\00"
@.str.3 = [3 x i8] c".c\00"
define i32 @all_c_code(i8* %0) {
%2 = tail call i64 @is_dir(i8* %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i64 %5, 0
br i1 %6, label %17, label %7
7: ; preds = %4, %1
%8 = tail call i64 @starts_with(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %7
%11 = tail call i64 @ends_with(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %10
%14 = tail call i64 @ends_with(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%15 = icmp ne i64 %14, 0
%16 = zext i1 %15 to i32
br label %17
17: ; preds = %13, %10, %7, %4
%18 = phi i32 [ 1, %4 ], [ 0, %7 ], [ 1, %10 ], [ %16, %13 ]
ret i32 %18
}