#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 Isleap(int);
int Rmonth(int dcount, int yr) {
  if (dcount == 4 || dcount == 6 || dcount == 9 || dcount == 11) {
    return 30;
  } else if (dcount == 2 && Isleap(yr) == 1) {
    return 29;
  } else if (dcount == 2 && Isleap(yr) == 0) {
    return 28;
  } else {
    return 31;
  }
}


x86 assembly (clang, -O0):
<Rmonth>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     1146 <Rmonth+0x36>
cmpl   $0x6,-0x8(%rbp)
je     1146 <Rmonth+0x36>
cmpl   $0x9,-0x8(%rbp)
je     1146 <Rmonth+0x36>
cmpl   $0xb,-0x8(%rbp)
jne    1152 <Rmonth+0x42>
movl   $0x1e,-0x4(%rbp)
jmp    11a7 <Rmonth+0x97>
cmpl   $0x2,-0x8(%rbp)
jne    1179 <Rmonth+0x69>
mov    -0xc(%rbp),%edi
call   1030 <Isleap@plt>
cmp    $0x1,%eax
jne    1179 <Rmonth+0x69>
movl   $0x1d,-0x4(%rbp)
jmp    11a7 <Rmonth+0x97>
cmpl   $0x2,-0x8(%rbp)
jne    11a0 <Rmonth+0x90>
mov    -0xc(%rbp),%edi
call   1030 <Isleap@plt>
cmp    $0x0,%eax
jne    11a0 <Rmonth+0x90>
movl   $0x1c,-0x4(%rbp)
jmp    11a7 <Rmonth+0x97>
movl   $0x1f,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Rmonth>:
push   %rbx
cmp    $0xb,%edi
ja     114c <Rmonth+0x3c>
mov    $0x1e,%eax
mov    $0xa50,%ecx
bt     %edi,%ecx
jae    1127 <Rmonth+0x17>
pop    %rbx
ret
cmp    $0x2,%edi
jne    114c <Rmonth+0x3c>
mov    %esi,%ebx
mov    %esi,%edi
call   1030 <Isleap@plt>
mov    %eax,%ecx
mov    $0x1d,%eax
cmp    $0x1,%ecx
je     1125 <Rmonth+0x15>
mov    %ebx,%edi
call   1030 <Isleap@plt>
test   %eax,%eax
je     1153 <Rmonth+0x43>
mov    $0x1f,%eax
pop    %rbx
ret
mov    $0x1c,%eax
pop    %rbx
ret

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

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