#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(char const);
int is_ipmi_opt_tag(const char *str) {
  if ((str == NULL) || (str[0] == '\0') || (str[1] != ':')) {
    return (0);
  }
  switch (toupper(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>
mov    (%rdi),%cl
test   %cl,%cl
je     1145 <is_ipmi_opt_tag+0x35>
cmpb   $0x3a,0x1(%rdi)
jne    1145 <is_ipmi_opt_tag+0x35>
movsbl %cl,%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 %26
19: ; preds = %12
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = call i32 @toupper(i8 signext %22)
switch i32 %23, label %25 [
i32 85, label %24
i32 80, label %24
i32 75, label %24
i32 76, label %24
i32 67, label %24
i32 87, label %24
]
24: ; preds = %19, %19, %19, %19, %19, %19
store i32 1, i32* %2
br label %26
25: ; preds = %19
store i32 0, i32* %2
br label %26
26: ; preds = %25, %24, %18
%27 = load i32, i32* %2
ret i32 %27
}

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