#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 *, double, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main(void) {
  int quantidadeDeDias, i, quantidadeDeFrutasPorDia;
  double gastoPorDia, gastoTotal = 0.0, quantidadeDeFrutasTotal = 0.0;
  char nomeDaFruta[1024], caractereAposNomeDaFruta;
  scanf("%d\n", &quantidadeDeDias);
  for (i = 1; i <= quantidadeDeDias; i++) {
    scanf("%lf\n", &gastoPorDia);
    gastoTotal += gastoPorDia;
    quantidadeDeFrutasPorDia = 0;
    while (1) {
      scanf("%s%c", nomeDaFruta, &caractereAposNomeDaFruta);
      quantidadeDeFrutasPorDia++;
      if (caractereAposNomeDaFruta == '\n') {
        break;
      }
    }
    quantidadeDeFrutasTotal += quantidadeDeFrutasPorDia;
    printf("day %d: %d kg\n", i, quantidadeDeFrutasPorDia);
  }
  printf("%.2f kg by day\n", quantidadeDeFrutasTotal / quantidadeDeDias);
  printf("R$ %.2f by day\n", gastoTotal / quantidadeDeDias);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x440,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1201 <main+0xe1>
lea    0xe96(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x430(%rbp),%rsi
lea    0xe6c(%rip),%rdi
lea    -0x431(%rbp),%rdx
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x431(%rbp),%eax
cmp    $0xa,%eax
jne    11c9 <main+0xa9>
jmp    11ce <main+0xae>
jmp    118f <main+0x6f>
cvtsi2sdl -0x10(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
mov    -0x10(%rbp),%esi
lea    0xe22(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115b <main+0x3b>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xe07(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
cvtsi2sdl -0x8(%rbp),%xmm1
divsd  %xmm1,%xmm0
lea    0xdfb(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x440,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
lea    0xec8(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0xc(%rsp),%eax
test   %eax,%eax
jle    1230 <main+0x110>
mov    $0x1,%r15d
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xea2(%rip),%r12
lea    0x30(%rsp),%r13
lea    0xb(%rsp),%rbx
lea    0xe96(%rip),%rbp
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xe6d(%rip),%rdi
lea    0x28(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x20(%rsp)
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <scanf@plt>
add    $0x1,%r14d
cmpb   $0xa,0xb(%rsp)
jne    11c0 <main+0xa0>
xorps  %xmm0,%xmm0
cvtsi2sd %r14d,%xmm0
movsd  0x18(%rsp),%xmm1
addsd  0x20(%rsp),%xmm1
movsd  %xmm1,0x18(%rsp)
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
xorps  %xmm0,%xmm0
cvtsi2sd %r15d,%xmm0
mov    %rbp,%rdi
mov    %r14d,%esi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0x1(%r15),%ecx
mov    0xc(%rsp),%eax
cmp    %eax,%r15d
mov    %ecx,%r15d
jl     1190 <main+0x70>
jmp    1244 <main+0x124>
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xdc1(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2sdl 0xc(%rsp),%xmm1
movsd  0x18(%rsp),%xmm0
divsd  %xmm1,%xmm0
lea    0xdb0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [5 x i8] c"%s%c\00"
@.str.3 = [15 x i8] c"day %d: %d kg\0A\00"
@.str.4 = [16 x i8] c"%.2f kg by day\0A\00"
@.str.5 = [16 x i8] c"R$ %.2f by day\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca [1024 x i8]
%9 = alloca i8
store i32 0, i32* %1
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %3
br label %11
11: ; preds = %39, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %42
15: ; preds = %11
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %5)
%17 = load double, double* %5
%18 = load double, double* %6
%19 = fadd double %18, %17
store double %19, double* %6
store i32 0, i32* %4
br label %20
20: ; preds = %15, %29
%21 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %9)
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
%25 = load i8, i8* %9
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 10
br i1 %27, label %28, label %29
28: ; preds = %20
br label %30
29: ; preds = %20
br label %20
30: ; preds = %28
%31 = load i32, i32* %4
%32 = sitofp i32 %31 to double
%33 = load double, double* %7
%34 = fadd double %33, %32
store double %34, double* %7
%35 = load i32, i32* %3
%36 = sitofp i32 %35 to double
%37 = load i32, i32* %4
%38 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %36, i32 %37)
br label %39
39: ; preds = %30
%40 = load i32, i32* %3
%41 = add nsw i32 %40, 1
store i32 %41, i32* %3
br label %11
42: ; preds = %11
%43 = load double, double* %7
%44 = load i32, i32* %2
%45 = sitofp i32 %44 to double
%46 = fdiv double %43, %45
%47 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %46)
%48 = load double, double* %6
%49 = load i32, i32* %2
%50 = sitofp i32 %49 to double
%51 = fdiv double %48, %50
%52 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %51)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
@.str.1 = [5 x i8] c"%lf\0A\00"
@.str.2 = [5 x i8] c"%s%c\00"
@.str.3 = [15 x i8] c"day %d: %d kg\0A\00"
@.str.4 = [16 x i8] c"%.2f kg by day\0A\00"
@.str.5 = [16 x i8] c"R$ %.2f by day\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca [1024 x i8]
%4 = alloca i8
%5 = bitcast i32* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp slt i32 %9, 1
br i1 %10, label %32, label %11
11: ; preds = %0, %23
%12 = phi double [ %26, %23 ], [ 0.000000e+00, %0 ]
%13 = phi double [ %24, %23 ], [ 0.000000e+00, %0 ]
%14 = phi i32 [ %29, %23 ], [ 1, %0 ]
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double* %2)
%16 = load double, double* %2
br label %17
17: ; preds = %17, %11
%18 = phi i32 [ 0, %11 ], [ %20, %17 ]
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %7, i8* %4)
%20 = add nuw nsw i32 %18, 1
%21 = load i8, i8* %4
%22 = icmp eq i8 %21, 10
br i1 %22, label %23, label %17
23: ; preds = %17
%24 = fadd double %13, %16
%25 = sitofp i32 %20 to double
%26 = fadd double %12, %25
%27 = sitofp i32 %14 to double
%28 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), double %27, i32 %20)
%29 = add nuw nsw i32 %14, 1
%30 = load i32, i32* %1
%31 = icmp slt i32 %14, %30
br i1 %31, label %11, label %32
32: ; preds = %23, %0
%33 = phi double [ 0.000000e+00, %0 ], [ %24, %23 ]
%34 = phi double [ 0.000000e+00, %0 ], [ %26, %23 ]
%35 = phi i32 [ %9, %0 ], [ %30, %23 ]
%36 = sitofp i32 %35 to double
%37 = fdiv double %34, %36
%38 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), double %37)
%39 = load i32, i32* %1
%40 = sitofp i32 %39 to double
%41 = fdiv double %33, %40
%42 = call i32 (i8*, double, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), double %41)
ret i32 0
}