#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 strlen(char *);
int isNumber(char n[100]) {
  int i;
  if (n[4] != '\0' || strlen(n) != 4)
    return 0;
  for (i = 0; i < strlen(n); i++)
    if (!(n[i] >= '0' && n[i] <= '9'))
      return 0;
  return 1;
}


x86 assembly (clang, -O0):
<isNumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x0,%eax
jne    113f <isNumber+0x2f>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x4,%eax
je     114b <isNumber+0x3b>
movl   $0x0,-0x4(%rbp)
jmp    11be <isNumber+0xae>
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    11b7 <isNumber+0xa7>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     1198 <isNumber+0x88>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    11a4 <isNumber+0x94>
movl   $0x0,-0x4(%rbp)
jmp    11be <isNumber+0xae>
jmp    11a9 <isNumber+0x99>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1152 <isNumber+0x42>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isNumber>:
push   %rbp
push   %r14
push   %rbx
xor    %r14d,%r14d
cmpb   $0x0,0x4(%rdi)
jne    1162 <isNumber+0x52>
mov    %rdi,%rbx
call   1030 <strlen@plt>
cmp    $0x4,%eax
jne    1162 <isNumber+0x52>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    1162 <isNumber+0x52>
xor    %ebp,%ebp
xchg   %ax,%ax
movzbl (%rbx,%rbp,1),%eax
add    $0xd0,%al
cmp    $0xa,%al
jae    115f <isNumber+0x4f>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1140 <isNumber+0x30>
jmp    1162 <isNumber+0x52>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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