#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, i = 0, b, c, d, e, f = 0, g;
  do {
    scanf("%d", &a);
  } while (a < 0 && a > 10000);
  while (a > 0) {
    b = a % 10;
    a = a / 10;
    i++;
    c = a % 10;
    a = a / 10;
    i++;
    d = a % 10;
    a = a / 10;
    i++;
    e = a % 10;
    a = a / 10;
    i++;
  }
  f = b + c + d + e;
  g = f / i;
  if (g > 7)
    printf("\n heavy");
  if (g < 7)
    printf("\n light");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xebc(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
xor    %eax,%eax
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x25(%rbp)
jge    1169 <main+0x49>
cmpl   $0x2710,-0x8(%rbp)
setg   %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    113d <main+0x1d>
jmp    1179 <main+0x59>
cmpl   $0x0,-0x8(%rbp)
jle    121c <main+0xfc>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-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)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%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)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%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)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x1c(%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)
jmp    1179 <main+0x59>
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
add    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cltd
idivl  -0xc(%rbp)
mov    %eax,-0x24(%rbp)
cmpl   $0x7,-0x24(%rbp)
jle    124b <main+0x12b>
lea    0xdbd(%rip),%rdi
call   1030 <printf@plt>
cmpl   $0x7,-0x24(%rbp)
jge    1261 <main+0x141>
lea    0xdaf(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%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),%eax
lea    0xec6(%rip),%rdi
test   %eax,%eax
jle    11fa <main+0xda>
xor    %ecx,%ecx
mov    $0xd1b71759,%edx
nopl   0x0(%rax)
mov    %eax,%esi
mov    %eax,%eax
imul   %rdx,%rax
shr    $0x2d,%rax
add    $0x4,%ecx
cmp    $0x270f,%esi
ja     1150 <main+0x30>
mov    %eax,0x4(%rsp)
movzwl %si,%r8d
imul   $0xcccd,%r8d,%eax
shr    $0x13,%eax
lea    (%rax,%rax,1),%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%esi
imul   $0xcccd,%eax,%edx
shr    $0x12,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %edx,%eax
add    %esi,%eax
mov    %r8d,%edx
shr    $0x2,%edx
imul   $0x147b,%edx,%edx
shr    $0x11,%edx
movzbl %dl,%edx
imul   $0xcd,%edx,%esi
shr    $0xa,%esi
and    $0xfffffffe,%esi
lea    (%rsi,%rsi,4),%esi
sub    %sil,%dl
movzbl %dl,%r9d
shr    $0x3,%r8d
imul   $0x20c5,%r8d,%esi
shr    $0x14,%esi
imul   $0xcd,%esi,%edx
shr    $0xa,%edx
and    $0xfffffffe,%edx
lea    (%rdx,%rdx,4),%edx
sub    %dl,%sil
movzbl %sil,%edx
movzwl %ax,%eax
add    %r9d,%eax
add    %edx,%eax
xor    %edx,%edx
div    %ecx
cmp    $0x7,%eax
ja     11fa <main+0xda>
je     11ff <main+0xdf>
lea    0xe11(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"\0A heavy\00"
@.str.2 = [8 x i8] c"\0A light\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %8
br label %10
10: ; preds = %18, %0
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %12
12: ; preds = %10
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %12
%16 = load i32, i32* %2
%17 = icmp sgt i32 %16, 10000
br label %18
18: ; preds = %15, %12
%19 = phi i1 [ false, %12 ], [ %17, %15 ]
br i1 %19, label %10, label %20
20: ; preds = %18
br label %21
21: ; preds = %24, %20
%22 = load i32, i32* %2
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %49
24: ; preds = %21
%25 = load i32, i32* %2
%26 = srem i32 %25, 10
store i32 %26, i32* %4
%27 = load i32, i32* %2
%28 = sdiv i32 %27, 10
store i32 %28, i32* %2
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
%31 = load i32, i32* %2
%32 = srem i32 %31, 10
store i32 %32, i32* %5
%33 = load i32, i32* %2
%34 = sdiv i32 %33, 10
store i32 %34, i32* %2
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
%37 = load i32, i32* %2
%38 = srem i32 %37, 10
store i32 %38, i32* %6
%39 = load i32, i32* %2
%40 = sdiv i32 %39, 10
store i32 %40, i32* %2
%41 = load i32, i32* %3
%42 = add nsw i32 %41, 1
store i32 %42, i32* %3
%43 = load i32, i32* %2
%44 = srem i32 %43, 10
store i32 %44, i32* %7
%45 = load i32, i32* %2
%46 = sdiv i32 %45, 10
store i32 %46, i32* %2
%47 = load i32, i32* %3
%48 = add nsw i32 %47, 1
store i32 %48, i32* %3
br label %21
49: ; preds = %21
%50 = load i32, i32* %4
%51 = load i32, i32* %5
%52 = add nsw i32 %50, %51
%53 = load i32, i32* %6
%54 = add nsw i32 %52, %53
%55 = load i32, i32* %7
%56 = add nsw i32 %54, %55
store i32 %56, i32* %8
%57 = load i32, i32* %8
%58 = load i32, i32* %3
%59 = sdiv i32 %57, %58
store i32 %59, i32* %9
%60 = load i32, i32* %9
%61 = icmp sgt i32 %60, 7
br i1 %61, label %62, label %64
62: ; preds = %49
%63 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %64
64: ; preds = %62, %49
%65 = load i32, i32* %9
%66 = icmp slt i32 %65, 7
br i1 %66, label %67, label %69
67: ; preds = %64
%68 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %69
69: ; preds = %67, %64
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [8 x i8] c"\0A heavy\00"
@.str.2 = [8 x i8] c"\0A 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 %36
6: ; preds = %0, %6
%7 = phi i32 [ %10, %6 ], [ 0, %0 ]
%8 = phi i32 [ %9, %6 ], [ %4, %0 ]
%9 = udiv i32 %8, 10000
%10 = add nuw nsw i32 %7, 4
%11 = icmp ult i32 %8, 10000
br i1 %11, label %12, label %6
12: ; preds = %6
store i32 %9, i32* %1
%13 = trunc i32 %8 to i16
%14 = urem i16 %13, 10
%15 = trunc i32 %8 to i16
%16 = udiv i16 %15, 10
%17 = urem i16 %16, 10
%18 = trunc i32 %8 to i16
%19 = udiv i16 %18, 100
%20 = trunc i16 %19 to i8
%21 = urem i8 %20, 10
%22 = zext i8 %21 to i32
%23 = trunc i32 %8 to i16
%24 = udiv i16 %23, 1000
%25 = trunc i16 %24 to i8
%26 = urem i8 %25, 10
%27 = zext i8 %26 to i32
%28 = add nuw nsw i16 %17, %14
%29 = zext i16 %28 to i32
%30 = add nuw nsw i32 %29, %22
%31 = add nuw nsw i32 %30, %27
%32 = udiv i32 %31, %10
%33 = icmp ugt i32 %32, 7
br i1 %33, label %36, label %34
34: ; preds = %12
%35 = icmp eq i32 %32, 7
br i1 %35, label %39, label %36
36: ; preds = %34, %12, %0
%37 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %0 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), %12 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), %34 ]
%38 = call i32 @printf(i8* dereferenceable(1) %37)
br label %39
39: ; preds = %36, %34
ret i32 0
}