#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 */
scalar_t__ checkPresence(int *, int, int);
int /*<<< orphan*/ printf(char *);
int findIfSubset(int *set1, int *set2, int len1, int len2) {
  int i, flag = 0;
  for (i = 0; i < len1; i++) {
    if (0 != checkPresence(set2, set1[i], len2)) {
      flag = 1;
      break;
    }
  }
  if (flag == 0) {
    printf("A is subset of B\n");
    return 1;
  } else {
    printf("A is not subset of B\n");
    return 0;
  }
}


x86 assembly (clang, -O0):
<findIfSubset>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    1194 <findIfSubset+0x74>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x20(%rbp),%edx
call   1040 <checkPresence@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
je     1181 <findIfSubset+0x61>
movl   $0x1,-0x28(%rbp)
jmp    1194 <findIfSubset+0x74>
jmp    1186 <findIfSubset+0x66>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1144 <findIfSubset+0x24>
cmpl   $0x0,-0x28(%rbp)
jne    11b6 <findIfSubset+0x96>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11c9 <findIfSubset+0xa9>
lea    0xe55(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findIfSubset>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%ebx
lea    0xede(%rip),%r15
test   %edx,%edx
jle    117e <findIfSubset+0x5e>
mov    %ecx,%r12d
mov    %rsi,%r13
mov    %rdi,%rbp
mov    %edx,%ebx
xor    %r14d,%r14d
nopl   0x0(%rax)
mov    0x0(%rbp,%r14,4),%esi
mov    %r13,%rdi
mov    %r12d,%edx
call   1040 <checkPresence@plt>
test   %rax,%rax
jne    1175 <findIfSubset+0x55>
add    $0x1,%r14
cmp    %r14,%rbx
jne    1150 <findIfSubset+0x30>
mov    $0x1,%ebx
jmp    117e <findIfSubset+0x5e>
lea    0xe84(%rip),%r15
xor    %ebx,%ebx
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"A is subset of B\0A\00"
@.str.1 = [22 x i8] c"A is not subset of B\0A\00"
define i32 @findIfSubset(i32* %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %6
store i32* %1, i32** %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 0, i32* %11
store i32 0, i32* %10
br label %12
12: ; preds = %28, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %8
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %31
16: ; preds = %12
%17 = load i32*, i32** %7
%18 = load i32*, i32** %6
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
%22 = load i32, i32* %21
%23 = load i32, i32* %9
%24 = call i64 @checkPresence(i32* %17, i32 %22, i32 %23)
%25 = icmp ne i64 0, %24
br i1 %25, label %26, label %27
26: ; preds = %16
store i32 1, i32* %11
br label %31
27: ; preds = %16
br label %28
28: ; preds = %27
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
store i32 %30, i32* %10
br label %12
31: ; preds = %26, %12
%32 = load i32, i32* %11
%33 = icmp eq i32 %32, 0
br i1 %33, label %34, label %36
34: ; preds = %31
%35 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %5
br label %38
36: ; preds = %31
%37 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %5
br label %38
38: ; preds = %36, %34
%39 = load i32, i32* %5
ret i32 %39
}

LLVM IR (-O2):
@str = [21 x i8] c"A is not subset of B\00"
@str.2 = [17 x i8] c"A is subset of B\00"
define i32 @findIfSubset(i32* nocapture %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %17
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %10
8: ; preds = %10
%9 = icmp eq i64 %16, %7
br i1 %9, label %17, label %10
10: ; preds = %6, %8
%11 = phi i64 [ 0, %6 ], [ %16, %8 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
%13 = load i32, i32* %12
%14 = tail call i64 @checkPresence(i32* %1, i32 %13, i32 %3)
%15 = icmp eq i64 %14, 0
%16 = add nuw nsw i64 %11, 1
br i1 %15, label %8, label %17
17: ; preds = %10, %8, %4
%18 = phi i8* [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0), %4 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0), %10 ]
%19 = phi i32 [ 1, %4 ], [ 1, %8 ], [ 0, %10 ]
%20 = tail call i32 @puts(i8* dereferenceable(1) %18)
ret i32 %19
}