#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*/ print(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
void ex10() {
  print("\n------------------------------\n");
  float peso, altura;
  printf("Informe o peso: ");
  scanf("%f", &peso);
  while (!(peso > 0)) {
    printf("Valor invalido, tente novamente: ");
    scanf("%f", &peso);
  }
  printf("Informe a altura: ");
  scanf("%f", &altura);
  while (!(altura > 0)) {
    printf("Valor invalido, tente novamente: ");
    scanf("%f", &altura);
  }
  int grupo = 0;
  char grupos[10] = "ABCDEFGHI";
  if (peso > 90)
    grupo += 6;
  else if (peso > 60)
    grupo += 3;
  if (altura > 1.7)
    grupo += 2;
  else if (altura >= 1.2)
    grupo++;
  printf("Sua classificacao e: %c\n", grupos[grupo]);
  print("\n------------------------------\n");
}


x86 assembly (clang, -O0):
<ex10>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed9(%rip),%rdi
call   1040 <print@plt>
lea    0xeee(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef1(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x4(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
xor    $0xff,%al
test   $0x1,%al
jne    117f <ex10+0x4f>
jmp    11a2 <ex10+0x72>
lea    0xec7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1050 <scanf@plt>
jmp    1162 <ex10+0x32>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe93(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
movss  -0x8(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
seta   %al
xor    $0xff,%al
test   $0x1,%al
jne    11dd <ex10+0xad>
jmp    1200 <ex10+0xd0>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe58(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
jmp    11c0 <ex10+0x90>
movl   $0x0,-0xc(%rbp)
mov    0xe74(%rip),%rax
mov    %rax,-0x16(%rbp)
mov    0xe71(%rip),%ax
mov    %ax,-0xe(%rbp)
movss  -0x4(%rbp),%xmm0
movss  0xdd6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1241 <ex10+0x111>
mov    -0xc(%rbp),%eax
add    $0x6,%eax
mov    %eax,-0xc(%rbp)
jmp    1265 <ex10+0x135>
movss  -0x4(%rbp),%xmm0
movss  0xdb6(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1260 <ex10+0x130>
mov    -0xc(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0xc(%rbp)
jmp    1265 <ex10+0x135>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd92(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    128e <ex10+0x15e>
mov    -0xc(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0xc(%rbp)
jmp    12b7 <ex10+0x187>
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd71(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12b2 <ex10+0x182>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    12b7 <ex10+0x187>
movslq -0xc(%rbp),%rax
movsbl -0x16(%rbp,%rax,1),%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xd43(%rip),%rdi
call   1040 <print@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ex10>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xee0(%rip),%rdi
call   1040 <print@plt>
lea    0xef5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef8(%rip),%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     11b4 <ex10+0x84>
lea    0xedc(%rip),%r14
lea    0xed2(%rip),%r15
lea    0x8(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
ucomiss 0xe56(%rip),%xmm0
jbe    1190 <ex10+0x60>
lea    0xebc(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe89(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xe28(%rip),%xmm0
ja     1224 <ex10+0xf4>
lea    0xe6c(%rip),%r14
lea    0xe62(%rip),%r15
lea    0xc(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <scanf@plt>
movss  0xc(%rsp),%xmm0
ucomiss 0xde6(%rip),%xmm0
jbe    1200 <ex10+0xd0>
movss  0x8(%rsp),%xmm1
mov    $0x6,%eax
ucomiss 0xdca(%rip),%xmm1
ja     1248 <ex10+0x118>
xor    %eax,%eax
ucomiss 0xdc3(%rip),%xmm1
jbe    1248 <ex10+0x118>
mov    $0x3,%eax
cvtss2sd %xmm0,%xmm0
ucomisd 0xdbc(%rip),%xmm0
jbe    125b <ex10+0x12b>
add    $0x2,%eax
jmp    1268 <ex10+0x138>
ucomisd 0xdb5(%rip),%xmm0
jb     1268 <ex10+0x138>
add    $0x1,%eax
mov    %eax,%eax
lea    0xe19(%rip),%rcx
movsbl (%rax,%rcx,1),%esi
lea    0xe18(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xd96(%rip),%rdi
call   1040 <print@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [33 x i8] c"\0A------------------------------\0A\00"
@.str.1 = [17 x i8] c"Informe o peso: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [34 x i8] c"Valor invalido, tente novamente: \00"
@.str.4 = [19 x i8] c"Informe a altura: \00"
@__const.ex10.grupos = [10 x i8] c"ABCDEFGHI\00"
@.str.5 = [25 x i8] c"Sua classificacao e: %c\0A\00"
define void @ex10() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = alloca [10 x i8]
%5 = call i32 @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
br label %8
8: ; preds = %12, %0
%9 = load float, float* %1
%10 = fcmp ogt float %9, 0.000000e+00
%11 = xor i1 %10, true
br i1 %11, label %12, label %15
12: ; preds = %8
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
br label %8
15: ; preds = %8
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
br label %18
18: ; preds = %22, %15
%19 = load float, float* %2
%20 = fcmp ogt float %19, 0.000000e+00
%21 = xor i1 %20, true
br i1 %21, label %22, label %25
22: ; preds = %18
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
br label %18
25: ; preds = %18
store i32 0, i32* %3
%26 = bitcast [10 x i8]* %4 to i8*
%27 = load float, float* %1
%28 = fcmp ogt float %27, 9.000000e+01
br i1 %28, label %29, label %32
29: ; preds = %25
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 6
store i32 %31, i32* %3
br label %39
32: ; preds = %25
%33 = load float, float* %1
%34 = fcmp ogt float %33, 6.000000e+01
br i1 %34, label %35, label %38
35: ; preds = %32
%36 = load i32, i32* %3
%37 = add nsw i32 %36, 3
store i32 %37, i32* %3
br label %38
38: ; preds = %35, %32
br label %39
39: ; preds = %38, %29
%40 = load float, float* %2
%41 = fpext float %40 to double
%42 = fcmp ogt double %41, 1.700000e+00
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32, i32* %3
%45 = add nsw i32 %44, 2
store i32 %45, i32* %3
br label %54
46: ; preds = %39
%47 = load float, float* %2
%48 = fpext float %47 to double
%49 = fcmp oge double %48, 1.200000e+00
br i1 %49, label %50, label %53
50: ; preds = %46
%51 = load i32, i32* %3
%52 = add nsw i32 %51, 1
store i32 %52, i32* %3
br label %53
53: ; preds = %50, %46
br label %54
54: ; preds = %53, %43
%55 = load i32, i32* %3
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %56
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %59)
%61 = call i32 @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"\0A------------------------------\0A\00"
@.str.1 = [17 x i8] c"Informe o peso: \00"
@.str.2 = [3 x i8] c"%f\00"
@.str.3 = [34 x i8] c"Valor invalido, tente novamente: \00"
@.str.4 = [19 x i8] c"Informe a altura: \00"
@__const.ex10.grupos = [10 x i8] c"ABCDEFGHI\00"
@.str.5 = [25 x i8] c"Sua classificacao e: %c\0A\00"
define void @ex10() {
%1 = alloca float
%2 = alloca float
%3 = tail call i32 @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%8 = load float, float* %1
%9 = fcmp ule float %8, 0.000000e+00
br i1 %9, label %10, label %15
10: ; preds = %0, %10
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %1)
%13 = load float, float* %1
%14 = fcmp ule float %13, 0.000000e+00
br i1 %14, label %10, label %15
15: ; preds = %10, %0
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%18 = load float, float* %2
%19 = fcmp ule float %18, 0.000000e+00
br i1 %19, label %20, label %25
20: ; preds = %15, %20
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), float* %2)
%23 = load float, float* %2
%24 = fcmp ule float %23, 0.000000e+00
br i1 %24, label %20, label %25
25: ; preds = %20, %15
%26 = phi float [ %18, %15 ], [ %23, %20 ]
%27 = load float, float* %1
%28 = fcmp ogt float %27, 9.000000e+01
br i1 %28, label %32, label %29
29: ; preds = %25
%30 = fcmp ogt float %27, 6.000000e+01
br i1 %30, label %31, label %32
31: ; preds = %29
br label %32
32: ; preds = %25, %29, %31
%33 = phi i32 [ 3, %31 ], [ 0, %29 ], [ 6, %25 ]
%34 = fpext float %26 to double
%35 = fcmp ogt double %34, 1.700000e+00
br i1 %35, label %36, label %38
36: ; preds = %32
%37 = add nuw nsw i32 %33, 2
br label %42
38: ; preds = %32
%39 = fcmp ult double %34, 1.200000e+00
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = add nuw nsw i32 %33, 1
br label %42
42: ; preds = %38, %40, %36
%43 = phi i32 [ %37, %36 ], [ %41, %40 ], [ %33, %38 ]
%44 = zext i32 %43 to i64
%45 = getelementptr inbounds [10 x i8], [10 x i8]* @__const.ex10.grupos, i64 0, i64 %44
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %47)
%49 = call i32 @print(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
ret void
}