#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(char *);
unsigned int strings_length(char *);
bool strings_is_white_space(char *string) {
  assert(string);
  unsigned int length = strings_length(string);
  for (unsigned int k = 0; k < length; k++) {
    if (string[k] > 0x20)
      return false;
  }
  return true;
}


x86 assembly (clang, -O0):
<strings_is_white_space>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <assert@plt>
mov    -0x10(%rbp),%rdi
call   1030 <strings_length@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jae    1187 <strings_is_white_space+0x67>
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
jle    1174 <strings_is_white_space+0x54>
movl   $0x0,-0x4(%rbp)
jmp    118e <strings_is_white_space+0x6e>
jmp    1179 <strings_is_white_space+0x59>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1148 <strings_is_white_space+0x28>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strings_is_white_space>:
push   %rbx
mov    %rdi,%rbx
call   1040 <assert@plt>
mov    %rbx,%rdi
call   1030 <strings_length@plt>
test   %eax,%eax
je     116c <strings_is_white_space+0x4c>
mov    %eax,%ecx
xor    %eax,%eax
cmpb   $0x20,(%rbx)
jg     116a <strings_is_white_space+0x4a>
mov    %ecx,%ecx
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nop
mov    %rax,%rdx
cmp    %rax,%rcx
je     1162 <strings_is_white_space+0x42>
lea    0x1(%rdx),%rax
cmpb   $0x21,(%rbx,%rdx,1)
jl     1150 <strings_is_white_space+0x30>
xor    %eax,%eax
cmp    %rcx,%rdx
setae  %al
pop    %rbx
ret
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @strings_is_white_space(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @assert(i8* %6)
%8 = load i8*, i8** %3
%9 = call i32 @strings_length(i8* %8)
store i32 %9, i32* %4
store i32 0, i32* %5
br label %10
10: ; preds = %24, %1
%11 = load i32, i32* %5
%12 = load i32, i32* %4
%13 = icmp ult i32 %11, %12
br i1 %13, label %14, label %27
14: ; preds = %10
%15 = load i8*, i8** %3
%16 = load i32, i32* %5
%17 = zext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = icmp sgt i32 %20, 32
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 0, i32* %2
br label %28
23: ; preds = %14
br label %24
24: ; preds = %23
%25 = load i32, i32* %5
%26 = add i32 %25, 1
store i32 %26, i32* %5
br label %10
27: ; preds = %10
store i32 1, i32* %2
br label %28
28: ; preds = %27, %22
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @strings_is_white_space(i8* %0) {
%2 = tail call i32 @assert(i8* %0)
%3 = tail call i32 @strings_length(i8* %0)
%4 = icmp eq i32 %3, 0
br i1 %4, label %20, label %5
5: ; preds = %1
%6 = zext i32 %3 to i64
%7 = load i8, i8* %0
%8 = icmp sgt i8 %7, 32
br i1 %8, label %20, label %9
9: ; preds = %5, %12
%10 = phi i64 [ %16, %12 ], [ 1, %5 ]
%11 = icmp eq i64 %10, %6
br i1 %11, label %17, label %12
12: ; preds = %9
%13 = getelementptr inbounds i8, i8* %0, i64 %10
%14 = load i8, i8* %13
%15 = icmp sgt i8 %14, 32
%16 = add nuw nsw i64 %10, 1
br i1 %15, label %17, label %9
17: ; preds = %9, %12
%18 = icmp uge i64 %10, %6
%19 = zext i1 %18 to i32
br label %20
20: ; preds = %17, %5, %1
%21 = phi i32 [ 1, %1 ], [ 0, %5 ], [ %19, %17 ]
ret i32 %21
}