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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     118c <main+0x6c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    -0x14(%rbp),%eax
add    %edx,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    114d <main+0x2d>
mov    -0xc(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0xc(%rbp)
cmpl   $0x7,-0xc(%rbp)
jg     11ac <main+0x8c>
lea    0xe5c(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x7,-0xc(%rbp)
jle    11c2 <main+0xa2>
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%edx
test   %edx,%edx
je     118e <main+0x6e>
xor    %ecx,%ecx
xor    %eax,%eax
xchg   %ax,%ax
movslq %edx,%rsi
imul   $0x66666667,%rsi,%rdx
mov    %rdx,%rdi
shr    $0x3f,%rdi
sar    $0x22,%rdx
add    %edi,%edx
lea    (%rdx,%rdx,1),%edi
lea    (%rdi,%rdi,4),%r8d
mov    %esi,%edi
sub    %r8d,%edi
add    %edi,%eax
add    $0x1,%ecx
add    $0x9,%esi
cmp    $0x12,%esi
ja     1140 <main+0x20>
mov    %edx,0x4(%rsp)
cltd
idiv   %ecx
cmp    $0x8,%eax
lea    0xe88(%rip),%rax
lea    0xe7b(%rip),%rdi
cmovl  %rax,%rdi
jmp    1195 <main+0x75>
lea    0xe74(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [7 x i8] c"light\0A\00"
@.str.2 = [7 x i8] c"heavy\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %9, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i32, i32* %3
%11 = load i32, i32* %2
%12 = srem i32 %11, 10
%13 = add nsw i32 %10, %12
store i32 %13, i32* %3
%14 = load i32, i32* %2
%15 = sdiv i32 %14, 10
store i32 %15, i32* %2
%16 = load i32, i32* %4
%17 = add nsw i32 %16, 1
store i32 %17, i32* %4
br label %6
18: ; preds = %6
%19 = load i32, i32* %3
%20 = load i32, i32* %4
%21 = sdiv i32 %19, %20
store i32 %21, i32* %3
%22 = load i32, i32* %3
%23 = icmp sle i32 %22, 7
br i1 %23, label %24, label %26
24: ; preds = %18
%25 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %18
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 7
br i1 %28, label %29, label %31
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %31
31: ; preds = %29, %26
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@str = [6 x i8] c"heavy\00"
@str.3 = [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 eq i32 %4, 0
br i1 %5, label %20, label %6
6: ; preds = %0, %6
%7 = phi i32 [ %13, %6 ], [ 0, %0 ]
%8 = phi i32 [ %11, %6 ], [ 0, %0 ]
%9 = phi i32 [ %12, %6 ], [ %4, %0 ]
%10 = srem i32 %9, 10
%11 = add nsw i32 %8, %10
%12 = sdiv i32 %9, 10
%13 = add nuw nsw i32 %7, 1
%14 = add i32 %9, 9
%15 = icmp ult i32 %14, 19
br i1 %15, label %16, label %6
16: ; preds = %6
store i32 %12, i32* %1
%17 = sdiv i32 %11, %13
%18 = icmp slt i32 %17, 8
%19 = select i1 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0)
br label %20
20: ; preds = %16, %0
%21 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str.3, i64 0, i64 0), %0 ], [ %19, %16 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
ret i32 0
}