#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*/ assert(int /*<<< orphan*/);
scalar_t__ isdigit(int /*<<< orphan*/);
int vl_check_number_string(char *p_str) {
  assert(p_str != NULL);
  if (p_str == NULL)
    return 2;
  while (*p_str) {
    if (isdigit(*(p_str++)) == 0)
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<vl_check_number_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpq   $0x0,-0x10(%rbp)
jne    1155 <vl_check_number_string+0x35>
movl   $0x2,-0x4(%rbp)
jmp    11a0 <vl_check_number_string+0x80>
jmp    115a <vl_check_number_string+0x3a>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1199 <vl_check_number_string+0x79>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
jne    1194 <vl_check_number_string+0x74>
movl   $0x1,-0x4(%rbp)
jmp    11a0 <vl_check_number_string+0x80>
jmp    115a <vl_check_number_string+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vl_check_number_string>:
push   %rbx
mov    %rdi,%rbx
xor    %edi,%edi
test   %rbx,%rbx
setne  %dil
call   1040 <assert@plt>
test   %rbx,%rbx
je     115c <vl_check_number_string+0x3c>
nopw   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
test   %edi,%edi
je     1163 <vl_check_number_string+0x43>
add    $0x1,%rbx
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1140 <vl_check_number_string+0x20>
mov    $0x1,%eax
pop    %rbx
ret
mov    $0x2,%eax
pop    %rbx
ret
xor    %eax,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @vl_check_number_string(i8* %0) {
%2 = icmp ne i8* %0, null
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = icmp eq i8* %0, null
br i1 %5, label %15, label %6
6: ; preds = %1, %10
%7 = phi i8* [ %11, %10 ], [ %0, %1 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 0
br i1 %9, label %15, label %10
10: ; preds = %6
%11 = getelementptr inbounds i8, i8* %7, i64 1
%12 = sext i8 %8 to i32
%13 = tail call i64 @isdigit(i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %6
15: ; preds = %6, %10, %1
%16 = phi i32 [ 2, %1 ], [ 0, %6 ], [ 1, %10 ]
ret i32 %16
}