#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 *, ...);
void main() {
  int i, idade, cont = 0, conth = 0, contp = 0;
  float altura, peso, somah = 0.0;
  for (i = 1; i <= 15; i++) {
    printf("\n- Pessoa %d:\n", i);
    printf("Idade: ");
    scanf(" %d", &idade);
    printf("Altura (em metros): ");
    scanf(" %f", &altura);
    printf("Peso: ");
    scanf(" %f", &peso);
    if (idade > 50)
      cont++;
    if (idade >= 10 && idade <= 20) {
      somah += altura;
      conth++;
    }
    if (peso < 40)
      contp++;
  }
  printf("\nPessoas acima de 50 anos: %d.\n"
         "Media de altura das pessoas com 10 a 20 anos: %.2f.\n"
         "Percentagem de pessoas com peso abaixo de 40kg: %d%%.\n",
         cont, somah / conth, 100 * contp / 15);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0xf,-0x4(%rbp)
jg     1234 <main+0x114>
mov    -0x4(%rbp),%esi
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe78(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
cmpl   $0x32,-0x8(%rbp)
jle    11da <main+0xba>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0xa,-0x8(%rbp)
jl     1206 <main+0xe6>
cmpl   $0x14,-0x8(%rbp)
jg     1206 <main+0xe6>
movss  -0x18(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movss  0xdf2(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
jbe    1221 <main+0x101>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1226 <main+0x106>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    114c <main+0x2c>
mov    -0xc(%rbp),%esi
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
imul   $0x64,-0x14(%rbp),%eax
mov    $0xf,%ecx
cltd
idiv   %ecx
mov    %eax,%edx
lea    0xde1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
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
mov    $0x1,%ebp
xorps  %xmm1,%xmm1
lea    0xefb(%rip),%r15
lea    0xc(%rsp),%r14
xor    %r12d,%r12d
xor    %r13d,%r13d
xor    %ebx,%ebx
jmp    118d <main+0x6d>
nopl   0x0(%rax)
movss  0xea8(%rip),%xmm0
movss  0x8(%rsp),%xmm1
xor    %ecx,%ecx
cmp    $0x33,%eax
setge  %cl
add    %ecx,%ebx
xor    %eax,%eax
movss  0xe92(%rip),%xmm2
ucomiss 0xc(%rsp),%xmm2
seta   %al
addss  %xmm0,%xmm1
add    %eax,%r12d
add    $0x1,%ebp
cmp    $0x10,%ebp
je     121e <main+0xfe>
movss  %xmm1,0x8(%rsp)
lea    0xe6e(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
lea    0x14(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe58(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
lea    0x10(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xe54(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
lea    -0xa(%rax),%ecx
cmp    $0xb,%ecx
adc    $0x0,%r13d
cmp    $0xb,%ecx
jae    1150 <main+0x30>
movss  0x10(%rsp),%xmm0
jmp    1158 <main+0x38>
xorps  %xmm0,%xmm0
cvtsi2ss %r13d,%xmm0
divss  %xmm0,%xmm1
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
imul   $0x64,%r12d,%eax
mov    $0x88888889,%edx
imul   %rax,%rdx
shr    $0x23,%rdx
lea    0xdfa(%rip),%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [15 x i8] c"\0A- Pessoa %d:\0A\00"
@.str.1 = [8 x i8] c"Idade: \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [21 x i8] c"Altura (em metros): \00"
@.str.4 = [4 x i8] c" %f\00"
@.str.5 = [7 x i8] c"Peso: \00"
@.str.6 = [138 x i8] c"\0APessoas acima de 50 anos: %d.\0AMedia de altura das pessoas com 10 a 20 anos: %.2f.\0APercentagem de pessoas com peso abaixo de 40kg: %d%%.\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca float
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store float 0.000000e+00, float* %8
store i32 1, i32* %1
br label %9
9: ; preds = %45, %0
%10 = load i32, i32* %1
%11 = icmp sle i32 %10, 15
br i1 %11, label %12, label %48
12: ; preds = %9
%13 = load i32, i32* %1
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %2)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %6)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %7)
%21 = load i32, i32* %2
%22 = icmp sgt i32 %21, 50
br i1 %22, label %23, label %26
23: ; preds = %12
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %23, %12
%27 = load i32, i32* %2
%28 = icmp sge i32 %27, 10
br i1 %28, label %29, label %38
29: ; preds = %26
%30 = load i32, i32* %2
%31 = icmp sle i32 %30, 20
br i1 %31, label %32, label %38
32: ; preds = %29
%33 = load float, float* %6
%34 = load float, float* %8
%35 = fadd float %34, %33
store float %35, float* %8
%36 = load i32, i32* %4
%37 = add nsw i32 %36, 1
store i32 %37, i32* %4
br label %38
38: ; preds = %32, %29, %26
%39 = load float, float* %7
%40 = fcmp olt float %39, 4.000000e+01
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %44
44: ; preds = %41, %38
br label %45
45: ; preds = %44
%46 = load i32, i32* %1
%47 = add nsw i32 %46, 1
store i32 %47, i32* %1
br label %9
48: ; preds = %9
%49 = load i32, i32* %3
%50 = load float, float* %8
%51 = load i32, i32* %4
%52 = sitofp i32 %51 to float
%53 = fdiv float %50, %52
%54 = fpext float %53 to double
%55 = load i32, i32* %5
%56 = mul nsw i32 100, %55
%57 = sdiv i32 %56, 15
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([138 x i8], [138 x i8]* @.str.6, i64 0, i64 0), i32 %49, double %54, i32 %57)
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"\0A- Pessoa %d:\0A\00"
@.str.1 = [8 x i8] c"Idade: \00"
@.str.2 = [4 x i8] c" %d\00"
@.str.3 = [21 x i8] c"Altura (em metros): \00"
@.str.4 = [4 x i8] c" %f\00"
@.str.5 = [7 x i8] c"Peso: \00"
@.str.6 = [138 x i8] c"\0APessoas acima de 50 anos: %d.\0AMedia de altura das pessoas com 10 a 20 anos: %.2f.\0APercentagem de pessoas com peso abaixo de 40kg: %d%%.\0A\00"
define void @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast float* %3 to i8*
br label %7
7: ; preds = %0, %7
%8 = phi float [ 0.000000e+00, %0 ], [ %30, %7 ]
%9 = phi i32 [ 0, %0 ], [ %34, %7 ]
%10 = phi i32 [ 0, %0 ], [ %28, %7 ]
%11 = phi i32 [ 0, %0 ], [ %23, %7 ]
%12 = phi i32 [ 1, %0 ], [ %35, %7 ]
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %2)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), float* %3)
%20 = load i32, i32* %1
%21 = icmp sgt i32 %20, 50
%22 = zext i1 %21 to i32
%23 = add nuw nsw i32 %11, %22
%24 = add i32 %20, -10
%25 = icmp ult i32 %24, 11
%26 = load float, float* %2
%27 = zext i1 %25 to i32
%28 = add nuw nsw i32 %10, %27
%29 = select i1 %25, float %26, float -0.000000e+00
%30 = fadd float %8, %29
%31 = load float, float* %3
%32 = fcmp olt float %31, 4.000000e+01
%33 = zext i1 %32 to i32
%34 = add nuw nsw i32 %9, %33
%35 = add nuw nsw i32 %12, 1
%36 = icmp eq i32 %35, 16
br i1 %36, label %37, label %7
37: ; preds = %7
%38 = sitofp i32 %28 to float
%39 = fdiv float %30, %38
%40 = fpext float %39 to double
%41 = mul nsw i32 %34, 100
%42 = udiv i32 %41, 15
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([138 x i8], [138 x i8]* @.str.6, i64 0, i64 0), i32 %23, double %40, i32 %42)
ret void
}