#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(int);
int check_mday(int year, int mon, int mday) {
  switch (mon) {
  case 0:
  case 2:
  case 4:
  case 6:
  case 7:
  case 9:
  case 11:
    if (mday >= 1 && mday <= 31)
      return 1;
    break;
  case 3:
  case 5:
  case 8:
  case 10:
    if (mday >= 1 && mday <= 30)
      return 1;
    break;
  case 1:
    if (mday >= 1 && mday <= (__isleap(year) ? 29 : 28))
      return 1;
    break;
  }
  return 0;
}


x86 assembly (clang, -O0):
<check_mday>:
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)
test   %eax,%eax
je     11e1 <check_mday+0xd1>
jmp    1134 <check_mday+0x24>
mov    -0x14(%rbp),%eax
sub    $0x1,%eax
je     122b <check_mday+0x11b>
jmp    1145 <check_mday+0x35>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11e1 <check_mday+0xd1>
jmp    1156 <check_mday+0x46>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     1206 <check_mday+0xf6>
jmp    1167 <check_mday+0x57>
mov    -0x14(%rbp),%eax
sub    $0x4,%eax
je     11e1 <check_mday+0xd1>
jmp    1178 <check_mday+0x68>
mov    -0x14(%rbp),%eax
sub    $0x5,%eax
je     1206 <check_mday+0xf6>
jmp    1189 <check_mday+0x79>
mov    -0x14(%rbp),%eax
add    $0xfffffffa,%eax
sub    $0x2,%eax
jb     11e1 <check_mday+0xd1>
jmp    119d <check_mday+0x8d>
mov    -0x14(%rbp),%eax
sub    $0x8,%eax
je     1206 <check_mday+0xf6>
jmp    11ae <check_mday+0x9e>
mov    -0x14(%rbp),%eax
sub    $0x9,%eax
je     11e1 <check_mday+0xd1>
jmp    11bf <check_mday+0xaf>
mov    -0x14(%rbp),%eax
sub    $0xa,%eax
je     1206 <check_mday+0xf6>
jmp    11d0 <check_mday+0xc0>
mov    -0x14(%rbp),%eax
sub    $0xb,%eax
jne    1271 <check_mday+0x161>
jmp    11e1 <check_mday+0xd1>
cmpl   $0x1,-0x10(%rbp)
jl     1201 <check_mday+0xf1>
cmpl   $0x1f,-0x10(%rbp)
jg     1201 <check_mday+0xf1>
movl   $0x1,-0x4(%rbp)
jmp    1278 <check_mday+0x168>
jmp    1271 <check_mday+0x161>
cmpl   $0x1,-0x10(%rbp)
jl     1226 <check_mday+0x116>
cmpl   $0x1e,-0x10(%rbp)
jg     1226 <check_mday+0x116>
movl   $0x1,-0x4(%rbp)
jmp    1278 <check_mday+0x168>
jmp    1271 <check_mday+0x161>
cmpl   $0x1,-0x10(%rbp)
jl     126c <check_mday+0x15c>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <__isleap@plt>
mov    %eax,%esi
mov    -0x18(%rbp),%eax
mov    $0x1c,%ecx
mov    $0x1d,%edx
cmp    $0x0,%esi
cmovne %edx,%ecx
cmp    %ecx,%eax
jg     126c <check_mday+0x15c>
movl   $0x1,-0x4(%rbp)
jmp    1278 <check_mday+0x168>
jmp    1271 <check_mday+0x161>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<check_mday>:
push   %rbx
cmp    $0xb,%esi
ja     1148 <check_mday+0x38>
mov    %edx,%ebx
mov    $0xad5,%eax
bt     %esi,%eax
jae    1131 <check_mday+0x21>
add    $0xffffffff,%ebx
mov    $0x1,%eax
cmp    $0x1f,%ebx
jae    1148 <check_mday+0x38>
pop    %rbx
ret
mov    $0x528,%eax
bt     %esi,%eax
jae    114c <check_mday+0x3c>
add    $0xffffffff,%ebx
mov    $0x1,%eax
cmp    $0x1e,%ebx
jb     112f <check_mday+0x1f>
xor    %eax,%eax
pop    %rbx
ret
test   %ebx,%ebx
jle    1148 <check_mday+0x38>
call   1030 <__isleap@plt>
cmp    $0x1,%eax
mov    $0x1d,%ecx
sbb    $0x0,%ecx
mov    $0x1,%eax
cmp    %ebx,%ecx
jae    112f <check_mday+0x1f>
jmp    1148 <check_mday+0x38>

LLVM IR (-O0):
define i32 @check_mday(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 %38 [
i32 0, label %9
i32 2, label %9
i32 4, label %9
i32 6, label %9
i32 7, label %9
i32 9, label %9
i32 11, label %9
i32 3, label %17
i32 5, label %17
i32 8, label %17
i32 10, label %17
i32 1, label %25
]
9: ; preds = %3, %3, %3, %3, %3, %3, %3
%10 = load i32, i32* %7
%11 = icmp sge i32 %10, 1
br i1 %11, label %12, label %16
12: ; preds = %9
%13 = load i32, i32* %7
%14 = icmp sle i32 %13, 31
br i1 %14, label %15, label %16
15: ; preds = %12
store i32 1, i32* %4
br label %39
16: ; preds = %12, %9
br label %38
17: ; preds = %3, %3, %3, %3
%18 = load i32, i32* %7
%19 = icmp sge i32 %18, 1
br i1 %19, label %20, label %24
20: ; preds = %17
%21 = load i32, i32* %7
%22 = icmp sle i32 %21, 30
br i1 %22, label %23, label %24
23: ; preds = %20
store i32 1, i32* %4
br label %39
24: ; preds = %20, %17
br label %38
25: ; preds = %3
%26 = load i32, i32* %7
%27 = icmp sge i32 %26, 1
br i1 %27, label %28, label %37
28: ; preds = %25
%29 = load i32, i32* %7
%30 = load i32, i32* %5
%31 = call i32 @__isleap(i32 %30)
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i32 29, i32 28
%35 = icmp sle i32 %29, %34
br i1 %35, label %36, label %37
36: ; preds = %28
store i32 1, i32* %4
br label %39
37: ; preds = %28, %25
br label %38
38: ; preds = %3, %37, %24, %16
store i32 0, i32* %4
br label %39
39: ; preds = %38, %36, %23, %15
%40 = load i32, i32* %4
ret i32 %40
}

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