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

/* Variables and functions */
int /*<<< orphan*/ S_IFBLK;
int /*<<< orphan*/ S_IFCHR;
int /*<<< orphan*/ S_IFIFO;
int /*<<< orphan*/ S_IFREG;
int /*<<< orphan*/ strcmp(char *, char *);
mode_t nod_type(char *type) {
  if (!strcmp(type, "c") || !strcmp(type, "u"))
    return S_IFCHR;
  if (!strcmp(type, "d"))
    return S_IFBLK;
  if (!strcmp(type, "p"))
    return S_IFIFO;
  return S_IFREG;
}


x86 assembly (clang, -O0):
<nod_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
je     114e <nod_type+0x3e>
mov    -0x10(%rbp),%rdi
lea    0xec2(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    115f <nod_type+0x4f>
mov    0x2e7b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <nod_type+0xaf>
mov    -0x10(%rbp),%rdi
lea    0xe9a(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1189 <nod_type+0x79>
mov    0x2e59(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <nod_type+0xaf>
mov    -0x10(%rbp),%rdi
lea    0xe72(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    11b3 <nod_type+0xa3>
mov    0x2e1f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11bf <nod_type+0xaf>
mov    0x2e2e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nod_type>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xee2(%rip),%rsi
call   1030 <strcmp@plt>
mov    0x2ea6(%rip),%r14
test   %eax,%eax
je     1180 <nod_type+0x70>
lea    0xecd(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1180 <nod_type+0x70>
lea    0xebc(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
je     1170 <nod_type+0x60>
lea    0xeab(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcmp@plt>
test   %eax,%eax
jne    1179 <nod_type+0x69>
mov    0x2e5a(%rip),%r14
jmp    1180 <nod_type+0x70>
mov    0x2e61(%rip),%r14
jmp    1180 <nod_type+0x70>
mov    0x2e68(%rip),%r14
mov    (%r14),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c"c\00"
@.str.1 = [2 x i8] c"u\00"
@S_IFCHR = global i32 0
@.str.2 = [2 x i8] c"d\00"
@S_IFBLK = global i32 0
@.str.3 = [2 x i8] c"p\00"
@S_IFIFO = global i32 0
@S_IFREG = global i32 0
define i32 @nod_type(i8* nocapture %0) {
%2 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %2, 0
br i1 %3, label %14, label %4
4: ; preds = %1
%5 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%6 = icmp eq i32 %5, 0
br i1 %6, label %14, label %7
7: ; preds = %4
%8 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = icmp eq i32 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i32 @strcmp(i8* dereferenceable(1) %0, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32* @S_IFIFO, i32* @S_IFREG
br label %14
14: ; preds = %10, %7, %1, %4
%15 = phi i32* [ @S_IFCHR, %4 ], [ @S_IFCHR, %1 ], [ @S_IFBLK, %7 ], [ %13, %10 ]
%16 = load i32, i32* %15
ret i32 %16
}