#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 a_contains_b(int *, int, int *, int);
int ab_equals_ba(int *, int, int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int *set_a(int);
int *set_b(int);
int main(int argc, const char *argv[]) {
  int n, m, *p, *q, result;
  printf("Informe o numero de elementos de A: \n");
  scanf("%d", &n);
  printf("Informe os elementos de A: \n");
  p = set_a(n);
  printf("Informe o numero de elementos de B: \n");
  scanf("%d", &m);
  printf("Informe os elementos de B: \n");
  q = set_b(m);
  result = a_contains_b(p, n, q, m);
  if (result == 1) {
    printf("A esta contido em B\n");
  } else {
    printf("A nao esta contido em B\n");
  }
  result = ab_equals_ba(p, n, q, m);
  if (result == 1) {
    printf("A=B\n");
  } else {
    printf("A!=B\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe83(%rip),%rdi
call   1050 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
call   1060 <set_a@plt>
mov    %rax,-0x20(%rbp)
lea    0xe95(%rip),%rdi
call   1050 <printf@plt>
lea    0xe69(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <scanf@plt>
lea    0xe9f(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
call   1080 <set_b@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
call   1030 <a_contains_b@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jne    120f <main+0xaf>
lea    0xe84(%rip),%rdi
call   1050 <printf@plt>
jmp    121b <main+0xbb>
lea    0xe88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x28(%rbp),%rdx
mov    -0x18(%rbp),%ecx
call   1040 <ab_equals_ba@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x1,-0x2c(%rbp)
jne    124c <main+0xec>
lea    0xe75(%rip),%rdi
call   1050 <printf@plt>
jmp    1258 <main+0xf8>
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xe93(%rip),%rdi
call   1040 <puts@plt>
lea    0xe84(%rip),%r14
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
lea    0xe98(%rip),%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%edi
call   1060 <set_a@plt>
mov    %rax,%r15
lea    0xe9c(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1070 <scanf@plt>
lea    0xea8(%rip),%rdi
call   1040 <puts@plt>
mov    0x8(%rsp),%edi
call   1080 <set_b@plt>
mov    %rax,%rbx
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
mov    %r15,%rdi
mov    %rax,%rdx
call   1030 <a_contains_b@plt>
cmp    $0x1,%eax
lea    0xeb7(%rip),%rax
lea    0xe8f(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%ecx
mov    %r15,%rdi
mov    %rbx,%rdx
call   1050 <ab_equals_ba@plt>
cmp    $0x1,%eax
lea    0xe86(%rip),%rax
lea    0xe7a(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [38 x i8] c"Informe o numero de elementos de A: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [29 x i8] c"Informe os elementos de A: \0A\00"
@.str.3 = [38 x i8] c"Informe o numero de elementos de B: \0A\00"
@.str.4 = [29 x i8] c"Informe os elementos de B: \0A\00"
@.str.5 = [21 x i8] c"A esta contido em B\0A\00"
@.str.6 = [25 x i8] c"A nao esta contido em B\0A\00"
@.str.7 = [5 x i8] c"A=B\0A\00"
@.str.8 = [6 x i8] c"A!=B\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%13 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* %6
%15 = call i32* @set_a(i32 %14)
store i32* %15, i32** %8
%16 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%18 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32, i32* %7
%20 = call i32* @set_b(i32 %19)
store i32* %20, i32** %9
%21 = load i32*, i32** %8
%22 = load i32, i32* %6
%23 = load i32*, i32** %9
%24 = load i32, i32* %7
%25 = call i32 @a_contains_b(i32* %21, i32 %22, i32* %23, i32 %24)
store i32 %25, i32* %10
%26 = load i32, i32* %10
%27 = icmp eq i32 %26, 1
br i1 %27, label %28, label %30
28: ; preds = %2
%29 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %32
30: ; preds = %2
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
%33 = load i32*, i32** %8
%34 = load i32, i32* %6
%35 = load i32*, i32** %9
%36 = load i32, i32* %7
%37 = call i32 @ab_equals_ba(i32* %33, i32 %34, i32* %35, i32 %36)
store i32 %37, i32* %10
%38 = load i32, i32* %10
%39 = icmp eq i32 %38, 1
br i1 %39, label %40, label %42
40: ; preds = %32
%41 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0))
br label %44
42: ; preds = %32
%43 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %44
44: ; preds = %42, %40
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [37 x i8] c"Informe o numero de elementos de A: \00"
@str.9 = [28 x i8] c"Informe os elementos de A: \00"
@str.10 = [37 x i8] c"Informe o numero de elementos de B: \00"
@str.11 = [28 x i8] c"Informe os elementos de B: \00"
@str.12 = [24 x i8] c"A nao esta contido em B\00"
@str.13 = [5 x i8] c"A!=B\00"
@str.14 = [4 x i8] c"A=B\00"
@str.15 = [20 x i8] c"A esta contido em B\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.9, i64 0, i64 0))
%10 = load i32, i32* %3
%11 = call i32* @set_a(i32 %10)
%12 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.10, i64 0, i64 0))
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.11, i64 0, i64 0))
%15 = load i32, i32* %4
%16 = call i32* @set_b(i32 %15)
%17 = load i32, i32* %3
%18 = load i32, i32* %4
%19 = call i32 @a_contains_b(i32* %11, i32 %17, i32* %16, i32 %18)
%20 = icmp eq i32 %19, 1
%21 = select i1 %20, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @str.15, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @str.12, i64 0, i64 0)
%22 = call i32 @puts(i8* dereferenceable(1) %21)
%23 = load i32, i32* %3
%24 = load i32, i32* %4
%25 = call i32 @ab_equals_ba(i32* %11, i32 %23, i32* %16, i32 %24)
%26 = icmp eq i32 %25, 1
%27 = select i1 %26, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @str.14, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @str.13, i64 0, i64 0)
%28 = call i32 @puts(i8* dereferenceable(1) %27)
ret i32 0
}