#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
void main() {
  int X[20], vzs = 0;
  for (int i = 0; i < 20; i++) {
    printf("Informe o valor na posicao %d: ", i + 1);
    scanf("%d", &X[i]);
  }
  for (int i = 0; i < 20; i++) {
    printf("O valor %d aparece ", X[i]);
    for (int j = 0; j < 20; j++) {
      if (X[i] == X[j]) {
        vzs++;
      }
    }
    printf("%d vezes!\n", vzs);
    vzs = 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x54(%rbp)
movl   $0x0,-0x58(%rbp)
cmpl   $0x14,-0x58(%rbp)
jge    117b <main+0x5b>
mov    -0x58(%rbp),%esi
add    $0x1,%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
movslq -0x58(%rbp),%rax
lea    -0x50(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeb8(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    1136 <main+0x16>
movl   $0x0,-0x5c(%rbp)
cmpl   $0x14,-0x5c(%rbp)
jge    1207 <main+0xe7>
movslq -0x5c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%esi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x60(%rbp)
cmpl   $0x14,-0x60(%rbp)
jge    11e3 <main+0xc3>
movslq -0x5c(%rbp),%rax
mov    -0x50(%rbp,%rax,4),%eax
movslq -0x60(%rbp),%rcx
cmp    -0x50(%rbp,%rcx,4),%eax
jne    11d0 <main+0xb0>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    11d5 <main+0xb5>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
jmp    11a7 <main+0x87>
mov    -0x54(%rbp),%esi
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x54(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1182 <main+0x62>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xedc(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x5,%esi
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x6,%esi
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x7,%esi
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x8,%esi
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x9,%esi
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xa,%esi
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xb,%esi
call   1030 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xc,%esi
call   1030 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xd,%esi
call   1030 <printf@plt>
lea    0x30(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xe,%esi
call   1030 <printf@plt>
lea    0x34(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0xf,%esi
call   1030 <printf@plt>
lea    0x38(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x10,%esi
call   1030 <printf@plt>
lea    0x3c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x11,%esi
call   1030 <printf@plt>
lea    0x40(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x12,%esi
call   1030 <printf@plt>
lea    0x44(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x13,%esi
call   1030 <printf@plt>
lea    0x48(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    %r14,%rdi
mov    $0x14,%esi
call   1030 <printf@plt>
lea    0x4c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xor    %ebx,%ebx
lea    0xcdd(%rip),%r14
lea    0xcea(%rip),%r15
nopl   (%rax)
mov    (%rsp,%rbx,4),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
movd   (%rsp,%rbx,4),%xmm0
pshufd $0x0,%xmm0,%xmm0
movdqa 0x30(%rsp),%xmm1
pcmpeqd %xmm0,%xmm1
movdqa 0x20(%rsp),%xmm2
pcmpeqd %xmm0,%xmm2
packssdw %xmm1,%xmm2
movdqa 0x10(%rsp),%xmm1
pcmpeqd %xmm0,%xmm1
movdqa (%rsp),%xmm3
pcmpeqd %xmm0,%xmm3
packssdw %xmm1,%xmm3
packsswb %xmm2,%xmm3
pmovmskb %xmm3,%eax
mov    %eax,%ecx
shr    %ecx
and    $0x5555,%ecx
sub    %ecx,%eax
mov    %eax,%ecx
and    $0x3333,%ecx
shr    $0x2,%eax
and    $0x3333,%eax
add    %ecx,%eax
mov    %eax,%ecx
shr    $0x4,%ecx
add    %eax,%ecx
and    $0xf0f,%ecx
mov    %ecx,%eax
shl    $0x8,%eax
add    %ecx,%eax
movzbl %ah,%eax
pcmpeqd 0x40(%rsp),%xmm0
movmskps %xmm0,%ecx
mov    %ecx,%edx
shr    %dl
and    $0x5,%dl
sub    %dl,%cl
mov    %ecx,%edx
and    $0x33,%dl
shr    $0x2,%cl
and    $0x33,%cl
add    %dl,%cl
mov    %ecx,%edx
shr    $0x4,%dl
add    %cl,%dl
and    $0xf,%dl
movzbl %dl,%esi
add    %eax,%esi
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x14,%rbx
jne    1350 <main+0x230>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Informe o valor na posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"O valor %d aparece \00"
@.str.3 = [11 x i8] c"%d vezes!\0A\00"
define void @main() {
%1 = alloca [20 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %3
br label %6
6: ; preds = %17, %0
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 20
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = add nsw i32 %10, 1
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = load i32, i32* %3
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %15)
br label %17
17: ; preds = %9
%18 = load i32, i32* %3
%19 = add nsw i32 %18, 1
store i32 %19, i32* %3
br label %6
20: ; preds = %6
store i32 0, i32* %4
br label %21
21: ; preds = %53, %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 20
br i1 %23, label %24, label %56
24: ; preds = %21
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %28)
store i32 0, i32* %5
br label %30
30: ; preds = %47, %24
%31 = load i32, i32* %5
%32 = icmp slt i32 %31, 20
br i1 %32, label %33, label %50
33: ; preds = %30
%34 = load i32, i32* %4
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = load i32, i32* %5
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = icmp eq i32 %37, %41
br i1 %42, label %43, label %46
43: ; preds = %33
%44 = load i32, i32* %2
%45 = add nsw i32 %44, 1
store i32 %45, i32* %2
br label %46
46: ; preds = %43, %33
br label %47
47: ; preds = %46
%48 = load i32, i32* %5
%49 = add nsw i32 %48, 1
store i32 %49, i32* %5
br label %30
50: ; preds = %30
%51 = load i32, i32* %2
%52 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %51)
store i32 0, i32* %2
br label %53
53: ; preds = %50
%54 = load i32, i32* %4
%55 = add nsw i32 %54, 1
store i32 %55, i32* %4
br label %21
56: ; preds = %21
ret void
}

LLVM IR (-O2):
@.str = [32 x i8] c"Informe o valor na posicao %d: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"O valor %d aparece \00"
@.str.3 = [11 x i8] c"%d vezes!\0A\00"
define void @main() {
%1 = alloca [20 x i32]
%2 = bitcast [20 x i32]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 2)
%7 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%9 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 3)
%10 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 4)
%13 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 3
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
%15 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 5)
%16 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 4
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 6)
%19 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 5
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %19)
%21 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 7)
%22 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 6
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 8)
%25 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 7
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 9)
%28 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 8
%29 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %28)
%30 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 10)
%31 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 9
%32 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %31)
%33 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 11)
%34 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 10
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %34)
%36 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 12)
%37 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 11
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 13)
%40 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 12
%41 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %40)
%42 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 14)
%43 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 13
%44 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %43)
%45 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 15)
%46 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 14
%47 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %46)
%48 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 16)
%49 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 15
%50 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %49)
%51 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 17)
%52 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 16
%53 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %52)
%54 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 18)
%55 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 17
%56 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %55)
%57 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 19)
%58 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 18
%59 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %58)
%60 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i32 20)
%61 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 19
%62 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %61)
%63 = bitcast [20 x i32]* %1 to <16 x i32>*
%64 = bitcast i32* %52 to <4 x i32>*
br label %66
65: ; preds = %66
ret void
66: ; preds = %0, %66
%67 = phi i64 [ 0, %0 ], [ %88, %66 ]
%68 = getelementptr inbounds [20 x i32], [20 x i32]* %1, i64 0, i64 %67
%69 = load i32, i32* %68
%70 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %69)
%71 = load i32, i32* %68
%72 = load <16 x i32>, <16 x i32>* %63
%73 = insertelement <16 x i32> poison, i32 %71, i64 0
%74 = shufflevector <16 x i32> %73, <16 x i32> poison, <16 x i32> zeroinitializer
%75 = icmp eq <16 x i32> %74, %72
%76 = load <4 x i32>, <4 x i32>* %64
%77 = insertelement <4 x i32> poison, i32 %71, i64 0
%78 = shufflevector <4 x i32> %77, <4 x i32> poison, <4 x i32> zeroinitializer
%79 = icmp eq <4 x i32> %78, %76
%80 = bitcast <16 x i1> %75 to i16
%81 = call i16 @llvm.ctpop.i16(i16 %80)
%82 = zext i16 %81 to i32
%83 = bitcast <4 x i1> %79 to i4
%84 = call i4 @llvm.ctpop.i4(i4 %83)
%85 = zext i4 %84 to i32
%86 = add nuw nsw i32 %82, %85
%87 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %86)
%88 = add nuw nsw i64 %67, 1
%89 = icmp eq i64 %88, 20
br i1 %89, label %65, label %66
}