#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 argc, char *argv[]) {
  int year;
  printf("Enter a year to check if it is a leap year\n");
  scanf("%d", &year);
  if (year % 400 == 0)
    printf("%d is a leap year.\n", year);
  else if (year % 100 == 0)
    printf("%d is not a leap year.\n", year);
  else if (year % 4 == 0)
    printf("%d is a leap year.\n", year);
  else
    printf("%d is not a leap year.\n", year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee1(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    117e <main+0x5e>
mov    -0x14(%rbp),%esi
lea    0xebd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11ed <main+0xcd>
mov    -0x14(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11a8 <main+0x88>
mov    -0x14(%rbp),%esi
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11d2 <main+0xb2>
mov    -0x14(%rbp),%esi
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e3 <main+0xc3>
mov    -0x14(%rbp),%esi
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e8 <main+0xc8>
jmp    11ed <main+0xcd>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xef7(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x4(%rsp),%esi
imul   $0xc28f5c29,%esi,%eax
add    $0x51eb850,%eax
mov    %eax,%ecx
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
jb     118c <main+0x5c>
ror    $0x2,%eax
cmp    $0x28f5c29,%eax
jb     1195 <main+0x65>
test   $0x3,%sil
lea    0xe84(%rip),%rax
lea    0xe91(%rip),%rdi
cmove  %rax,%rdi
jmp    119c <main+0x6c>
lea    0xe70(%rip),%rdi
jmp    119c <main+0x6c>
lea    0xe7b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [44 x i8] c"Enter a year to check if it is a leap year\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d is a leap year.\0A\00"
@.str.3 = [24 x i8] c"%d is not a leap year.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%9 = load i32, i32* %6
%10 = srem i32 %9, 400
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = load i32, i32* %6
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %13)
br label %34
15: ; preds = %2
%16 = load i32, i32* %6
%17 = srem i32 %16, 100
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i32, i32* %6
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %20)
br label %33
22: ; preds = %15
%23 = load i32, i32* %6
%24 = srem i32 %23, 4
%25 = icmp eq i32 %24, 0
br i1 %25, label %26, label %29
26: ; preds = %22
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i32 %27)
br label %32
29: ; preds = %22
%30 = load i32, i32* %6
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %26
br label %33
33: ; preds = %32, %19
br label %34
34: ; preds = %33, %12
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [20 x i8] c"%d is a leap year.\0A\00"
@.str.3 = [24 x i8] c"%d is not a leap year.\0A\00"
@str = [43 x i8] c"Enter a year to check if it is a leap year\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = bitcast i32* %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %3
%8 = srem i32 %7, 400
%9 = icmp eq i32 %8, 0
br i1 %9, label %17, label %10
10: ; preds = %2
%11 = srem i32 %7, 100
%12 = icmp eq i32 %11, 0
br i1 %12, label %17, label %13
13: ; preds = %10
%14 = and i32 %7, 3
%15 = icmp eq i32 %14, 0
%16 = select i1 %15, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0)
br label %17
17: ; preds = %13, %10, %2
%18 = phi i8* [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), %2 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %10 ], [ %16, %13 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %18, i32 %7)
ret i32 0
}