#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_quarter(int y, int q) {
  static const int days_in_quarter[2][5] = {{0, 90, 91, 92, 92},
                                            {0, 91, 91, 92, 92}};
  if (q < 1 || q > 4)
    return 0;
  return days_in_quarter[dt_leap_year(y)][q];
}


x86 assembly (clang, -O0):
<dt_days_in_quarter>:
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_quarter+0x22>
cmpl   $0x4,-0xc(%rbp)
jle    113e <dt_days_in_quarter+0x2e>
movl   $0x0,-0x4(%rbp)
jmp    1161 <dt_days_in_quarter+0x51>
mov    -0x8(%rbp),%edi
call   1030 <dt_leap_year@plt>
mov    %rax,%rcx
lea    0xeb0(%rip),%rax
imul   $0x14,%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_quarter>:
push   %rbx
mov    %esi,%ebx
lea    -0x5(%rbx),%ecx
xor    %eax,%eax
cmp    $0xfffffffc,%ecx
jb     1136 <dt_days_in_quarter+0x26>
call   1030 <dt_leap_year@plt>
mov    %ebx,%ecx
lea    (%rax,%rax,4),%rax
lea    0xed1(%rip),%rdx
lea    (%rdx,%rax,4),%rax
mov    (%rax,%rcx,4),%eax
pop    %rbx
ret

LLVM IR (-O0):
@dt_days_in_quarter.days_in_quarter = internal constant [2 x [5 x i32]] [[5 x i32] [i32 0, i32 90, i32 91, i32 92, i32 92], [5 x i32] [i32 0, i32 91, i32 91, i32 92, i32 92]]
define i32 @dt_days_in_quarter(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, 4
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 [5 x i32]], [2 x [5 x i32]]* @dt_days_in_quarter.days_in_quarter, i64 0, i64 %14
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [5 x i32], [5 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_quarter.days_in_quarter = internal unnamed_addr constant [2 x [5 x i32]] [[5 x i32] [i32 0, i32 90, i32 91, i32 92, i32 92], [5 x i32] [i32 0, i32 91, i32 91, i32 92, i32 92]]
define i32 @dt_days_in_quarter(i32 %0, i32 %1) {
%3 = add i32 %1, -5
%4 = icmp ult i32 %3, -4
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 [5 x i32]], [2 x [5 x i32]]* @dt_days_in_quarter.days_in_quarter, 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
}