#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() {
  int n, i, j, num, kg;
  float preco, total;
  char frutas[10000];
  scanf("%d", &n);
  total = 0.0;
  kg = 0;
  for (i = 0; i < n; i++) {
    num = 0;
    scanf("%f%*c", &preco);
    total += preco;
    scanf("%[^\n]%*c", &frutas);
    for (j = 0; frutas[j] != '\0'; j++) {
      if (frutas[j] == 32)
        num++;
    }
    kg += num + 1;
    printf("day %d: %d kg\n", i + 1, num + 1);
  }
  printf("%.2f kg by day\n", (float)kg / n);
  printf("R$ %.2f by day\n", total / n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2730,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xec7(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1228 <main+0x108>
movl   $0x0,-0x14(%rbp)
lea    0xe8f(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
lea    0xe74(%rip),%rdi
lea    -0x2730(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movslq -0x10(%rbp),%rax
movsbl -0x2730(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     11f0 <main+0xd0>
movslq -0x10(%rbp),%rax
movsbl -0x2730(%rbp,%rax,1),%eax
ff
cmp    $0x20,%eax
jne    11dd <main+0xbd>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    11e2 <main+0xc2>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11aa <main+0x8a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
cvtsi2ss %eax,%xmm0
mov    -0x14(%rbp),%esi
add    $0x1,%esi
lea    0xdff(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115a <main+0x3a>
cvtsi2ssl -0x18(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
lea    0xde4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
cvtsi2ssl -0x8(%rbp),%xmm1
divss  %xmm1,%xmm0
lea    0xdd8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2730,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x2728,%rsp
lea    0xec8(%rip),%rdi
xor    %ebp,%ebp
lea    0x4(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xorps  %xmm0,%xmm0
test   %eax,%eax
jle    1207 <main+0xe7>
movss  %xmm0,(%rsp)
lea    0xea8(%rip),%r12
lea    0x10(%rsp),%rbx
lea    0xea5(%rip),%r13
xor    %r14d,%r14d
xor    %r15d,%r15d
lea    0xe89(%rip),%rdi
lea    0xc(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0xc(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rax
movss  (%rsp),%xmm0
jmp    11b8 <main+0x98>
nopl   0x0(%rax)
add    $0x1,%r15d
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%cl
je     11b0 <main+0x90>
test   %cl,%cl
jne    11b4 <main+0x94>
addss  0x8(%rsp),%xmm0
movss  %xmm0,(%rsp)
mov    %r15d,%esi
add    $0x1,%esi
add    %r15d,%ebp
add    $0x1,%ebp
add    $0x1,%r14d
xorps  %xmm0,%xmm0
cvtsi2ss %r14d,%xmm0
mov    %r13,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    0x4(%rsp),%eax
cmp    %eax,%r14d
jl     1170 <main+0x50>
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
jmp    120f <main+0xef>
xorps  %xmm1,%xmm1
movss  %xmm1,(%rsp)
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
lea    0xe00(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xorps  %xmm1,%xmm1
cvtsi2ssl 0x4(%rsp),%xmm1
movss  (%rsp),%xmm0
divss  %xmm1,%xmm0
lea    0xdf0(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x2728,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%f%*c\00"
@.str.2 = [9 x i8] c"%[^\0A]%*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 i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca [10000 x i8]
store i32 0, i32* %1
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store float 0.000000e+00, float* %8
store i32 0, i32* %6
store i32 0, i32* %3
br label %11
11: ; preds = %53, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %56
15: ; preds = %11
store i32 0, i32* %5
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %7)
%17 = load float, float* %7
%18 = load float, float* %8
%19 = fadd float %18, %17
store float %19, float* %8
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), [10000 x i8]* %9)
store i32 0, i32* %4
br label %21
21: ; preds = %39, %15
%22 = load i32, i32* %4
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %42
28: ; preds = %21
%29 = load i32, i32* %4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10000 x i8], [10000 x i8]* %9, i64 0, i64 %30
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 32
br i1 %34, label %35, label %38
35: ; preds = %28
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %38
38: ; preds = %35, %28
br label %39
39: ; preds = %38
%40 = load i32, i32* %4
%41 = add nsw i32 %40, 1
store i32 %41, i32* %4
br label %21
42: ; preds = %21
%43 = load i32, i32* %5
%44 = add nsw i32 %43, 1
%45 = load i32, i32* %6
%46 = add nsw i32 %45, %44
store i32 %46, i32* %6
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
%49 = sitofp i32 %48 to float
%50 = load i32, i32* %5
%51 = add nsw i32 %50, 1
%52 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float %49, i32 %51)
br label %53
53: ; preds = %42
%54 = load i32, i32* %3
%55 = add nsw i32 %54, 1
store i32 %55, i32* %3
br label %11
56: ; preds = %11
%57 = load i32, i32* %6
%58 = sitofp i32 %57 to float
%59 = load i32, i32* %2
%60 = sitofp i32 %59 to float
%61 = fdiv float %58, %60
%62 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), float %61)
%63 = load float, float* %8
%64 = load i32, i32* %2
%65 = sitofp i32 %64 to float
%66 = fdiv float %63, %65
%67 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), float %66)
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"%f%*c\00"
@.str.2 = [9 x i8] c"%[^\0A]%*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 float
%3 = alloca [10000 x i8]
%4 = bitcast i32* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 0
%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 sgt i32 %8, 0
br i1 %9, label %10, label %38
10: ; preds = %0, %27
%11 = phi float [ %28, %27 ], [ 0.000000e+00, %0 ]
%12 = phi i32 [ %30, %27 ], [ 0, %0 ]
%13 = phi i32 [ %31, %27 ], [ 0, %0 ]
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), float* %2)
%15 = load float, float* %2
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), [10000 x i8]* %3)
br label %17
17: ; preds = %24, %10
%18 = phi i64 [ %26, %24 ], [ 0, %10 ]
%19 = phi i32 [ %25, %24 ], [ 0, %10 ]
%20 = getelementptr inbounds [10000 x i8], [10000 x i8]* %3, i64 0, i64 %18
%21 = load i8, i8* %20
switch i8 %21, label %24 [
i8 0, label %27
i8 32, label %22
]
22: ; preds = %17
%23 = add nsw i32 %19, 1
br label %24
24: ; preds = %17, %22
%25 = phi i32 [ %23, %22 ], [ %19, %17 ]
%26 = add nuw i64 %18, 1
br label %17
27: ; preds = %17
%28 = fadd float %11, %15
%29 = add nsw i32 %19, 1
%30 = add nsw i32 %29, %12
%31 = add nuw nsw i32 %13, 1
%32 = sitofp i32 %31 to float
%33 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0), float %32, i32 %29)
%34 = load i32, i32* %1
%35 = icmp slt i32 %31, %34
br i1 %35, label %10, label %36
36: ; preds = %27
%37 = sitofp i32 %30 to float
br label %38
38: ; preds = %36, %0
%39 = phi float [ 0.000000e+00, %0 ], [ %37, %36 ]
%40 = phi float [ 0.000000e+00, %0 ], [ %28, %36 ]
%41 = phi i32 [ %8, %0 ], [ %34, %36 ]
%42 = sitofp i32 %41 to float
%43 = fdiv float %39, %42
%44 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), float %43)
%45 = load i32, i32* %1
%46 = sitofp i32 %45 to float
%47 = fdiv float %40, %46
%48 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), float %47)
ret i32 0
}