#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 stat {
  int dummy;
};

/* Variables and functions */
int FTW_D;
int FTW_F;
int /*<<< orphan*/ printf(char *, char const *);
int statFunc(const char *path, struct stat *stbuff, int type) {
  if (type == FTW_F)
    printf("%s : Regular File\n", path);
  if (type == FTW_D)
    printf("%s : Directory\n", path);
  return 0;
}


x86 assembly (clang, -O0):
<statFunc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2eb3(%rip),%rcx
cmp    (%rcx),%eax
jne    1145 <statFunc+0x35>
mov    -0x8(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
mov    0x2e99(%rip),%rcx
cmp    (%rcx),%eax
jne    1167 <statFunc+0x57>
mov    -0x8(%rbp),%rsi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<statFunc>:
push   %rbp
push   %rbx
push   %rax
mov    %edx,%ebp
mov    %rdi,%rbx
mov    0x2ec1(%rip),%rax
cmp    %edx,(%rax)
jne    1132 <statFunc+0x22>
lea    0xed6(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
mov    0x2eaf(%rip),%rax
cmp    %ebp,(%rax)
jne    114c <statFunc+0x3c>
lea    0xecf(%rip),%rdi
mov    %rbx,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.stat = type { i32 }
@FTW_F = global i32 0
@.str = [19 x i8] c"%s : Regular File\0A\00"
@FTW_D = global i32 0
@.str.1 = [16 x i8] c"%s : Directory\0A\00"
define i32 @statFunc(i8* %0, %struct.stat* %1, i32 %2) {
%4 = alloca i8*
%5 = alloca %struct.stat*
%6 = alloca i32
store i8* %0, i8** %4
store %struct.stat* %1, %struct.stat** %5
store i32 %2, i32* %6
%7 = load i32, i32* %6
%8 = load i32, i32* @FTW_F
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i8*, i8** %4
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %11)
br label %13
13: ; preds = %10, %3
%14 = load i32, i32* %6
%15 = load i32, i32* @FTW_D
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %20
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %18)
br label %20
20: ; preds = %17, %13
ret i32 0
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@FTW_F = global i32 0
@.str = [19 x i8] c"%s : Regular File\0A\00"
@FTW_D = global i32 0
@.str.1 = [16 x i8] c"%s : Directory\0A\00"
define i32 @statFunc(i8* %0, %struct.stat* nocapture readnone %1, i32 %2) {
%4 = load i32, i32* @FTW_F
%5 = icmp eq i32 %4, %2
br i1 %5, label %6, label %8
6: ; preds = %3
%7 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %8
8: ; preds = %6, %3
%9 = load i32, i32* @FTW_D
%10 = icmp eq i32 %9, %2
br i1 %10, label %11, label %13
11: ; preds = %8
%12 = tail call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %13
13: ; preds = %11, %8
ret i32 0
}