#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;
size_t strlen(char *);
int check_sanity(const char *text, size_t len) {
  errno = EINVAL;
  if (len != strlen("84be9c3e-8a32-42c0-891c-4cd3b072becc"))
    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)
mov    0x2eb1(%rip),%rax
mov    (%rax),%rcx
mov    0x2eaf(%rip),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    0xebd(%rip),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
je     1164 <check_sanity+0x54>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <check_sanity+0xb9>
mov    -0x10(%rbp),%rax
movsbl 0x8(%rax),%eax
cmp    $0x2d,%eax
jne    11a8 <check_sanity+0x98>
mov    -0x10(%rbp),%rax
movsbl 0xd(%rax),%eax
cmp    $0x2d,%eax
jne    11a8 <check_sanity+0x98>
mov    -0x10(%rbp),%rax
movsbl 0x12(%rax),%eax
cmp    $0x2d,%eax
jne    11a8 <check_sanity+0x98>
mov    -0x10(%rbp),%rax
movsbl 0x17(%rax),%eax
cmp    $0x2d,%eax
je     11b4 <check_sanity+0xa4>
movl   $0xffffffff,-0x4(%rbp)
jmp    11c9 <check_sanity+0xb9>
mov    0x2e25(%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>:
mov    0x2ed1(%rip),%rax
mov    (%rax),%rax
mov    0x2ecf(%rip),%rcx
mov    %rax,(%rcx)
mov    $0xffffffff,%eax
cmp    $0x24,%rsi
jne    1140 <check_sanity+0x40>
cmpb   $0x2d,0x8(%rdi)
jne    1140 <check_sanity+0x40>
cmpb   $0x2d,0xd(%rdi)
jne    1140 <check_sanity+0x40>
cmpb   $0x2d,0x12(%rdi)
jne    1140 <check_sanity+0x40>
cmpb   $0x2d,0x17(%rdi)
jne    1140 <check_sanity+0x40>
movq   $0x0,(%rcx)
xor    %eax,%eax
ret

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

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 eq i64 %1, 36
br i1 %4, label %5, label %22
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 8
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 45
br i1 %8, label %9, label %22
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 13
%11 = load i8, i8* %10
%12 = icmp eq i8 %11, 45
br i1 %12, label %13, label %22
13: ; preds = %9
%14 = getelementptr inbounds i8, i8* %0, i64 18
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 45
br i1 %16, label %17, label %22
17: ; preds = %13
%18 = getelementptr inbounds i8, i8* %0, i64 23
%19 = load i8, i8* %18
%20 = icmp eq i8 %19, 45
br i1 %20, label %21, label %22
21: ; preds = %17
store i64 0, i64* @errno
br label %22
22: ; preds = %5, %9, %13, %17, %2, %21
%23 = phi i32 [ 0, %21 ], [ -1, %2 ], [ -1, %17 ], [ -1, %13 ], [ -1, %9 ], [ -1, %5 ]
ret i32 %23
}