#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 const);
bool cmdlineIsANumber(const char *s) {
  for (int i = 0; s[i]; s++) {
    if (!isdigit(s[i]) && s[i] != 'x') {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<cmdlineIsANumber>:
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     1186 <cmdlineIsANumber+0x76>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1170 <cmdlineIsANumber+0x60>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x78,%eax
je     1170 <cmdlineIsANumber+0x60>
movl   $0x0,-0x4(%rbp)
jmp    118d <cmdlineIsANumber+0x7d>
jmp    1175 <cmdlineIsANumber+0x65>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1123 <cmdlineIsANumber+0x13>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdlineIsANumber>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     114f <cmdlineIsANumber+0x3f>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    113b <cmdlineIsANumber+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     114f <cmdlineIsANumber+0x3f>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1130 <cmdlineIsANumber+0x20>
cmpb   $0x78,-0x1(%rbx)
je     1130 <cmdlineIsANumber+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @cmdlineIsANumber(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 = %30, %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 %33
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 = call i32 @isdigit(i8 signext %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %29, label %20
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 ne i32 %26, 120
br i1 %27, label %28, label %29
28: ; preds = %20
store i32 0, i32* %2
br label %34
29: ; preds = %20, %12
br label %30
30: ; preds = %29
%31 = load i8*, i8** %3
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %3
br label %5
33: ; preds = %5
store i32 1, i32* %2
br label %34
34: ; preds = %33, %28
%35 = load i32, i32* %2
ret i32 %35
}

LLVM IR (-O2):
define i32 @cmdlineIsANumber(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %16, label %4
4: ; preds = %1, %12
%5 = phi i8 [ %14, %12 ], [ %2, %1 ]
%6 = phi i8* [ %13, %12 ], [ %0, %1 ]
%7 = tail call i32 @isdigit(i8 signext %5)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 120
br i1 %11, label %12, label %16
12: ; preds = %4, %9
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 0
br i1 %15, label %16, label %4
16: ; preds = %12, %9, %1
%17 = phi i32 [ 1, %1 ], [ 0, %9 ], [ 1, %12 ]
ret i32 %17
}