#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 has_text(const char *text) {
  if (!text)
    return 0;
  while (*text) {
    if (!isspace(*text))
      return 1;
    text++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<has_text>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1133 <has_text+0x23>
movl   $0x0,-0x4(%rbp)
jmp    117e <has_text+0x6e>
jmp    1138 <has_text+0x28>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1177 <has_text+0x67>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    1166 <has_text+0x56>
movl   $0x1,-0x4(%rbp)
jmp    117e <has_text+0x6e>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1138 <has_text+0x28>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @has_text(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 0, i32* %2
br label %22
7: ; preds = %1
br label %8
8: ; preds = %18, %7
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %21
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 1, i32* %2
br label %22
18: ; preds = %12
%19 = load i8*, i8** %3
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %3
br label %8
21: ; preds = %8
store i32 0, i32* %2
br label %22
22: ; preds = %21, %17, %6
%23 = load i32, i32* %2
ret i32 %23
}

LLVM IR (-O2):
define i32 @has_text(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 [ 0, %1 ], [ 0, %3 ], [ 1, %9 ], [ 0, %6 ]
ret i32 %16
}