#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 */
int /*<<< orphan*/ ident_dir(char *);
int /*<<< orphan*/ ident_file(char *, char *, int);
int /*<<< orphan*/ ident_zip(char *);
int /*<<< orphan*/ is_directory(char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int ident(char *fn) {
  int l;
  if (!is_directory(fn)) {
    l = strlen(fn);
    if (l > 4) {
      if (strcmp(&fn[l - 4], ".ZIP") == 0) {
        ident_zip(fn);
      } else {
        ident_file(".", fn, -1);
      }
    } else {
      ident_file(".", fn, -1);
    };
  } else {
    ident_dir(fn);
  };
}


x86 assembly (clang, -O0):
<ident>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <is_directory@plt>
cmp    $0x0,%eax
jne    11fb <ident+0x9b>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x4,-0x14(%rbp)
jle    11e1 <ident+0x81>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
cltq
add    %rax,%rdi
lea    0xe56(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    11c7 <ident+0x67>
mov    -0x10(%rbp),%rdi
call   1060 <ident_zip@plt>
jmp    11dc <ident+0x7c>
mov    -0x10(%rbp),%rsi
lea    0xe33(%rip),%rdi
mov    $0xffffffff,%edx
call   1040 <ident_file@plt>
jmp    11f6 <ident+0x96>
mov    -0x10(%rbp),%rsi
lea    0xe19(%rip),%rdi
mov    $0xffffffff,%edx
call   1040 <ident_file@plt>
jmp    1204 <ident+0xa4>
mov    -0x10(%rbp),%rdi
call   1070 <ident_dir@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ident>:
push   %rbx
mov    %rdi,%rbx
call   1080 <is_directory@plt>
test   %eax,%eax
je     1177 <ident+0x17>
mov    %rbx,%rdi
call   1070 <ident_dir@plt>
pop    %rbx
ret
mov    %rbx,%rdi
call   1030 <strlen@plt>
cmp    $0x5,%eax
jl     119e <ident+0x3e>
add    $0xfffffffc,%eax
add    %rbx,%rax
lea    0xe6f(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11b4 <ident+0x54>
lea    0xe60(%rip),%rdi
mov    %rbx,%rsi
mov    $0xffffffff,%edx
call   1040 <ident_file@plt>
pop    %rbx
ret
mov    %rbx,%rdi
call   1060 <ident_zip@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [5 x i8] c".ZIP\00"
@.str.1 = [2 x i8] c".\00"
define i32 @ident(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i32 @is_directory(i8* %5)
%7 = icmp ne i32 %6, 0
br i1 %7, label %32, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %4
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 4
br i1 %12, label %13, label %28
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %14, i64 %17
%19 = call i64 @strcmp(i8* %18, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%20 = icmp eq i64 %19, 0
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = load i8*, i8** %3
%23 = call i32 @ident_zip(i8* %22)
br label %27
24: ; preds = %13
%25 = load i8*, i8** %3
%26 = call i32 @ident_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %25, i32 -1)
br label %27
27: ; preds = %24, %21
br label %31
28: ; preds = %8
%29 = load i8*, i8** %3
%30 = call i32 @ident_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %29, i32 -1)
br label %31
31: ; preds = %28, %27
br label %35
32: ; preds = %1
%33 = load i8*, i8** %3
%34 = call i32 @ident_dir(i8* %33)
br label %35
35: ; preds = %32, %31
%36 = load i32, i32* %2
ret i32 %36
}

LLVM IR (-O2):
@.str = [5 x i8] c".ZIP\00"
@.str.1 = [2 x i8] c".\00"
define i32 @ident(i8* %0) {
%2 = tail call i32 @is_directory(i8* %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %19
4: ; preds = %1
%5 = tail call i32 @strlen(i8* %0)
%6 = icmp sgt i32 %5, 4
br i1 %6, label %7, label %17
7: ; preds = %4
%8 = add nsw i32 %5, -4
%9 = zext i32 %8 to i64
%10 = getelementptr inbounds i8, i8* %0, i64 %9
%11 = tail call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 @ident_zip(i8* %0)
br label %21
15: ; preds = %7
%16 = tail call i32 @ident_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 -1)
br label %21
17: ; preds = %4
%18 = tail call i32 @ident_file(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32 -1)
br label %21
19: ; preds = %1
%20 = tail call i32 @ident_dir(i8* %0)
br label %21
21: ; preds = %17, %15, %13, %19
ret i32 undef
}