#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 *, float);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  float a, b, c, e, f, d1 = 0, d2 = 0, d3 = 0;
  char d;
  scanf("%f", &a);
  for (e = 0; e < a; e++) {
    scanf("%f", &b);
    scanf(" %c", &d);
    if (d == 'C') {
      d1 += b;
    } else if (d == 'R') {
      d2 += b;
    } else
      d3 += b;
  }
  f = d1 + d2 + d3;
  printf("Total: %.0f cobaias\n", f);
  printf("Total de coelhos: %.0f\n", d1);
  printf("Total de ratos: %.0f\n", d2);
  printf("Total de sapos: %.0f\n", d3);
  printf("Percentual de coelhos: %.2f %%\n", ((d1 / f) * 100));
  printf("Percentual de ratos: %.2f %%\n", ((d2 / f) * 100));
  printf("Percentual de sapos: %.2f %%\n", ((d3 / f) * 100));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm1
movss  -0x8(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    120a <main+0xea>
lea    0xe8d(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xe7e(%rip),%rdi
lea    -0x25(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0x25(%rbp),%eax
cmp    $0x43,%eax
jne    11b9 <main+0x99>
movss  -0xc(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11ee <main+0xce>
movsbl -0x25(%rbp),%eax
cmp    $0x52,%eax
jne    11da <main+0xba>
movss  -0xc(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
jmp    11e9 <main+0xc9>
movss  -0xc(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
jmp    11ee <main+0xce>
jmp    11f3 <main+0xd3>
movss  0xe09(%rip),%xmm0
addss  -0x14(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
jmp    1161 <main+0x41>
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
lea    0xde5(%rip),%rdi
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
lea    0xdf0(%rip),%rdi
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
movss  -0x1c(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xd8c(%rip),%xmm1
mulss  %xmm1,%xmm0
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xd6a(%rip),%xmm1
mulss  %xmm1,%xmm0
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
movss  -0x24(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  0xd48(%rip),%xmm1
mulss  %xmm1,%xmm0
lea    0xde3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
lea    0xed6(%rip),%rdi
lea    0x24(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x24(%rsp),%xmm0
xorps  %xmm2,%xmm2
xorps  %xmm1,%xmm1
movss  %xmm1,0x14(%rsp)
ucomiss %xmm2,%xmm0
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
jbe    1234 <main+0x114>
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
lea    0xe8d(%rip),%r14
lea    0x20(%rsp),%r15
lea    0xe84(%rip),%r12
lea    0x13(%rsp),%rbx
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
xorps  %xmm1,%xmm1
jmp    11db <main+0xbb>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movss  0x1c(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
movss  %xmm0,0x1c(%rsp)
movss  0xc(%rsp),%xmm1
addss  0xe30(%rip),%xmm1
movss  0x24(%rsp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1234 <main+0x114>
movss  %xmm1,0xc(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movzbl 0x13(%rsp),%eax
cmp    $0x52,%al
je     1220 <main+0x100>
cmp    $0x43,%al
jne    11b0 <main+0x90>
movss  0x14(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
movss  %xmm0,0x14(%rsp)
jmp    11c2 <main+0xa2>
nopl   0x0(%rax)
movss  0x18(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
movss  %xmm0,0x18(%rsp)
jmp    11c2 <main+0xa2>
movss  0x14(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
addss  0x1c(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
lea    0xdbc(%rip),%rdi
call   1030 <printf@plt>
lea    0xdc5(%rip),%rdi
movss  0x14(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xdcb(%rip),%rdi
movss  0x18(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xdcf(%rip),%rdi
movss  0x1c(%rsp),%xmm0
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
mulss  0xd62(%rip),%xmm0
lea    0xdbf(%rip),%rdi
call   1030 <printf@plt>
movss  0x18(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
mulss  0xd42(%rip),%xmm0
lea    0xdbf(%rip),%rdi
call   1030 <printf@plt>
movss  0x1c(%rsp),%xmm0
divss  0xc(%rsp),%xmm0
mulss  0xd22(%rip),%xmm0
lea    0xdbd(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [21 x i8] c"Total: %.0f cobaias\0A\00"
@.str.3 = [24 x i8] c"Total de coelhos: %.0f\0A\00"
@.str.4 = [22 x i8] c"Total de ratos: %.0f\0A\00"
@.str.5 = [22 x i8] c"Total de sapos: %.0f\0A\00"
@.str.6 = [32 x i8] c"Percentual de coelhos: %.2f %%\0A\00"
@.str.7 = [30 x i8] c"Percentual de ratos: %.2f %%\0A\00"
@.str.8 = [30 x i8] c"Percentual de sapos: %.2f %%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i8
store i32 0, i32* %1
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
store float 0.000000e+00, float* %9
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
store float 0.000000e+00, float* %5
br label %12
12: ; preds = %40, %0
%13 = load float, float* %5
%14 = load float, float* %2
%15 = fcmp olt float %13, %14
br i1 %15, label %16, label %43
16: ; preds = %12
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %3)
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %10)
%19 = load i8, i8* %10
%20 = sext i8 %19 to i32
%21 = icmp eq i32 %20, 67
br i1 %21, label %22, label %26
22: ; preds = %16
%23 = load float, float* %3
%24 = load float, float* %7
%25 = fadd float %24, %23
store float %25, float* %7
br label %39
26: ; preds = %16
%27 = load i8, i8* %10
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 82
br i1 %29, label %30, label %34
30: ; preds = %26
%31 = load float, float* %3
%32 = load float, float* %8
%33 = fadd float %32, %31
store float %33, float* %8
br label %38
34: ; preds = %26
%35 = load float, float* %3
%36 = load float, float* %9
%37 = fadd float %36, %35
store float %37, float* %9
br label %38
38: ; preds = %34, %30
br label %39
39: ; preds = %38, %22
br label %40
40: ; preds = %39
%41 = load float, float* %5
%42 = fadd float %41, 1.000000e+00
store float %42, float* %5
br label %12
43: ; preds = %12
%44 = load float, float* %7
%45 = load float, float* %8
%46 = fadd float %44, %45
%47 = load float, float* %9
%48 = fadd float %46, %47
store float %48, float* %6
%49 = load float, float* %6
%50 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), float %49)
%51 = load float, float* %7
%52 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), float %51)
%53 = load float, float* %8
%54 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), float %53)
%55 = load float, float* %9
%56 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), float %55)
%57 = load float, float* %7
%58 = load float, float* %6
%59 = fdiv float %57, %58
%60 = fmul float %59, 1.000000e+02
%61 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), float %60)
%62 = load float, float* %8
%63 = load float, float* %6
%64 = fdiv float %62, %63
%65 = fmul float %64, 1.000000e+02
%66 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), float %65)
%67 = load float, float* %9
%68 = load float, float* %6
%69 = fdiv float %67, %68
%70 = fmul float %69, 1.000000e+02
%71 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), float %70)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
@.str.1 = [4 x i8] c" %c\00"
@.str.2 = [21 x i8] c"Total: %.0f cobaias\0A\00"
@.str.3 = [24 x i8] c"Total de coelhos: %.0f\0A\00"
@.str.4 = [22 x i8] c"Total de ratos: %.0f\0A\00"
@.str.5 = [22 x i8] c"Total de sapos: %.0f\0A\00"
@.str.6 = [32 x i8] c"Percentual de coelhos: %.2f %%\0A\00"
@.str.7 = [30 x i8] c"Percentual de ratos: %.2f %%\0A\00"
@.str.8 = [30 x i8] c"Percentual de sapos: %.2f %%\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*
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %1)
%7 = load float, float* %1
%8 = fcmp ogt float %7, 0.000000e+00
br i1 %8, label %9, label %33
9: ; preds = %0, %26
%10 = phi float [ %29, %26 ], [ 0.000000e+00, %0 ]
%11 = phi float [ %28, %26 ], [ 0.000000e+00, %0 ]
%12 = phi float [ %27, %26 ], [ 0.000000e+00, %0 ]
%13 = phi float [ %30, %26 ], [ 0.000000e+00, %0 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), float* %2)
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%16 = load i8, i8* %3
switch i8 %16, label %23 [
i8 67, label %17
i8 82, label %20
]
17: ; preds = %9
%18 = load float, float* %2
%19 = fadd float %12, %18
br label %26
20: ; preds = %9
%21 = load float, float* %2
%22 = fadd float %11, %21
br label %26
23: ; preds = %9
%24 = load float, float* %2
%25 = fadd float %10, %24
br label %26
26: ; preds = %17, %23, %20
%27 = phi float [ %19, %17 ], [ %12, %20 ], [ %12, %23 ]
%28 = phi float [ %11, %17 ], [ %22, %20 ], [ %11, %23 ]
%29 = phi float [ %10, %17 ], [ %10, %20 ], [ %25, %23 ]
%30 = fadd float %13, 1.000000e+00
%31 = load float, float* %1
%32 = fcmp olt float %30, %31
br i1 %32, label %9, label %33
33: ; preds = %26, %0
%34 = phi float [ 0.000000e+00, %0 ], [ %27, %26 ]
%35 = phi float [ 0.000000e+00, %0 ], [ %28, %26 ]
%36 = phi float [ 0.000000e+00, %0 ], [ %29, %26 ]
%37 = fadd float %34, %35
%38 = fadd float %37, %36
%39 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), float %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), float %34)
%41 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), float %35)
%42 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), float %36)
%43 = fdiv float %34, %38
%44 = fmul float %43, 1.000000e+02
%45 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), float %44)
%46 = fdiv float %35, %38
%47 = fmul float %46, 1.000000e+02
%48 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), float %47)
%49 = fdiv float %36, %38
%50 = fmul float %49, 1.000000e+02
%51 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0), float %50)
ret i32 0
}