#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 toupper(int);
int is_ipmi_opt_tag(const char *str) {
  if ((str == NULL) || (str[0] == '\0') || (str[1] != ':')) {
    return (0);
  }
  switch (toupper((int)str[0])) {
  case 'U':
  case 'P':
  case 'K':
  case 'L':
  case 'C':
  case 'W':
    return (1);
  }
  return (0);
}


x86 assembly (clang, -O0):
<is_ipmi_opt_tag>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1148 <is_ipmi_opt_tag+0x38>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1148 <is_ipmi_opt_tag+0x38>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x3a,%eax
je     1154 <is_ipmi_opt_tag+0x44>
movl   $0x0,-0x4(%rbp)
jmp    11cd <is_ipmi_opt_tag+0xbd>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
mov    %ecx,-0x14(%rbp)
sub    $0x43,%eax
je     11ba <is_ipmi_opt_tag+0xaa>
jmp    1173 <is_ipmi_opt_tag+0x63>
mov    -0x14(%rbp),%eax
add    $0xffffffb5,%eax
sub    $0x2,%eax
jb     11ba <is_ipmi_opt_tag+0xaa>
jmp    1187 <is_ipmi_opt_tag+0x77>
mov    -0x14(%rbp),%eax
sub    $0x50,%eax
je     11ba <is_ipmi_opt_tag+0xaa>
jmp    1198 <is_ipmi_opt_tag+0x88>
mov    -0x14(%rbp),%eax
sub    $0x55,%eax
je     11ba <is_ipmi_opt_tag+0xaa>
jmp    11a9 <is_ipmi_opt_tag+0x99>
mov    -0x14(%rbp),%eax
sub    $0x57,%eax
jne    11c6 <is_ipmi_opt_tag+0xb6>
jmp    11ba <is_ipmi_opt_tag+0xaa>
movl   $0x1,-0x4(%rbp)
jmp    11cd <is_ipmi_opt_tag+0xbd>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_ipmi_opt_tag>:
push   %rax
xor    %eax,%eax
test   %rdi,%rdi
je     1145 <is_ipmi_opt_tag+0x35>
movsbl (%rdi),%ecx
test   %ecx,%ecx
je     1145 <is_ipmi_opt_tag+0x35>
cmpb   $0x3a,0x1(%rdi)
jne    1145 <is_ipmi_opt_tag+0x35>
mov    %ecx,%edi
call   1030 <toupper@plt>
mov    %eax,%ecx
add    $0xffffffbd,%ecx
cmp    $0x14,%ecx
ja     1147 <is_ipmi_opt_tag+0x37>
mov    $0x1,%eax
mov    $0x142301,%edx
bt     %ecx,%edx
jae    1147 <is_ipmi_opt_tag+0x37>
pop    %rcx
ret
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @is_ipmi_opt_tag(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp eq i8* %4, null
br i1 %5, label %18, label %6
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 0
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %6
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 58
br i1 %17, label %18, label %19
18: ; preds = %12, %6, %1
store i32 0, i32* %2
br label %27
19: ; preds = %12
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = call i32 @toupper(i32 %23)
switch i32 %24, label %26 [
i32 85, label %25
i32 80, label %25
i32 75, label %25
i32 76, label %25
i32 67, label %25
i32 87, label %25
]
25: ; preds = %19, %19, %19, %19, %19, %19
store i32 1, i32* %2
br label %27
26: ; preds = %19
store i32 0, i32* %2
br label %27
27: ; preds = %26, %25, %18
%28 = load i32, i32* %2
ret i32 %28
}

LLVM IR (-O2):
define i32 @is_ipmi_opt_tag(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %14, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = sext i8 %4 to i32
%6 = icmp eq i8 %4, 0
br i1 %6, label %14, label %7
7: ; preds = %3
%8 = getelementptr inbounds i8, i8* %0, i64 1
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 58
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = tail call i32 @toupper(i32 %5)
switch i32 %12, label %13 [
i32 85, label %14
i32 80, label %14
i32 75, label %14
i32 76, label %14
i32 67, label %14
i32 87, label %14
]
13: ; preds = %11
br label %14
14: ; preds = %11, %11, %11, %11, %11, %11, %1, %3, %7, %13
%15 = phi i32 [ 0, %13 ], [ 0, %7 ], [ 0, %3 ], [ 0, %1 ], [ 1, %11 ], [ 1, %11 ], [ 1, %11 ], [ 1, %11 ], [ 1, %11 ], [ 1, %11 ]
ret i32 %15
}