#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*/ isdigit(char);
int strlen(char *);
int is_sms_number(char *number) {
  int i, count = strlen(number);
  if (!isdigit(number[0]) && number[0] != '+')
    return 0;
  for (i = 1; i < count; i++) {
    if (!isdigit(number[i]))
      return 0;
  }
  return 1;
}


x86 assembly (clang, -O0):
<is_sms_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1169 <is_sms_number+0x49>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     1169 <is_sms_number+0x49>
movl   $0x0,-0x4(%rbp)
jmp    11bc <is_sms_number+0x9c>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11b5 <is_sms_number+0x95>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    11a2 <is_sms_number+0x82>
movl   $0x0,-0x4(%rbp)
jmp    11bc <is_sms_number+0x9c>
jmp    11a7 <is_sms_number+0x87>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1170 <is_sms_number+0x50>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_sms_number>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
call   1040 <strlen@plt>
mov    %eax,%ebp
movsbl (%r15),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1147 <is_sms_number+0x27>
xor    %r14d,%r14d
cmpb   $0x2b,(%r15)
jne    117c <is_sms_number+0x5c>
mov    $0x1,%r14d
cmp    $0x2,%ebp
jl     117c <is_sms_number+0x5c>
mov    %ebp,%ebp
mov    $0x1,%ebx
nopl   0x0(%rax)
movsbl (%r15,%rbx,1),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1179 <is_sms_number+0x59>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1160 <is_sms_number+0x40>
jmp    117c <is_sms_number+0x5c>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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