#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__ strlen(char *);
int checkIfNumberOnly(char *s) {
  int i = 0;
  int len = (int)(strlen(s));
  for (i = 0; i < len; i++) {
    if (!((s[i] >= '0' && s[i] <= '9') || s[i] == ' '))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<checkIfNumberOnly>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11a0 <checkIfNumberOnly+0x90>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     116c <checkIfNumberOnly+0x5c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jle    118d <checkIfNumberOnly+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     118d <checkIfNumberOnly+0x7d>
movl   $0x0,-0x4(%rbp)
jmp    11a7 <checkIfNumberOnly+0x97>
jmp    1192 <checkIfNumberOnly+0x82>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <checkIfNumberOnly+0x26>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkIfNumberOnly>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %ecx,%ecx
jle    114d <checkIfNumberOnly+0x3d>
mov    %ecx,%ecx
xor    %edx,%edx
jmp    1139 <checkIfNumberOnly+0x29>
xchg   %ax,%ax
add    $0x1,%rdx
cmp    %rdx,%rcx
je     114d <checkIfNumberOnly+0x3d>
movzbl (%r14,%rdx,1),%ebx
cmp    $0x20,%bl
je     1130 <checkIfNumberOnly+0x20>
add    $0xd0,%bl
cmp    $0xa,%bl
jb     1130 <checkIfNumberOnly+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @checkIfNumberOnly(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 i64 @strlen(i8* %6)
%8 = trunc i64 %7 to i32
store i32 %8, i32* %5
store i32 0, i32* %4
br label %9
9: ; preds = %39, %1
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %42
13: ; preds = %9
%14 = load i8*, i8** %3
%15 = load i32, i32* %4
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8, i8* %14, i64 %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp sge i32 %19, 48
br i1 %20, label %21, label %29
21: ; preds = %13
%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 sle i32 %27, 57
br i1 %28, label %38, label %29
29: ; preds = %21, %13
%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 eq i32 %35, 32
br i1 %36, label %38, label %37
37: ; preds = %29
store i32 0, i32* %2
br label %43
38: ; preds = %29, %21
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %9
42: ; preds = %9
store i32 1, i32* %2
br label %43
43: ; preds = %42, %37
%44 = load i32, i32* %2
ret i32 %44
}

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