#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*/ isalnum(char);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ printf(char *, ...);
int strlen(char *);
int is_number(char *pchar) {
  int i, is_num = 0;
  int lnum = strlen(pchar);
  for (i = 0; i <= lnum; i++) {
    if (!isalnum(*pchar))
      break;
    printf("%c - ", *pchar);
    if (!isdigit(*pchar)) {
      is_num++;
      break;
    }
    pchar++;
  }
  printf("%s\n", pchar);
  return is_num;
}


x86 assembly (clang, -O0):
<is_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11de <is_number+0x9e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isalnum@plt>
cmp    $0x0,%eax
jne    118c <is_number+0x4c>
jmp    11de <is_number+0x9e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11c4 <is_number+0x84>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11de <is_number+0x9e>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1166 <is_number+0x26>
mov    -0x8(%rbp),%rsi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_number>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1050 <strlen@plt>
test   %eax,%eax
js     11b0 <is_number+0x60>
mov    %eax,%ebp
add    $0x1,%ebp
lea    0xe91(%rip),%r15
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsbl (%rbx),%edi
call   1070 <isalnum@plt>
test   %eax,%eax
je     11bb <is_number+0x6b>
movsbl (%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     11b5 <is_number+0x65>
add    $0x1,%rbx
add    $0xffffffff,%ebp
jne    1180 <is_number+0x30>
jmp    11bb <is_number+0x6b>
xor    %r14d,%r14d
jmp    11bb <is_number+0x6b>
mov    $0x1,%r14d
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%c - \00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @is_number(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
%6 = load i8*, i8** %2
%7 = call i32 @strlen(i8* %6)
store i32 %7, i32* %5
store i32 0, i32* %3
br label %8
8: ; preds = %33, %1
%9 = load i32, i32* %3
%10 = load i32, i32* %5
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %36
12: ; preds = %8
%13 = load i8*, i8** %2
%14 = load i8, i8* %13
%15 = call i32 @isalnum(i8 signext %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %18, label %17
17: ; preds = %12
br label %36
18: ; preds = %12
%19 = load i8*, i8** %2
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %2
%24 = load i8, i8* %23
%25 = call i32 @isdigit(i8 signext %24)
%26 = icmp ne i32 %25, 0
br i1 %26, label %30, label %27
27: ; preds = %18
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %36
30: ; preds = %18
%31 = load i8*, i8** %2
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %2
br label %33
33: ; preds = %30
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %8
36: ; preds = %27, %17, %8
%37 = load i8*, i8** %2
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %37)
%39 = load i32, i32* %4
ret i32 %39
}

LLVM IR (-O2):
@.str = [6 x i8] c"%c - \00"
define i32 @is_number(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp slt i32 %2, 0
br i1 %3, label %21, label %4
4: ; preds = %1, %17
%5 = phi i8* [ %18, %17 ], [ %0, %1 ]
%6 = phi i32 [ %19, %17 ], [ 0, %1 ]
%7 = load i8, i8* %5
%8 = tail call i32 @isalnum(i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %21, label %10
10: ; preds = %4
%11 = load i8, i8* %5
%12 = sext i8 %11 to i32
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = load i8, i8* %5
%15 = tail call i32 @isdigit(i8 signext %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %21, label %17
17: ; preds = %10
%18 = getelementptr inbounds i8, i8* %5, i64 1
%19 = add nuw i32 %6, 1
%20 = icmp eq i32 %6, %2
br i1 %20, label %21, label %4
21: ; preds = %17, %4, %10, %1
%22 = phi i8* [ %0, %1 ], [ %5, %10 ], [ %5, %4 ], [ %18, %17 ]
%23 = phi i32 [ 0, %1 ], [ 1, %10 ], [ 0, %4 ], [ 0, %17 ]
%24 = tail call i32 @puts(i8* dereferenceable(1) %22)
ret i32 %23
}