#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(char const);
int strempty(const char *p) {
  if (!p)
    return (1);
  for (; *p; p++)
    if (!isspace(*p))
      return (0);
  return (1);
}


x86 assembly (clang, -O0):
<strempty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <strempty+0x23>
movl   $0x1,-0x4(%rbp)
jmp    1183 <strempty+0x73>
jmp    1138 <strempty+0x28>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     117c <strempty+0x6c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1166 <strempty+0x56>
movl   $0x0,-0x4(%rbp)
jmp    1183 <strempty+0x73>
jmp    116b <strempty+0x5b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <strempty+0x28>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strempty>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%ebp
test   %rdi,%rdi
je     114b <strempty+0x3b>
mov    %rdi,%rbx
mov    (%rdi),%al
test   %al,%al
je     114b <strempty+0x3b>
add    $0x1,%rbx
nopw   0x0(%rax,%rax,1)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     1149 <strempty+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <strempty+0x20>
jmp    114b <strempty+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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