#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*/ isalpha(char);
scalar_t__ isspace(char);
int _parse_name(char *arg, char *name) {
  int i;
  for (; isspace(*arg); arg++)
    ;
  for (i = 0; *name = *arg; arg++, i++, name++)
    if ((*arg < 0) || !isalpha(*arg) || i > 15)
      return (1);
  if (!i)
    return (1);
  return (0);
}


x86 assembly (clang, -O0):
<_parse_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isspace@plt>
cmp    $0x0,%rax
je     115c <_parse_name+0x3c>
jmp    114b <_parse_name+0x2b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1130 <_parse_name+0x10>
movl   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%al
mov    -0x18(%rbp),%rcx
mov    %al,(%rcx)
cmp    $0x0,%al
je     11dd <_parse_name+0xbd>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jl     11a6 <_parse_name+0x86>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
je     11a6 <_parse_name+0x86>
cmpl   $0xf,-0x1c(%rbp)
jle    11b2 <_parse_name+0x92>
movl   $0x1,-0x4(%rbp)
jmp    11fa <_parse_name+0xda>
jmp    11b7 <_parse_name+0x97>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1163 <_parse_name+0x43>
cmpl   $0x0,-0x1c(%rbp)
jne    11f3 <_parse_name+0xd3>
movl   $0x1,-0x4(%rbp)
jmp    11fa <_parse_name+0xda>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_parse_name>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
xchg   %ax,%ax
movsbl (%rbx),%edi
call   1030 <isspace@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <_parse_name+0x10>
mov    -0x1(%rbx),%r15b
mov    %r15b,(%r14)
test   %r15b,%r15b
je     118b <_parse_name+0x6b>
xor    %ebp,%ebp
mov    $0x1,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
movzbl -0x1(%rbx,%rbp,1),%eax
test   %al,%al
js     1195 <_parse_name+0x75>
movsbl %al,%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     1195 <_parse_name+0x75>
cmp    $0xf,%ebp
ja     1195 <_parse_name+0x75>
movzbl (%rbx,%rbp,1),%eax
mov    %al,0x1(%r14,%rbp,1)
add    $0x1,%rbp
test   %al,%al
jne    1160 <_parse_name+0x40>
xor    %r12d,%r12d
test   %r15b,%r15b
sete   %r12b
mov    %r12d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @_parse_name(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
br label %7
7: ; preds = %13, %2
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = call i64 @isspace(i8 signext %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %7
br label %13
13: ; preds = %12
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
br label %7
16: ; preds = %7
store i32 0, i32* %6
br label %17
17: ; preds = %37, %16
%18 = load i8*, i8** %4
%19 = load i8, i8* %18
%20 = load i8*, i8** %5
store i8 %19, i8* %20
%21 = icmp ne i8 %19, 0
br i1 %21, label %22, label %44
22: ; preds = %17
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = sext i8 %24 to i32
%26 = icmp slt i32 %25, 0
br i1 %26, label %35, label %27
27: ; preds = %22
%28 = load i8*, i8** %4
%29 = load i8, i8* %28
%30 = call i32 @isalpha(i8 signext %29)
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %27
%33 = load i32, i32* %6
%34 = icmp sgt i32 %33, 15
br i1 %34, label %35, label %36
35: ; preds = %32, %27, %22
store i32 1, i32* %3
br label %49
36: ; preds = %32
br label %37
37: ; preds = %36
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %4
%40 = load i32, i32* %6
%41 = add nsw i32 %40, 1
store i32 %41, i32* %6
%42 = load i8*, i8** %5
%43 = getelementptr inbounds i8, i8* %42, i32 1
store i8* %43, i8** %5
br label %17
44: ; preds = %17
%45 = load i32, i32* %6
%46 = icmp ne i32 %45, 0
br i1 %46, label %48, label %47
47: ; preds = %44
store i32 1, i32* %3
br label %49
48: ; preds = %44
store i32 0, i32* %3
br label %49
49: ; preds = %48, %47, %35
%50 = load i32, i32* %3
ret i32 %50
}

LLVM IR (-O2):
define i32 @_parse_name(i8* nocapture %0, i8* nocapture writeonly %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %0, %2 ], [ %8, %3 ]
%5 = load i8, i8* %4
%6 = tail call i64 @isspace(i8 signext %5)
%7 = icmp eq i64 %6, 0
%8 = getelementptr inbounds i8, i8* %4, i64 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = load i8, i8* %4
store i8 %10, i8* %1
%11 = icmp eq i8 %10, 0
br i1 %11, label %29, label %12
12: ; preds = %9, %23
%13 = phi i32 [ %25, %23 ], [ 0, %9 ]
%14 = phi i8* [ %26, %23 ], [ %1, %9 ]
%15 = phi i8* [ %24, %23 ], [ %4, %9 ]
%16 = load i8, i8* %15
%17 = icmp slt i8 %16, 0
br i1 %17, label %31, label %18
18: ; preds = %12
%19 = tail call i32 @isalpha(i8 signext %16)
%20 = icmp eq i32 %19, 0
%21 = icmp ugt i32 %13, 15
%22 = select i1 %20, i1 true, i1 %21
br i1 %22, label %31, label %23
23: ; preds = %18
%24 = getelementptr inbounds i8, i8* %15, i64 1
%25 = add nuw nsw i32 %13, 1
%26 = getelementptr inbounds i8, i8* %14, i64 1
%27 = load i8, i8* %24
store i8 %27, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %29, label %12
29: ; preds = %23, %9
%30 = zext i1 %11 to i32
br label %31
31: ; preds = %12, %18, %29
%32 = phi i32 [ %30, %29 ], [ 1, %18 ], [ 1, %12 ]
ret i32 %32
}