#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(unsigned char);
int irc_protocol_is_numeric_command(const char *str) {
  while (str && str[0]) {
    if (!isdigit((unsigned char)str[0]))
      return 0;
    str++;
  }
  return 1;
}


x86 assembly (clang, -O0):
<irc_protocol_is_numeric_command>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
je     113c <irc_protocol_is_numeric_command+0x2c>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    114c <irc_protocol_is_numeric_command+0x3c>
jmp    117e <irc_protocol_is_numeric_command+0x6e>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    116d <irc_protocol_is_numeric_command+0x5d>
movl   $0x0,-0x4(%rbp)
jmp    1185 <irc_protocol_is_numeric_command+0x75>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    111c <irc_protocol_is_numeric_command+0xc>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32 @irc_protocol_is_numeric_command(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
br label %4
4: ; preds = %22, %1
%5 = load i8*, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %13
7: ; preds = %4
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp ne i32 %11, 0
br label %13
13: ; preds = %7, %4
%14 = phi i1 [ false, %4 ], [ %12, %7 ]
br i1 %14, label %15, label %25
15: ; preds = %13
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = call i32 @isdigit(i8 zeroext %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %15
store i32 0, i32* %2
br label %26
22: ; preds = %15
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i32 1
store i8* %24, i8** %3
br label %4
25: ; preds = %13
store i32 1, i32* %2
br label %26
26: ; preds = %25, %21
%27 = load i32, i32* %2
ret i32 %27
}

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