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


x86 assembly (clang, -O0):
<Barcode_i25_verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1135 <Barcode_i25_verify+0x25>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <Barcode_i25_verify+0x96>
jmp    113a <Barcode_i25_verify+0x2a>
mov    -0x10(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     1165 <Barcode_i25_verify+0x55>
mov    -0x10(%rbp),%rax
movzbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    1175 <Barcode_i25_verify+0x65>
jmp    1186 <Barcode_i25_verify+0x76>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    113a <Barcode_i25_verify+0x2a>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     119f <Barcode_i25_verify+0x8f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a6 <Barcode_i25_verify+0x96>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Barcode_i25_verify>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     113c <Barcode_i25_verify+0x2c>
mov    %rdi,%rbx
add    $0x1,%rbx
xchg   %ax,%ax
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1143 <Barcode_i25_verify+0x33>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1120 <Barcode_i25_verify+0x10>
xor    %eax,%eax
pop    %rbx
ret
mov    $0xffffffff,%eax
pop    %rbx
ret
xor    %eax,%eax
cmp    -0x1(%rbx),%al
sbb    %eax,%eax
pop    %rbx
ret

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

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