#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*/ is_leap(int);
int days_of_month(int year, int month) {
  int days;
  switch (month) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    days = 31;
    break;
  case 2: {
    if (is_leap(year)) {
      days = 29;
    } else {
      days = 28;
    }
  } break;
  case 4:
  case 6:
  case 9:
  case 11:
    days = 30;
    break;
  }
  return days;
}


x86 assembly (clang, -O0):
<days_of_month>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11df <days_of_month+0xcf>
jmp    1132 <days_of_month+0x22>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11eb <days_of_month+0xdb>
jmp    1143 <days_of_month+0x33>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11df <days_of_month+0xcf>
jmp    1154 <days_of_month+0x44>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     1214 <days_of_month+0x104>
jmp    1165 <days_of_month+0x55>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     11df <days_of_month+0xcf>
jmp    1176 <days_of_month+0x66>
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
je     1214 <days_of_month+0x104>
jmp    1187 <days_of_month+0x77>
mov    -0x10(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
jb     11df <days_of_month+0xcf>
jmp    119b <days_of_month+0x8b>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     1214 <days_of_month+0x104>
jmp    11ac <days_of_month+0x9c>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     11df <days_of_month+0xcf>
jmp    11bd <days_of_month+0xad>
mov    -0x10(%rbp),%eax
sub    $0xb,%eax
je     1214 <days_of_month+0x104>
jmp    11ce <days_of_month+0xbe>
mov    -0x10(%rbp),%eax
sub    $0xc,%eax
jne    121b <days_of_month+0x10b>
jmp    11df <days_of_month+0xcf>
movl   $0x1f,-0xc(%rbp)
jmp    121b <days_of_month+0x10b>
mov    -0x4(%rbp),%edi
call   1030 <is_leap@plt>
cmp    $0x0,%eax
je     1208 <days_of_month+0xf8>
movl   $0x1d,-0xc(%rbp)
jmp    120f <days_of_month+0xff>
movl   $0x1c,-0xc(%rbp)
jmp    121b <days_of_month+0x10b>
movl   $0x1e,-0xc(%rbp)
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<days_of_month>:
mov    $0x1f,%eax
cmp    $0xb,%esi
ja     1129 <days_of_month+0x19>
mov    $0xa50,%ecx
bt     %esi,%ecx
jae    112a <days_of_month+0x1a>
mov    $0x1e,%eax
ret
cmp    $0x2,%esi
jne    1129 <days_of_month+0x19>
push   %rax
call   1030 <is_leap@plt>
cmp    $0x1,%eax
mov    $0x1d,%eax
sbb    $0x0,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
define i32 @days_of_month(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
switch i32 %6, label %16 [
i32 1, label %7
i32 3, label %7
i32 5, label %7
i32 7, label %7
i32 8, label %7
i32 10, label %7
i32 12, label %7
i32 2, label %8
i32 4, label %15
i32 6, label %15
i32 9, label %15
i32 11, label %15
]
7: ; preds = %2, %2, %2, %2, %2, %2, %2
store i32 31, i32* %5
br label %16
8: ; preds = %2
%9 = load i32, i32* %3
%10 = call i32 @is_leap(i32 %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %13
12: ; preds = %8
store i32 29, i32* %5
br label %14
13: ; preds = %8
store i32 28, i32* %5
br label %14
14: ; preds = %13, %12
br label %16
15: ; preds = %2, %2, %2, %2
store i32 30, i32* %5
br label %16
16: ; preds = %2, %15, %14, %7
%17 = load i32, i32* %5
ret i32 %17
}

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