#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 */
size_t strlen(char const *);
bool cyg_isstrempty(char *str, const char *vals) {
  if (vals == NULL)
    return false;
  size_t i;
  for (i = 0; i < strlen(vals); i++) {
    if (str[0] == vals[i])
      return true;
  }
  return false;
}


x86 assembly (clang, -O0):
<cyg_isstrempty>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1137 <cyg_isstrempty+0x27>
movl   $0x0,-0x4(%rbp)
jmp    11a4 <cyg_isstrempty+0x94>
movq   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
cmp    %rcx,%rax
jae    119d <cyg_isstrempty+0x8d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1187 <cyg_isstrempty+0x77>
movl   $0x1,-0x4(%rbp)
jmp    11a4 <cyg_isstrempty+0x94>
jmp    118c <cyg_isstrempty+0x7c>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    113f <cyg_isstrempty+0x2f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cyg_isstrempty>:
push   %rbp
push   %r14
push   %rbx
xor    %ebp,%ebp
test   %rsi,%rsi
je     1157 <cyg_isstrempty+0x47>
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1030 <strlen@plt>
test   %rax,%rax
je     1157 <cyg_isstrempty+0x47>
mov    (%r14),%cl
xor    %edx,%edx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    (%rbx,%rdx,1),%cl
je     1152 <cyg_isstrempty+0x42>
add    $0x1,%rdx
cmp    %rdx,%rax
jne    1140 <cyg_isstrempty+0x30>
xor    %ebp,%ebp
jmp    1157 <cyg_isstrempty+0x47>
mov    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

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