#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*/ is_upperchar(char const);
int /*<<< orphan*/ is_upperchar_space(char const);
int nbib_istag(const char *buf) {
  if (!is_upperchar(buf[0]))
    return 0;
  if (!is_upperchar(buf[1]))
    return 0;
  if (!is_upperchar_space(buf[2]))
    return 0;
  if (!is_upperchar_space(buf[3]))
    return 0;
  if (buf[4] != '-')
    return 0;
  if (buf[5] != ' ')
    return 0;
  return 1;
}


x86 assembly (clang, -O0):
<nbib_istag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <is_upperchar@plt>
cmp    $0x0,%eax
jne    114d <nbib_istag+0x2d>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%edi
call   1030 <is_upperchar@plt>
cmp    $0x0,%eax
jne    116f <nbib_istag+0x4f>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%edi
call   1040 <is_upperchar_space@plt>
cmp    $0x0,%eax
jne    1191 <nbib_istag+0x71>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
mov    -0x10(%rbp),%rax
movsbl 0x3(%rax),%edi
call   1040 <is_upperchar_space@plt>
cmp    $0x0,%eax
jne    11b3 <nbib_istag+0x93>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
mov    -0x10(%rbp),%rax
movsbl 0x4(%rax),%eax
cmp    $0x2d,%eax
je     11d0 <nbib_istag+0xb0>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
mov    -0x10(%rbp),%rax
movsbl 0x5(%rax),%eax
cmp    $0x20,%eax
je     11ed <nbib_istag+0xcd>
movl   $0x0,-0x4(%rbp)
jmp    11f4 <nbib_istag+0xd4>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<nbib_istag>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movsbl (%rdi),%edi
call   1030 <is_upperchar@plt>
xor    %ebp,%ebp
test   %eax,%eax
je     116b <nbib_istag+0x4b>
movsbl 0x1(%rbx),%edi
call   1030 <is_upperchar@plt>
test   %eax,%eax
je     116b <nbib_istag+0x4b>
movsbl 0x2(%rbx),%edi
call   1040 <is_upperchar_space@plt>
test   %eax,%eax
je     116b <nbib_istag+0x4b>
movsbl 0x3(%rbx),%edi
call   1040 <is_upperchar_space@plt>
test   %eax,%eax
je     116b <nbib_istag+0x4b>
cmpb   $0x2d,0x4(%rbx)
jne    116b <nbib_istag+0x4b>
xor    %ebp,%ebp
cmpb   $0x20,0x5(%rbx)
sete   %bpl
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @nbib_istag(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = tail call i32 @is_upperchar(i8 signext %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %29, label %5
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = tail call i32 @is_upperchar(i8 signext %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %29, label %10
10: ; preds = %5
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = tail call i32 @is_upperchar_space(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %29, label %15
15: ; preds = %10
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = tail call i32 @is_upperchar_space(i8 signext %17)
%19 = icmp eq i32 %18, 0
br i1 %19, label %29, label %20
20: ; preds = %15
%21 = getelementptr inbounds i8, i8* %0, i64 4
%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 5
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 32
%28 = zext i1 %27 to i32
br label %29
29: ; preds = %24, %20, %15, %10, %5, %1
%30 = phi i32 [ 0, %1 ], [ 0, %5 ], [ 0, %10 ], [ 0, %15 ], [ 0, %20 ], [ %28, %24 ]
ret i32 %30
}