#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*/ heb_is_leap_year(int const);
int const heb_month_length(int const, int const);
int heb_check_date(const int year, const int month, const int day) {
  if (year < 1)
    return 1;
  if (month > 13 || (month == 13 && !heb_is_leap_year(year)))
    return 1;
  return day > 0 && day <= heb_month_length(year, month);
}


x86 assembly (clang, -O0):
<heb_check_date>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jge    1147 <heb_check_date+0x27>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <heb_check_date+0x90>
cmpl   $0xd,-0xc(%rbp)
jg     116c <heb_check_date+0x4c>
cmpl   $0xd,-0xc(%rbp)
jne    1178 <heb_check_date+0x58>
mov    -0x8(%rbp),%edi
call   1030 <heb_is_leap_year@plt>
cmp    $0x0,%eax
jne    1178 <heb_check_date+0x58>
movl   $0x1,-0x4(%rbp)
jmp    11b0 <heb_check_date+0x90>
xor    %eax,%eax
cmpl   $0x0,-0x10(%rbp)
mov    %al,-0x11(%rbp)
jle    11a5 <heb_check_date+0x85>
mov    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1040 <heb_month_length@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<heb_check_date>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x1,%ebx
test   %edi,%edi
jle    1165 <heb_check_date+0x45>
mov    %esi,%r15d
cmp    $0xd,%esi
jg     1165 <heb_check_date+0x45>
mov    %edx,%r14d
mov    %edi,%ebp
jne    114a <heb_check_date+0x2a>
mov    %ebp,%edi
call   1030 <heb_is_leap_year@plt>
test   %eax,%eax
je     1165 <heb_check_date+0x45>
test   %r14d,%r14d
jle    1163 <heb_check_date+0x43>
mov    %ebp,%edi
mov    %r15d,%esi
call   1040 <heb_month_length@plt>
xor    %ebx,%ebx
cmp    %r14d,%eax
setge  %bl
jmp    1165 <heb_check_date+0x45>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @heb_check_date(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* %5
%9 = icmp slt i32 %8, 1
br i1 %9, label %10, label %11
10: ; preds = %3
store i32 1, i32* %4
br label %34
11: ; preds = %3
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 13
br i1 %13, label %21, label %14
14: ; preds = %11
%15 = load i32, i32* %6
%16 = icmp eq i32 %15, 13
br i1 %16, label %17, label %22
17: ; preds = %14
%18 = load i32, i32* %5
%19 = call i32 @heb_is_leap_year(i32 %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %22, label %21
21: ; preds = %17, %11
store i32 1, i32* %4
br label %34
22: ; preds = %17, %14
%23 = load i32, i32* %7
%24 = icmp sgt i32 %23, 0
br i1 %24, label %25, label %31
25: ; preds = %22
%26 = load i32, i32* %7
%27 = load i32, i32* %5
%28 = load i32, i32* %6
%29 = call i32 @heb_month_length(i32 %27, i32 %28)
%30 = icmp sle i32 %26, %29
br label %31
31: ; preds = %25, %22
%32 = phi i1 [ false, %22 ], [ %30, %25 ]
%33 = zext i1 %32 to i32
store i32 %33, i32* %4
br label %34
34: ; preds = %31, %21, %10
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
define i32 @heb_check_date(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %0, 1
%5 = icmp sgt i32 %1, 13
%6 = or i1 %4, %5
br i1 %6, label %18, label %7
7: ; preds = %3
%8 = icmp eq i32 %1, 13
br i1 %8, label %9, label %12
9: ; preds = %7
%10 = tail call i32 @heb_is_leap_year(i32 %0)
%11 = icmp eq i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %9, %7
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %18
14: ; preds = %12
%15 = tail call i32 @heb_month_length(i32 %0, i32 %1)
%16 = icmp sge i32 %15, %2
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %12, %14, %9, %3
%19 = phi i32 [ 1, %3 ], [ 1, %9 ], [ 0, %12 ], [ %17, %14 ]
ret i32 %19
}