#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 *);
int main() {
  int vetor[4], cont = 0;
  for (int i = 0; i < 4; i++) {
    printf("Introduza a %da. idade: ", i + 1);
    scanf("%d", &vetor[i]);
    if (vetor[i] >= 18)
      cont++;
  }
  printf("Das 4 idades inseridas, %d sao maiores de idade.", cont);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x24(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0x4,-0x28(%rbp)
jge    119f <main+0x7f>
mov    -0x28(%rbp),%esi
add    $0x1,%esi
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xeaa(%rip),%rdi
call   1040 <scanf@plt>
movslq -0x28(%rbp),%rax
cmpl   $0x12,-0x20(%rbp,%rax,4)
jl     118c <main+0x6c>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1191 <main+0x71>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    113d <main+0x1d>
mov    -0x24(%rbp),%esi
lea    0xe73(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xee2(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
call   1030 <printf@plt>
lea    0xee7(%rip),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <printf@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x4(%rsp),%xmm0
unpcklpd 0x10(%rsp),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %r14,%rdi
mov    $0x3,%esi
call   1030 <printf@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm0
movaps %xmm0,0x20(%rsp)
mov    %r14,%rdi
mov    $0x4,%esi
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
unpcklpd 0x20(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
shufps $0x22,%xmm0,%xmm1
pcmpgtd 0xe23(%rip),%xmm1
movmskps %xmm1,%eax
mov    %eax,%ecx
shr    %cl
and    $0x5,%cl
sub    %cl,%al
mov    %eax,%ecx
and    $0x33,%cl
shr    $0x2,%al
and    $0x33,%al
add    %cl,%al
mov    %eax,%ecx
shr    $0x4,%cl
add    %al,%cl
and    $0xf,%cl
movzbl %cl,%esi
lea    0xe23(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Introduza a %da. idade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [49 x i8] c"Das 4 idades inseridas, %d sao maiores de idade.\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %25, %0
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %28
8: ; preds = %5
%9 = load i32, i32* %4
%10 = add nsw i32 %9, 1
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %13
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = icmp sge i32 %19, 18
br i1 %20, label %21, label %24
21: ; preds = %8
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %24
24: ; preds = %21, %8
br label %25
25: ; preds = %24
%26 = load i32, i32* %4
%27 = add nsw i32 %26, 1
store i32 %27, i32* %4
br label %5
28: ; preds = %5
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %29)
%31 = load i32, i32* %1
ret i32 %31
}

LLVM IR (-O2):
@.str = [25 x i8] c"Introduza a %da. idade: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [49 x i8] c"Das 4 idades inseridas, %d sao maiores de idade.\00"
define i32 @main() {
%1 = alloca <4 x i32>
%2 = bitcast <4 x i32>* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 1)
%4 = getelementptr inbounds <4 x i32>, <4 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 = load <4 x i32>, <4 x i32>* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 2)
%8 = getelementptr inbounds <4 x i32>, <4 x i32>* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = load i32, i32* %8
%11 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 3)
%12 = getelementptr inbounds <4 x i32>, <4 x i32>* %1, i64 0, i64 2
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = load i32, i32* %12
%15 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i32 4)
%16 = getelementptr inbounds <4 x i32>, <4 x i32>* %1, i64 0, i64 3
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = load i32, i32* %16
%19 = insertelement <4 x i32> %6, i32 %10, i64 1
%20 = insertelement <4 x i32> %19, i32 %14, i64 2
%21 = insertelement <4 x i32> %20, i32 %18, i64 3
%22 = icmp sgt <4 x i32> %21, <i32 17, i32 17, i32 17, i32 17>
%23 = bitcast <4 x i1> %22 to i4
%24 = call i4 @llvm.ctpop.i4(i4 %23)
%25 = zext i4 %24 to i32
%26 = call i32 @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.2, i64 0, i64 0), i32 %25)
ret i32 0
}