#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__ checkIfEqual(int *, int, int *);
scalar_t__ checkOverlapping(int *, int *, int, int);
int /*<<< orphan*/ printf(char *, ...);
int readInput(int *);
int /*<<< orphan*/ sort(int *, int);
int main() {
  int set1[100], len1, set2[100], len2;
  int overlapping = 0, i;
  len1 = readInput(set1);
  len2 = readInput(set2);
  for (i = 0; i < len1; i++) {
    if (set1[i] == set2[0]) {
      overlapping += checkOverlapping(&set1[i], set2, len1 - i, len2);
    }
  }
  printf("\n(1). possible overlappings = %d\n", overlapping);
  if (len1 != len2) {
    printf("\n(2). multisets A and B are not equal\n");
    return 0;
  }
  sort(set1, len1);
  sort(set2, len2);
  if (checkIfEqual(set1, len1, set2)) {
    printf("\n(2). multisets A and B are equal\n");
  } else
    printf("\n(2). multisets A and B are not equal\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x350,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x348(%rbp)
lea    -0x1a0(%rbp),%rdi
call   1060 <readInput@plt>
mov    %eax,-0x1a4(%rbp)
lea    -0x340(%rbp),%rdi
call   1060 <readInput@plt>
mov    %eax,-0x344(%rbp)
movl   $0x0,-0x34c(%rbp)
mov    -0x34c(%rbp),%eax
cmp    -0x1a4(%rbp),%eax
jge    1225 <main+0xd5>
movslq -0x34c(%rbp),%rax
mov    -0x1a0(%rbp,%rax,4),%eax
cmp    -0x340(%rbp),%eax
jne    120c <main+0xbc>
movslq -0x34c(%rbp),%rax
lea    -0x1a0(%rbp),%rdi
shl    $0x2,%rax
add    %rax,%rdi
lea    -0x340(%rbp),%rsi
mov    -0x1a4(%rbp),%edx
sub    -0x34c(%rbp),%edx
mov    -0x344(%rbp),%ecx
call   1070 <checkOverlapping@plt>
mov    %rax,%rcx
movslq -0x348(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x348(%rbp)
jmp    1211 <main+0xc1>
mov    -0x34c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34c(%rbp)
jmp    119a <main+0x4a>
mov    -0x348(%rbp),%esi
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1a4(%rbp),%eax
cmp    -0x344(%rbp),%eax
je     1265 <main+0x115>
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    12d4 <main+0x184>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
call   1040 <sort@plt>
lea    -0x340(%rbp),%rdi
mov    -0x344(%rbp),%esi
call   1040 <sort@plt>
lea    -0x1a0(%rbp),%rdi
mov    -0x1a4(%rbp),%esi
lea    -0x340(%rbp),%rdx
call   1050 <checkIfEqual@plt>
cmp    $0x0,%rax
je     12bf <main+0x16f>
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    12cd <main+0x17d>
lea    0xd5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x350,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x328,%rsp
lea    0x190(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <readInput@plt>
mov    %eax,%r14d
mov    %rsp,%rdi
call   1070 <readInput@plt>
mov    %eax,%r15d
test   %r14d,%r14d
jle    11c6 <main+0x66>
mov    %r14d,%ebp
xor    %r12d,%r12d
mov    %rsp,%r13
jmp    11aa <main+0x4a>
nop
add    $0x4,%rbx
add    $0xffffffffffffffff,%rbp
je     11c9 <main+0x69>
mov    (%rbx),%eax
cmp    (%rsp),%eax
jne    11a0 <main+0x40>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %ebp,%edx
mov    %r15d,%ecx
call   1080 <checkOverlapping@plt>
add    %eax,%r12d
jmp    11a0 <main+0x40>
xor    %r12d,%r12d
lea    0xe30(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    %r15d,%r14d
jne    1225 <main+0xc5>
lea    0x190(%rsp),%rbx
mov    %rbx,%rdi
mov    %r14d,%esi
call   1050 <sort@plt>
mov    %rsp,%rbp
mov    %rbp,%rdi
mov    %r14d,%esi
call   1050 <sort@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
mov    %rbp,%rdx
call   1060 <checkIfEqual@plt>
test   %rax,%rax
lea    0xe2c(%rip),%rax
lea    0xe03(%rip),%rdi
cmove  %rax,%rdi
jmp    122c <main+0xcc>
lea    0xe18(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x328,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [34 x i8] c"\0A(1). possible overlappings = %d\0A\00"
@.str.1 = [39 x i8] c"\0A(2). multisets A and B are not equal\0A\00"
@.str.2 = [35 x i8] c"\0A(2). multisets A and B are equal\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca [100 x i32]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %6
%8 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%9 = call i32 @readInput(i32* %8)
store i32 %9, i32* %3
%10 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%11 = call i32 @readInput(i32* %10)
store i32 %11, i32* %5
store i32 0, i32* %7
br label %12
12: ; preds = %39, %0
%13 = load i32, i32* %7
%14 = load i32, i32* %3
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %42
16: ; preds = %12
%17 = load i32, i32* %7
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %18
%20 = load i32, i32* %19
%21 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%22 = load i32, i32* %21
%23 = icmp eq i32 %20, %22
br i1 %23, label %24, label %38
24: ; preds = %16
%25 = load i32, i32* %7
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 %26
%28 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%29 = load i32, i32* %3
%30 = load i32, i32* %7
%31 = sub nsw i32 %29, %30
%32 = load i32, i32* %5
%33 = call i64 @checkOverlapping(i32* %27, i32* %28, i32 %31, i32 %32)
%34 = load i32, i32* %6
%35 = sext i32 %34 to i64
%36 = add nsw i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %6
br label %38
38: ; preds = %24, %16
br label %39
39: ; preds = %38
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %12
42: ; preds = %12
%43 = load i32, i32* %6
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %43)
%45 = load i32, i32* %3
%46 = load i32, i32* %5
%47 = icmp ne i32 %45, %46
br i1 %47, label %48, label %50
48: ; preds = %42
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %1
br label %67
50: ; preds = %42
%51 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%52 = load i32, i32* %3
%53 = call i32 @sort(i32* %51, i32 %52)
%54 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%55 = load i32, i32* %5
%56 = call i32 @sort(i32* %54, i32 %55)
%57 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%58 = load i32, i32* %3
%59 = getelementptr inbounds [100 x i32], [100 x i32]* %4, i64 0, i64 0
%60 = call i64 @checkIfEqual(i32* %57, i32 %58, i32* %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %50
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %66
64: ; preds = %50
%65 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
br label %66
66: ; preds = %64, %62
store i32 0, i32* %1
br label %67
67: ; preds = %66, %48
%68 = load i32, i32* %1
ret i32 %68
}

LLVM IR (-O2):
@.str = [34 x i8] c"\0A(1). possible overlappings = %d\0A\00"
@str.3 = [34 x i8] c"\0A(2). multisets A and B are equal\00"
@str.4 = [38 x i8] c"\0A(2). multisets A and B are not equal\00"
define i32 @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = bitcast [100 x i32]* %1 to i8*
%4 = bitcast [100 x i32]* %2 to i8*
%5 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%6 = call i32 @readInput(i32* %5)
%7 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%8 = call i32 @readInput(i32* %7)
%9 = icmp sgt i32 %6, 0
br i1 %9, label %10, label %29
10: ; preds = %0
%11 = zext i32 %6 to i64
br label %12
12: ; preds = %10, %25
%13 = phi i64 [ 0, %10 ], [ %27, %25 ]
%14 = phi i32 [ 0, %10 ], [ %26, %25 ]
%15 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %13
%16 = load i32, i32* %15
%17 = load i32, i32* %7
%18 = icmp eq i32 %16, %17
br i1 %18, label %19, label %25
19: ; preds = %12
%20 = trunc i64 %13 to i32
%21 = sub nsw i32 %6, %20
%22 = call i64 @checkOverlapping(i32* %15, i32* %7, i32 %21, i32 %8)
%23 = trunc i64 %22 to i32
%24 = add i32 %14, %23
br label %25
25: ; preds = %12, %19
%26 = phi i32 [ %24, %19 ], [ %14, %12 ]
%27 = add nuw nsw i64 %13, 1
%28 = icmp eq i64 %27, %11
br i1 %28, label %29, label %12
29: ; preds = %25, %0
%30 = phi i32 [ 0, %0 ], [ %26, %25 ]
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i32 %30)
%32 = icmp eq i32 %6, %8
br i1 %32, label %33, label %39
33: ; preds = %29
%34 = call i32 @sort(i32* %5, i32 %6)
%35 = call i32 @sort(i32* %7, i32 %6)
%36 = call i64 @checkIfEqual(i32* %5, i32 %6, i32* %7)
%37 = icmp eq i64 %36, 0
%38 = select i1 %37, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @str.3, i64 0, i64 0)
br label %39
39: ; preds = %33, %29
%40 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0), %29 ], [ %38, %33 ]
%41 = call i32 @puts(i8* dereferenceable(1) %40)
ret i32 0
}