#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 */
typedef int uint32_t;

/* Variables and functions */
uint32_t getmonleng(uint32_t year, uint32_t month) {
  switch (month) {
  case 1:
  case 3:
  case 5:
  case 7:
  case 8:
  case 10:
  case 12:
    return 31;
  case 4:
  case 6:
  case 9:
  case 11:
    return 30;
  case 2:
    if (year % 4)
      return 28;
    if (year % 100)
      return 29;
    if (year % 400)
      return 28;
    return 29;
  }
  return 0;
}


x86 assembly (clang, -O0):
<getmonleng>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
sub    $0x1,%eax
je     11cb <getmonleng+0xcb>
jmp    111e <getmonleng+0x1e>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     11e3 <getmonleng+0xe3>
jmp    112f <getmonleng+0x2f>
mov    -0x10(%rbp),%eax
sub    $0x3,%eax
je     11cb <getmonleng+0xcb>
jmp    1140 <getmonleng+0x40>
mov    -0x10(%rbp),%eax
sub    $0x4,%eax
je     11d7 <getmonleng+0xd7>
jmp    1151 <getmonleng+0x51>
mov    -0x10(%rbp),%eax
sub    $0x5,%eax
je     11cb <getmonleng+0xcb>
jmp    1162 <getmonleng+0x62>
mov    -0x10(%rbp),%eax
sub    $0x6,%eax
je     11d7 <getmonleng+0xd7>
jmp    1173 <getmonleng+0x73>
mov    -0x10(%rbp),%eax
add    $0xfffffff9,%eax
sub    $0x2,%eax
jb     11cb <getmonleng+0xcb>
jmp    1187 <getmonleng+0x87>
mov    -0x10(%rbp),%eax
sub    $0x9,%eax
je     11d7 <getmonleng+0xd7>
jmp    1198 <getmonleng+0x98>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
je     11cb <getmonleng+0xcb>
jmp    11a9 <getmonleng+0xa9>
mov    -0x10(%rbp),%eax
sub    $0xb,%eax
je     11d7 <getmonleng+0xd7>
jmp    11ba <getmonleng+0xba>
mov    -0x10(%rbp),%eax
sub    $0xc,%eax
jne    124f <getmonleng+0x14f>
jmp    11cb <getmonleng+0xcb>
movl   $0x1f,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
movl   $0x1e,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
mov    -0x8(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1203 <getmonleng+0x103>
movl   $0x1c,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1223 <getmonleng+0x123>
movl   $0x1d,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1243 <getmonleng+0x143>
movl   $0x1c,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
movl   $0x1d,-0x4(%rbp)
jmp    1256 <getmonleng+0x156>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmonleng>:
cmp    $0xc,%esi
ja     1165 <getmonleng+0x65>
mov    $0x1f,%eax
mov    $0x15aa,%ecx
bt     %esi,%ecx
jae    1115 <getmonleng+0x15>
ret
mov    $0xa50,%eax
bt     %esi,%eax
jae    1125 <getmonleng+0x25>
mov    $0x1e,%eax
ret
cmp    $0x2,%esi
jne    1165 <getmonleng+0x65>
mov    $0x1c,%eax
test   $0x3,%dil
jne    1114 <getmonleng+0x14>
imul   $0xc28f5c29,%edi,%ecx
add    $0x51eb850,%ecx
mov    %ecx,%edx
ror    $0x2,%edx
mov    $0x1d,%eax
cmp    $0x28f5c28,%edx
ja     1114 <getmonleng+0x14>
ror    $0x4,%ecx
xor    %eax,%eax
cmp    $0xa3d70b,%ecx
setb   %al
or     $0x1c,%eax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @getmonleng(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
switch i32 %6, label %25 [
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 4, label %8
i32 6, label %8
i32 9, label %8
i32 11, label %8
i32 2, label %9
]
7: ; preds = %2, %2, %2, %2, %2, %2, %2
store i32 31, i32* %3
br label %26
8: ; preds = %2, %2, %2, %2
store i32 30, i32* %3
br label %26
9: ; preds = %2
%10 = load i32, i32* %4
%11 = srem i32 %10, 4
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %9
store i32 28, i32* %3
br label %26
14: ; preds = %9
%15 = load i32, i32* %4
%16 = srem i32 %15, 100
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %14
store i32 29, i32* %3
br label %26
19: ; preds = %14
%20 = load i32, i32* %4
%21 = srem i32 %20, 400
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %24
23: ; preds = %19
store i32 28, i32* %3
br label %26
24: ; preds = %19
store i32 29, i32* %3
br label %26
25: ; preds = %2
store i32 0, i32* %3
br label %26
26: ; preds = %25, %24, %23, %18, %13, %8, %7
%27 = load i32, i32* %3
ret i32 %27
}

LLVM IR (-O2):
define i32 @getmonleng(i32 %0, i32 %1) {
switch i32 %1, label %14 [
i32 1, label %15
i32 3, label %15
i32 5, label %15
i32 7, label %15
i32 8, label %15
i32 10, label %15
i32 12, label %15
i32 4, label %3
i32 6, label %3
i32 9, label %3
i32 11, label %3
i32 2, label %4
]
3: ; preds = %2, %2, %2, %2
br label %15
4: ; preds = %2
%5 = and i32 %0, 3
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = srem i32 %0, 100
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %15
10: ; preds = %7
%11 = srem i32 %0, 400
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 29, i32 28
br label %15
14: ; preds = %2
br label %15
15: ; preds = %10, %7, %4, %2, %2, %2, %2, %2, %2, %2, %14, %3
%16 = phi i32 [ 0, %14 ], [ 30, %3 ], [ 31, %2 ], [ 31, %2 ], [ 31, %2 ], [ 31, %2 ], [ 31, %2 ], [ 31, %2 ], [ 31, %2 ], [ 28, %4 ], [ 29, %7 ], [ %13, %10 ]
ret i32 %16
}