#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*/ printf(char *);
int validate(int directoryOrFile, char *extension) {
  if (directoryOrFile == 0) {
    return (extension[0] == ' ');
  } else if (directoryOrFile == 1) {
    return (extension[0] != ' ');
  } else {
    printf("This should never be seen so I dunno how you got here.\n");
    return 1;
  }
}


x86 assembly (clang, -O0):
<validate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1143 <validate+0x33>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <validate+0x6a>
cmpl   $0x1,-0x8(%rbp)
jne    1167 <validate+0x57>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    117a <validate+0x6a>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate>:
push   %rax
cmp    $0x1,%edi
je     1122 <validate+0x12>
test   %edi,%edi
jne    112a <validate+0x1a>
cmpb   $0x20,(%rsi)
sete   %al
jmp    1138 <validate+0x28>
cmpb   $0x20,(%rsi)
setne  %al
jmp    1138 <validate+0x28>
lea    0xecf(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%al
movzbl %al,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"This should never be seen so I dunno how you got here.\0A\00"
define i32 @validate(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %15
8: ; preds = %2
%9 = load i8*, i8** %5
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 32
%14 = zext i1 %13 to i32
store i32 %14, i32* %3
br label %27
15: ; preds = %2
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 1
br i1 %17, label %18, label %25
18: ; preds = %15
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i64 0
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 32
%24 = zext i1 %23 to i32
store i32 %24, i32* %3
br label %27
25: ; preds = %15
%26 = call i32 @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %27
27: ; preds = %25, %18, %8
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@str = [55 x i8] c"This should never be seen so I dunno how you got here.\00"
define i32 @validate(i32 %0, i8* nocapture %1) {
switch i32 %0, label %9 [
i32 0, label %3
i32 1, label %6
]
3: ; preds = %2
%4 = load i8, i8* %1
%5 = icmp eq i8 %4, 32
br label %11
6: ; preds = %2
%7 = load i8, i8* %1
%8 = icmp ne i8 %7, 32
br label %11
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
br label %11
11: ; preds = %9, %6, %3
%12 = phi i1 [ %5, %3 ], [ %8, %6 ], [ true, %9 ]
%13 = zext i1 %12 to i32
ret i32 %13
}