#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*/ isspace(unsigned char);
int IsNullOrEmpty(const char *p) {
  int empty = 1;
  while (p && *p && empty) {
    if (!isspace((unsigned char)*p++)) {
      empty = 0;
    }
  }
  return empty;
}


x86 assembly (clang, -O0):
<IsNullOrEmpty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0xd(%rbp)
je     1152 <IsNullOrEmpty+0x42>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0xd(%rbp)
je     1152 <IsNullOrEmpty+0x42>
cmpl   $0x0,-0xc(%rbp)
setne  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1162 <IsNullOrEmpty+0x52>
jmp    118e <IsNullOrEmpty+0x7e>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
movzbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1189 <IsNullOrEmpty+0x79>
movl   $0x0,-0xc(%rbp)
jmp    1123 <IsNullOrEmpty+0x13>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsNullOrEmpty>:
push   %rbx
mov    $0x1,%eax
test   %rdi,%rdi
je     1150 <IsNullOrEmpty+0x40>
mov    %rdi,%rbx
mov    (%rdi),%dl
test   %dl,%dl
je     1150 <IsNullOrEmpty+0x40>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movzbl %dl,%edi
call   1030 <isspace@plt>
mov    %eax,%ecx
test   %eax,%eax
je     1149 <IsNullOrEmpty+0x39>
movzbl (%rbx),%edx
add    $0x1,%rbx
test   %dl,%dl
jne    1130 <IsNullOrEmpty+0x20>
xor    %eax,%eax
test   %ecx,%ecx
setne  %al
pop    %rbx
ret

LLVM IR (-O0):
define i32 @IsNullOrEmpty(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 1, i32* %3
br label %4
4: ; preds = %24, %1
%5 = load i8*, i8** %2
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = load i32, i32* %3
%14 = icmp ne i32 %13, 0
br label %15
15: ; preds = %12, %7, %4
%16 = phi i1 [ false, %7 ], [ false, %4 ], [ %14, %12 ]
br i1 %16, label %17, label %25
17: ; preds = %15
%18 = load i8*, i8** %2
%19 = getelementptr inbounds i8, i8* %18, i32 1
store i8* %19, i8** %2
%20 = load i8, i8* %18
%21 = call i32 @isspace(i8 zeroext %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %17
store i32 0, i32* %3
br label %24
24: ; preds = %23, %17
br label %4
25: ; preds = %15
%26 = load i32, i32* %3
ret i32 %26
}

LLVM IR (-O2):
define i32 @IsNullOrEmpty(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %17, label %6
6: ; preds = %3, %6
%7 = phi i8 [ %12, %6 ], [ %4, %3 ]
%8 = phi i8* [ %9, %6 ], [ %0, %3 ]
%9 = getelementptr inbounds i8, i8* %8, i64 1
%10 = tail call i32 @isspace(i8 zeroext %7)
%11 = icmp ne i32 %10, 0
%12 = load i8, i8* %9
%13 = icmp ne i8 %12, 0
%14 = and i1 %11, %13
br i1 %14, label %6, label %15
15: ; preds = %6
%16 = zext i1 %11 to i32
br label %17
17: ; preds = %3, %15, %1
%18 = phi i32 [ 1, %1 ], [ %16, %15 ], [ 1, %3 ]
ret i32 %18
}