#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);
int str_length(char *);
int is_blank(char *s) {
  int i, len;
  len = str_length(s);
  if (len == 0) {
    return 1;
  } else {
    for (i = 0; i < len; i++) {
      if (!isspace(s[i])) {
        return 0;
      }
    }
    return 1;
  }
}


x86 assembly (clang, -O0):
<is_blank>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <str_length@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jne    114e <is_blank+0x2e>
movl   $0x1,-0x4(%rbp)
jmp    11a1 <is_blank+0x81>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    119a <is_blank+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
jne    1187 <is_blank+0x67>
movl   $0x0,-0x4(%rbp)
jmp    11a1 <is_blank+0x81>
jmp    118c <is_blank+0x6c>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <is_blank+0x35>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_blank>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1030 <str_length@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    115c <is_blank+0x3c>
mov    %eax,%ebp
xor    %ebx,%ebx
nopl   (%rax)
movsbl (%r15,%rbx,1),%edi
call   1040 <isspace@plt>
test   %eax,%eax
je     1159 <is_blank+0x39>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1140 <is_blank+0x20>
jmp    115c <is_blank+0x3c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @is_blank(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 @str_length(i8* %6)
store i32 %7, i32* %5
%8 = load i32, i32* %5
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %1
store i32 1, i32* %2
br label %30
11: ; preds = %1
store i32 0, i32* %4
br label %12
12: ; preds = %26, %11
%13 = load i32, i32* %4
%14 = load i32, i32* %5
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = load i8*, i8** %3
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @isspace(i8 signext %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %16
store i32 0, i32* %2
br label %30
25: ; preds = %16
br label %26
26: ; preds = %25
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %12
29: ; preds = %12
store i32 1, i32* %2
br label %30
30: ; preds = %29, %24, %10
%31 = load i32, i32* %2
ret i32 %31
}

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