int main(void) {
  int i, x;
  char letra[128];
  double quantia, sapo = 0, rato = 0, coelho = 0, total = 0;
  scanf("%d", &x);
  for (i = 1; i <= x; i++) {
    scanf("%lf%s", &quantia, &letra);
    if (letra == 'C') {
      coelho += quantia;
      total += quantia;
    } else if (letra == 'S') {
      sapo += quantia;
      total += quantia;
    } else if (letra == 'R') {
      rato += quantia;
      total += quantia;
    }
  }
  printf("Total: %.0lf\n", total);
  printf("Total de coelhos: %.0lf\n", coelho);
  printf("Total de ratos: %.0lf\n", rato);
  printf("Total de sapos: %.0lf\n", sapo);
  printf("Percentual de coelhos: %.2lf %%\n", coelho * 100 / total);
  printf("Percentual de ratos: %.2lf %%\n", rato * 100 / total);
  printf("Percentual de sapos: %.2lf %%\n", sapo * 100 / total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
xorps  %xmm0,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
lea    0xea3(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     1295 <main+0x175>
lea    0xe81(%rip),%rdi
lea    -0x98(%rbp),%rsi
lea    -0x90(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
lea    -0x90(%rbp),%rax
mov    $0x43,%ecx
cmp    %rcx,%rax
jne    11e9 <main+0xc9>
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1282 <main+0x162>
lea    -0x90(%rbp),%rax
mov    $0x53,%ecx
cmp    %rcx,%rax
jne    1233 <main+0x113>
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    127d <main+0x15d>
lea    -0x90(%rbp),%rax
mov    $0x52,%ecx
cmp    %rcx,%rax
jne    1278 <main+0x158>
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
addsd  -0xb8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    127d <main+0x15d>
jmp    1282 <main+0x162>
jmp    1287 <main+0x167>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1177 <main+0x57>
movsd  -0xb8(%rbp),%xmm0
ff
lea    0xd6d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0xb0(%rbp),%xmm0
ff
lea    0xd65(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0xa8(%rbp),%xmm0
ff
lea    0xd68(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0xa0(%rbp),%xmm0
ff
lea    0xd69(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xd0b(%rip),%xmm0
mulsd  -0xb0(%rbp),%xmm0
ff
divsd  -0xb8(%rbp),%xmm0
ff
lea    0xd5a(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xce5(%rip),%xmm0
mulsd  -0xa8(%rbp),%xmm0
ff
divsd  -0xb8(%rbp),%xmm0
ff
lea    0xd55(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0xcbf(%rip),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
divsd  -0xb8(%rbp),%xmm0
ff
lea    0xd4e(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x98,%rsp
lea    0xed4(%rip),%rdi
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1179 <main+0x59>
lea    0xebd(%rip),%r14
lea    0x8(%rsp),%r15
lea    0x10(%rsp),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%ebp
cmp    0x4(%rsp),%ebp
jl     1160 <main+0x40>
lea    0xe91(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe8e(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe96(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
xorps  %xmm0,%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xea2(%rip),%rdi
movsd  0xe34(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
movsd  0xe1e(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xeb6(%rip),%rdi
movsd  0xe08(%rip),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x98,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%lf%s\00"
@.str.2 = [14 x i8] c"Total: %.0lf\0A\00"
@.str.3 = [25 x i8] c"Total de coelhos: %.0lf\0A\00"
@.str.4 = [23 x i8] c"Total de ratos: %.0lf\0A\00"
@.str.5 = [23 x i8] c"Total de sapos: %.0lf\0A\00"
@.str.6 = [33 x i8] c"Percentual de coelhos: %.2lf %%\0A\00"
@.str.7 = [31 x i8] c"Percentual de ratos: %.2lf %%\0A\00"
@.str.8 = [31 x i8] c"Percentual de sapos: %.2lf %%\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [128 x i8]
%3 = alloca double
%4 = bitcast i32* %1 to i8*
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %2, i64 0, i64 0
%6 = bitcast double* %3 to i8*
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = icmp slt i32 %8, 1
br i1 %9, label %16, label %10
10: ; preds = %0, %10
%11 = phi i32 [ %13, %10 ], [ 1, %0 ]
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double* %3, [128 x i8]* %2)
%13 = add nuw nsw i32 %11, 1
%14 = load i32, i32* %1
%15 = icmp slt i32 %11, %14
br i1 %15, label %10, label %16
16: ; preds = %10, %0
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), double 0.000000e+00)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double 0.000000e+00)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), double 0.000000e+00)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.5, i64 0, i64 0), double 0.000000e+00)
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.6, i64 0, i64 0), double 0x7FF8000000000000)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0), double 0x7FF8000000000000)
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.8, i64 0, i64 0), double 0x7FF8000000000000)
ret i32 0
}