#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 strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
int check(char *string) {
  int ctr;
  if (strlen(string) > 16)
    return -1;
  if (strstr(string, ":") != NULL)
    return -1;
  for (ctr = 0; ctr < strlen(string); ctr++)
    if (string[ctr] < 48 || string[ctr] > 126)
      return -1;
  return 0;
}


x86 assembly (clang, -O0):
<check>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x10,%eax
jle    114a <check+0x2a>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <check+0xc3>
mov    -0x10(%rbp),%rdi
lea    0xeab(%rip),%rsi
call   1040 <strstr@plt>
cmp    $0x0,%rax
je     1170 <check+0x50>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <check+0xc3>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11dc <check+0xbc>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x30,%eax
jl     11bd <check+0x9d>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7e,%eax
jle    11c9 <check+0xa9>
movl   $0xffffffff,-0x4(%rbp)
jmp    11e3 <check+0xc3>
jmp    11ce <check+0xae>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1177 <check+0x57>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    $0xffffffff,%r14d
cmp    $0x10,%eax
jg     1180 <check+0x60>
mov    %rbx,%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
jne    1180 <check+0x60>
mov    %rbx,%rdi
call   1030 <strlen@plt>
test   %eax,%eax
jle    117d <check+0x5d>
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
movzbl (%rbx,%rbp,1),%eax
add    $0x81,%al
cmp    $0xb0,%al
jbe    1180 <check+0x60>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
cmp    %rax,%rbp
jl     1160 <check+0x40>
xor    %r14d,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c":\00"
define i32 @check(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 sgt i32 %6, 16
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 -1, i32* %2
br label %42
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = call i32* @strstr(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 -1, i32* %2
br label %42
14: ; preds = %9
store i32 0, i32* %4
br label %15
15: ; preds = %38, %14
%16 = load i32, i32* %4
%17 = load i8*, i8** %3
%18 = call i32 @strlen(i8* %17)
%19 = icmp slt i32 %16, %18
br i1 %19, label %20, label %41
20: ; preds = %15
%21 = load i8*, i8** %3
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds i8, i8* %21, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp slt i32 %26, 48
br i1 %27, label %36, label %28
28: ; preds = %20
%29 = load i8*, i8** %3
%30 = load i32, i32* %4
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %29, i64 %31
%33 = load i8, i8* %32
%34 = sext i8 %33 to i32
%35 = icmp sgt i32 %34, 126
br i1 %35, label %36, label %37
36: ; preds = %28, %20
store i32 -1, i32* %2
br label %42
37: ; preds = %28
br label %38
38: ; preds = %37
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
br label %15
41: ; preds = %15
store i32 0, i32* %2
br label %42
42: ; preds = %41, %36, %13, %8
%43 = load i32, i32* %2
ret i32 %43
}

LLVM IR (-O2):
define i32 @check(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = icmp sgt i32 %2, 16
br i1 %3, label %21, label %4
4: ; preds = %1
%5 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 58)
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %21
7: ; preds = %4
%8 = tail call i32 @strlen(i8* %0)
%9 = icmp sgt i32 %8, 0
br i1 %9, label %14, label %21
10: ; preds = %14
%11 = tail call i32 @strlen(i8* %0)
%12 = sext i32 %11 to i64
%13 = icmp slt i64 %20, %12
br i1 %13, label %14, label %21
14: ; preds = %7, %10
%15 = phi i64 [ %20, %10 ], [ 0, %7 ]
%16 = getelementptr inbounds i8, i8* %0, i64 %15
%17 = load i8, i8* %16
%18 = add i8 %17, -127
%19 = icmp ult i8 %18, -79
%20 = add nuw nsw i64 %15, 1
br i1 %19, label %21, label %10
21: ; preds = %14, %10, %7, %4, %1
%22 = phi i32 [ -1, %1 ], [ -1, %4 ], [ 0, %7 ], [ -1, %14 ], [ 0, %10 ]
ret i32 %22
}