#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__ EINVAL;
scalar_t__ errno;
int /*<<< orphan*/ real_isspace(char const);
size_t strlen(char *);
int check_sanity(const char *text, size_t len) {
  size_t sl = strlen("84be9c3e-8a32-42c0-891c-4cd3b072becc");
  errno = EINVAL;
  if (len < sl)
    return -1;
  else if (len > sl && !real_isspace(text[sl]))
    return -1;
  if (text[8] != '-' || text[13] != '-' || text[18] != '-' || text[23] != '-')
    return -1;
  errno = 0;
  return 0;
}


x86 assembly (clang, -O0):
<check_sanity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x20(%rbp)
mov    0x2e91(%rip),%rax
mov    (%rax),%rcx
mov    0x2e8f(%rip),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    116e <check_sanity+0x4e>
movl   $0xffffffff,-0x4(%rbp)
jmp    120c <check_sanity+0xec>
mov    -0x18(%rbp),%rax
cmp    -0x20(%rbp),%rax
jbe    11a2 <check_sanity+0x82>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <real_isspace@plt>
cmp    $0x0,%eax
jne    11a2 <check_sanity+0x82>
movl   $0xffffffff,-0x4(%rbp)
jmp    120c <check_sanity+0xec>
jmp    11a7 <check_sanity+0x87>
mov    -0x10(%rbp),%rax
movsbl 0x8(%rax),%eax
cmp    $0x2d,%eax
jne    11eb <check_sanity+0xcb>
mov    -0x10(%rbp),%rax
movsbl 0xd(%rax),%eax
cmp    $0x2d,%eax
jne    11eb <check_sanity+0xcb>
mov    -0x10(%rbp),%rax
movsbl 0x12(%rax),%eax
cmp    $0x2d,%eax
jne    11eb <check_sanity+0xcb>
mov    -0x10(%rbp),%rax
movsbl 0x17(%rax),%eax
cmp    $0x2d,%eax
je     11f7 <check_sanity+0xd7>
movl   $0xffffffff,-0x4(%rbp)
jmp    120c <check_sanity+0xec>
mov    0x2de2(%rip),%rax
movq   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_sanity>:
push   %rbp
push   %r14
push   %rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%rax
mov    0x2ebb(%rip),%r14
mov    %rax,(%r14)
mov    $0xffffffff,%ebp
cmp    $0x24,%rsi
jb     1166 <check_sanity+0x56>
mov    %rdi,%rbx
je     1145 <check_sanity+0x35>
movsbl 0x24(%rbx),%edi
call   1030 <real_isspace@plt>
test   %eax,%eax
je     1166 <check_sanity+0x56>
cmpb   $0x2d,0x8(%rbx)
jne    1166 <check_sanity+0x56>
cmpb   $0x2d,0xd(%rbx)
jne    1166 <check_sanity+0x56>
cmpb   $0x2d,0x12(%rbx)
jne    1166 <check_sanity+0x56>
cmpb   $0x2d,0x17(%rbx)
jne    1166 <check_sanity+0x56>
movq   $0x0,(%r14)
xor    %ebp,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [37 x i8] c"84be9c3e-8a32-42c0-891c-4cd3b072becc\00"
@EINVAL = global i64 0
@errno = global i64 0
define i32 @check_sanity(i8* %0, i64 %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i64
store i8* %0, i8** %4
store i64 %1, i64* %5
%7 = call i64 @strlen(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i64 %7, i64* %6
%8 = load i64, i64* @EINVAL
store i64 %8, i64* @errno
%9 = load i64, i64* %5
%10 = load i64, i64* %6
%11 = icmp ult i64 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 -1, i32* %3
br label %52
13: ; preds = %2
%14 = load i64, i64* %5
%15 = load i64, i64* %6
%16 = icmp ugt i64 %14, %15
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = load i8*, i8** %4
%19 = load i64, i64* %6
%20 = getelementptr inbounds i8, i8* %18, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @real_isspace(i8 signext %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %17
store i32 -1, i32* %3
br label %52
25: ; preds = %17, %13
br label %26
26: ; preds = %25
%27 = load i8*, i8** %4
%28 = getelementptr inbounds i8, i8* %27, i64 8
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = icmp ne i32 %30, 45
br i1 %31, label %50, label %32
32: ; preds = %26
%33 = load i8*, i8** %4
%34 = getelementptr inbounds i8, i8* %33, i64 13
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 45
br i1 %37, label %50, label %38
38: ; preds = %32
%39 = load i8*, i8** %4
%40 = getelementptr inbounds i8, i8* %39, i64 18
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp ne i32 %42, 45
br i1 %43, label %50, label %44
44: ; preds = %38
%45 = load i8*, i8** %4
%46 = getelementptr inbounds i8, i8* %45, i64 23
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp ne i32 %48, 45
br i1 %49, label %50, label %51
50: ; preds = %44, %38, %32, %26
store i32 -1, i32* %3
br label %52
51: ; preds = %44
store i64 0, i64* @errno
store i32 0, i32* %3
br label %52
52: ; preds = %51, %50, %24, %12
%53 = load i32, i32* %3
ret i32 %53
}

LLVM IR (-O2):
@EINVAL = global i64 0
@errno = global i64 0
define i32 @check_sanity(i8* nocapture %0, i64 %1) {
%3 = load i64, i64* @EINVAL
store i64 %3, i64* @errno
%4 = icmp ult i64 %1, 36
br i1 %4, label %29, label %5
5: ; preds = %2
%6 = icmp eq i64 %1, 36
br i1 %6, label %12, label %7
7: ; preds = %5
%8 = getelementptr inbounds i8, i8* %0, i64 36
%9 = load i8, i8* %8
%10 = tail call i32 @real_isspace(i8 signext %9)
%11 = icmp eq i32 %10, 0
br i1 %11, label %29, label %12
12: ; preds = %5, %7
%13 = getelementptr inbounds i8, i8* %0, i64 8
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 45
br i1 %15, label %16, label %29
16: ; preds = %12
%17 = getelementptr inbounds i8, i8* %0, i64 13
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 45
br i1 %19, label %20, label %29
20: ; preds = %16
%21 = getelementptr inbounds i8, i8* %0, i64 18
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 45
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = getelementptr inbounds i8, i8* %0, i64 23
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 45
br i1 %27, label %28, label %29
28: ; preds = %24
store i64 0, i64* @errno
br label %29
29: ; preds = %12, %16, %20, %24, %7, %2, %28
%30 = phi i32 [ 0, %28 ], [ -1, %2 ], [ -1, %7 ], [ -1, %24 ], [ -1, %20 ], [ -1, %16 ], [ -1, %12 ]
ret i32 %30
}