#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 str_isdigit(const char *s) {
  for (; *s != '\0'; ++s) {
    if (!isdigit(*s) && (*s != ',') && (*s != '.')) {
      return false;
    }
  }
  return true;
}


x86 assembly (clang, -O0):
<str_isdigit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1183 <str_isdigit+0x73>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    116d <str_isdigit+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2c,%eax
je     116d <str_isdigit+0x5d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     116d <str_isdigit+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    118a <str_isdigit+0x7a>
jmp    1172 <str_isdigit+0x62>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <str_isdigit+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_isdigit>:
push   %rbp
push   %rbx
push   %rax
mov    (%rdi),%al
mov    $0x1,%ebp
test   %al,%al
je     1153 <str_isdigit+0x43>
mov    %rdi,%rbx
add    $0x1,%rbx
jmp    113b <str_isdigit+0x2b>
nopw   0x0(%rax,%rax,1)
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
je     1153 <str_isdigit+0x43>
movsbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
jne    1130 <str_isdigit+0x20>
movzbl -0x1(%rbx),%eax
or     $0x2,%al
cmp    $0x2e,%al
je     1130 <str_isdigit+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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