#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 n = 0, sum = 0, a = 0, i = 0;
  float avr = 0;
  do {
    scanf("%d", &n);
  } while (n < 1 || n > 9999);
  while (n > 0) {
    a = n % 10;
    sum = sum + a;
    n = n / 10;
    ++i;
  }
  avr = (float)sum / i;
  if (avr > 7)
    printf("heavy");
  else
    printf("light");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
lea    0xeaa(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jl     117f <main+0x5f>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1153 <main+0x33>
jmp    118f <main+0x6f>
cmpl   $0x0,-0x8(%rbp)
jle    11cc <main+0xac>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118f <main+0x6f>
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe14(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1206 <main+0xe6>
lea    0xe0b(%rip),%rdi
call   1030 <printf@plt>
jmp    1212 <main+0xf2>
lea    0xe00(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
movl   $0x0,0x4(%rsp)
lea    0xee1(%rip),%r14
lea    0x4(%rsp),%rbx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
lea    -0x2710(%rax),%ecx
cmp    $0xffffd8f1,%ecx
jb     1140 <main+0x20>
pxor   %xmm0,%xmm0
mov    $0xcccccccd,%ecx
movaps 0xe93(%rip),%xmm1
nopl   (%rax)
mov    %eax,%edx
mov    %eax,%eax
imul   %rcx,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
movd   %edi,%xmm2
movaps %xmm1,%xmm3
movss  %xmm2,%xmm3
paddd  %xmm3,%xmm0
cmp    $0x9,%edx
ja     1170 <main+0x50>
mov    %eax,0x4(%rsp)
cvtdq2ps %xmm0,%xmm0
movaps %xmm0,%xmm1
shufps $0x55,%xmm0,%xmm1
divss  %xmm1,%xmm0
ucomiss 0xe5d(%rip),%xmm0
lea    0xe5d(%rip),%rax
lea    0xe5c(%rip),%rdi
cmova  %rax,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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