#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 *gui_bar_item_string_get_item_start(char const *);
int /*<<< orphan*/ gui_bar_item_valid_char_name(char const);
int strlen(char const *);
scalar_t__ strncmp(char const *, char const *, int);
int gui_bar_item_string_is_item(const char *string, const char *item_name) {
  const char *item_start;
  int length;
  item_start = gui_bar_item_string_get_item_start(string);
  if (!item_start)
    return 0;
  length = strlen(item_name);
  if (strncmp(item_start, item_name, length) == 0) {
    if (!gui_bar_item_valid_char_name(item_start[length]))
      return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<gui_bar_item_string_is_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <gui_bar_item_string_get_item_start@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1174 <gui_bar_item_string_is_item+0x34>
movl   $0x0,-0x4(%rbp)
jmp    11cc <gui_bar_item_string_is_item+0x8c>
mov    -0x18(%rbp),%rdi
call   1050 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    11c5 <gui_bar_item_string_is_item+0x85>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1060 <gui_bar_item_valid_char_name@plt>
cmp    $0x0,%eax
jne    11c0 <gui_bar_item_string_is_item+0x80>
movl   $0x1,-0x4(%rbp)
jmp    11cc <gui_bar_item_string_is_item+0x8c>
jmp    11c5 <gui_bar_item_string_is_item+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gui_bar_item_string_is_item>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbp
call   1040 <gui_bar_item_string_get_item_start@plt>
xor    %r14d,%r14d
test   %rax,%rax
je     118d <gui_bar_item_string_is_item+0x4d>
mov    %rax,%rbx
mov    %rbp,%rdi
call   1050 <strlen@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
jne    118d <gui_bar_item_string_is_item+0x4d>
movslq %r15d,%rax
movsbl (%rbx,%rax,1),%edi
call   1060 <gui_bar_item_valid_char_name@plt>
test   %eax,%eax
jne    118d <gui_bar_item_string_is_item+0x4d>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @gui_bar_item_string_is_item(i8* %0, i8* %1) {
%3 = tail call i8* @gui_bar_item_string_get_item_start(i8* %0)
%4 = icmp eq i8* %3, null
br i1 %4, label %16, label %5
5: ; preds = %2
%6 = tail call i32 @strlen(i8* %1)
%7 = tail call i64 @strncmp(i8* %3, i8* %1, i32 %6)
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = sext i32 %6 to i64
%11 = getelementptr inbounds i8, i8* %3, i64 %10
%12 = load i8, i8* %11
%13 = tail call i32 @gui_bar_item_valid_char_name(i8 signext %12)
%14 = icmp eq i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %9, %5
br label %16
16: ; preds = %9, %2, %15
%17 = phi i32 [ 0, %15 ], [ 0, %2 ], [ 1, %9 ]
ret i32 %17
}