#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__ isdigit(char);
int is_number(char *character) {
  char *character_start = character;
  if (*character == '+' || *character == '-')
    ++character;
  while (isdigit(*character))
    ++character;
  return (character > character_start && isdigit(character[-1]) &&
          *character == '\0')
             ? 1
             : 0;
}


x86 assembly (clang, -O0):
<is_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     1144 <is_number+0x34>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1150 <is_number+0x40>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1155 <is_number+0x45>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     117c <is_number+0x6c>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1155 <is_number+0x45>
mov    -0x8(%rbp),%rcx
xor    %eax,%eax
cmp    -0x10(%rbp),%rcx
mov    %al,-0x11(%rbp)
jbe    11be <is_number+0xae>
mov    -0x8(%rbp),%rax
movsbl -0x1(%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x11(%rbp)
je     11be <is_number+0xae>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%dl
xor    %eax,%eax
mov    $0x1,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_number>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbp
mov    (%rdi),%al
cmp    $0x2d,%al
je     1124 <is_number+0x14>
mov    %rbp,%rbx
cmp    $0x2b,%al
jne    1128 <is_number+0x18>
lea    0x1(%rbp),%rbx
add    $0xffffffffffffffff,%rbx
nopl   0x0(%rax)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1130 <is_number+0x20>
xor    %r14d,%r14d
cmp    %rbp,%rbx
jbe    1162 <is_number+0x52>
movsbl -0x1(%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1162 <is_number+0x52>
xor    %r14d,%r14d
cmpb   $0x0,(%rbx)
sete   %r14b
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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