#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 */
scalar_t__ is_leap_year(unsigned int);
unsigned _days_in_month(unsigned year, unsigned month) {
  if (month == 3 || month == 8 || month == 5 || month == 10)
    return 30;
  if (month == 1)
    return is_leap_year(year) ? 29 : 28;
  return 31;
}


x86 assembly (clang, -O0):
<_days_in_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
je     1146 <_days_in_month+0x36>
cmpl   $0x8,-0xc(%rbp)
je     1146 <_days_in_month+0x36>
cmpl   $0x5,-0xc(%rbp)
je     1146 <_days_in_month+0x36>
cmpl   $0xa,-0xc(%rbp)
jne    1152 <_days_in_month+0x42>
movl   $0x1e,-0x4(%rbp)
jmp    1187 <_days_in_month+0x77>
cmpl   $0x1,-0xc(%rbp)
jne    1180 <_days_in_month+0x70>
mov    -0x8(%rbp),%edi
call   1030 <is_leap_year@plt>
mov    %rax,%rdx
mov    $0x1c,%eax
mov    $0x1d,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
mov    %eax,-0x4(%rbp)
jmp    1187 <_days_in_month+0x77>
movl   $0x1f,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_days_in_month>:
cmp    $0xa,%esi
ja     1141 <_days_in_month+0x31>
mov    $0x1e,%eax
mov    $0x528,%ecx
bt     %esi,%ecx
jae    1125 <_days_in_month+0x15>
ret
cmp    $0x1,%esi
jne    1141 <_days_in_month+0x31>
push   %rax
call   1030 <is_leap_year@plt>
cmp    $0x1,%rax
mov    $0x1d,%eax
sbb    $0x0,%eax
add    $0x8,%rsp
ret
mov    $0x1f,%eax
ret

LLVM IR (-O0):
define i32 @_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 eq i32 %6, 3
br i1 %7, label %17, label %8
8: ; preds = %2
%9 = load i32, i32* %5
%10 = icmp eq i32 %9, 8
br i1 %10, label %17, label %11
11: ; preds = %8
%12 = load i32, i32* %5
%13 = icmp eq i32 %12, 5
br i1 %13, label %17, label %14
14: ; preds = %11
%15 = load i32, i32* %5
%16 = icmp eq i32 %15, 10
br i1 %16, label %17, label %18
17: ; preds = %14, %11, %8, %2
store i32 30, i32* %3
br label %28
18: ; preds = %14
%19 = load i32, i32* %5
%20 = icmp eq i32 %19, 1
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = load i32, i32* %4
%23 = call i64 @is_leap_year(i32 %22)
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i64
%26 = select i1 %24, i32 29, i32 28
store i32 %26, i32* %3
br label %28
27: ; preds = %18
store i32 31, i32* %3
br label %28
28: ; preds = %27, %21, %17
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
define i32 @_days_in_month(i32 %0, i32 %1) {
switch i32 %1, label %7 [
i32 10, label %8
i32 8, label %8
i32 5, label %8
i32 3, label %8
i32 1, label %3
]
3: ; preds = %2
%4 = tail call i64 @is_leap_year(i32 %0)
%5 = icmp eq i64 %4, 0
%6 = select i1 %5, i32 28, i32 29
br label %8
7: ; preds = %2
br label %8
8: ; preds = %2, %2, %2, %2, %7, %3
%9 = phi i32 [ %6, %3 ], [ 31, %7 ], [ 30, %2 ], [ 30, %2 ], [ 30, %2 ], [ 30, %2 ]
ret i32 %9
}