#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_int(char *s) {
  int result = 0;
  char c;
  if (*s == '-')
    s++;
  while (isdigit(c = *s++))
    result = 1;
  return c ? 0 : result;
}


x86 assembly (clang, -O0):
<is_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    113f <is_int+0x2f>
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1144 <is_int+0x34>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    %al,-0xd(%rbp)
movsbl %al,%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     1176 <is_int+0x66>
movl   $0x1,-0xc(%rbp)
jmp    1144 <is_int+0x34>
movsbl -0xd(%rbp),%eax
cmp    $0x0,%eax
je     118d <is_int+0x7d>
xor    %eax,%eax
mov    %eax,-0x14(%rbp)
jmp    1193 <is_int+0x83>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_int>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r15
xor    %ebp,%ebp
cmpb   $0x2d,(%rdi)
sete   %bpl
mov    (%rdi,%rbp,1),%bl
movsbl %bl,%edi
call   1030 <isdigit@plt>
xor    %r14d,%r14d
mov    $0x0,%ecx
test   %rax,%rax
je     116a <is_int+0x5a>
add    %r15,%rbp
add    $0x1,%rbp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl 0x0(%rbp),%ebx
movsbl %bl,%edi
call   1030 <isdigit@plt>
add    $0x1,%rbp
test   %rax,%rax
jne    1150 <is_int+0x40>
mov    $0x1,%ecx
test   %bl,%bl
cmove  %ecx,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @is_int(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 = tail call i64 @isdigit(i8 signext %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %15, label %9
9: ; preds = %1, %9
%10 = phi i8* [ %11, %9 ], [ %5, %1 ]
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = tail call i64 @isdigit(i8 signext %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %9
15: ; preds = %9, %1
%16 = phi i32 [ 0, %1 ], [ 1, %9 ]
%17 = phi i8 [ %6, %1 ], [ %12, %9 ]
%18 = icmp eq i8 %17, 0
%19 = select i1 %18, i32 %16, i32 0
ret i32 %19
}