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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x15(%rbp)
jle    115b <main+0x3b>
cmpl   $0x2710,-0x8(%rbp)
setge  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    112f <main+0xf>
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x1c(%rbp),%eax
add    %edx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1174 <main+0x54>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xe3a(%rip),%xmm0
ucomiss -0x14(%rbp),%xmm0
jbe    11dc <main+0xbc>
lea    0xe30(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  0xe17(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11fe <main+0xde>
lea    0xe14(%rip),%rdi
call   1030 <printf@plt>
movss  -0x14(%rbp),%xmm0
movss  0xdf5(%rip),%xmm1
ucomiss %xmm1,%xmm0
jne    1226 <main+0x106>
jp     1226 <main+0x106>
lea    0xde6(%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),%ecx
lea    -0x2710(%rcx),%eax
cmp    $0xffffd8f1,%eax
jb     1130 <main+0x10>
xor    %eax,%eax
xor    %esi,%esi
movslq %ecx,%rdx
imul   $0x66666667,%rdx,%rcx
mov    %rcx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rcx
add    %edi,%ecx
lea    (%rcx,%rcx,1),%edi
lea    (%rdi,%rdi,4),%edi
mov    %edx,%ebx
sub    %edi,%ebx
add    %ebx,%eax
add    $0x1,%esi
add    $0x9,%edx
cmp    $0x12,%edx
ja     1150 <main+0x30>
mov    %ecx,0x4(%rsp)
cltd
idiv   %esi
cmp    $0x8,%eax
lea    0xe74(%rip),%rax
lea    0xe73(%rip),%rdi
cmovl  %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"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 float
store i32 0, i32* %1
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 sle i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %8
%12 = load i32, i32* %2
%13 = icmp sge i32 %12, 10000
br label %14
14: ; preds = %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ]
br i1 %15, label %6, label %16
16: ; preds = %14
store i32 0, i32* %3
store i32 0, i32* %4
br label %17
17: ; preds = %26, %16
%18 = load i32, i32* %4
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
%21 = add nsw i32 %18, %20
store i32 %21, i32* %4
%22 = load i32, i32* %2
%23 = sdiv i32 %22, 10
store i32 %23, i32* %2
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %26
26: ; preds = %17
%27 = load i32, i32* %2
%28 = icmp ne i32 %27, 0
br i1 %28, label %17, label %29
29: ; preds = %26
%30 = load i32, i32* %4
%31 = load i32, i32* %3
%32 = sdiv i32 %30, %31
%33 = sitofp i32 %32 to float
store float %33, float* %5
%34 = load float, float* %5
%35 = fcmp olt float %34, 7.000000e+00
br i1 %35, label %36, label %38
36: ; preds = %29
%37 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %29
%39 = load float, float* %5
%40 = fcmp ogt float %39, 7.000000e+00
br i1 %40, label %41, label %43
41: ; preds = %38
%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, %38
%44 = load float, float* %5
%45 = fcmp oeq float %44, 7.000000e+00
br i1 %45, label %46, label %48
46: ; preds = %43
%47 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
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 [ %14, %8 ], [ %5, %3 ]
%10 = phi i32 [ %13, %8 ], [ 0, %3 ]
%11 = phi i32 [ %15, %8 ], [ 0, %3 ]
%12 = srem i32 %9, 10
%13 = add nsw i32 %12, %10
%14 = sdiv i32 %9, 10
%15 = add nuw nsw i32 %11, 1
%16 = add nsw i32 %9, 9
%17 = icmp ult i32 %16, 19
br i1 %17, label %18, label %8
18: ; preds = %8
store i32 %14, i32* %1
%19 = sdiv i32 %13, %15
%20 = icmp slt i32 %19, 8
%21 = select i1 %20, 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)
%22 = call i32 @printf(i8* dereferenceable(1) %21)
ret i32 0
}