#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 /*<<< orphan*/ Existe(int, int *, int);
int /*<<< orphan*/ PrintVetor(int *, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int tamanho;
  printf("Qual o tamanho dos conjuntos?\n");
  scanf("%i", &tamanho);
  int conjA[tamanho];
  int conjB[tamanho];
  int uniao[tamanho * 2];
  printf("Preencha o Conjunto A\n");
  for (int i = 0; i < tamanho; i++) {
    scanf("%d", &conjA[i]);
    uniao[i] = conjA[i];
  }
  printf("Preencha o Conjunto B\n");
  for (int i = 0; i < tamanho; i++)
    scanf("%d", &conjB[i]);
  printf("Conjunto A: ");
  PrintVetor(conjA, tamanho);
  printf("Conjunto B: ");
  PrintVetor(conjB, tamanho);
  for (int i = 0, k = tamanho; i < tamanho; i++, k++)
    if (!Existe(conjB[i], uniao, k))
      uniao[k] = conjB[i];
  printf("Conjunto Uniao: ");
  PrintVetor(uniao, tamanho * 2);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1040 <printf@plt>
lea    0xebd(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%eax
add    %eax,%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
lea    0xe47(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1232 <main+0xf2>
mov    -0x50(%rbp),%rsi
movslq -0x2c(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe30(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x50(%rbp),%rcx
mov    -0x40(%rbp),%rax
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11e7 <main+0xa7>
lea    0xe03(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    127a <main+0x13a>
mov    -0x48(%rbp),%rsi
movslq -0x30(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdd2(%rip),%rdi
call   1060 <scanf@plt>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1245 <main+0x105>
lea    0xdd2(%rip),%rdi
call   1040 <printf@plt>
mov    -0x50(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <PrintVetor@plt>
lea    0xdc7(%rip),%rdi
call   1040 <printf@plt>
mov    -0x48(%rbp),%rdi
mov    -0x8(%rbp),%esi
call   1050 <PrintVetor@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1315 <main+0x1d5>
mov    -0x40(%rbp),%rsi
mov    -0x48(%rbp),%rax
movslq -0x34(%rbp),%rcx
mov    (%rax,%rcx,4),%edi
mov    -0x38(%rbp),%edx
call   1030 <Existe@plt>
cmp    $0x0,%eax
jne    12f9 <main+0x1b9>
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
movslq -0x34(%rbp),%rdx
mov    (%rcx,%rdx,4),%edx
movslq -0x38(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    12fe <main+0x1be>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    12b7 <main+0x177>
lea    0xd51(%rip),%rdi
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    -0x8(%rbp),%esi
shl    $0x1,%esi
call   1050 <PrintVetor@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
lea    0xe8c(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
mov    %rsp,-0x48(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%r12
mov    %r12,%rsp
add    %eax,%eax
mov    %rsp,%rcx
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rcx,%rsp
lea    0xe78(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1225 <main+0xd5>
xor    %r15d,%r15d
lea    0xe17(%rip),%r13
mov    -0x38(%rbp),%rbx
mov    -0x40(%rbp),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
mov    (%rbx),%eax
mov    %eax,(%r14)
add    $0x1,%r15
movslq -0x2c(%rbp),%rax
add    $0x4,%r14
add    $0x4,%rbx
cmp    %rax,%r15
jl     1200 <main+0xb0>
lea    0xe39(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    126c <main+0x11c>
xor    %r14d,%r14d
lea    0xdc2(%rip),%r13
mov    %r12,%rbx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r13,%rdi
mov    %rbx,%rsi
call   1070 <scanf@plt>
add    $0x1,%r14
movslq -0x2c(%rbp),%rax
add    $0x4,%rbx
cmp    %rax,%r14
jl     1250 <main+0x100>
lea    0xd93(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    -0x38(%rbp),%rdi
call   1060 <PrintVetor@plt>
lea    0xd88(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
mov    %r12,%rdi
call   1060 <PrintVetor@plt>
mov    -0x2c(%rbp),%r13d
test   %r13d,%r13d
mov    -0x40(%rbp),%r14
jle    12db <main+0x18b>
lea    (%r14,%r13,4),%r15
xor    %ebx,%ebx
jmp    12bd <main+0x16d>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
cmp    %rax,%rbx
jge    12db <main+0x18b>
mov    (%r12,%rbx,4),%edi
lea    (%rbx,%r13,1),%edx
mov    %r14,%rsi
call   1040 <Existe@plt>
test   %eax,%eax
jne    12b0 <main+0x160>
mov    (%r12,%rbx,4),%eax
mov    %eax,(%r15,%rbx,4)
jmp    12b0 <main+0x160>
lea    0xd3e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x2c(%rbp),%esi
add    %esi,%esi
mov    %r14,%rdi
call   1060 <PrintVetor@plt>
mov    -0x48(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"Qual o tamanho dos conjuntos?\0A\00"
@.str.1 = [3 x i8] c"%i\00"
@.str.2 = [23 x i8] c"Preencha o Conjunto A\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [23 x i8] c"Preencha o Conjunto B\0A\00"
@.str.5 = [13 x i8] c"Conjunto A: \00"
@.str.6 = [13 x i8] c"Conjunto B: \00"
@.str.7 = [17 x i8] c"Conjunto Uniao: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 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* %2)
%13 = load i32, i32* %2
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %3
%16 = alloca i32, i64 %14
store i64 %14, i64* %4
%17 = load i32, i32* %2
%18 = zext i32 %17 to i64
%19 = alloca i32, i64 %18
store i64 %18, i64* %5
%20 = load i32, i32* %2
%21 = mul nsw i32 %20, 2
%22 = zext i32 %21 to i64
%23 = alloca i32, i64 %22
store i64 %22, i64* %6
%24 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %7
br label %25
25: ; preds = %41, %0
%26 = load i32, i32* %7
%27 = load i32, i32* %2
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %44
29: ; preds = %25
%30 = load i32, i32* %7
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32, i32* %16, i64 %31
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %32)
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds i32, i32* %16, i64 %35
%37 = load i32, i32* %36
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %23, i64 %39
store i32 %37, i32* %40
br label %41
41: ; preds = %29
%42 = load i32, i32* %7
%43 = add nsw i32 %42, 1
store i32 %43, i32* %7
br label %25
44: ; preds = %25
%45 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %8
br label %46
46: ; preds = %55, %44
%47 = load i32, i32* %8
%48 = load i32, i32* %2
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %58
50: ; preds = %46
%51 = load i32, i32* %8
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %19, i64 %52
%54 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %53)
br label %55
55: ; preds = %50
%56 = load i32, i32* %8
%57 = add nsw i32 %56, 1
store i32 %57, i32* %8
br label %46
58: ; preds = %46
%59 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* %2
%61 = call i32 @PrintVetor(i32* %16, i32 %60)
%62 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%63 = load i32, i32* %2
%64 = call i32 @PrintVetor(i32* %19, i32 %63)
store i32 0, i32* %9
%65 = load i32, i32* %2
store i32 %65, i32* %10
br label %66
66: ; preds = %87, %58
%67 = load i32, i32* %9
%68 = load i32, i32* %2
%69 = icmp slt i32 %67, %68
br i1 %69, label %70, label %92
70: ; preds = %66
%71 = load i32, i32* %9
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i32, i32* %19, i64 %72
%74 = load i32, i32* %73
%75 = load i32, i32* %10
%76 = call i32 @Existe(i32 %74, i32* %23, i32 %75)
%77 = icmp ne i32 %76, 0
br i1 %77, label %86, label %78
78: ; preds = %70
%79 = load i32, i32* %9
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds i32, i32* %19, i64 %80
%82 = load i32, i32* %81
%83 = load i32, i32* %10
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds i32, i32* %23, i64 %84
store i32 %82, i32* %85
br label %86
86: ; preds = %78, %70
br label %87
87: ; preds = %86
%88 = load i32, i32* %9
%89 = add nsw i32 %88, 1
store i32 %89, i32* %9
%90 = load i32, i32* %10
%91 = add nsw i32 %90, 1
store i32 %91, i32* %10
br label %66
92: ; preds = %66
%93 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%94 = load i32, i32* %2
%95 = mul nsw i32 %94, 2
%96 = call i32 @PrintVetor(i32* %23, i32 %95)
%97 = load i8*, i8** %3
%98 = load i32, i32* %1
ret i32 %98
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%i\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.5 = [13 x i8] c"Conjunto A: \00"
@.str.6 = [13 x i8] c"Conjunto B: \00"
@.str.7 = [17 x i8] c"Conjunto Uniao: \00"
@str = [30 x i8] c"Qual o tamanho dos conjuntos?\00"
@str.8 = [22 x i8] c"Preencha o Conjunto A\00"
@str.9 = [22 x i8] c"Preencha o Conjunto B\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca i32, i64 %6
%9 = load i32, i32* %1
%10 = zext i32 %9 to i64
%11 = alloca i32, i64 %10
%12 = shl nsw i32 %9, 1
%13 = zext i32 %12 to i64
%14 = alloca i32, i64 %13
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.8, i64 0, i64 0))
%16 = load i32, i32* %1
%17 = icmp sgt i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %22, %0
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.9, i64 0, i64 0))
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 0
br i1 %21, label %43, label %32
22: ; preds = %0, %22
%23 = phi i64 [ %28, %22 ], [ 0, %0 ]
%24 = getelementptr inbounds i32, i32* %8, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %24)
%26 = load i32, i32* %24
%27 = getelementptr inbounds i32, i32* %14, i64 %23
store i32 %26, i32* %27
%28 = add nuw nsw i64 %23, 1
%29 = load i32, i32* %1
%30 = sext i32 %29 to i64
%31 = icmp slt i64 %28, %30
br i1 %31, label %22, label %18
32: ; preds = %43, %18
%33 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* %1
%35 = call i32 @PrintVetor(i32* %8, i32 %34)
%36 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.6, i64 0, i64 0))
%37 = load i32, i32* %1
%38 = call i32 @PrintVetor(i32* %11, i32 %37)
%39 = load i32, i32* %1
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %51
41: ; preds = %32
%42 = zext i32 %39 to i64
br label %56
43: ; preds = %18, %43
%44 = phi i64 [ %47, %43 ], [ 0, %18 ]
%45 = getelementptr inbounds i32, i32* %11, i64 %44
%46 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32* %45)
%47 = add nuw nsw i64 %44, 1
%48 = load i32, i32* %1
%49 = sext i32 %48 to i64
%50 = icmp slt i64 %47, %49
br i1 %50, label %43, label %32
51: ; preds = %67, %32
%52 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.7, i64 0, i64 0))
%53 = load i32, i32* %1
%54 = shl nsw i32 %53, 1
%55 = call i32 @PrintVetor(i32* %14, i32 %54)
ret i32 0
56: ; preds = %41, %67
%57 = phi i64 [ 0, %41 ], [ %68, %67 ]
%58 = phi i64 [ %42, %41 ], [ %69, %67 ]
%59 = getelementptr inbounds i32, i32* %11, i64 %57
%60 = load i32, i32* %59
%61 = trunc i64 %58 to i32
%62 = call i32 @Existe(i32 %60, i32* %14, i32 %61)
%63 = icmp eq i32 %62, 0
br i1 %63, label %64, label %67
64: ; preds = %56
%65 = load i32, i32* %59
%66 = getelementptr inbounds i32, i32* %14, i64 %58
store i32 %65, i32* %66
br label %67
67: ; preds = %56, %64
%68 = add nuw nsw i64 %57, 1
%69 = add nuw nsw i64 %58, 1
%70 = load i32, i32* %1
%71 = sext i32 %70 to i64
%72 = icmp slt i64 %68, %71
br i1 %72, label %56, label %51
}