#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__ isLeapYear(int);
int getMonthAnchorDay(int month, int year) {
  int anchorDays[12] = {3, 28, 7, 4, 9, 6, 11, 8, 5, 10, 7, 12};
  if (isLeapYear(year)) {
    anchorDays[0] = 4;
    anchorDays[1] = 29;
  }
  return anchorDays[month - 1];
}


x86 assembly (clang, -O0):
<getMonthAnchorDay>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec7(%rip),%rsi
mov    $0x30,%edx
call   1030 <memcpy@plt>
mov    -0x8(%rbp),%edi
call   1040 <isLeapYear@plt>
cmp    $0x0,%rax
je     1163 <getMonthAnchorDay+0x43>
movl   $0x4,-0x40(%rbp)
movl   $0x1d,-0x3c(%rbp)
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
cltq
mov    -0x40(%rbp,%rax,4),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getMonthAnchorDay>:
push   %rbx
sub    $0x30,%rsp
mov    %edi,%ebx
movaps 0xf02(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xee6(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeca(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %esi,%edi
call   1030 <isLeapYear@plt>
test   %rax,%rax
je     1154 <getMonthAnchorDay+0x44>
movabs $0x1d00000004,%rax
mov    %rax,(%rsp)
movslq %ebx,%rax
mov    -0x4(%rsp,%rax,4),%eax
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.getMonthAnchorDay.anchorDays = [12 x i32] [i32 3, i32 28, i32 7, i32 4, i32 9, i32 6, i32 11, i32 8, i32 5, i32 10, i32 7, i32 12]
define i32 @getMonthAnchorDay(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [12 x i32]
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = bitcast [12 x i32]* %5 to i8*
%7 = load i32, i32* %4
%8 = call i64 @isLeapYear(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %2
%11 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 0
store i32 4, i32* %11
%12 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 1
store i32 29, i32* %12
br label %13
13: ; preds = %10, %2
%14 = load i32, i32* %3
%15 = sub nsw i32 %14, 1
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [12 x i32], [12 x i32]* %5, i64 0, i64 %16
%18 = load i32, i32* %17
ret i32 %18
}

LLVM IR (-O2):
@__const.getMonthAnchorDay.anchorDays = [12 x i32] [i32 3, i32 28, i32 7, i32 4, i32 9, i32 6, i32 11, i32 8, i32 5, i32 10, i32 7, i32 12]
define i32 @getMonthAnchorDay(i32 %0, i32 %1) {
%3 = alloca [12 x i32]
%4 = bitcast [12 x i32]* %3 to i8*
%5 = tail call i64 @isLeapYear(i32 %1)
%6 = icmp eq i64 %5, 0
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 0
store i32 4, i32* %8
%9 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 1
store i32 29, i32* %9
br label %10
10: ; preds = %7, %2
%11 = add nsw i32 %0, -1
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [12 x i32], [12 x i32]* %3, i64 0, i64 %12
%14 = load i32, i32* %13
ret i32 %14
}