#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 */
scalar_t__ isalpha(char const);
int slab_badname_detect(const char *restrict buffer) {
  int numberarea = 0;
  while (*buffer) {
    if ((*buffer) == ' ') {
      numberarea = 1;
    }
    if (isalpha(*buffer) && numberarea) {
      return 1;
    }
    buffer++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<slab_badname_detect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1184 <slab_badname_detect+0x74>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x20,%eax
jne    1147 <slab_badname_detect+0x37>
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isalpha@plt>
cmp    $0x0,%rax
je     1173 <slab_badname_detect+0x63>
cmpl   $0x0,-0x14(%rbp)
je     1173 <slab_badname_detect+0x63>
movl   $0x1,-0x4(%rbp)
jmp    118b <slab_badname_detect+0x7b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <slab_badname_detect+0x13>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slab_badname_detect>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
xor    %r14d,%r14d
xor    %ebp,%ebp
nopl   0x0(%rax)
movzbl (%rbx),%eax
cmp    $0x20,%al
je     1130 <slab_badname_detect+0x20>
test   %al,%al
jne    1135 <slab_badname_detect+0x25>
jmp    1150 <slab_badname_detect+0x40>
nopl   (%rax)
mov    $0x1,%ebp
movsbl %al,%edi
call   1030 <isalpha@plt>
add    $0x1,%rbx
test   %rax,%rax
je     1120 <slab_badname_detect+0x10>
test   %ebp,%ebp
je     1120 <slab_badname_detect+0x10>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @slab_badname_detect(i8* noalias nocapture %0) {
br label %2
2: ; preds = %7, %1
%3 = phi i8* [ %0, %1 ], [ %13, %7 ]
%4 = phi i32 [ 0, %1 ], [ %8, %7 ]
%5 = load i8, i8* %3
switch i8 %5, label %7 [
i8 0, label %14
i8 32, label %6
]
6: ; preds = %2
br label %7
7: ; preds = %2, %6
%8 = phi i32 [ 1, %6 ], [ %4, %2 ]
%9 = tail call i64 @isalpha(i8 signext %5)
%10 = icmp ne i64 %9, 0
%11 = icmp ne i32 %8, 0
%12 = select i1 %10, i1 %11, i1 false
%13 = getelementptr inbounds i8, i8* %3, i64 1
br i1 %12, label %14, label %2
14: ; preds = %2, %7
%15 = phi i32 [ 1, %7 ], [ 0, %2 ]
ret i32 %15
}