#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*/ printSet(int *, int);
int /*<<< orphan*/ printf(char *);
int findIntersection(int *set1, int len1, int *set2, int len2) {
  int intersection[200], i, loc = 0;
  for (i = 0; i < len1; i++) {
    if (0 == checkPresence(set2, set1[i], len2)) {
      intersection[loc] = set1[i];
      loc++;
    }
  }
  printf("\nIntersection ::");
  printSet(intersection, loc);
  return 0;
}


x86 assembly (clang, -O0):
<findIntersection>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
movl   $0x0,-0x348(%rbp)
movl   $0x0,-0x344(%rbp)
mov    -0x344(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11d8 <findIntersection+0xa8>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x344(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
mov    -0x1c(%rbp),%edx
call   1040 <checkPresence@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jne    11bf <findIntersection+0x8f>
mov    -0x8(%rbp),%rax
movslq -0x344(%rbp),%rcx
mov    (%rax,%rcx,4),%ecx
movslq -0x348(%rbp),%rax
mov    %ecx,-0x340(%rbp,%rax,4)
mov    -0x348(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x348(%rbp)
jmp    11c4 <findIntersection+0x94>
mov    -0x344(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x344(%rbp)
jmp    115d <findIntersection+0x2d>
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
lea    -0x340(%rbp),%rdi
mov    -0x348(%rbp),%esi
call   1050 <printSet@plt>
xor    %eax,%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findIntersection>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x328,%rsp
test   %esi,%esi
jle    118e <findIntersection+0x5e>
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %rdi,%r13
mov    %esi,%r12d
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1169 <findIntersection+0x39>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r12
je     1190 <findIntersection+0x60>
mov    0x0(%r13,%rbp,4),%esi
mov    %r15,%rdi
mov    %r14d,%edx
call   1040 <checkPresence@plt>
test   %rax,%rax
jne    1160 <findIntersection+0x30>
mov    0x0(%r13,%rbp,4),%eax
movslq %ebx,%rbx
mov    %eax,(%rsp,%rbx,4)
add    $0x1,%ebx
jmp    1160 <findIntersection+0x30>
xor    %ebx,%ebx
lea    0xe69(%rip),%rdi
call   1030 <printf@plt>
mov    %rsp,%rdi
mov    %ebx,%esi
call   1050 <printSet@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0AIntersection ::\00"
define i32 @findIntersection(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [200 x i32]
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
store i32 0, i32* %11
store i32 0, i32* %10
br label %12
12: ; preds = %38, %4
%13 = load i32, i32* %10
%14 = load i32, i32* %6
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %41
16: ; preds = %12
%17 = load i32*, i32** %7
%18 = load i32*, i32** %5
%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* %8
%24 = call i64 @checkPresence(i32* %17, i32 %22, i32 %23)
%25 = icmp eq i64 0, %24
br i1 %25, label %26, label %37
26: ; preds = %16
%27 = load i32*, i32** %5
%28 = load i32, i32* %10
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32, i32* %11
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [200 x i32], [200 x i32]* %9, i64 0, i64 %33
store i32 %31, i32* %34
%35 = load i32, i32* %11
%36 = add nsw i32 %35, 1
store i32 %36, i32* %11
br label %37
37: ; preds = %26, %16
br label %38
38: ; preds = %37
%39 = load i32, i32* %10
%40 = add nsw i32 %39, 1
store i32 %40, i32* %10
br label %12
41: ; preds = %12
%42 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%43 = getelementptr inbounds [200 x i32], [200 x i32]* %9, i64 0, i64 0
%44 = load i32, i32* %11
%45 = call i32 @printSet(i32* %43, i32 %44)
ret i32 0
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0AIntersection ::\00"
define i32 @findIntersection(i32* nocapture %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca [200 x i32]
%6 = bitcast [200 x i32]* %5 to i8*
%7 = icmp sgt i32 %1, 0
br i1 %7, label %8, label %26
8: ; preds = %4
%9 = zext i32 %1 to i64
br label %10
10: ; preds = %8, %22
%11 = phi i64 [ 0, %8 ], [ %24, %22 ]
%12 = phi i32 [ 0, %8 ], [ %23, %22 ]
%13 = getelementptr inbounds i32, i32* %0, i64 %11
%14 = load i32, i32* %13
%15 = tail call i64 @checkPresence(i32* %2, i32 %14, i32 %3)
%16 = icmp eq i64 %15, 0
br i1 %16, label %17, label %22
17: ; preds = %10
%18 = load i32, i32* %13
%19 = sext i32 %12 to i64
%20 = getelementptr inbounds [200 x i32], [200 x i32]* %5, i64 0, i64 %19
store i32 %18, i32* %20
%21 = add nsw i32 %12, 1
br label %22
22: ; preds = %10, %17
%23 = phi i32 [ %21, %17 ], [ %12, %10 ]
%24 = add nuw nsw i64 %11, 1
%25 = icmp eq i64 %24, %9
br i1 %25, label %26, label %10
26: ; preds = %22, %4
%27 = phi i32 [ 0, %4 ], [ %23, %22 ]
%28 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%29 = getelementptr inbounds [200 x i32], [200 x i32]* %5, i64 0, i64 0
%30 = call i32 @printSet(i32* %29, i32 %27)
ret i32 0
}