#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 *);
void main() {
  int y;
  printf("ENTER THE YEAR: \n");
  scanf("%d", &y);
  if (y % 4 == 0) {
    if (y % 100 != 0) {
      printf("\n\n THIS IS A LEAP YEAR");
    } else {
      if (y % 400 == 0) {
        printf("\n\n THIS YEAR IS A YEAP YEAR \n\n");
      } else {
        printf("\n\n NOT A LEAP YEAR\n\n");
      }
    }
  } else {
    printf("\n\n NOT A LEAP YEAR \n\n");
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
lea    0xed7(%rip),%rdi
lea    -0x4(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11b8 <main+0x98>
mov    -0x4(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     117d <main+0x5d>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    11b3 <main+0x93>
mov    -0x4(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a2 <main+0x82>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
jmp    11ae <main+0x8e>
lea    0xea2(%rip),%rdi
call   1030 <printf@plt>
jmp    11b3 <main+0x93>
jmp    11c4 <main+0xa4>
lea    0xea1(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee2(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   $0x3,%al
je     1164 <main+0x34>
lea    0xece(%rip),%rdi
call   1030 <puts@plt>
pop    %rax
ret
imul   $0xc28f5c29,%eax,%eax
add    $0x51eb850,%eax
mov    %eax,%ecx
ror    $0x2,%ecx
cmp    $0x28f5c29,%ecx
jb     118a <main+0x5a>
lea    0xe80(%rip),%rdi
call   1040 <printf@plt>
pop    %rax
ret
ror    $0x4,%eax
cmp    $0xa3d70a,%eax
jbe    119d <main+0x6d>
lea    0xea5(%rip),%rdi
jmp    115d <main+0x2d>
lea    0xeb0(%rip),%rdi
jmp    115d <main+0x2d>

LLVM IR (-O0):
@.str = [18 x i8] c"ENTER THE YEAR: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"\0A\0A THIS IS A LEAP YEAR\00"
@.str.3 = [31 x i8] c"\0A\0A THIS YEAR IS A YEAP YEAR \0A\0A\00"
@.str.4 = [21 x i8] c"\0A\0A NOT A LEAP YEAR\0A\0A\00"
@.str.5 = [22 x i8] c"\0A\0A NOT A LEAP YEAR \0A\0A\00"
define void @main() {
%1 = alloca i32
%2 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%4 = load i32, i32* %1
%5 = srem i32 %4, 4
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %23
7: ; preds = %0
%8 = load i32, i32* %1
%9 = srem i32 %8, 100
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %22
13: ; preds = %7
%14 = load i32, i32* %1
%15 = srem i32 %14, 400
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
br label %21
19: ; preds = %13
%20 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %21
21: ; preds = %19, %17
br label %22
22: ; preds = %21, %11
br label %25
23: ; preds = %0
%24 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %25
25: ; preds = %23, %22
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"\0A\0A THIS IS A LEAP YEAR\00"
@str = [17 x i8] c"ENTER THE YEAR: \00"
@str.6 = [21 x i8] c"\0A\0A NOT A LEAP YEAR \0A\00"
@str.7 = [20 x i8] c"\0A\0A NOT A LEAP YEAR\0A\00"
@str.8 = [30 x i8] c"\0A\0A THIS YEAR IS A YEAP YEAR \0A\00"
define void @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = and i32 %5, 3
%7 = icmp eq i32 %6, 0
br i1 %7, label %8, label %20
8: ; preds = %0
%9 = srem i32 %5, 100
%10 = icmp eq i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %8
%12 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
br label %22
13: ; preds = %8
%14 = srem i32 %5, 400
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %13
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.8, i64 0, i64 0))
br label %22
18: ; preds = %13
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.7, i64 0, i64 0))
br label %22
20: ; preds = %0
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.6, i64 0, i64 0))
br label %22
22: ; preds = %11, %18, %16, %20
ret void
}