#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 /*<<< orphan*/ strlen(unsigned char *);
int Barcode_msi_verify(unsigned char *text) {
  int i;
  if (!strlen(text))
    return -1;
  for (i = 0; text[i]; i++) {
    if (!isdigit(text[i]))
      return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Barcode_msi_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_msi_verify+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a3 <Barcode_msi_verify+0x83>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     119c <Barcode_msi_verify+0x7c>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzbl (%rax,%rcx,1),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    1189 <Barcode_msi_verify+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    11a3 <Barcode_msi_verify+0x83>
jmp    118e <Barcode_msi_verify+0x6e>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1151 <Barcode_msi_verify+0x31>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Barcode_msi_verify>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <strlen@plt>
mov    $0xffffffff,%ebp
test   %eax,%eax
je     1159 <Barcode_msi_verify+0x39>
mov    (%rbx),%al
test   %al,%al
je     1157 <Barcode_msi_verify+0x37>
add    $0x1,%rbx
xchg   %ax,%ax
movzbl %al,%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1159 <Barcode_msi_verify+0x39>
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <Barcode_msi_verify+0x20>
xor    %ebp,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

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