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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jl     1169 <main+0x49>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    113d <main+0x1d>
jmp    1179 <main+0x59>
cmpl   $0x0,-0x8(%rbp)
jle    11c6 <main+0xa6>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%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)
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1179 <main+0x59>
movss  0xe32(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    11e4 <main+0xc4>
lea    0xe28(%rip),%rdi
call   1030 <printf@plt>
movss  -0x18(%rbp),%xmm0
movss  0xe0f(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1206 <main+0xe6>
lea    0xe0c(%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
lea    0xed5(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
lea    -0x2710(%rdx),%eax
cmp    $0xffffd8f1,%eax
jb     1130 <main+0x10>
xor    %ecx,%ecx
mov    $0xcccccccd,%r8d
xor    %eax,%eax
cs nopw 0x0(%rax,%rax,1)
mov    %edx,%esi
mov    %edx,%edx
imul   %r8,%rdx
shr    $0x23,%rdx
lea    (%rdx,%rdx,1),%ebx
lea    (%rbx,%rbx,4),%ebx
mov    %esi,%edi
sub    %ebx,%edi
add    %edi,%eax
add    $0x1,%ecx
cmp    $0x9,%esi
ja     1160 <main+0x40>
mov    %edx,0x4(%rsp)
xor    %edx,%edx
div    %ecx
mov    %eax,%ebx
cmp    $0x6,%eax
ja     119b <main+0x7b>
lea    0xe6d(%rip),%rdi
call   1030 <printf@plt>
cmp    $0x8,%ebx
jb     11ac <main+0x8c>
lea    0xe62(%rip),%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"light\00"
@.str.2 = [6 x i8] c"heavy\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* %4
store i32 0, i32* %5
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 %35
21: ; preds = %18
%22 = load i32, i32* %2
%23 = srem i32 %22, 10
store i32 %23, i32* %3
%24 = load i32, i32* %4
%25 = load i32, i32* %3
%26 = add nsw i32 %24, %25
store i32 %26, i32* %4
%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
%31 = load i32, i32* %4
%32 = load i32, i32* %5
%33 = sdiv i32 %31, %32
%34 = sitofp i32 %33 to float
store float %34, float* %6
br label %18
35: ; preds = %18
%36 = load float, float* %6
%37 = fcmp olt float %36, 7.000000e+00
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %35
%41 = load float, float* %6
%42 = fcmp ogt float %41, 7.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [6 x i8] c"light\00"
@.str.2 = [6 x i8] c"heavy\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
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 [ %15, %8 ], [ 0, %3 ]
%10 = phi i32 [ %13, %8 ], [ 0, %3 ]
%11 = phi i32 [ %14, %8 ], [ %5, %3 ]
%12 = urem i32 %11, 10
%13 = add nuw nsw i32 %10, %12
%14 = udiv i32 %11, 10
%15 = add nuw nsw i32 %9, 1
%16 = icmp ult i32 %11, 10
br i1 %16, label %17, label %8
17: ; preds = %8
store i32 %14, i32* %1
%18 = udiv i32 %13, %15
%19 = icmp ult i32 %18, 7
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %17
%23 = icmp ugt i32 %18, 7
br i1 %23, label %24, label %26
24: ; preds = %22
%25 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %26
26: ; preds = %24, %22
ret i32 0
}