#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 */
size_t dt_leap_year(int);
int dt_days_in_month(int y, int m) {
  static const int days_in_month[2][13] = {
      {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31},
      {0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}};
  if (m < 1 || m > 12)
    return 0;
  return days_in_month[dt_leap_year(y)][m];
}


x86 assembly (clang, -O0):
<dt_days_in_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1132 <dt_days_in_month+0x22>
cmpl   $0xc,-0xc(%rbp)
jle    113e <dt_days_in_month+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1161 <dt_days_in_month+0x51>
mov    -0x8(%rbp),%edi
call   1030 <dt_leap_year@plt>
mov    %rax,%rcx
lea    0xeb0(%rip),%rax
imul   $0x34,%rcx,%rcx
add    %rcx,%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_days_in_month>:
push   %rbx
mov    %esi,%ebx
lea    -0xd(%rbx),%ecx
xor    %eax,%eax
cmp    $0xfffffff4,%ecx
jb     1135 <dt_days_in_month+0x25>
call   1030 <dt_leap_year@plt>
mov    %ebx,%ecx
imul   $0x34,%rax,%rax
lea    0xed1(%rip),%rdx
add    %rax,%rdx
mov    (%rdx,%rcx,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
@dt_days_in_month.days_in_month = internal constant [2 x [13 x i32]] [[13 x i32] [i32 0, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31], [13 x i32] [i32 0, i32 31, i32 29, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]]
define i32 @dt_days_in_month(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp slt i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp sgt i32 %9, 12
br i1 %10, label %11, label %12
11: ; preds = %8, %2
store i32 0, i32* %3
br label %20
12: ; preds = %8
%13 = load i32, i32* %4
%14 = call i64 @dt_leap_year(i32 %13)
%15 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @dt_days_in_month.days_in_month, i64 0, i64 %14
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [13 x i32], [13 x i32]* %15, i64 0, i64 %17
%19 = load i32, i32* %18
store i32 %19, i32* %3
br label %20
20: ; preds = %12, %11
%21 = load i32, i32* %3
ret i32 %21
}

LLVM IR (-O2):
@dt_days_in_month.days_in_month = internal unnamed_addr constant [2 x [13 x i32]] [[13 x i32] [i32 0, i32 31, i32 28, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31], [13 x i32] [i32 0, i32 31, i32 29, i32 31, i32 30, i32 31, i32 30, i32 31, i32 31, i32 30, i32 31, i32 30, i32 31]]
define i32 @dt_days_in_month(i32 %0, i32 %1) {
%3 = add i32 %1, -13
%4 = icmp ult i32 %3, -12
br i1 %4, label %10, label %5
5: ; preds = %2
%6 = tail call i64 @dt_leap_year(i32 %0)
%7 = zext i32 %1 to i64
%8 = getelementptr inbounds [2 x [13 x i32]], [2 x [13 x i32]]* @dt_days_in_month.days_in_month, i64 0, i64 %6, i64 %7
%9 = load i32, i32* %8
br label %10
10: ; preds = %2, %5
%11 = phi i32 [ %9, %5 ], [ 0, %2 ]
ret i32 %11
}