#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 strcspn(char *, char *);
int strlen(char *);
int contains(char *str, char **expv, int expc) {
  int result = 0;
  int j = 0;
  int i;
  if (strlen(str) != expc)
    return 0;
  for (i = 0; i < expc; i++) {
    j = strcspn(str, expv[i]);
    if (j == 0)
      result = 1;
    else {
      result = 0;
      break;
    }
    str++;
  }
  return result;
}


x86 assembly (clang, -O0):
<contains>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
cmp    -0x1c(%rbp),%eax
je     115f <contains+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    11cc <contains+0xac>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11c6 <contains+0xa6>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rax
movslq -0x28(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <strcspn@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jne    11a0 <contains+0x80>
movl   $0x1,-0x20(%rbp)
jmp    11ac <contains+0x8c>
movl   $0x0,-0x20(%rbp)
jmp    11c6 <contains+0xa6>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1166 <contains+0x46>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<contains>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%ebp
mov    %rsi,%r15
mov    %rdi,%r12
call   1030 <strlen@plt>
xor    %r14d,%r14d
cmp    %ebp,%eax
jne    1170 <contains+0x50>
test   %ebp,%ebp
jle    1170 <contains+0x50>
mov    %ebp,%ebp
xor    %r14d,%r14d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
lea    (%r12,%rbx,1),%rdi
mov    (%r15,%rbx,8),%rsi
call   1040 <strcspn@plt>
test   %eax,%eax
jne    1170 <contains+0x50>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1150 <contains+0x30>
mov    $0x1,%r14d
mov    %r14d,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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