#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(unsigned char);
int isinteger(const char *s) {
  if (((unsigned char)*s) == '-' || ((unsigned char)*s) == '+')
    s++;
  while (*s) {
    if (!isdigit((unsigned char)*s))
      break;
    s++;
  }
  return (*s == '\0');
}


x86 assembly (clang, -O0):
<isinteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2d,%eax
je     113c <isinteger+0x2c>
mov    -0x8(%rbp),%rax
movzbl (%rax),%eax
cmp    $0x2b,%eax
jne    1148 <isinteger+0x38>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114d <isinteger+0x3d>
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1185 <isinteger+0x75>
mov    -0x8(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1174 <isinteger+0x64>
jmp    1185 <isinteger+0x75>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    114d <isinteger+0x3d>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isinteger>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
cmp    $0x2d,%al
je     1120 <isinteger+0x10>
cmp    $0x2b,%al
jne    1127 <isinteger+0x17>
mov    0x1(%rbx),%al
add    $0x1,%rbx
mov    $0x1,%ebp
test   %al,%al
je     1163 <isinteger+0x53>
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1159 <isinteger+0x49>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <isinteger+0x30>
jmp    1163 <isinteger+0x53>
xor    %ebp,%ebp
cmpb   $0x0,-0x1(%rbx)
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @isinteger(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = load i8, i8* %3
%5 = zext i8 %4 to i32
%6 = icmp eq i32 %5, 45
br i1 %6, label %12, label %7
7: ; preds = %1
%8 = load i8*, i8** %2
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
%11 = icmp eq i32 %10, 43
br i1 %11, label %12, label %15
12: ; preds = %7, %1
%13 = load i8*, i8** %2
%14 = getelementptr inbounds i8, i8* %13, i32 1
store i8* %14, i8** %2
br label %15
15: ; preds = %12, %7
br label %16
16: ; preds = %26, %15
%17 = load i8*, i8** %2
%18 = load i8, i8* %17
%19 = icmp ne i8 %18, 0
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = load i8*, i8** %2
%22 = load i8, i8* %21
%23 = call i32 @isdigit(i8 zeroext %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %20
br label %29
26: ; preds = %20
%27 = load i8*, i8** %2
%28 = getelementptr inbounds i8, i8* %27, i32 1
store i8* %28, i8** %2
br label %16
29: ; preds = %25, %16
%30 = load i8*, i8** %2
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 0
%34 = zext i1 %33 to i32
ret i32 %34
}

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