#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 const);
int strlen(char const *);
int check_name(const char *name) {
  if (strlen(name) < 2) {
    return 0;
  }
  for (int i = 0; i < strlen(name); ++i) {
    if (!isalpha(name[i])) {
      return 0;
    }
  }
  return 1;
}


x86 assembly (clang, -O0):
<check_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x2,%eax
jge    114a <check_name+0x2a>
movl   $0x0,-0x4(%rbp)
jmp    11ad <check_name+0x8d>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11a6 <check_name+0x86>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <isalpha@plt>
cmp    $0x0,%eax
jne    1193 <check_name+0x73>
movl   $0x0,-0x4(%rbp)
jmp    11ad <check_name+0x8d>
jmp    1198 <check_name+0x78>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <check_name+0x31>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_name>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
xor    %r14d,%r14d
cmp    $0x2,%eax
jl     1175 <check_name+0x55>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    1175 <check_name+0x55>
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
movsbl (%rbx,%rbp,1),%edi
call   1040 <isalpha@plt>
test   %eax,%eax
je     1172 <check_name+0x52>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1150 <check_name+0x30>
jmp    1175 <check_name+0x55>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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