#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 *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a;
  float sum = 0;
  float avg = 0;
  int c, br = 0;
  scanf("%d", &a);
  do {
    c = a % 10;
    sum = sum + c;
    a = a / 10;
    br++;
  } while (a > 0);
  avg = sum / br;
  if (avg > 7)
    printf("heavy\n");
  else
    printf("light");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0xc(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xeb7(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1156 <main+0x36>
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x18(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x10(%rbp),%xmm0
movss  0xe48(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11d2 <main+0xb2>
lea    0xe3f(%rip),%rdi
call   1030 <printf@plt>
jmp    11de <main+0xbe>
lea    0xe35(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xecc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
xorps  %xmm0,%xmm0
mov    0x4(%rsp),%ecx
nopl   0x0(%rax,%rax,1)
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rcx
add    %esi,%ecx
lea    (%rcx,%rcx,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
xorps  %xmm1,%xmm1
cvtsi2ss %edi,%xmm1
addss  %xmm1,%xmm0
add    $0x1,%eax
cmp    $0x9,%edx
jg     1150 <main+0x20>
mov    %ecx,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm0
ucomiss 0xe66(%rip),%xmm0
jbe    11aa <main+0x7a>
lea    0xe6a(%rip),%rdi
call   1030 <puts@plt>
jmp    11b6 <main+0x86>
lea    0xe56(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"heavy\0A\00"
@.str.2 = [6 x i8] c"light\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
%4 = alloca float
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store float 0.000000e+00, float* %3
store float 0.000000e+00, float* %4
store i32 0, i32* %6
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %19, %0
%9 = load i32, i32* %2
%10 = srem i32 %9, 10
store i32 %10, i32* %5
%11 = load float, float* %3
%12 = load i32, i32* %5
%13 = sitofp i32 %12 to float
%14 = fadd float %11, %13
store float %14, float* %3
%15 = load i32, i32* %2
%16 = sdiv i32 %15, 10
store i32 %16, i32* %2
%17 = load i32, i32* %6
%18 = add nsw i32 %17, 1
store i32 %18, i32* %6
br label %19
19: ; preds = %8
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 0
br i1 %21, label %8, label %22
22: ; preds = %19
%23 = load float, float* %3
%24 = load i32, i32* %6
%25 = sitofp i32 %24 to float
%26 = fdiv float %23, %25
store float %26, float* %4
%27 = load float, float* %4
%28 = fcmp ogt float %27, 7.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %22
%30 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %33
31: ; preds = %22
%32 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %33
33: ; preds = %31, %29
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.2 = [6 x i8] c"light\00"
@str = [6 x i8] c"heavy\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
br label %5
5: ; preds = %5, %0
%6 = phi i32 [ %12, %5 ], [ %4, %0 ]
%7 = phi float [ %11, %5 ], [ 0.000000e+00, %0 ]
%8 = phi i32 [ %13, %5 ], [ 0, %0 ]
%9 = srem i32 %6, 10
%10 = sitofp i32 %9 to float
%11 = fadd float %7, %10
%12 = sdiv i32 %6, 10
%13 = add nuw nsw i32 %8, 1
%14 = icmp sgt i32 %6, 9
br i1 %14, label %5, label %15
15: ; preds = %5
store i32 %12, i32* %1
%16 = sitofp i32 %13 to float
%17 = fdiv float %11, %16
%18 = fcmp ogt float %17, 7.000000e+00
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
br label %23
21: ; preds = %15
%22 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %21, %19
ret i32 0
}