#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*/ assert(int /*<<< orphan*/);
int /*<<< orphan*/ isspace(char const);
bool empty_string(char const *s) {
  assert(s != NULL);
  for (; *s; s++)
    if (!isspace(*s))
      return false;
  return true;
}


x86 assembly (clang, -O0):
<empty_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1182 <empty_string+0x62>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%eax
jne    116c <empty_string+0x4c>
movl   $0x0,-0x4(%rbp)
jmp    1189 <empty_string+0x69>
jmp    1171 <empty_string+0x51>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113e <empty_string+0x1e>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<empty_string>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
mov    (%rbx),%al
mov    $0x1,%ebp
test   %al,%al
je     116b <empty_string+0x4b>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <isspace@plt>
test   %eax,%eax
je     1169 <empty_string+0x49>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1150 <empty_string+0x30>
jmp    116b <empty_string+0x4b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @empty_string(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
br label %8
8: ; preds = %19, %1
%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
%24 = load i32, i32* %2
ret i32 %24
}

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