#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);
unsigned int strlen(char *);
int LooksLikeAnInteger(char *IntegerString) {
  unsigned int Index;
  Index = 0;
  if (IntegerString[Index] == '-') {
    Index++;
  }
  while (Index < strlen(IntegerString)) {
    if (!isdigit(IntegerString[Index])) {
      return (0);
    }
    Index++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<LooksLikeAnInteger>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
jne    1150 <LooksLikeAnInteger+0x30>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <LooksLikeAnInteger+0x35>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jae    11a4 <LooksLikeAnInteger+0x84>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1196 <LooksLikeAnInteger+0x76>
movl   $0x0,-0x4(%rbp)
jmp    11ab <LooksLikeAnInteger+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1155 <LooksLikeAnInteger+0x35>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LooksLikeAnInteger>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%r15b
xor    %ebp,%ebp
cmp    $0x2d,%r15b
sete   %bpl
call   1040 <strlen@plt>
mov    $0x1,%r14d
cmp    %ebp,%eax
jbe    1175 <LooksLikeAnInteger+0x55>
xor    %ebp,%ebp
cmp    $0x2d,%r15b
sete   %bpl
movsbl (%rbx,%rbp,1),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1172 <LooksLikeAnInteger+0x52>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbp
jb     1150 <LooksLikeAnInteger+0x30>
jmp    1175 <LooksLikeAnInteger+0x55>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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