#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__ isdigit(char const);
int strlen(char const *);
int validate_type(const char type[]) {
  for (int i = 0, len = strlen(type); i < len; i++) {
    if (isdigit(type[i]))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<validate_type>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    1185 <validate_type+0x65>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1172 <validate_type+0x52>
movl   $0x0,-0x4(%rbp)
jmp    118c <validate_type+0x6c>
jmp    1177 <validate_type+0x57>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    113f <validate_type+0x1f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_type>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
jle    1174 <validate_type+0x54>
mov    %eax,%ebp
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1179 <validate_type+0x59>
mov    %ebp,%r14d
mov    $0x1,%ecx
nopl   0x0(%rax)
mov    %rcx,%rbp
cmp    %rcx,%r14
je     116a <validate_type+0x4a>
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
lea    0x1(%rbp),%rcx
test   %rax,%rax
je     1150 <validate_type+0x30>
xor    %eax,%eax
cmp    %r14,%rbp
setae  %al
jmp    1179 <validate_type+0x59>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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