#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 */
struct cli_def {
  int dummy;
};

/* Variables and functions */
scalar_t__ strlen(char const *);
scalar_t__ strspn(char const *, char *);
int cli_search_flags_validator(struct cli_def *cli, const char *word,
                               const char *value) {
  if ((*value++ == '-') && (*value) && (strspn(value, "vie") == strlen(value)))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<cli_search_flags_validator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1198 <cli_search_flags_validator+0x78>
mov    -0x20(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1198 <cli_search_flags_validator+0x78>
mov    -0x20(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1040 <strspn@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jne    1198 <cli_search_flags_validator+0x78>
movl   $0x0,-0x4(%rbp)
jmp    119f <cli_search_flags_validator+0x7f>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cli_search_flags_validator>:
push   %r14
push   %rbx
push   %rax
cmpb   $0x2d,(%rdx)
jne    1159 <cli_search_flags_validator+0x39>
mov    %rdx,%rbx
add    $0x1,%rbx
cmpb   $0x0,(%rbx)
je     1159 <cli_search_flags_validator+0x39>
lea    0xec4(%rip),%rsi
mov    %rbx,%rdi
call   1040 <strspn@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%r14
je     115e <cli_search_flags_validator+0x3e>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.cli_def = type { i32 }
@.str = [4 x i8] c"vie\00"
define i32 @cli_search_flags_validator(%struct.cli_def* %0, i8* %1, i8* %2) {
%4 = alloca i32
%5 = alloca %struct.cli_def*
%6 = alloca i8*
%7 = alloca i8*
store %struct.cli_def* %0, %struct.cli_def** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
%8 = load i8*, i8** %7
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %7
%10 = load i8, i8* %8
%11 = sext i8 %10 to i32
%12 = icmp eq i32 %11, 45
br i1 %12, label %13, label %25
13: ; preds = %3
%14 = load i8*, i8** %7
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = load i8*, i8** %7
%20 = call i64 @strspn(i8* %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %7
%22 = call i64 @strlen(i8* %21)
%23 = icmp eq i64 %20, %22
br i1 %23, label %24, label %25
24: ; preds = %18
store i32 0, i32* %4
br label %26
25: ; preds = %18, %13, %3
store i32 -1, i32* %4
br label %26
26: ; preds = %25, %24
%27 = load i32, i32* %4
ret i32 %27
}

LLVM IR (-O2):
%struct.cli_def = type { i32 }
@.str = [4 x i8] c"vie\00"
define i32 @cli_search_flags_validator(%struct.cli_def* nocapture readnone %0, i8* nocapture readnone %1, i8* nocapture %2) {
%4 = getelementptr inbounds i8, i8* %2, i64 1
%5 = load i8, i8* %2
%6 = icmp eq i8 %5, 45
br i1 %6, label %7, label %14
7: ; preds = %3
%8 = load i8, i8* %4
%9 = icmp eq i8 %8, 0
br i1 %9, label %14, label %10
10: ; preds = %7
%11 = tail call i64 @strspn(i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%12 = tail call i64 @strlen(i8* %4)
%13 = icmp eq i64 %11, %12
br i1 %13, label %15, label %14
14: ; preds = %10, %7, %3
br label %15
15: ; preds = %10, %14
%16 = phi i32 [ -1, %14 ], [ 0, %10 ]
ret i32 %16
}