#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*/ isleap(unsigned int);
int isvaliddate(unsigned y, unsigned m, unsigned d) {
  switch (m) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    if (!d || d > 31)
      return 0;
    break;
  case 2:
    if (isleap(y)) {
      if (!d || d > 29)
        return 0;
    } else if (!d || d > 28)
      return 0;
    break;
  case 4:
  case 6:
  case 9:
  case 11:
    if (!d || d > 30)
      return 0;
    break;
  default:
    return 0;
    break;
  }
  return 1;
}


x86 assembly (clang, -O0):
<isvaliddate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11e2 <isvaliddate+0xd2>
jmp    1135 <isvaliddate+0x25>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     1207 <isvaliddate+0xf7>
jmp    1146 <isvaliddate+0x36>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     11e2 <isvaliddate+0xd2>
jmp    1157 <isvaliddate+0x47>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     1267 <isvaliddate+0x157>
jmp    1168 <isvaliddate+0x58>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
je     11e2 <isvaliddate+0xd2>
jmp    1179 <isvaliddate+0x69>
mov    -0x14(%rbp),%eax
sub    $0x6,%eax
je     1267 <isvaliddate+0x157>
jmp    118a <isvaliddate+0x7a>
mov    -0x14(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
jb     11e2 <isvaliddate+0xd2>
jmp    119e <isvaliddate+0x8e>
mov    -0x14(%rbp),%eax
sub    $0x9,%eax
je     1267 <isvaliddate+0x157>
jmp    11af <isvaliddate+0x9f>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     11e2 <isvaliddate+0xd2>
jmp    11c0 <isvaliddate+0xb0>
mov    -0x14(%rbp),%eax
sub    $0xb,%eax
je     1267 <isvaliddate+0x157>
jmp    11d1 <isvaliddate+0xc1>
mov    -0x14(%rbp),%eax
sub    $0xc,%eax
jne    128c <isvaliddate+0x17c>
jmp    11e2 <isvaliddate+0xd2>
cmpl   $0x0,-0x10(%rbp)
je     11f6 <isvaliddate+0xe6>
cmpl   $0x1f,-0x10(%rbp)
jbe    1202 <isvaliddate+0xf2>
movl   $0x0,-0x4(%rbp)
jmp    129f <isvaliddate+0x18f>
jmp    1298 <isvaliddate+0x188>
mov    -0x8(%rbp),%edi
call   1030 <isleap@plt>
cmp    $0x0,%eax
je     123d <isvaliddate+0x12d>
cmpl   $0x0,-0x10(%rbp)
je     122c <isvaliddate+0x11c>
cmpl   $0x1d,-0x10(%rbp)
jbe    1238 <isvaliddate+0x128>
movl   $0x0,-0x4(%rbp)
jmp    129f <isvaliddate+0x18f>
jmp    1262 <isvaliddate+0x152>
cmpl   $0x0,-0x10(%rbp)
je     1251 <isvaliddate+0x141>
cmpl   $0x1c,-0x10(%rbp)
jbe    125d <isvaliddate+0x14d>
movl   $0x0,-0x4(%rbp)
jmp    129f <isvaliddate+0x18f>
jmp    1262 <isvaliddate+0x152>
jmp    1298 <isvaliddate+0x188>
cmpl   $0x0,-0x10(%rbp)
je     127b <isvaliddate+0x16b>
cmpl   $0x1e,-0x10(%rbp)
jbe    1287 <isvaliddate+0x177>
movl   $0x0,-0x4(%rbp)
jmp    129f <isvaliddate+0x18f>
jmp    1298 <isvaliddate+0x188>
movl   $0x0,-0x4(%rbp)
jmp    129f <isvaliddate+0x18f>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<isvaliddate>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cmp    $0xc,%esi
ja     1147 <isvaliddate+0x37>
mov    %edx,%ebp
mov    $0x15aa,%eax
bt     %esi,%eax
jae    1130 <isvaliddate+0x20>
add    $0xffffffe0,%ebp
cmp    $0xffffffe1,%ebp
jae    1142 <isvaliddate+0x32>
jmp    1147 <isvaliddate+0x37>
mov    $0xa50,%eax
bt     %esi,%eax
jae    1150 <isvaliddate+0x40>
add    $0xffffffe1,%ebp
cmp    $0xffffffe2,%ebp
jb     1147 <isvaliddate+0x37>
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
cmp    $0x2,%esi
jne    1147 <isvaliddate+0x37>
call   1030 <isleap@plt>
test   %eax,%eax
je     1168 <isvaliddate+0x58>
add    $0xffffffe2,%ebp
cmp    $0xffffffe3,%ebp
jae    1142 <isvaliddate+0x32>
jmp    1147 <isvaliddate+0x37>
add    $0xffffffe3,%ebp
cmp    $0xffffffe4,%ebp
jae    1142 <isvaliddate+0x32>
jmp    1147 <isvaliddate+0x37>

LLVM IR (-O0):
define i32 @isvaliddate(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %6
switch i32 %8, label %46 [
i32 1, label %9
i32 3, label %9
i32 5, label %9
i32 7, label %9
i32 8, label %9
i32 10, label %9
i32 12, label %9
i32 2, label %17
i32 4, label %38
i32 6, label %38
i32 9, label %38
i32 11, label %38
]
9: ; preds = %3, %3, %3, %3, %3, %3, %3
%10 = load i32, i32* %7
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %9
%13 = load i32, i32* %7
%14 = icmp ugt i32 %13, 31
br i1 %14, label %15, label %16
15: ; preds = %12, %9
store i32 0, i32* %4
br label %48
16: ; preds = %12
br label %47
17: ; preds = %3
%18 = load i32, i32* %5
%19 = call i32 @isleap(i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = load i32, i32* %7
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %21
%25 = load i32, i32* %7
%26 = icmp ugt i32 %25, 29
br i1 %26, label %27, label %28
27: ; preds = %24, %21
store i32 0, i32* %4
br label %48
28: ; preds = %24
br label %37
29: ; preds = %17
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %7
%34 = icmp ugt i32 %33, 28
br i1 %34, label %35, label %36
35: ; preds = %32, %29
store i32 0, i32* %4
br label %48
36: ; preds = %32
br label %37
37: ; preds = %36, %28
br label %47
38: ; preds = %3, %3, %3, %3
%39 = load i32, i32* %7
%40 = icmp ne i32 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %38
%42 = load i32, i32* %7
%43 = icmp ugt i32 %42, 30
br i1 %43, label %44, label %45
44: ; preds = %41, %38
store i32 0, i32* %4
br label %48
45: ; preds = %41
br label %47
46: ; preds = %3
store i32 0, i32* %4
br label %48
47: ; preds = %45, %37, %16
store i32 1, i32* %4
br label %48
48: ; preds = %47, %46, %44, %35, %27, %15
%49 = load i32, i32* %4
ret i32 %49
}

LLVM IR (-O2):
define i32 @isvaliddate(i32 %0, i32 %1, i32 %2) {
switch i32 %1, label %20 [
i32 1, label %4
i32 3, label %4
i32 5, label %4
i32 7, label %4
i32 8, label %4
i32 10, label %4
i32 12, label %4
i32 2, label %7
i32 4, label %16
i32 6, label %16
i32 9, label %16
i32 11, label %16
]
4: ; preds = %3, %3, %3, %3, %3, %3, %3
%5 = add i32 %2, -32
%6 = icmp ult i32 %5, -31
br i1 %6, label %20, label %19
7: ; preds = %3
%8 = tail call i32 @isleap(i32 %0)
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = add i32 %2, -30
%12 = icmp ult i32 %11, -29
br i1 %12, label %20, label %19
13: ; preds = %7
%14 = add i32 %2, -29
%15 = icmp ult i32 %14, -28
br i1 %15, label %20, label %19
16: ; preds = %3, %3, %3, %3
%17 = add i32 %2, -31
%18 = icmp ult i32 %17, -30
br i1 %18, label %20, label %19
19: ; preds = %16, %10, %13, %4
br label %20
20: ; preds = %3, %16, %13, %10, %4, %19
%21 = phi i32 [ 1, %19 ], [ 0, %4 ], [ 0, %10 ], [ 0, %13 ], [ 0, %16 ], [ 0, %3 ]
ret i32 %21
}