#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*/ printf(char *);
int checknumeric(char *arg) {
  int i;
  for (i = 0; arg[i]; i++)
    if (arg[i] >= '0' && arg[i] <= '9')
      return 1;
    else {
      printf("calci: Non-numeric data detected\n");
      return 0;
    }
}


x86 assembly (clang, -O0):
<checknumeric>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     117e <checknumeric+0x6e>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     116b <checknumeric+0x5b>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x39,%eax
jg     116b <checknumeric+0x5b>
movl   $0x1,-0x4(%rbp)
jmp    117e <checknumeric+0x6e>
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checknumeric>:
push   %rax
mov    (%rdi),%cl
test   %cl,%cl
je     1134 <checknumeric+0x24>
add    $0xd0,%cl
mov    $0x1,%eax
cmp    $0xa,%cl
jb     1132 <checknumeric+0x22>
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret
pop    %rcx
ret

LLVM IR (-O0):
@.str = [34 x i8] c"calci: Non-numeric data detected\0A\00"
define i32 @checknumeric(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 0, i32* %4
br label %5
5: ; preds = %31, %1
%6 = load i8*, i8** %3
%7 = load i32, i32* %4
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = icmp ne i8 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %5
%13 = load i8*, i8** %3
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sge i32 %18, 48
br i1 %19, label %20, label %29
20: ; preds = %12
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sle i32 %26, 57
br i1 %27, label %28, label %29
28: ; preds = %20
store i32 1, i32* %2
br label %34
29: ; preds = %20, %12
%30 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %2
br label %34
31: ; No predecessors!
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %5
34: ; preds = %28, %29, %5
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
@str = [33 x i8] c"calci: Non-numeric data detected\00"
define i32 @checknumeric(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %9, label %4
4: ; preds = %1
%5 = add i8 %2, -48
%6 = icmp ult i8 %5, 10
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str, i64 0, i64 0))
br label %9
9: ; preds = %1, %4, %7
%10 = phi i32 [ 0, %7 ], [ 1, %4 ], [ undef, %1 ]
ret i32 %10
}