#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);
char isnumber(char *string) {
  int i = 0;
  int digit = 0;
  char check = 0;
  while (string[i] != '\0' && check == 0) {
    if (isdigit(string[i]) != 0) {
      check = 0;
      digit = string[i] - '0' + digit * 10;
    } else {
      check = 1;
      return 0;
    }
    i++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isnumber>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x1a(%rbp)
je     1155 <isnumber+0x45>
movsbl -0x19(%rbp),%eax
cmp    $0x0,%eax
sete   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1165 <isnumber+0x55>
jmp    11bc <isnumber+0xac>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11a1 <isnumber+0x91>
movb   $0x0,-0x19(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
sub    $0x30,%eax
imul   $0xa,-0x18(%rbp),%ecx
add    %ecx,%eax
mov    %eax,-0x18(%rbp)
jmp    11ae <isnumber+0x9e>
movb   $0x1,-0x19(%rbp)
movb   $0x0,-0x1(%rbp)
jmp    11c0 <isnumber+0xb0>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112e <isnumber+0x1e>
movb   $0x1,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isnumber>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%bpl
test   %al,%al
je     114c <isnumber+0x3c>
mov    %rdi,%rbx
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     114a <isnumber+0x3a>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <isnumber+0x20>
jmp    114c <isnumber+0x3c>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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