#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 HMonthLength(int, int);
int IsValid(int yh, int mh, int dh) {
  int valid = 1;
  if ((yh < 1420) || (yh > 1450))
    valid = 0;
  if ((mh < 1) || (mh > 12))
    valid = 0;
  if ((dh < 1) || (dh > HMonthLength(yh, mh)))
    valid = 0;
  return (valid);
}


x86 assembly (clang, -O0):
<IsValid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
cmpl   $0x58c,-0x4(%rbp)
jl     1142 <IsValid+0x32>
cmpl   $0x5aa,-0x4(%rbp)
jle    1149 <IsValid+0x39>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
jl     115d <IsValid+0x4d>
cmpl   $0xc,-0x8(%rbp)
jle    1164 <IsValid+0x54>
movl   $0x0,-0x10(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     118c <IsValid+0x7c>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <HMonthLength@plt>
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
cmp    %ecx,%eax
jle    1193 <IsValid+0x83>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<IsValid>:
push   %rbp
push   %r14
push   %rbx
test   %edx,%edx
jle    113a <IsValid+0x2a>
mov    %edx,%ebx
lea    -0x1(%rsi),%eax
cmp    $0xc,%eax
setb   %bpl
lea    -0x58c(%rdi),%eax
cmp    $0x1f,%eax
setb   %r14b
call   1030 <HMonthLength@plt>
cmp    %ebx,%eax
jge    113e <IsValid+0x2e>
xor    %eax,%eax
jmp    1145 <IsValid+0x35>
and    %bpl,%r14b
movzbl %r14b,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @IsValid(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 1, i32* %7
%8 = load i32, i32* %4
%9 = icmp slt i32 %8, 1420
br i1 %9, label %13, label %10
10: ; preds = %3
%11 = load i32, i32* %4
%12 = icmp sgt i32 %11, 1450
br i1 %12, label %13, label %14
13: ; preds = %10, %3
store i32 0, i32* %7
br label %14
14: ; preds = %13, %10
%15 = load i32, i32* %5
%16 = icmp slt i32 %15, 1
br i1 %16, label %20, label %17
17: ; preds = %14
%18 = load i32, i32* %5
%19 = icmp sgt i32 %18, 12
br i1 %19, label %20, label %21
20: ; preds = %17, %14
store i32 0, i32* %7
br label %21
21: ; preds = %20, %17
%22 = load i32, i32* %6
%23 = icmp slt i32 %22, 1
br i1 %23, label %30, label %24
24: ; preds = %21
%25 = load i32, i32* %6
%26 = load i32, i32* %4
%27 = load i32, i32* %5
%28 = call i32 @HMonthLength(i32 %26, i32 %27)
%29 = icmp sgt i32 %25, %28
br i1 %29, label %30, label %31
30: ; preds = %24, %21
store i32 0, i32* %7
br label %31
31: ; preds = %30, %24
%32 = load i32, i32* %7
ret i32 %32
}

LLVM IR (-O2):
define i32 @IsValid(i32 %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %2, 1
br i1 %4, label %14, label %5
5: ; preds = %3
%6 = add i32 %1, -1
%7 = icmp ult i32 %6, 12
%8 = add i32 %0, -1420
%9 = icmp ult i32 %8, 31
%10 = and i1 %9, %7
%11 = zext i1 %10 to i32
%12 = tail call i32 @HMonthLength(i32 %0, i32 %1)
%13 = icmp slt i32 %12, %2
br i1 %13, label %14, label %15
14: ; preds = %5, %3
br label %15
15: ; preds = %14, %5
%16 = phi i32 [ 0, %14 ], [ %11, %5 ]
ret i32 %16
}