#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() {
  char food[80];
  int a, i, l, j;
  float totaltak = 0, totaltim = 0, tim = 1, tak = 0;
  float r1, r2;
  scanf("%d", &a);
  for (i = 1; i <= a; i++) {
    scanf("%f", &tak);
    totaltak += tak;
    scanf(" %[^\n]", &food);
    for (j = 0;; j++) {
      if (food[j] == ' ') {
        tim = tim + 1;
      }
      if (food[j] == '\0') {
        break;
      }
    }
    printf("day %d: %.0f kg\n", i, tim);
    totaltim = totaltim + tim;
    tim = 1;
  }
  r1 = (float)(totaltim / a);
  r2 = (float)(totaltak / a);
  printf("%.2f kg by day\n", r1);
  printf("R$ %.2f by day\n", r2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x74(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x78(%rbp)
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x7c(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x80(%rbp)
lea    0xea6(%rip),%rdi
lea    -0x64(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x1,-0x68(%rbp)
mov    -0x68(%rbp),%eax
cmp    -0x64(%rbp),%eax
jg     124a <main+0x12a>
lea    0xe84(%rip),%rdi
lea    -0x80(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x80(%rbp),%xmm0
addss  -0x74(%rbp),%xmm0
movss  %xmm0,-0x74(%rbp)
lea    0xe66(%rip),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movl   $0x0,-0x70(%rbp)
movslq -0x70(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x20,%eax
jne    11da <main+0xba>
movss  0xe30(%rip),%xmm0
addss  -0x7c(%rbp),%xmm0
movss  %xmm0,-0x7c(%rbp)
movslq -0x70(%rbp),%rax
movsbl -0x60(%rbp,%rax,1),%eax
cmp    $0x0,%eax
jne    11f1 <main+0xd1>
jmp    1204 <main+0xe4>
jmp    11f6 <main+0xd6>
mov    -0x70(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x70(%rbp)
jmp    11b6 <main+0x96>
cvtsi2ssl -0x68(%rbp),%xmm0
movss  -0x7c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xdf8(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x78(%rbp),%xmm0
addss  -0x7c(%rbp),%xmm0
movss  %xmm0,-0x78(%rbp)
movss  0xdc9(%rip),%xmm0
movss  %xmm0,-0x7c(%rbp)
mov    -0x68(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x68(%rbp)
jmp    1170 <main+0x50>
movss  -0x78(%rbp),%xmm0
cvtsi2ssl -0x64(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x84(%rbp)
ff
movss  -0x74(%rbp),%xmm0
cvtsi2ssl -0x64(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x88(%rbp)
ff
movss  -0x84(%rbp),%xmm0
ff
lea    0xd9d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x88(%rbp),%xmm0
ff
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
movl   $0x0,0x14(%rsp)
lea    0xec7(%rip),%rdi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    0x18(%rsp),%eax
xorps  %xmm0,%xmm0
test   %eax,%eax
jle    1240 <main+0x120>
mov    $0x1,%ebp
lea    0xea3(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xe9a(%rip),%r12
lea    0x20(%rsp),%rbx
lea    0xe95(%rip),%r13
xorps  %xmm1,%xmm1
movss  %xmm1,0xc(%rsp)
jmp    11d9 <main+0xb9>
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
xorps  %xmm1,%xmm1
cvtss2sd %xmm2,%xmm1
mov    %r13,%rdi
mov    $0x2,%al
movss  %xmm2,0x10(%rsp)
call   1030 <printf@plt>
movss  0x1c(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
lea    0x1(%rbp),%ecx
mov    0x18(%rsp),%eax
cmp    %eax,%ebp
mov    %ecx,%ebp
jge    1249 <main+0x129>
movss  %xmm0,0x1c(%rsp)
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x14(%rsp),%xmm0
movss  %xmm0,0x10(%rsp)
mov    %r12,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rbx,%rax
movss  0xdf0(%rip),%xmm1
movaps %xmm1,%xmm0
movaps %xmm1,%xmm2
jmp    122f <main+0x10f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rax
movaps %xmm2,%xmm0
test   %cl,%cl
je     1190 <main+0x70>
movzbl (%rax),%ecx
addss  %xmm1,%xmm2
cmp    $0x20,%cl
je     1220 <main+0x100>
movaps %xmm0,%xmm2
jmp    1220 <main+0x100>
movss  %xmm0,0xc(%rsp)
xorps  %xmm0,%xmm0
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm2
divss  %xmm1,%xmm2
movss  %xmm2,0xc(%rsp)
lea    0xdb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xdb9(%rip),%rdi
movss  0xc(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%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 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c" %[^\0A]\00"
@.str.3 = [17 x i8] c"day %d: %.0f 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 [80 x i8]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
store i32 0, i32* %1
store float 0.000000e+00, float* %7
store float 0.000000e+00, float* %8
store float 1.000000e+00, float* %9
store float 0.000000e+00, float* %10
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %4
br label %14
14: ; preds = %55, %0
%15 = load i32, i32* %4
%16 = load i32, i32* %3
%17 = icmp sle i32 %15, %16
br i1 %17, label %18, label %58
18: ; preds = %14
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%20 = load float, float* %10
%21 = load float, float* %7
%22 = fadd float %21, %20
store float %22, float* %7
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), [80 x i8]* %2)
store i32 0, i32* %6
br label %24
24: ; preds = %43, %18
%25 = load i32, i32* %6
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %26
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 32
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load float, float* %9
%33 = fadd float %32, 1.000000e+00
store float %33, float* %9
br label %34
34: ; preds = %31, %24
%35 = load i32, i32* %6
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 %36
%38 = load i8, i8* %37
%39 = sext i8 %38 to i32
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %42
41: ; preds = %34
br label %46
42: ; preds = %34
br label %43
43: ; preds = %42
%44 = load i32, i32* %6
%45 = add nsw i32 %44, 1
store i32 %45, i32* %6
br label %24
46: ; preds = %41
%47 = load i32, i32* %4
%48 = sitofp i32 %47 to float
%49 = load float, float* %9
%50 = fpext float %49 to double
%51 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), float %48, double %50)
%52 = load float, float* %8
%53 = load float, float* %9
%54 = fadd float %52, %53
store float %54, float* %8
store float 1.000000e+00, float* %9
br label %55
55: ; preds = %46
%56 = load i32, i32* %4
%57 = add nsw i32 %56, 1
store i32 %57, i32* %4
br label %14
58: ; preds = %14
%59 = load float, float* %8
%60 = load i32, i32* %3
%61 = sitofp i32 %60 to float
%62 = fdiv float %59, %61
store float %62, float* %11
%63 = load float, float* %7
%64 = load i32, i32* %3
%65 = sitofp i32 %64 to float
%66 = fdiv float %63, %65
store float %66, float* %12
%67 = load float, float* %11
%68 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.4, i64 0, i64 0), float %67)
%69 = load float, float* %12
%70 = call i32 (i8*, float, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.5, i64 0, i64 0), float %69)
ret i32 0
}

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