#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, b, i;
  float avg = 0;
  do {
    scanf("%d", &n);
  } while (n < 1 && n > 9999);
  for (i = 0; n > 0; n = n / 10) {
    b = n % 10;
    avg = avg + b;
    i++;
  }
  avg = avg / i;
  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)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x14(%rbp)
lea    0xec6(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jge    1163 <main+0x43>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1137 <main+0x17>
movl   $0x0,-0x10(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    11bc <main+0x9c>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0xc(%rbp)
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0xc(%rbp),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x55>
movss  -0x14(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
movss  0xe24(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11f6 <main+0xd6>
lea    0xe1b(%rip),%rdi
call   1030 <printf@plt>
jmp    1202 <main+0xe2>
lea    0xe10(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xedc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jle    119a <main+0x7a>
xor    %ecx,%ecx
xorps  %xmm0,%xmm0
mov    $0xcccccccd,%r8d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%edx
mov    %eax,%eax
imul   %r8,%rax
shr    $0x23,%rax
lea    (%rax,%rax,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %edx,%esi
sub    %edi,%esi
xorps  %xmm1,%xmm1
cvtsi2ss %esi,%xmm1
addss  %xmm1,%xmm0
add    $0x1,%ecx
cmp    $0x9,%edx
ja     1150 <main+0x30>
mov    %eax,0x4(%rsp)
xorps  %xmm1,%xmm1
cvtsi2ss %ecx,%xmm1
divss  %xmm1,%xmm0
ucomiss 0xe71(%rip),%xmm0
jbe    119a <main+0x7a>
lea    0xe6f(%rip),%rdi
jmp    11a1 <main+0x81>
lea    0xe6c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
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
store i32 0, i32* %1
store float 0.000000e+00, float* %5
br label %6
6: ; preds = %14, %0
%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 = %6
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 1
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sgt i32 %12, 9999
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ false, %8 ], [ %13, %11 ]
br i1 %15, label %6, label %16
16: ; preds = %14
store i32 0, i32* %4
br label %17
17: ; preds = %29, %16
%18 = load i32, i32* %2
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %32
20: ; preds = %17
%21 = load i32, i32* %2
%22 = srem i32 %21, 10
store i32 %22, i32* %3
%23 = load float, float* %5
%24 = load i32, i32* %3
%25 = sitofp i32 %24 to float
%26 = fadd float %23, %25
store float %26, float* %5
%27 = load i32, i32* %4
%28 = add nsw i32 %27, 1
store i32 %28, i32* %4
br label %29
29: ; preds = %20
%30 = load i32, i32* %2
%31 = sdiv i32 %30, 10
store i32 %31, i32* %2
br label %17
32: ; preds = %17
%33 = load float, float* %5
%34 = load i32, i32* %4
%35 = sitofp i32 %34 to float
%36 = fdiv float %33, %35
store float %36, float* %5
%37 = load float, float* %5
%38 = fcmp ogt float %37, 7.000000e+00
br i1 %38, label %39, label %41
39: ; preds = %32
%40 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %43
41: ; preds = %32
%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*
%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
%5 = icmp sgt i32 %4, 0
br i1 %5, label %6, label %20
6: ; preds = %0, %6
%7 = phi float [ %12, %6 ], [ 0.000000e+00, %0 ]
%8 = phi i32 [ %13, %6 ], [ 0, %0 ]
%9 = phi i32 [ %14, %6 ], [ %4, %0 ]
%10 = urem i32 %9, 10
%11 = sitofp i32 %10 to float
%12 = fadd float %7, %11
%13 = add nuw nsw i32 %8, 1
%14 = udiv i32 %9, 10
%15 = icmp ult i32 %9, 10
br i1 %15, label %16, label %6
16: ; preds = %6
store i32 %14, i32* %1
%17 = sitofp i32 %13 to float
%18 = fdiv float %12, %17
%19 = fcmp ogt float %18, 7.000000e+00
br i1 %19, label %21, label %20
20: ; preds = %0, %16
br label %21
21: ; preds = %16, %20
%22 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), %20 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), %16 ]
%23 = call i32 @printf(i8* dereferenceable(1) %22)
ret i32 0
}