#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 */
char *strchr(char *, char);
int isheader(char *s) {
  char *p;
  if (((p = strchr(s, ':')) == 0) || (s == p)) {
    return (0);
  }
  while (s != p) {
    if ((*s < '!') || (*s > '~')) {
      return (0);
    }
    s++;
  }
  return (1);
}


x86 assembly (clang, -O0):
<isheader>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1146 <isheader+0x36>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1152 <isheader+0x42>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <isheader+0x99>
jmp    1157 <isheader+0x47>
mov    -0x10(%rbp),%rax
cmp    -0x18(%rbp),%rax
je     11a2 <isheader+0x92>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x21,%eax
jl     1185 <isheader+0x75>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7e,%eax
jle    1191 <isheader+0x81>
movl   $0x0,-0x4(%rbp)
jmp    11a9 <isheader+0x99>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1157 <isheader+0x47>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isheader>:
push   %rbx
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1149 <isheader+0x39>
cmp    %rbx,%rcx
je     1149 <isheader+0x39>
nopl   (%rax)
movzbl (%rbx),%edx
add    $0x81,%dl
cmp    $0xa1,%dl
jbe    1149 <isheader+0x39>
add    $0x1,%rbx
cmp    %rcx,%rbx
jne    1130 <isheader+0x20>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @isheader(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
%6 = call i8* @strchr(i8* %5, i8 signext 58)
store i8* %6, i8** %4
%7 = icmp eq i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = load i8*, i8** %4
%11 = icmp eq i8* %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8, %1
store i32 0, i32* %2
br label %33
13: ; preds = %8
br label %14
14: ; preds = %29, %13
%15 = load i8*, i8** %3
%16 = load i8*, i8** %4
%17 = icmp ne i8* %15, %16
br i1 %17, label %18, label %32
18: ; preds = %14
%19 = load i8*, i8** %3
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp slt i32 %21, 33
br i1 %22, label %28, label %23
23: ; preds = %18
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp sgt i32 %26, 126
br i1 %27, label %28, label %29
28: ; preds = %23, %18
store i32 0, i32* %2
br label %33
29: ; preds = %23
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i32 1
store i8* %31, i8** %3
br label %14
32: ; preds = %14
store i32 1, i32* %2
br label %33
33: ; preds = %32, %28, %12
%34 = load i32, i32* %2
ret i32 %34
}

LLVM IR (-O2):
define i32 @isheader(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 58)
%3 = icmp eq i8* %2, null
%4 = icmp eq i8* %2, %0
%5 = or i1 %3, %4
br i1 %5, label %14, label %8
6: ; preds = %8
%7 = icmp eq i8* %13, %2
br i1 %7, label %14, label %8
8: ; preds = %1, %6
%9 = phi i8* [ %13, %6 ], [ %0, %1 ]
%10 = load i8, i8* %9
%11 = add i8 %10, -127
%12 = icmp ult i8 %11, -94
%13 = getelementptr inbounds i8, i8* %9, i64 1
br i1 %12, label %14, label %6
14: ; preds = %8, %6, %1
%15 = phi i32 [ 0, %1 ], [ 0, %8 ], [ 1, %6 ]
ret i32 %15
}