#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*/ parser_Expected(char *);
int /*<<< orphan*/ parser_IsDigit(char);
int strlen(char *);
int parser_IsInt(char *s) {
  int i = 0;
  for (i = 0; i < strlen(s); i++)
    if (!parser_IsDigit(s[i]) && s[i] != '-') {
      parser_Expected("Inteiro");
      return 0;
    }
  return 1;
}


x86 assembly (clang, -O0):
<parser_IsInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x14(%rbp)
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
jge    11c0 <parser_IsInt+0x90>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <parser_IsDigit@plt>
cmp    $0x0,%eax
jne    11ad <parser_IsInt+0x7d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2d,%eax
je     11ad <parser_IsInt+0x7d>
lea    0xe64(%rip),%rdi
call   1050 <parser_Expected@plt>
movl   $0x0,-0x4(%rbp)
jmp    11c7 <parser_IsInt+0x97>
jmp    11b2 <parser_IsInt+0x82>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114a <parser_IsInt+0x1a>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parser_IsInt>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0x1,%r14d
test   %eax,%eax
jle    1185 <parser_IsInt+0x55>
xor    %ebp,%ebp
jmp    1163 <parser_IsInt+0x33>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
mov    %rbx,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%rbp
jge    1185 <parser_IsInt+0x55>
movsbl (%rbx,%rbp,1),%edi
call   1030 <parser_IsDigit@plt>
test   %eax,%eax
jne    1150 <parser_IsInt+0x20>
cmpb   $0x2d,(%rbx,%rbp,1)
je     1150 <parser_IsInt+0x20>
lea    0xe83(%rip),%rdi
call   1050 <parser_Expected@plt>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Inteiro\00"
define i32 @parser_IsInt(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
store i32 0, i32* %4
br label %5
5: ; preds = %29, %1
%6 = load i32, i32* %4
%7 = load i8*, i8** %3
%8 = call i32 @strlen(i8* %7)
%9 = icmp slt i32 %6, %8
br i1 %9, label %10, label %32
10: ; preds = %5
%11 = load i8*, i8** %3
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8, i8* %11, i64 %13
%15 = load i8, i8* %14
%16 = call i32 @parser_IsDigit(i8 signext %15)
%17 = icmp ne i32 %16, 0
br i1 %17, label %28, label %18
18: ; preds = %10
%19 = load i8*, i8** %3
%20 = load i32, i32* %4
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp ne i32 %24, 45
br i1 %25, label %26, label %28
26: ; preds = %18
%27 = call i32 @parser_Expected(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %33
28: ; preds = %18, %10
br label %29
29: ; preds = %28
%30 = load i32, i32* %4
%31 = add nsw i32 %30, 1
store i32 %31, i32* %4
br label %5
32: ; preds = %5
store i32 1, i32* %2
br label %33
33: ; preds = %32, %26
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@.str = [8 x i8] c"Inteiro\00"
define i32 @parser_IsInt(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %20
4: ; preds = %1, %15
%5 = phi i64 [ %16, %15 ], [ 0, %1 ]
%6 = getelementptr inbounds i8, i8* %0, i64 %5
%7 = load i8, i8* %6
%8 = tail call i32 @parser_IsDigit(i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %4
%11 = load i8, i8* %6
%12 = icmp eq i8 %11, 45
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = tail call i32 @parser_Expected(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %20
15: ; preds = %4, %10
%16 = add nuw nsw i64 %5, 1
%17 = tail call i32 @strlen(i8* %0)
%18 = sext i32 %17 to i64
%19 = icmp slt i64 %16, %18
br i1 %19, label %4, label %20
20: ; preds = %15, %1, %13
%21 = phi i32 [ 0, %13 ], [ 1, %1 ], [ 1, %15 ]
ret i32 %21
}