#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 Strlen(char *);
int s_is_dchr(char c, char *chrs) {
  int i;
  if (!chrs)
    return 0;
  for (i = 0; i < Strlen(chrs); i++)
    if (c == chrs[i])
      return 1;
  return 0;
}


x86 assembly (clang, -O0):
<s_is_dchr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1139 <s_is_dchr+0x29>
movl   $0x0,-0x4(%rbp)
jmp    119a <s_is_dchr+0x8a>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <Strlen@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    1193 <s_is_dchr+0x83>
movsbl -0x5(%rbp),%eax
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
cmp    %ecx,%eax
jne    1180 <s_is_dchr+0x70>
movl   $0x1,-0x4(%rbp)
jmp    119a <s_is_dchr+0x8a>
jmp    1185 <s_is_dchr+0x75>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1140 <s_is_dchr+0x30>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_is_dchr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r14d,%r14d
test   %rsi,%rsi
je     1164 <s_is_dchr+0x54>
mov    %rsi,%rbx
mov    %edi,%r15d
mov    %rsi,%rdi
call   1030 <Strlen@plt>
test   %eax,%eax
jle    1164 <s_is_dchr+0x54>
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    %r15b,(%rbx,%rbp,1)
je     115e <s_is_dchr+0x4e>
add    $0x1,%rbp
mov    %rbx,%rdi
call   1030 <Strlen@plt>
cltq
cmp    %rax,%rbp
jl     1140 <s_is_dchr+0x30>
xor    %r14d,%r14d
jmp    1164 <s_is_dchr+0x54>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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