#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 /*<<< orphan*/ isspace(unsigned char);
scalar_t__ strchr(char const *, char);
int check_user_specified_header(const char *s) {
  const char *p;
  for (p = s; *p && *p != ':' && !isspace((unsigned char)(*p)); p++)
    ;
  if (*p != ':' || p == s)
    return 0;
  if (strchr(s, '\n'))
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<check_user_specified_header>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x19(%rbp)
je     1175 <check_user_specified_header+0x55>
mov    -0x18(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x3a,%ecx
mov    %al,-0x19(%rbp)
je     1175 <check_user_specified_header+0x55>
mov    -0x18(%rbp),%rax
movzbl (%rax),%edi
call   1040 <isspace@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1185 <check_user_specified_header+0x65>
jmp    119b <check_user_specified_header+0x7b>
jmp    118a <check_user_specified_header+0x6a>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1134 <check_user_specified_header+0x14>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3a,%eax
jne    11b9 <check_user_specified_header+0x99>
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jne    11c5 <check_user_specified_header+0xa5>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <check_user_specified_header+0xd0>
mov    -0x10(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
cmp    $0x0,%rax
je     11e9 <check_user_specified_header+0xc9>
movl   $0x0,-0x4(%rbp)
jmp    11f0 <check_user_specified_header+0xd0>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_user_specified_header>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
nopl   0x0(%rax)
movzbl (%r14,%rbx,1),%ecx
test   %cl,%cl
je     1154 <check_user_specified_header+0x34>
cmp    $0x3a,%cl
je     1154 <check_user_specified_header+0x34>
movzbl %cl,%edi
call   1040 <isspace@plt>
test   %eax,%eax
jne    1150 <check_user_specified_header+0x30>
add    $0x1,%rbx
jmp    1130 <check_user_specified_header+0x10>
mov    (%r14,%rbx,1),%cl
xor    %eax,%eax
test   %rbx,%rbx
je     1178 <check_user_specified_header+0x58>
cmp    $0x3a,%cl
jne    1178 <check_user_specified_header+0x58>
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
sete   %al
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @check_user_specified_header(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
%5 = load i8*, i8** %3
store i8* %5, i8** %4
br label %6
6: ; preds = %25, %1
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %6
%12 = load i8*, i8** %4
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = icmp ne i32 %14, 58
br i1 %15, label %16, label %22
16: ; preds = %11
%17 = load i8*, i8** %4
%18 = load i8, i8* %17
%19 = call i32 @isspace(i8 zeroext %18)
%20 = icmp ne i32 %19, 0
%21 = xor i1 %20, true
br label %22
22: ; preds = %16, %11, %6
%23 = phi i1 [ false, %11 ], [ false, %6 ], [ %21, %16 ]
br i1 %23, label %24, label %28
24: ; preds = %22
br label %25
25: ; preds = %24
%26 = load i8*, i8** %4
%27 = getelementptr inbounds i8, i8* %26, i32 1
store i8* %27, i8** %4
br label %6
28: ; preds = %22
%29 = load i8*, i8** %4
%30 = load i8, i8* %29
%31 = sext i8 %30 to i32
%32 = icmp ne i32 %31, 58
br i1 %32, label %37, label %33
33: ; preds = %28
%34 = load i8*, i8** %4
%35 = load i8*, i8** %3
%36 = icmp eq i8* %34, %35
br i1 %36, label %37, label %38
37: ; preds = %33, %28
store i32 0, i32* %2
br label %44
38: ; preds = %33
%39 = load i8*, i8** %3
%40 = call i64 @strchr(i8* %39, i8 signext 10)
%41 = icmp ne i64 %40, 0
br i1 %41, label %42, label %43
42: ; preds = %38
store i32 0, i32* %2
br label %44
43: ; preds = %38
store i32 1, i32* %2
br label %44
44: ; preds = %43, %42, %37
%45 = load i32, i32* %2
ret i32 %45
}

LLVM IR (-O2):
define i32 @check_user_specified_header(i8* %0) {
br label %2
2: ; preds = %10, %1
%3 = phi i8* [ %0, %1 ], [ %11, %10 ]
%4 = load i8, i8* %3
switch i8 %4, label %5 [
i8 0, label %12
i8 58, label %12
]
5: ; preds = %2
%6 = tail call i32 @isspace(i8 zeroext %4)
%7 = icmp eq i32 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5
%9 = load i8, i8* %3
br label %12
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %3, i64 1
br label %2
12: ; preds = %2, %2, %8
%13 = phi i8 [ %9, %8 ], [ %4, %2 ], [ %4, %2 ]
%14 = icmp ne i8 %13, 58
%15 = icmp eq i8* %3, %0
%16 = or i1 %15, %14
br i1 %16, label %21, label %17
17: ; preds = %12
%18 = tail call i64 @strchr(i8* %0, i8 signext 10)
%19 = icmp eq i64 %18, 0
%20 = zext i1 %19 to i32
br label %21
21: ; preds = %17, %12
%22 = phi i32 [ 0, %12 ], [ %20, %17 ]
ret i32 %22
}