#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 sscanf(unsigned char *, char *, unsigned int *, int *);
int /*<<< orphan*/ strlen(unsigned char *);
int Barcode_128raw_verify(unsigned char *text) {
  int n;
  unsigned val;
  if (!strlen(text))
    return -1;
  while (*text) {
    if (sscanf(text, "%u%n", &val, &n) < 1)
      return -1;
    if (val > 105)
      return -1;
    text += n;
  }
  return 0;
}


x86 assembly (clang, -O0):
<Barcode_128raw_verify>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%eax
jne    114a <Barcode_128raw_verify+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <Barcode_128raw_verify+0x9c>
jmp    114f <Barcode_128raw_verify+0x2f>
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     11b5 <Barcode_128raw_verify+0x95>
mov    -0x10(%rbp),%rdi
lea    0xe99(%rip),%rsi
lea    -0x18(%rbp),%rdx
lea    -0x14(%rbp),%rcx
call   1040 <sscanf@plt>
cmp    $0x1,%eax
jge    1189 <Barcode_128raw_verify+0x69>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <Barcode_128raw_verify+0x9c>
cmpl   $0x69,-0x18(%rbp)
jbe    119f <Barcode_128raw_verify+0x7f>
movl   $0xffffffff,-0x4(%rbp)
jmp    11bc <Barcode_128raw_verify+0x9c>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
jmp    114f <Barcode_128raw_verify+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Barcode_128raw_verify>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0xffffffff,%r14d
test   %eax,%eax
je     118e <Barcode_128raw_verify+0x6e>
cmpb   $0x0,(%rbx)
je     118b <Barcode_128raw_verify+0x6b>
lea    0xeb6(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %rbp,%rcx
call   1040 <sscanf@plt>
test   %eax,%eax
jle    118e <Barcode_128raw_verify+0x6e>
cmpl   $0x69,0x8(%rsp)
ja     118e <Barcode_128raw_verify+0x6e>
movslq 0xc(%rsp),%rax
cmpb   $0x0,(%rbx,%rax,1)
lea    (%rbx,%rax,1),%rbx
jne    1160 <Barcode_128raw_verify+0x40>
xor    %r14d,%r14d
mov    %r14d,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%u%n\00"
define i32 @Barcode_128raw_verify(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i32 @strlen(i8* %6)
%8 = icmp ne i32 %7, 0
br i1 %8, label %10, label %9
9: ; preds = %1
store i32 -1, i32* %2
br label %30
10: ; preds = %1
br label %11
11: ; preds = %24, %10
%12 = load i8*, i8** %3
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %29
15: ; preds = %11
%16 = load i8*, i8** %3
%17 = call i32 @sscanf(i8* %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %5, i32* %4)
%18 = icmp slt i32 %17, 1
br i1 %18, label %19, label %20
19: ; preds = %15
store i32 -1, i32* %2
br label %30
20: ; preds = %15
%21 = load i32, i32* %5
%22 = icmp ugt i32 %21, 105
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 -1, i32* %2
br label %30
24: ; preds = %20
%25 = load i32, i32* %4
%26 = load i8*, i8** %3
%27 = sext i32 %25 to i64
%28 = getelementptr inbounds i8, i8* %26, i64 %27
store i8* %28, i8** %3
br label %11
29: ; preds = %11
store i32 0, i32* %2
br label %30
30: ; preds = %29, %23, %19, %9
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
@.str = [5 x i8] c"%u%n\00"
define i32 @Barcode_128raw_verify(i8* %0) {
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %2 to i8*
%5 = bitcast i32* %3 to i8*
%6 = tail call i32 @strlen(i8* %0)
%7 = icmp eq i32 %6, 0
br i1 %7, label %24, label %8
8: ; preds = %1
%9 = load i8, i8* %0
%10 = icmp eq i8 %9, 0
br i1 %10, label %24, label %11
11: ; preds = %8, %18
%12 = phi i8* [ %21, %18 ], [ %0, %8 ]
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32* %3, i32* %2)
%14 = icmp slt i32 %13, 1
%15 = load i32, i32* %3
%16 = icmp ugt i32 %15, 105
%17 = select i1 %14, i1 true, i1 %16
br i1 %17, label %24, label %18
18: ; preds = %11
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8, i8* %12, i64 %20
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %24, label %11
24: ; preds = %11, %18, %8, %1
%25 = phi i32 [ -1, %1 ], [ 0, %8 ], [ -1, %11 ], [ 0, %18 ]
ret i32 %25
}