#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 */
bool isLeap(int year) {
  if (year <= 1582)
    return year % 4 == 0;
  else
    return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
}


x86 assembly (clang, -O0):
<isLeap>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x62e,-0x8(%rbp)
jg     1132 <isLeap+0x32>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
jmp    1189 <isLeap+0x89>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
xor    %eax,%eax
cmp    $0x0,%edx
mov    %al,-0x9(%rbp)
jne    117e <isLeap+0x7e>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    $0x1,%al
cmp    $0x0,%edx
mov    %al,-0xa(%rbp)
jne    1178 <isLeap+0x78>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
sete   %al
mov    %al,-0xa(%rbp)
mov    -0xa(%rbp),%al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isLeap>:
cmp    $0x62f,%edi
setl   %dl
mov    %edi,%ecx
and    $0x3,%ecx
sete   %al
and    %dl,%al
cmp    $0x62f,%edi
jl     1134 <isLeap+0x34>
test   %ecx,%ecx
jne    1134 <isLeap+0x34>
imul   $0xc28f5c29,%edi,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
mov    $0x1,%al
cmp    $0x28f5c28,%edx
jbe    1138 <isLeap+0x38>
movzbl %al,%eax
ret
ror    $0x4,%ecx
cmp    $0xa3d70b,%ecx
setb   %al
movzbl %al,%eax
ret

LLVM IR (-O0):
define i32 @isLeap(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sle i32 %4, 1582
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i32, i32* %3
%8 = srem i32 %7, 4
%9 = icmp eq i32 %8, 0
%10 = zext i1 %9 to i32
store i32 %10, i32* %2
br label %28
11: ; preds = %1
%12 = load i32, i32* %3
%13 = srem i32 %12, 4
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %25
15: ; preds = %11
%16 = load i32, i32* %3
%17 = srem i32 %16, 100
%18 = icmp ne i32 %17, 0
br i1 %18, label %23, label %19
19: ; preds = %15
%20 = load i32, i32* %3
%21 = srem i32 %20, 400
%22 = icmp eq i32 %21, 0
br label %23
23: ; preds = %19, %15
%24 = phi i1 [ true, %15 ], [ %22, %19 ]
br label %25
25: ; preds = %23, %11
%26 = phi i1 [ false, %11 ], [ %24, %23 ]
%27 = zext i1 %26 to i32
store i32 %27, i32* %2
br label %28
28: ; preds = %25, %6
%29 = load i32, i32* %2
ret i32 %29
}

LLVM IR (-O2):
define i32 @isLeap(i32 %0) {
%2 = icmp slt i32 %0, 1583
%3 = and i32 %0, 3
%4 = icmp eq i32 %3, 0
%5 = xor i1 %4, true
%6 = or i1 %2, %5
%7 = and i1 %2, %4
br i1 %6, label %14, label %8
8: ; preds = %1
%9 = urem i32 %0, 100
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %8
%12 = urem i32 %0, 400
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %1, %11, %8
%15 = phi i1 [ true, %8 ], [ %13, %11 ], [ %7, %1 ]
%16 = zext i1 %15 to i32
ret i32 %16
}