#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*/ exit(int);
int /*<<< orphan*/ printf(char *);
int detectOp(char *tk) {
  if (*tk == 42 || *tk == 43 || *tk == 45)
    return 1;
  else if (*tk < 48 || *tk > 57) {
    printf("Error: caracter incorrecto\n");
    exit(-1);
  } else
    return 0;
}


x86 assembly (clang, -O0):
<detectOp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2a,%eax
je     115c <detectOp+0x3c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
je     115c <detectOp+0x3c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1168 <detectOp+0x48>
movl   $0x1,-0x4(%rbp)
jmp    11a5 <detectOp+0x85>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     1188 <detectOp+0x68>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x39,%eax
jle    119e <detectOp+0x7e>
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detectOp>:
push   %rax
movzbl (%rdi),%ecx
cmp    $0x2d,%rcx
ja     113f <detectOp+0x1f>
mov    $0x1,%eax
movabs $0x2c0000000000,%rdx
bt     %rcx,%rdx
jb     1149 <detectOp+0x29>
add    $0xc6,%cl
xor    %eax,%eax
cmp    $0xf5,%cl
jbe    114b <detectOp+0x2b>
pop    %rcx
ret
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"Error: caracter incorrecto\0A\00"
define i32 @detectOp(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp eq i32 %6, 42
br i1 %7, label %18, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 43
br i1 %12, label %18, label %13
13: ; preds = %8
%14 = load i8*, i8** %3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 45
br i1 %17, label %18, label %19
18: ; preds = %13, %8, %1
store i32 1, i32* %2
br label %33
19: ; preds = %13
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp slt i32 %22, 48
br i1 %23, label %29, label %24
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp sgt i32 %27, 57
br i1 %28, label %29, label %32
29: ; preds = %24, %19
%30 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @exit(i32 -1)
unreachable
32: ; preds = %24
store i32 0, i32* %2
br label %33
33: ; preds = %32, %18
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
@str = [27 x i8] c"Error: caracter incorrecto\00"
define i32 @detectOp(i8* nocapture %0) {
%2 = load i8, i8* %0
switch i8 %2, label %3 [
i8 42, label %9
i8 43, label %9
i8 45, label %9
]
3: ; preds = %1
%4 = add i8 %2, -58
%5 = icmp ult i8 %4, -10
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %3, %1, %1, %1
%10 = phi i32 [ 1, %1 ], [ 1, %1 ], [ 1, %1 ], [ 0, %3 ]
ret i32 %10
}