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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xecb(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0xe5(%rbp)
jl     1164 <main+0x44>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0xe5(%rbp)
mov    -0xe5(%rbp),%al
test   $0x1,%al
jne    1132 <main+0x12>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x10(%rbp),%rax
mov    %edx,-0xe0(%rbp,%rax,4)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
movslq -0x10(%rbp),%rcx
add    -0xe0(%rbp,%rcx,4),%eax
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x9,-0x8(%rbp)
jg     1180 <main+0x60>
cmpl   $0x1,-0x8(%rbp)
jl     11db <main+0xbb>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
cvtsi2ssl -0xc(%rbp),%xmm0
cvtsi2ssl -0x10(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0xe4(%rbp)
ff
movss  0xe07(%rip),%xmm0
ucomiss -0xe4(%rbp),%xmm0
jb     1212 <main+0xf2>
lea    0xdfa(%rip),%rdi
call   1030 <printf@plt>
movss  -0xe4(%rbp),%xmm0
ff
movss  0xdde(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    1237 <main+0x117>
lea    0xddb(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0xf0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xed9(%rip),%r14
mov    %rsp,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
lea    -0x2710(%rax),%ecx
cmp    $0xffffd8f1,%ecx
jb     1130 <main+0x10>
xor    %edx,%edx
mov    $0x1,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,%esi
movslq %eax,%rdi
imul   $0x66666667,%rdi,%rax
mov    %rax,%rbx
shr    $0x3f,%rbx
sar    $0x22,%rax
add    %ebx,%eax
lea    (%rax,%rax,1),%ebx
lea    (%rbx,%rbx,4),%r8d
mov    %edi,%ebx
sub    %r8d,%ebx
add    %ebx,%edx
add    $0x1,%ecx
cmp    $0x63,%edi
jg     1160 <main+0x40>
xor    %edi,%edi
cmp    $0xa,%esi
cmovge %eax,%edi
add    %edi,%edx
cvtsi2ss %edx,%xmm1
mov    %eax,(%rsp)
cvtsi2ss %ecx,%xmm0
divss  %xmm0,%xmm1
movss  0xe50(%rip),%xmm0
ucomiss %xmm1,%xmm0
jb     11cd <main+0xad>
lea    0xe4b(%rip),%rdi
movss  %xmm1,0x4(%rsp)
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm1
ucomiss 0xe2c(%rip),%xmm1
jbe    11e2 <main+0xc2>
lea    0xe30(%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"heavi\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca [50 x i32]
%6 = alloca float
store i32 0, i32* %1
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
store i32 1, i32* %4
store i32 0, i32* %3
br label %18
18: ; preds = %34, %17
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
%21 = load i32, i32* %4
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds [50 x i32], [50 x i32]* %5, i64 0, i64 %22
store i32 %20, i32* %23
%24 = load i32, i32* %2
%25 = sdiv i32 %24, 10
store i32 %25, i32* %2
%26 = load i32, i32* %3
%27 = load i32, i32* %4
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [50 x i32], [50 x i32]* %5, i64 0, i64 %28
%30 = load i32, i32* %29
%31 = add nsw i32 %26, %30
store i32 %31, i32* %3
%32 = load i32, i32* %4
%33 = add nsw i32 %32, 1
store i32 %33, i32* %4
br label %34
34: ; preds = %18
%35 = load i32, i32* %2
%36 = icmp sgt i32 %35, 9
br i1 %36, label %18, label %37
37: ; preds = %34
%38 = load i32, i32* %2
%39 = icmp sge i32 %38, 1
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = load i32, i32* %3
%42 = load i32, i32* %2
%43 = add nsw i32 %41, %42
store i32 %43, i32* %3
br label %44
44: ; preds = %40, %37
%45 = load i32, i32* %3
%46 = sitofp i32 %45 to float
%47 = load i32, i32* %4
%48 = sitofp i32 %47 to float
%49 = fdiv float %46, %48
store float %49, float* %6
%50 = load float, float* %6
%51 = fcmp ole float %50, 7.000000e+00
br i1 %51, label %52, label %54
52: ; preds = %44
%53 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %54
54: ; preds = %52, %44
%55 = load float, float* %6
%56 = fcmp ogt float %55, 7.000000e+00
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %59
59: ; preds = %57, %54
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"heavi\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 [ %13, %8 ], [ %5, %3 ]
%10 = phi i32 [ %15, %8 ], [ 1, %3 ]
%11 = phi i32 [ %14, %8 ], [ 0, %3 ]
%12 = srem i32 %9, 10
%13 = sdiv i32 %9, 10
%14 = add nsw i32 %11, %12
%15 = add nuw nsw i32 %10, 1
%16 = icmp sgt i32 %9, 99
br i1 %16, label %8, label %17
17: ; preds = %8
store i32 %13, i32* %1
%18 = icmp sgt i32 %9, 9
%19 = select i1 %18, i32 %13, i32 0
%20 = add nsw i32 %14, %19
%21 = sitofp i32 %20 to float
%22 = sitofp i32 %15 to float
%23 = fdiv float %21, %22
%24 = fcmp ugt float %23, 7.000000e+00
br i1 %24, label %27, label %25
25: ; preds = %17
%26 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %17
%28 = fcmp ogt float %23, 7.000000e+00
br i1 %28, label %29, label %31
29: ; preds = %27
%30 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %27
ret i32 0
}