#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 */
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;
struct TYPE_3__ {
  int quot;
  scalar_t__ rem;
};
typedef TYPE_1__ div_t;

/* Variables and functions */
TYPE_1__ div(int, int);
uint8_t is_leap_year(uint16_t year) {
  div_t d;
  if (year & 3)
    return 0;
  d = div(year, 100);
  if (d.rem)
    return 1;
  if ((d.quot & 3) == 0)
    return 1;
  return 0;
}


x86 assembly (clang, -O0):
<is_leap_year>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
je     1136 <is_leap_year+0x26>
movl   $0x0,-0x4(%rbp)
jmp    1193 <is_leap_year+0x83>
mov    -0x8(%rbp),%edi
mov    $0x64,%esi
call   1030 <div@plt>
mov    %eax,-0x28(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1171 <is_leap_year+0x61>
movl   $0x1,-0x4(%rbp)
jmp    1193 <is_leap_year+0x83>
mov    -0x18(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    118c <is_leap_year+0x7c>
movl   $0x1,-0x4(%rbp)
jmp    1193 <is_leap_year+0x83>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<is_leap_year>:
xor    %eax,%eax
test   $0x3,%dil
je     1119 <is_leap_year+0x9>
ret
push   %rax
mov    $0x64,%esi
call   1030 <div@plt>
mov    %eax,%ecx
mov    $0x1,%eax
test   %rdx,%rdx
lea    0x8(%rsp),%rsp
jne    1118 <is_leap_year+0x8>
xor    %eax,%eax
test   $0x3,%cl
sete   %al
ret

LLVM IR (-O0):
%struct.TYPE_3__ = type { i32, i64 }
define i32 @is_leap_year(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.TYPE_3__
%5 = alloca %struct.TYPE_3__
store i32 %0, i32* %3
%6 = load i32, i32* %3
%7 = and i32 %6, 3
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %1
store i32 0, i32* %2
br label %31
10: ; preds = %1
%11 = load i32, i32* %3
%12 = call { i32, i64 } @div(i32 %11, i32 100)
%13 = bitcast %struct.TYPE_3__* %5 to { i32, i64 }*
%14 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %13, i32 0, i32 0
%15 = extractvalue { i32, i64 } %12, 0
store i32 %15, i32* %14
%16 = getelementptr inbounds { i32, i64 }, { i32, i64 }* %13, i32 0, i32 1
%17 = extractvalue { i32, i64 } %12, 1
store i64 %17, i64* %16
%18 = bitcast %struct.TYPE_3__* %4 to i8*
%19 = bitcast %struct.TYPE_3__* %5 to i8*
%20 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 1
%21 = load i64, i64* %20
%22 = icmp ne i64 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %10
store i32 1, i32* %2
br label %31
24: ; preds = %10
%25 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %4, i32 0, i32 0
%26 = load i32, i32* %25
%27 = and i32 %26, 3
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %30
29: ; preds = %24
store i32 1, i32* %2
br label %31
30: ; preds = %24
store i32 0, i32* %2
br label %31
31: ; preds = %30, %29, %23, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @is_leap_year(i32 %0) {
%2 = and i32 %0, 3
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %13
4: ; preds = %1
%5 = tail call { i32, i64 } @div(i32 %0, i32 100)
%6 = extractvalue { i32, i64 } %5, 1
%7 = icmp eq i64 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = extractvalue { i32, i64 } %5, 0
%10 = and i32 %9, 3
%11 = icmp eq i32 %10, 0
%12 = zext i1 %11 to i32
br label %13
13: ; preds = %8, %4, %1
%14 = phi i32 [ 0, %1 ], [ 1, %4 ], [ %12, %8 ]
ret i32 %14
}