#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, s = 0, n;
  float avg;
  do {
    scanf("%d", &a);
  } while (a < 1 || a > 9999);
  do {
    n = a % 10;
    s = s + n;
    i++;
    a = a / 10;
  } while (a > 0);
  avg = s / i;
  if (avg > 7)
    printf("\nheavy");
  if (avg < 7)
    printf("\nlight");
  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    0xec0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    $0x1,%al
cmpl   $0x1,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jl     1169 <main+0x49>
cmpl   $0x270f,-0x8(%rbp)
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    113d <main+0x1d>
jmp    1179 <main+0x59>
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jg     1179 <main+0x59>
mov    -0x10(%rbp),%eax
cltd
idivl  -0xc(%rbp)
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  0xe32(%rip),%xmm1
ucomiss %xmm1,%xmm0
jbe    11e3 <main+0xc3>
lea    0xe29(%rip),%rdi
call   1030 <printf@plt>
movss  0xe15(%rip),%xmm0
ucomiss -0x18(%rbp),%xmm0
jbe    1201 <main+0xe1>
lea    0xe12(%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
cmp    $0x9,%edx
jg     1150 <main+0x30>
mov    %ecx,0x4(%rsp)
cltd
idiv   %esi
cmp    $0x7,%eax
jle    1190 <main+0x70>
lea    0xe75(%rip),%rdi
jmp    1199 <main+0x79>
je     119e <main+0x7e>
lea    0xe71(%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 = [7 x i8] c"\0Aheavy\00"
@.str.2 = [7 x i8] c"\0Alight\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 0, i32* %1
store i32 0, i32* %3
store i32 0, i32* %4
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
br label %18
18: ; preds = %28, %17
%19 = load i32, i32* %2
%20 = srem i32 %19, 10
store i32 %20, i32* %5
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = add nsw i32 %21, %22
store i32 %23, i32* %4
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
%26 = load i32, i32* %2
%27 = sdiv i32 %26, 10
store i32 %27, i32* %2
br label %28
28: ; preds = %18
%29 = load i32, i32* %2
%30 = icmp sgt i32 %29, 0
br i1 %30, label %18, label %31
31: ; preds = %28
%32 = load i32, i32* %4
%33 = load i32, i32* %3
%34 = sdiv i32 %32, %33
%35 = sitofp i32 %34 to float
store float %35, float* %6
%36 = load float, float* %6
%37 = fcmp ogt float %36, 7.000000e+00
br i1 %37, label %38, label %40
38: ; preds = %31
%39 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
br label %40
40: ; preds = %38, %31
%41 = load float, float* %6
%42 = fcmp olt float %41, 7.000000e+00
br i1 %42, label %43, label %45
43: ; preds = %40
%44 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %45
45: ; preds = %43, %40
ret i32 0
}

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