#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 c, m, sum = 0, br = 0, avr;
  do {
    scanf("%d", &m);
    do {
      c = m % 10;
      sum = sum + c;
      m = m / 10;
      br++;
    } while (m > 0);
    avr = sum / br;
    if (avr > 7)
      printf("heavy");
    else
      printf("light");
  } while (c < 1 || c > 9999);
}


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    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0xc(%rbp)
jg     114d <main+0x2d>
mov    -0x10(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x18(%rbp)
cmpl   $0x7,-0x18(%rbp)
jle    11aa <main+0x8a>
lea    0xe63(%rip),%rdi
call   1030 <printf@plt>
jmp    11b6 <main+0x96>
lea    0xe58(%rip),%rdi
call   1030 <printf@plt>
jmp    11bb <main+0x9b>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jl     11d7 <main+0xb7>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    113d <main+0x1d>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
xor    %ebx,%ebx
lea    0x4(%rsp),%r15
lea    0xeca(%rip),%r12
lea    0xec9(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xea9(%rip),%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
mov    %ecx,%r14d
sub    %edx,%r14d
add    %r14d,%ebp
add    $0x1,%ebx
cmp    $0x9,%ecx
jg     1170 <main+0x50>
mov    %eax,0x4(%rsp)
mov    %ebp,%eax
cltd
idiv   %ebx
cmp    $0x8,%eax
mov    %r13,%rdi
cmovge %r12,%rdi
call   1030 <printf@plt>
test   %r14d,%r14d
jle    1150 <main+0x30>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
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 i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %39, %0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %9
9: ; preds = %19, %7
%10 = load i32, i32* %3
%11 = srem i32 %10, 10
store i32 %11, i32* %2
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = add nsw i32 %12, %13
store i32 %14, i32* %4
%15 = load i32, i32* %3
%16 = sdiv i32 %15, 10
store i32 %16, i32* %3
%17 = load i32, i32* %5
%18 = add nsw i32 %17, 1
store i32 %18, i32* %5
br label %19
19: ; preds = %9
%20 = load i32, i32* %3
%21 = icmp sgt i32 %20, 0
br i1 %21, label %9, label %22
22: ; preds = %19
%23 = load i32, i32* %4
%24 = load i32, i32* %5
%25 = sdiv i32 %23, %24
store i32 %25, i32* %6
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, 7
br i1 %27, label %28, label %30
28: ; preds = %22
%29 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
br label %32
30: ; preds = %22
%31 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %32
32: ; preds = %30, %28
br label %33
33: ; preds = %32
%34 = load i32, i32* %2
%35 = icmp slt i32 %34, 1
br i1 %35, label %39, label %36
36: ; preds = %33
%37 = load i32, i32* %2
%38 = icmp sgt i32 %37, 9999
br label %39
39: ; preds = %36, %33
%40 = phi i1 [ true, %33 ], [ %38, %36 ]
br i1 %40, label %7, label %41
41: ; preds = %39
%42 = load i32, i32* %1
ret i32 %42
}

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*
br label %3
3: ; preds = %17, %0
%4 = phi i32 [ 0, %0 ], [ %15, %17 ]
%5 = phi i32 [ 0, %0 ], [ %13, %17 ]
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
br label %8
8: ; preds = %8, %3
%9 = phi i32 [ %14, %8 ], [ %7, %3 ]
%10 = phi i32 [ %15, %8 ], [ %4, %3 ]
%11 = phi i32 [ %13, %8 ], [ %5, %3 ]
%12 = srem i32 %9, 10
%13 = add nsw i32 %11, %12
%14 = sdiv i32 %9, 10
%15 = add nsw i32 %10, 1
%16 = icmp sgt i32 %9, 9
br i1 %16, label %8, label %17
17: ; preds = %8
store i32 %14, i32* %1
%18 = sdiv i32 %13, %15
%19 = icmp sgt i32 %18, 7
%20 = select i1 %19, 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)
%21 = call i32 @printf(i8* dereferenceable(1) %20)
%22 = icmp slt i32 %12, 1
br i1 %22, label %3, label %23
23: ; preds = %17
ret i32 0
}