#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 /*<<< orphan*/ scanf(char *, float *);
int main() {
  float salario[8];
  float soma = 0, media, perc;
  int i, cont = 0;
  for (i = 0; i < 8; i++) {
    printf("\n Salario:");
    scanf("%f", &salario[i]);
    soma = soma + salario[i];
  }
  media = soma / i;
  printf("\n Media salarial = %.2f", media);
  for (i = 0; i < 8; i++) {
    if (salario[i] > media)
      cont++;
  }
  perc = ((float)cont / 8) * 100;
  printf("\nPercentagem = %.f %%", perc);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x34(%rbp)
movl   $0x0,-0x44(%rbp)
movl   $0x0,-0x40(%rbp)
cmpl   $0x8,-0x40(%rbp)
jge    119a <main+0x7a>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movslq -0x40(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea0(%rip),%rdi
call   1040 <scanf@plt>
movss  -0x34(%rbp),%xmm0
movslq -0x40(%rbp),%rax
addss  -0x30(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x34(%rbp)
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1145 <main+0x25>
movss  -0x34(%rbp),%xmm0
cvtsi2ssl -0x40(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe59(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x0,-0x40(%rbp)
cmpl   $0x8,-0x40(%rbp)
jge    1205 <main+0xe5>
movslq -0x40(%rbp),%rax
movss  -0x30(%rbp,%rax,4),%xmm0
ucomiss -0x38(%rbp),%xmm0
jbe    11f2 <main+0xd2>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    11f7 <main+0xd7>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    11cb <main+0xab>
cvtsi2ssl -0x44(%rbp),%xmm0
movss  0xdf2(%rip),%xmm1
divss  %xmm1,%xmm0
movss  0xde2(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdf7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x38,%rsp
lea    0xeda(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed4(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
addss  0x10(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x18(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x20(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x24(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x24(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x28(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x28(%rsp),%xmm0
movaps %xmm0,(%rsp)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x2c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
movaps (%rsp),%xmm0
addss  0x2c(%rsp),%xmm0
mulss  0xda0(%rip),%xmm0
movaps %xmm0,(%rsp)
cvtss2sd %xmm0,%xmm0
lea    0xda7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movaps (%rsp),%xmm1
shufps $0x0,%xmm1,%xmm1
movaps %xmm1,%xmm0
cmpltps 0x20(%rsp),%xmm0
cmpltps 0x10(%rsp),%xmm1
packssdw %xmm0,%xmm1
packsswb %xmm1,%xmm1
pmovmskb %xmm1,%eax
mov    %eax,%ecx
shr    %cl
and    $0x55,%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,%eax
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
mulss  0xd36(%rip),%xmm0
mulss  0xd32(%rip),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd51(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [11 x i8] c"\0A Salario:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"\0A Media salarial = %.2f\00"
@.str.3 = [22 x i8] c"\0APercentagem = %.f %%\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x float]
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store i32 0, i32* %7
store i32 0, i32* %6
br label %8
8: ; preds = %23, %0
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 8
br i1 %10, label %11, label %26
11: ; preds = %8
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* %6
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 %14
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %15)
%17 = load float, float* %3
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 %19
%21 = load float, float* %20
%22 = fadd float %17, %21
store float %22, float* %3
br label %23
23: ; preds = %11
%24 = load i32, i32* %6
%25 = add nsw i32 %24, 1
store i32 %25, i32* %6
br label %8
26: ; preds = %8
%27 = load float, float* %3
%28 = load i32, i32* %6
%29 = sitofp i32 %28 to float
%30 = fdiv float %27, %29
store float %30, float* %4
%31 = load float, float* %4
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %32)
store i32 0, i32* %6
br label %34
34: ; preds = %48, %26
%35 = load i32, i32* %6
%36 = icmp slt i32 %35, 8
br i1 %36, label %37, label %51
37: ; preds = %34
%38 = load i32, i32* %6
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [8 x float], [8 x float]* %2, i64 0, i64 %39
%41 = load float, float* %40
%42 = load float, float* %4
%43 = fcmp ogt float %41, %42
br i1 %43, label %44, label %47
44: ; preds = %37
%45 = load i32, i32* %7
%46 = add nsw i32 %45, 1
store i32 %46, i32* %7
br label %47
47: ; preds = %44, %37
br label %48
48: ; preds = %47
%49 = load i32, i32* %6
%50 = add nsw i32 %49, 1
store i32 %50, i32* %6
br label %34
51: ; preds = %34
%52 = load i32, i32* %7
%53 = sitofp i32 %52 to float
%54 = fdiv float %53, 8.000000e+00
%55 = fmul float %54, 1.000000e+02
store float %55, float* %5
%56 = load float, float* %5
%57 = fpext float %56 to double
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %57)
ret i32 0
}

LLVM IR (-O2):
@.str = [11 x i8] c"\0A Salario:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [24 x i8] c"\0A Media salarial = %.2f\00"
@.str.3 = [22 x i8] c"\0APercentagem = %.f %%\00"
define i32 @main() {
%1 = alloca <8 x float>
%2 = bitcast <8 x float>* %1 to i8*
%3 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%4 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%6 = load float, float* %4
%7 = fadd float %6, 0.000000e+00
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 1
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %9)
%11 = load float, float* %9
%12 = fadd float %7, %11
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%14 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 2
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %14)
%16 = load float, float* %14
%17 = fadd float %12, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%19 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 3
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %19)
%21 = load float, float* %19
%22 = fadd float %17, %21
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%24 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 4
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %24)
%26 = load float, float* %24
%27 = fadd float %22, %26
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%29 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 5
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %29)
%31 = load float, float* %29
%32 = fadd float %27, %31
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%34 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 6
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %34)
%36 = load float, float* %34
%37 = fadd float %32, %36
%38 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
%39 = getelementptr inbounds <8 x float>, <8 x float>* %1, i64 0, i64 7
%40 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %39)
%41 = load float, float* %39
%42 = fadd float %37, %41
%43 = fmul float %42, 1.250000e-01
%44 = fpext float %43 to double
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), double %44)
%46 = load <8 x float>, <8 x float>* %1
%47 = insertelement <8 x float> poison, float %43, i64 0
%48 = shufflevector <8 x float> %47, <8 x float> poison, <8 x i32> zeroinitializer
%49 = fcmp ogt <8 x float> %46, %48
%50 = bitcast <8 x i1> %49 to i8
%51 = call i8 @llvm.ctpop.i8(i8 %50)
%52 = uitofp i8 %51 to float
%53 = fmul float %52, 1.250000e-01
%54 = fmul float %53, 1.000000e+02
%55 = fpext float %54 to double
%56 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), double %55)
ret i32 0
}