#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, ...);
int /*<<< orphan*/ scanf(char *, ...);
char tolower(char);
int main() {
  float idade, peso, menor = 999999999, id_leve;
  char sexo;
  int i = 1, cont = 0, cont2 = 0;
  do {
    printf("entre com o peso do %dº animal (menor que 0 para sair): ", i);
    scanf("%f", &peso);
    if (peso > 0) {
      printf("entre com o sexo do %dº animal: ", i);
      scanf(" %c", &sexo);
      sexo = tolower(sexo);
      printf("entre com o idade do %dº animal: ", i);
      scanf("%f", &idade);
      if (peso < menor) {
        menor = peso;
        id_leve = idade;
      }
      if (sexo == 'm')
        cont++;
      if (idade > 3.5)
        cont2++;
    }
  } while (peso > 0);
  if (menor != 999999999) {
    printf("o animal mais magro e sua idade: %.2f Kg, %.2f anos\n", menor,
           id_leve);
    printf("a quantidade de animais machos: %d\n", cont);
    printf("a quantidade de animais acima de 3 anos e meio: %d\n", cont2);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movss  0xeb9(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jbe    124d <main+0x11d>
mov    -0x1c(%rbp),%esi
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    -0x15(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movsbl -0x15(%rbp),%edi
call   1040 <tolower@plt>
mov    %al,-0x15(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6e(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    120e <main+0xde>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movsbl -0x15(%rbp),%eax
cmp    $0x6d,%eax
jne    1224 <main+0xf4>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movss  -0x8(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdd3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1248 <main+0x118>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    124d <main+0x11d>
jmp    1252 <main+0x122>
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
ja     1161 <main+0x31>
movss  -0x10(%rbp),%xmm0
movss  0xd90(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1284 <main+0x154>
jp     1284 <main+0x154>
jmp    12c2 <main+0x192>
cvttss2si -0x10(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xdfd(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x20(%rbp),%esi
lea    0xe21(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x24(%rbp),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movss  0xeba(%rip),%xmm0
movss  %xmm0,0x4(%rsp)
lea    0xeb5(%rip),%r14
lea    0xee8(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xc(%rsp),%r13
xor    %ebp,%ebp
xor    %ebx,%ebx
jmp    1179 <main+0x49>
nopw   0x0(%rax,%rax,1)
ucomiss %xmm1,%xmm0
jbe    1253 <main+0x123>
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
xorps  %xmm1,%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1170 <main+0x40>
lea    0xe9b(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeaa(%rip),%rdi
lea    0x3(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movsbl 0x3(%rsp),%edi
call   1040 <tolower@plt>
mov    %al,0x3(%rsp)
lea    0xe8d(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movaps %xmm0,%xmm2
movss  0x4(%rsp),%xmm4
minss  %xmm4,%xmm2
movaps %xmm0,%xmm3
cmpltss %xmm4,%xmm3
movaps %xmm3,%xmm4
andps  %xmm1,%xmm4
andnps 0x10(%rsp),%xmm3
xor    %eax,%eax
cmpb   $0x6d,0x3(%rsp)
sete   %al
add    %eax,%ebp
xor    %eax,%eax
ucomiss 0xdcc(%rip),%xmm1
xorps  %xmm1,%xmm1
orps   %xmm4,%xmm3
seta   %al
add    %eax,%ebx
movss  %xmm2,0x4(%rsp)
movaps %xmm3,0x10(%rsp)
jmp    1170 <main+0x40>
movss  0x4(%rsp),%xmm0
ucomiss 0xda0(%rip),%xmm0
jne    1264 <main+0x134>
jnp    129f <main+0x16f>
cvttss2si %xmm0,%esi
movaps 0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe16(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe3d(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe51(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [58 x i8] c"entre com o peso do %d\C2\BA animal (menor que 0 para sair): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"entre com o sexo do %d\C2\BA animal: \00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [35 x i8] c"entre com o idade do %d\C2\BA animal: \00"
@.str.5 = [53 x i8] c"o animal mais magro e sua idade: %.2f Kg, %.2f anos\0A\00"
@.str.6 = [36 x i8] c"a quantidade de animais machos: %d\0A\00"
@.str.7 = [52 x i8] c"a quantidade de animais acima de 3 anos e meio: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i8
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store float 1.000000e+09, float* %4
store i32 1, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %47, %0
%11 = load i32, i32* %7
%12 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%14 = load float, float* %3
%15 = fcmp ogt float %14, 0.000000e+00
br i1 %15, label %16, label %46
16: ; preds = %10
%17 = load i32, i32* %7
%18 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%20 = load i8, i8* %6
%21 = call signext i8 @tolower(i8 signext %20)
store i8 %21, i8* %6
%22 = load i32, i32* %7
%23 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %22)
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%25 = load float, float* %3
%26 = load float, float* %4
%27 = fcmp olt float %25, %26
br i1 %27, label %28, label %31
28: ; preds = %16
%29 = load float, float* %3
store float %29, float* %4
%30 = load float, float* %2
store float %30, float* %5
br label %31
31: ; preds = %28, %16
%32 = load i8, i8* %6
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 109
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %8
%37 = add nsw i32 %36, 1
store i32 %37, i32* %8
br label %38
38: ; preds = %35, %31
%39 = load float, float* %2
%40 = fpext float %39 to double
%41 = fcmp ogt double %40, 3.500000e+00
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = load i32, i32* %9
%44 = add nsw i32 %43, 1
store i32 %44, i32* %9
br label %45
45: ; preds = %42, %38
br label %46
46: ; preds = %45, %10
br label %47
47: ; preds = %46
%48 = load float, float* %3
%49 = fcmp ogt float %48, 0.000000e+00
br i1 %49, label %10, label %50
50: ; preds = %47
%51 = load float, float* %4
%52 = fcmp une float %51, 1.000000e+09
br i1 %52, label %53, label %63
53: ; preds = %50
%54 = load float, float* %4
%55 = fptosi float %54 to i32
%56 = load float, float* %5
%57 = fpext float %56 to double
%58 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i32 %55, double %57)
%59 = load i32, i32* %8
%60 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %59)
%61 = load i32, i32* %9
%62 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %61)
br label %63
63: ; preds = %53, %50
ret i32 0
}

LLVM IR (-O2):
@.str = [58 x i8] c"entre com o peso do %d\C2\BA animal (menor que 0 para sair): \00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [34 x i8] c"entre com o sexo do %d\C2\BA animal: \00"
@.str.3 = [4 x i8] c" %c\00"
@.str.4 = [35 x i8] c"entre com o idade do %d\C2\BA animal: \00"
@.str.5 = [53 x i8] c"o animal mais magro e sua idade: %.2f Kg, %.2f anos\0A\00"
@.str.6 = [36 x i8] c"a quantidade de animais machos: %d\0A\00"
@.str.7 = [52 x i8] c"a quantidade de animais acima de 3 anos e meio: %d\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i8
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
br label %6
6: ; preds = %34, %0
%7 = phi float [ 1.000000e+09, %0 ], [ %36, %34 ]
%8 = phi float [ undef, %0 ], [ %37, %34 ]
%9 = phi i32 [ 0, %0 ], [ %38, %34 ]
%10 = phi i32 [ 0, %0 ], [ %39, %34 ]
%11 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0), i32 1)
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = load float, float* %2
%14 = fcmp ogt float %13, 0.000000e+00
br i1 %14, label %15, label %34
15: ; preds = %6
%16 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i32 1)
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %3)
%18 = load i8, i8* %3
%19 = call signext i8 @tolower(i8 signext %18)
store i8 %19, i8* %3
%20 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 1)
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%22 = load float, float* %2
%23 = fcmp olt float %22, %7
%24 = load float, float* %1
%25 = select i1 %23, float %22, float %7
%26 = select i1 %23, float %24, float %8
%27 = load i8, i8* %3
%28 = icmp eq i8 %27, 109
%29 = zext i1 %28 to i32
%30 = add nsw i32 %9, %29
%31 = fcmp ogt float %24, 3.500000e+00
%32 = zext i1 %31 to i32
%33 = add nsw i32 %10, %32
br label %34
34: ; preds = %15, %6
%35 = phi float [ %22, %15 ], [ %13, %6 ]
%36 = phi float [ %25, %15 ], [ %7, %6 ]
%37 = phi float [ %26, %15 ], [ %8, %6 ]
%38 = phi i32 [ %30, %15 ], [ %9, %6 ]
%39 = phi i32 [ %33, %15 ], [ %10, %6 ]
%40 = fcmp ogt float %35, 0.000000e+00
br i1 %40, label %6, label %41
41: ; preds = %34
%42 = fcmp une float %36, 1.000000e+09
br i1 %42, label %43, label %49
43: ; preds = %41
%44 = fptosi float %36 to i32
%45 = fpext float %37 to double
%46 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.5, i64 0, i64 0), i32 %44, double %45)
%47 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %38)
%48 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.7, i64 0, i64 0), i32 %39)
br label %49
49: ; preds = %43, %41
ret i32 0
}