#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 *, ...);
int main() {
  float alturas = 0.0f;
  int contador = 0, masculinos = 0, femininos = 0;
  printf("Cálculo de alunos e alunas e média de suas alturas\n");
  while (contador < 3) {
    float altura;
    char gen;
    printf("Digite a altura e o sexo do aluno\n");
    scanf("%f", &altura);
    scanf("%s", &gen);
    if (gen == 'm' || gen == 'M')
      masculinos++;
    else if (gen == 'f' || gen == 'F')
      femininos++;
    else
      continue;
    alturas += altura;
    contador++;
  }
  printf("A média de altura dos alunos é: %f\n", alturas / contador);
  printf("Temos %d alunos homens e %d alunos mulheres\n", masculinos,
         femininos);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x3,-0xc(%rbp)
jge    120d <main+0xed>
lea    0xecb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee0(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed1(%rip),%rdi
lea    -0x19(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x19(%rbp),%eax
cmp    $0x6d,%eax
je     11b0 <main+0x90>
movsbl -0x19(%rbp),%eax
cmp    $0x4d,%eax
jne    11be <main+0x9e>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11f0 <main+0xd0>
movsbl -0x19(%rbp),%eax
cmp    $0x66,%eax
je     11d8 <main+0xb8>
movsbl -0x19(%rbp),%eax
cmp    $0x46,%eax
jne    11e6 <main+0xc6>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11eb <main+0xcb>
jmp    115a <main+0x3a>
jmp    11f0 <main+0xd0>
movss  -0x18(%rbp),%xmm0
addss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x3a>
movss  -0x8(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe39(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf14(%rip),%rdi
call   1030 <puts@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,0x10(%rsp)
lea    0x14(%rsp),%r12
lea    0xea4(%rip),%r13
lea    0xf(%rsp),%r14
xor    %ebx,%ebx
xor    %ebp,%ebp
xor    %r15d,%r15d
jmp    118f <main+0x5f>
nopl   (%rax)
add    $0x1,%ebx
movss  0x10(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
add    $0x1,%r15d
cmp    $0x3,%r15d
jge    11cd <main+0x9d>
lea    0xef8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe5e(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movzbl 0xf(%rsp),%eax
and    $0xdf,%al
cmp    $0x46,%al
je     1170 <main+0x40>
cmp    $0x4d,%al
jne    1189 <main+0x59>
add    $0x1,%ebp
jmp    1173 <main+0x43>
xorps  %xmm0,%xmm0
cvtsi2ss %r15d,%xmm0
movss  0x10(%rsp),%xmm1
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xe19(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
lea    0xe31(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"C\C3\A1lculo de alunos e alunas e m\C3\A9dia de suas alturas\0A\00"
@.str.1 = [35 x i8] c"Digite a altura e o sexo do aluno\0A\00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [38 x i8] c"A m\C3\A9dia de altura dos alunos \C3\A9: %f\0A\00"
@.str.5 = [45 x i8] c"Temos %d alunos homens e %d alunos mulheres\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca i8
store i32 0, i32* %1
store float 0.000000e+00, float* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
br label %9
9: ; preds = %39, %37, %0
%10 = load i32, i32* %3
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %45
12: ; preds = %9
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %6)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %7)
%16 = load i8, i8* %7
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 109
br i1 %18, label %23, label %19
19: ; preds = %12
%20 = load i8, i8* %7
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 77
br i1 %22, label %23, label %26
23: ; preds = %19, %12
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %39
26: ; preds = %19
%27 = load i8, i8* %7
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 102
br i1 %29, label %34, label %30
30: ; preds = %26
%31 = load i8, i8* %7
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 70
br i1 %33, label %34, label %37
34: ; preds = %30, %26
%35 = load i32, i32* %5
%36 = add nsw i32 %35, 1
store i32 %36, i32* %5
br label %38
37: ; preds = %30
br label %9
38: ; preds = %34
br label %39
39: ; preds = %38, %23
%40 = load float, float* %6
%41 = load float, float* %2
%42 = fadd float %41, %40
store float %42, float* %2
%43 = load i32, i32* %3
%44 = add nsw i32 %43, 1
store i32 %44, i32* %3
br label %9
45: ; preds = %9
%46 = load float, float* %2
%47 = load i32, i32* %3
%48 = sitofp i32 %47 to float
%49 = fdiv float %46, %48
%50 = fpext float %49 to double
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %50)
%52 = load i32, i32* %4
%53 = load i32, i32* %5
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %52, i32 %53)
%55 = load i32, i32* %1
ret i32 %55
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [38 x i8] c"A m\C3\A9dia de altura dos alunos \C3\A9: %f\0A\00"
@.str.5 = [45 x i8] c"Temos %d alunos homens e %d alunos mulheres\0A\00"
@str = [53 x i8] c"C\C3\A1lculo de alunos e alunas e m\C3\A9dia de suas alturas\00"
@str.6 = [34 x i8] c"Digite a altura e o sexo do aluno\00"
define i32 @main() {
%1 = alloca float
%2 = alloca i8
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%4 = bitcast float* %1 to i8*
br label %5
5: ; preds = %0, %25
%6 = phi i32 [ 0, %0 ], [ %29, %25 ]
%7 = phi i32 [ 0, %0 ], [ %28, %25 ]
%8 = phi i32 [ 0, %0 ], [ %27, %25 ]
%9 = phi float [ 0.000000e+00, %0 ], [ %26, %25 ]
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.6, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %2)
%13 = load i8, i8* %2
%14 = and i8 %13, -33
switch i8 %14, label %25 [
i8 77, label %15
i8 70, label %17
]
15: ; preds = %5
%16 = add nsw i32 %7, 1
br label %19
17: ; preds = %5
%18 = add nsw i32 %6, 1
br label %19
19: ; preds = %17, %15
%20 = phi i32 [ %16, %15 ], [ %7, %17 ]
%21 = phi i32 [ %6, %15 ], [ %18, %17 ]
%22 = load float, float* %1
%23 = fadd float %9, %22
%24 = add nsw i32 %8, 1
br label %25
25: ; preds = %5, %19
%26 = phi float [ %23, %19 ], [ %9, %5 ]
%27 = phi i32 [ %24, %19 ], [ %8, %5 ]
%28 = phi i32 [ %20, %19 ], [ %7, %5 ]
%29 = phi i32 [ %21, %19 ], [ %6, %5 ]
%30 = icmp slt i32 %27, 3
br i1 %30, label %5, label %31
31: ; preds = %25
%32 = sitofp i32 %27 to float
%33 = fdiv float %26, %32
%34 = fpext float %33 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), double %34)
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %28, i32 %29)
ret i32 0
}