#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 /*<<< orphan*/ strlen(unsigned char *);
int Barcode_i25_verify(unsigned char *text) {
  if (!strlen(text))
    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),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%eax
jne    114a <Barcode_i25_verify+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bb <Barcode_i25_verify+0x9b>
jmp    114f <Barcode_i25_verify+0x2f>
mov    -0x10(%rbp),%rax
movzbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x11(%rbp)
je     117a <Barcode_i25_verify+0x5a>
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    118a <Barcode_i25_verify+0x6a>
jmp    119b <Barcode_i25_verify+0x7b>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <Barcode_i25_verify+0x2f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b4 <Barcode_i25_verify+0x94>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bb <Barcode_i25_verify+0x9b>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Barcode_i25_verify>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
test   %eax,%eax
je     115a <Barcode_i25_verify+0x3a>
mov    (%rbx),%al
xor    %ebp,%ebp
test   %al,%al
je     1168 <Barcode_i25_verify+0x48>
add    $0x1,%rbx
nopl   0x0(%rax,%rax,1)
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %rax,%rax
je     1161 <Barcode_i25_verify+0x41>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <Barcode_i25_verify+0x20>
jmp    1168 <Barcode_i25_verify+0x48>
mov    $0xffffffff,%ebp
jmp    1168 <Barcode_i25_verify+0x48>
xor    %eax,%eax
cmp    -0x1(%rbx),%al
sbb    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
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 = call i32 @strlen(i8* %4)
%6 = icmp ne i32 %5, 0
br i1 %6, label %8, label %7
7: ; preds = %1
store i32 -1, i32* %2
br label %30
8: ; preds = %1
br label %9
9: ; preds = %21, %8
%10 = load i8*, i8** %3
%11 = load i8, i8* %10
%12 = zext i8 %11 to i32
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %19
14: ; preds = %9
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = call i64 @isdigit(i8 zeroext %16)
%18 = icmp ne i64 %17, 0
br label %19
19: ; preds = %14, %9
%20 = phi i1 [ false, %9 ], [ %18, %14 ]
br i1 %20, label %21, label %24
21: ; preds = %19
%22 = load i8*, i8** %3
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %3
br label %9
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %28, label %29
28: ; preds = %24
store i32 -1, i32* %2
br label %30
29: ; preds = %24
store i32 0, i32* %2
br label %30
30: ; preds = %29, %28, %7
%31 = load i32, i32* %2
ret i32 %31
}

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