#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 isnumber(char *string) {
  if (*string == '-') {
    string++;
  }
  while (*string) {
    if (!isdigit(*string)) {
      return 0;
    }
    string++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1138 <isnumber+0x28>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <isnumber+0x2d>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     117c <isnumber+0x6c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    116b <isnumber+0x5b>
movl   $0x0,-0x4(%rbp)
jmp    1183 <isnumber+0x73>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113d <isnumber+0x2d>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumber>:
push   %rbp
push   %rbx
push   %rax
xor    %ecx,%ecx
cmpb   $0x2d,(%rdi)
sete   %cl
mov    (%rdi,%rcx,1),%al
mov    $0x1,%ebp
test   %al,%al
je     114b <isnumber+0x3b>
lea    (%rcx,%rdi,1),%rbx
add    $0x1,%rbx
nop
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1149 <isnumber+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumber+0x20>
jmp    114b <isnumber+0x3b>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isnumber(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 45
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i32 1
store i8* %10, i8** %3
br label %11
11: ; preds = %8, %1
br label %12
12: ; preds = %22, %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 = load i8, i8* %17
%19 = call i32 @isdigit(i8 signext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %16
store i32 0, i32* %2
br label %26
22: ; preds = %16
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %12
25: ; preds = %12
store i32 1, i32* %2
br label %26
26: ; preds = %25, %21
%27 = load i32, i32* %2
ret i32 %27
}

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