#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 *, ...);
void mostramedias(int numeros[], int indice, int total) {
  float media = (float)total / indice;
  printf("\nMedia: %2.1f", media);
  int i;
  printf("\nNumeros maiores ou iguais a media:\n");
  for (i = 0; i < indice; i++) {
    if (numeros[i] >= media) {
      printf("%d\n", numeros[i]);
    }
  }
}


x86 assembly (clang, -O0):
<mostramedias>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xebb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b0 <mostramedias+0xa0>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
cvtsi2ssl (%rax,%rcx,4),%xmm0
ucomiss -0x14(%rbp),%xmm0
jb     119d <mostramedias+0x8d>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe9d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11a2 <mostramedias+0x92>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1161 <mostramedias+0x51>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mostramedias>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cvtsi2ss %edx,%xmm1
mov    %esi,%ebp
cvtsi2ss %esi,%xmm0
mov    %rdi,%r15
divss  %xmm0,%xmm1
movss  %xmm1,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xeb4(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
call   1030 <puts@plt>
test   %ebp,%ebp
jle    1197 <mostramedias+0x77>
mov    %ebp,%ebp
lea    0xea2(%rip),%r14
xor    %ebx,%ebx
jmp    1179 <mostramedias+0x59>
add    $0x1,%rbx
cmp    %rbx,%rbp
je     1197 <mostramedias+0x77>
mov    (%r15,%rbx,4),%esi
xorps  %xmm0,%xmm0
cvtsi2ss %esi,%xmm0
ucomiss 0x4(%rsp),%xmm0
jb     1170 <mostramedias+0x50>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1170 <mostramedias+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"\0AMedia: %2.1f\00"
@.str.1 = [37 x i8] c"\0ANumeros maiores ou iguais a media:\0A\00"
@.str.2 = [4 x i8] c"%d\0A\00"
define void @mostramedias(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%9 = load i32, i32* %6
%10 = sitofp i32 %9 to float
%11 = load i32, i32* %5
%12 = sitofp i32 %11 to float
%13 = fdiv float %10, %12
store float %13, float* %7
%14 = load float, float* %7
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %15)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %8
br label %18
18: ; preds = %39, %3
%19 = load i32, i32* %8
%20 = load i32, i32* %5
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %42
22: ; preds = %18
%23 = load i32*, i32** %4
%24 = load i32, i32* %8
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
%27 = load i32, i32* %26
%28 = sitofp i32 %27 to float
%29 = load float, float* %7
%30 = fcmp oge float %28, %29
br i1 %30, label %31, label %38
31: ; preds = %22
%32 = load i32*, i32** %4
%33 = load i32, i32* %8
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i32, i32* %32, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
br label %38
38: ; preds = %31, %22
br label %39
39: ; preds = %38
%40 = load i32, i32* %8
%41 = add nsw i32 %40, 1
store i32 %41, i32* %8
br label %18
42: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str = [14 x i8] c"\0AMedia: %2.1f\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@str = [36 x i8] c"\0ANumeros maiores ou iguais a media:\00"
define void @mostramedias(i32* nocapture %0, i32 %1, i32 %2) {
%4 = sitofp i32 %2 to float
%5 = sitofp i32 %1 to float
%6 = fdiv float %4, %5
%7 = fpext float %6 to double
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0), double %7)
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = zext i32 %1 to i64
br label %13
13: ; preds = %11, %21
%14 = phi i64 [ 0, %11 ], [ %22, %21 ]
%15 = getelementptr inbounds i32, i32* %0, i64 %14
%16 = load i32, i32* %15
%17 = sitofp i32 %16 to float
%18 = fcmp ugt float %6, %17
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %16)
br label %21
21: ; preds = %13, %19
%22 = add nuw nsw i64 %14, 1
%23 = icmp eq i64 %22, %12
br i1 %23, label %24, label %13
24: ; preds = %21, %3
ret void
}