#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 *, ...);
int main() {
  int N, i = 0, Q;
  float total = 0, c[4] = {0, 0, 0, 0};
  char T;
  scanf(" %d", &N);
  while (i < N) {
    scanf(" %d %c", &Q, &T);
    total += Q;
    switch (T) {
    case 'R':
      c[0] += Q;
      break;
    case 'S':
      c[1] += Q;
      break;
    case 'C':
      c[2] += Q;
      break;
    }
    i++;
  }
  printf("Total: %0.0f cobaias\n", total);
  printf("Total de coelhos: %0.0f\n", c[2]);
  printf("Total de ratos: %0.0f\n", c[0]);
  printf("Total de sapos: %0.0f\n", c[1]);
  printf("Percentual de coelhos: %0.2f %%\n", c[2] * 100 / total);
  printf("Percentual de ratos: %0.2f %%\n", c[0] * 100 / total);
  printf("Percentual de sapos: %0.2f %%\n", c[1] * 100 / total);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1040 <memset@plt>
lea    0xe9f(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1221 <main+0xf1>
lea    0xe85(%rip),%rdi
xor    %eax,%eax
lea    -0x10(%rbp),%rsi
lea    -0x31(%rbp),%rdx
call   1050 <scanf@plt>
cvtsi2ssl -0x10(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movsbl -0x31(%rbp),%eax
mov    %eax,-0x38(%rbp)
sub    $0x43,%eax
je     1204 <main+0xd4>
jmp    11ba <main+0x8a>
mov    -0x38(%rbp),%eax
sub    $0x52,%eax
je     11dc <main+0xac>
jmp    11cb <main+0x9b>
mov    -0x38(%rbp),%eax
sub    $0x53,%eax
je     11f0 <main+0xc0>
jmp    1213 <main+0xe3>
cvtsi2ssl -0x10(%rbp),%xmm0
addss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
jmp    1213 <main+0xe3>
cvtsi2ssl -0x10(%rbp),%xmm0
addss  -0x2c(%rbp),%xmm0
movss  %xmm0,-0x2c(%rbp)
jmp    1213 <main+0xe3>
cvtsi2ssl -0x10(%rbp),%xmm0
addss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1170 <main+0x40>
movss  -0x14(%rbp),%xmm0
lea    0xde2(%rip),%rdi
call   1030 <printf@plt>
movss  -0x28(%rbp),%xmm0
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
movss  -0x30(%rbp),%xmm0
lea    0xdef(%rip),%rdi
call   1030 <printf@plt>
movss  -0x2c(%rbp),%xmm0
lea    0xdf5(%rip),%rdi
call   1030 <printf@plt>
movss  0xd93(%rip),%xmm0
mulss  -0x28(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
lea    0xdee(%rip),%rdi
call   1030 <printf@plt>
movss  0xd75(%rip),%xmm0
mulss  -0x30(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
lea    0xdf1(%rip),%rdi
call   1030 <printf@plt>
movss  0xd57(%rip),%xmm0
mulss  -0x2c(%rbp),%xmm0
divss  -0x14(%rbp),%xmm0
lea    0xdf2(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xed3(%rip),%rdi
lea    0x20(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
cmpl   $0x0,0x20(%rsp)
jle    1202 <main+0xe2>
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
lea    0xeb0(%rip),%r14
lea    0x24(%rsp),%r15
lea    0x13(%rsp),%rbx
xor    %ebp,%ebp
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm1,%xmm1
jmp    11a3 <main+0x83>
nopl   0x0(%rax,%rax,1)
movss  0x14(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x14(%rsp)
movss  0xc(%rsp),%xmm1
addss  %xmm0,%xmm1
add    $0x1,%ebp
cmp    0x20(%rsp),%ebp
jge    1220 <main+0x100>
movss  %xmm1,0xc(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
cvtsi2ssl 0x24(%rsp),%xmm0
movsbl 0x13(%rsp),%eax
cmp    $0x43,%eax
je     1180 <main+0x60>
cmp    $0x53,%eax
je     11f0 <main+0xd0>
cmp    $0x52,%eax
jne    1190 <main+0x70>
movss  0x18(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x18(%rsp)
jmp    1190 <main+0x70>
nopl   0x0(%rax,%rax,1)
movss  0x1c(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x1c(%rsp)
jmp    1190 <main+0x70>
xorps  %xmm1,%xmm1
xorps  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x1c(%rsp)
xorps  %xmm0,%xmm0
movss  %xmm0,0x14(%rsp)
movss  %xmm1,0xc(%rsp)
lea    0xde2(%rip),%rdi
movaps %xmm1,%xmm0
call   1030 <printf@plt>
lea    0xde9(%rip),%rdi
movss  0x14(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xdf0(%rip),%rdi
movss  0x18(%rsp),%xmm0
call   1030 <printf@plt>
lea    0xdf5(%rip),%rdi
movss  0x1c(%rsp),%xmm0
call   1030 <printf@plt>
movss  0x14(%rsp),%xmm0
mulss  0xd87(%rip),%xmm0
divss  0xc(%rsp),%xmm0
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
movss  0x18(%rsp),%xmm0
mulss  0xd67(%rip),%xmm0
divss  0xc(%rsp),%xmm0
lea    0xde7(%rip),%rdi
call   1030 <printf@plt>
movss  0x1c(%rsp),%xmm0
mulss  0xd47(%rip),%xmm0
divss  0xc(%rsp),%xmm0
lea    0xde6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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