#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 = 0, b, sum = 0;
  float avg, n;
  while (a <= 1 || a >= 9999)
    scanf("%d", &a);
  for (n = 0; a != 0;) {
    b = a % 10;
    a = a / 10;
    sum = sum + b;
    n = n + 1;
  }
  avg = sum / n;
  if (avg > 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,-0x10(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jle    1159 <main+0x39>
cmpl   $0x270f,-0x8(%rbp)
setge  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1169 <main+0x49>
jmp    117e <main+0x5e>
lea    0xe98(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    113d <main+0x1d>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     11cc <main+0xac>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
movss  0xe47(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1186 <main+0x66>
cvtsi2ssl -0x10(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe18(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1202 <main+0xe2>
lea    0xe13(%rip),%rdi
call   1030 <printf@plt>
jmp    120e <main+0xee>
lea    0xe08(%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    0xed5(%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    -0x270f(%rax),%ecx
cmp    $0xffffd8f3,%ecx
jb     1140 <main+0x20>
xor    %ecx,%ecx
xorps  %xmm0,%xmm0
movss  0xe96(%rip),%xmm1
nopw   0x0(%rax,%rax,1)
movslq %eax,%rdx
imul   $0x66666667,%rdx,%rax
mov    %rax,%rsi
shr    $0x3f,%rsi
sar    $0x22,%rax
add    %esi,%eax
lea    (%rax,%rax,1),%esi
lea    (%rsi,%rsi,4),%esi
mov    %edx,%edi
sub    %esi,%edi
add    %edi,%ecx
addss  %xmm1,%xmm0
add    $0x9,%edx
cmp    $0x12,%edx
ja     1170 <main+0x50>
mov    %eax,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
divss  %xmm0,%xmm1
ucomiss 0xe4f(%rip),%xmm1
lea    0xe4f(%rip),%rax
lea    0xe4e(%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 float
%6 = alloca float
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %4
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %2
%9 = icmp sle i32 %8, 1
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* %2
%12 = icmp sge i32 %11, 9999
br label %13
13: ; preds = %10, %7
%14 = phi i1 [ true, %7 ], [ %12, %10 ]
br i1 %14, label %15, label %17
15: ; preds = %13
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %7
17: ; preds = %13
store float 0.000000e+00, float* %6
br label %18
18: ; preds = %21, %17
%19 = load i32, i32* %2
%20 = icmp ne 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* %3
%24 = load i32, i32* %2
%25 = sdiv i32 %24, 10
store i32 %25, i32* %2
%26 = load i32, i32* %4
%27 = load i32, i32* %3
%28 = add nsw i32 %26, %27
store i32 %28, i32* %4
%29 = load float, float* %6
%30 = fadd float %29, 1.000000e+00
store float %30, float* %6
br label %18
31: ; preds = %18
%32 = load i32, i32* %4
%33 = sitofp i32 %32 to float
%34 = load float, float* %6
%35 = fdiv float %33, %34
store float %35, float* %5
%36 = load float, float* %5
%37 = fcmp ogt float %36, 7.000000e+00
br i1 %37, label %38, label %40
38: ; preds = %31
%39 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %42
40: ; preds = %31
%41 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %40, %38
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 = %0, %3
%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, -9999
%7 = icmp ult i32 %6, -9997
br i1 %7, label %3, label %8
8: ; preds = %3, %8
%9 = phi float [ %15, %8 ], [ 0.000000e+00, %3 ]
%10 = phi i32 [ %14, %8 ], [ 0, %3 ]
%11 = phi i32 [ %13, %8 ], [ %5, %3 ]
%12 = srem i32 %11, 10
%13 = sdiv i32 %11, 10
%14 = add nsw i32 %10, %12
%15 = fadd float %9, 1.000000e+00
%16 = add nsw i32 %11, 9
%17 = icmp ult i32 %16, 19
br i1 %17, label %18, label %8
18: ; preds = %8
store i32 %13, i32* %1
%19 = sitofp i32 %14 to float
%20 = fdiv float %19, %15
%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
}